I am embedding V8 and trying to capture the current javascript stacktrace 
using the "v8::StackTrace::CurrentStackTrace":

Isolate* isolate = info.GetIsolate();

Local<StackTrace> stack = v8::StackTrace::CurrentStackTrace(isolate, 10, v8
::StackTrace::StackTraceOptions::kDetailed);

*for* (*int* i = 0; i < stack->GetFrameCount(); i++) {

    Local<v8::StackFrame> frame = stack->GetFrame(isolate, i);

    Local<v8::String> funcName = frame->GetFunctionName();

    v8::String::Utf8Value str(isolate, funcName);

    *const* *char** name = *str;

    printf("%s (%d:%d)\n", name, frame->GetLineNumber(), frame->GetColumn
());

}

I have placed this code inside a custom function that I have registered to 
the global scope.

Before calling my custom function, I tried logging the stack property of an 
Error object (by using : console.log(new Error().stack)) and I obtained the 
following output:

Error
    at bar (file:///app/bundle.js:266:29)
    at test (file:///app/bundle.js:267:15)
    at Observable.onTap (file:///app/bundle.js:268:11)
    at Button.notify (file:///app/vendor.js:3620:32)
    at Button._emit (file:///app/vendor.js:3640:18)
    at TapHandlerImpl.tap (file:///app/vendor.js:15540:19)

With the "v8::StackTrace::CurrentStackTrace" method I get:

bar (266:29)
test (267:15)
(null) (268:11)
(null) (3620:32)
(null) (3640:18)
(null) (15540:19)

I am getting empty function names from some frames, while all the other 
information is present (script name, line, column numbers, ...).

Do you know what might be the reason for getting empty function names?

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/64d9e4ca-b271-4d83-aace-753c28e193f4%40googlegroups.com.

Reply via email to