You return a Handle from a dead HandleScope from Shell::Load. Using a debug build + gdb can figure this out easily, because we explicitly zap several data structures with special values to catch such things, in this case it's kHandleZapValue (0xbaddeaf on ia32).
On Mon, Jan 7, 2013 at 2:11 AM, Paul Harris <[email protected]> wrote: > I did at the time, it was internal to v8. > > Its the "new" keyword that seems to cause v8 to crash. > > > On Friday, December 14, 2012 4:52:04 AM UTC+8, Jakob Kummerow wrote: > >> Have you tried using your favorite debugger to get a backtrace? That >> should help you figure out what's going on. >> >> >> On Wed, Dec 12, 2012 at 5:41 PM, Paul Harris <[email protected]> wrote: >> >>> Hello again, >>> >>> I'm seeing a crash that seems a bit strange. >>> >>> I adjusted d8.cc's Load method so that it returns the result of the >>> script execution, like so: >>> >>> Handle<Value> Shell::Load(const Arguments& args) { >>> HandleScope handle_scope; >>> String::Utf8Value file(args[0]); >>> if (*file == NULL) { >>> return ThrowException(String::New("**Error loading file")); >>> } >>> Handle<String> source = ReadFile(*file); >>> if (source.IsEmpty()) { >>> return ThrowException(String::New("**Error loading file")); >>> } >>> TryCatch try_catch; >>> options.script_executed = true; >>> Handle<Script> script = Script::Compile(source); >>> if (script.IsEmpty()) { >>> // Print errors that happened during compilation. >>> ReportException(&try_catch); >>> return Undefined(); >>> } else { >>> Handle<Value> result = script->Run(); >>> if (result.IsEmpty()) { >>> ASSERT(try_catch.HasCaught()); >>> // Print errors that happened during execution. >>> ReportException(&try_catch); >>> return Undefined(); >>> } else { >>> ASSERT(!try_catch.HasCaught())**; >>> return result; >>> } >>> } >>> } >>> >>> >>> Then I compiled. In the same folder as d8.exe, saved this into the file >>> "hi.js" >>> ---- hi.js --- >>> (function() {}); >>> ------------- >>> >>> Then I ran d8.exe and did this: >>> > new load('hi.js')(); >>> >>> Which results in a hard crash, in both Debug and Release versions (on >>> windows). >>> >>> Surely it should just be an 'not a function' error or something like >>> that? >>> >>> cheers, >>> Paul >>> >>> -- >>> v8-users mailing list >>> [email protected] >>> http://groups.google.com/**group/v8-users<http://groups.google.com/group/v8-users> >> >> >> -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users > -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
