Logging js exception call stack trace in V8.

36 views
Skip to first unread message

nagarjuna atluri

unread,
May 10, 2013, 2:04:41 AM5/10/13
to v8-u...@googlegroups.com

 

Hi,


I am currently facing an exception on loading a page. The log statements from v8 just show the exception message string , source and line number.

Now I want to print out more detailed logs, with the js source code stack trace which generated the exception.

I have figured out that v8::Handle<v8::StackTrace> Message::GetStackTrace() const (api.cc) is the function which generates the stack trace array, which can be then printed.

On generating a dummy exception and tracing this function I noticed that

i::Handle<i::Object> stackFramesObj(message->stack_frames()); 

does not init the stackFramesObj into a JS array and the next line, which is

if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>();

executes and returns an empty stack trace.

How do I get the stack trace frames JS array? And just to add I do not want to use the console to see the call stack, I want to explicitly log it.
Reply all
Reply to author
Forward
0 new messages