Hi,
My embedded V8 application sometimes crashes without any backtrace info
when I debug the crash file in gdb. Is
there any setting that needs to be enabled to get backtrace info so that it
is easier to debug? I'm using debug version of v8.
The program below crashes with the below back trace if I fail to set the
arguments when calling a javascript function. Is there any easier way to
debug v8 when crashes with back traces like this occur?
(gdb) bt
#0 0x31a213ea in ?? ()
#1 0x5d334f11 in ?? ()
#2 0x5d3354c5 in ?? ()
#3 0x31a21381 in ?? ()
#4 0x0000000c in ?? ()
#5 0x00000000 in ?? ()
####
Handle<Value> LogCallback(const Arguments& args)
{
String::Utf8Value val(args[0]);
cout << *val << endl;
return v8::Undefined();
}
int main()
{
char *str = " function myfunc(obj) { log('in myfunc....' + obj); }
";
HandleScope handleScope;
// set global template
Handle<ObjectTemplate> globalTemplate = ObjectTemplate::New();
globalTemplate->Set(String::New("log"),FunctionTemplate::New(LogCallback));
// Create conext and enter
Handle<Context> context = Context::New(NULL, globalTemplate);
Context::Scope contextScope(context);
// Compile Script
Handle<String> scriptString = String::New(str);
Handle<Script> compiledScript = Script::Compile(scriptString);
// Run script
Handle<Value> result = compiledScript->Run();
Handle<Value> value = context->Global()->Get(String::New("myfunc"));
Handle<Function> function = Handle<Function>::Cast(value);
int argc = 1;
Handle<Value> args[argc];
// Commenting the below line causes crash with no stack info
//args[0] = String::New("teststring");
function->Call(context->Global(), argc, args);
return 0;
}
####
Thanks,
Mark
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users