How to debug V8 context creation failure in Blink layout tests?

46 views
Skip to first unread message

Domenic Denicola

unread,
Jun 30, 2015, 9:54:51 AM6/30/15
to v8-u...@googlegroups.com
While messing around with V8 extras, I managed to introduce some malformed syntax or misused API, which caused V8 context creation to fail during layout test startup. This manifests in WebCoreTestSupport::injectInternalsObject being passed an empty v8::Local<v8::Context>, and a subsequent crash.

I was wondering if there were some log file or something I could look in, where V8 would tell me why it failed to create a context? I only was able to figure out that this was due to my JS work due to some pretty extensive bisecting. And now I'm in for a fun time commenting out plausible-looking lines in my V8 extra .js file to find which ones are triggering the crash. If there were some way to get V8 to say "I failed while compiling this extra, on line X, because you tried to do bad thing Y," I'd be a very happy developer.

Jochen Eisinger

unread,
Jul 1, 2015, 4:35:58 AM7/1/15
to v8-u...@googlegroups.com
Currently, the only thing you can do is to attach a debugger, and see what the exception is that gets thrown.

best
-jochen

On Tue, Jun 30, 2015 at 3:54 PM Domenic Denicola <d...@domenic.me> wrote:
While messing around with V8 extras, I managed to introduce some malformed syntax or misused API, which caused V8 context creation to fail during layout test startup. This manifests in WebCoreTestSupport::injectInternalsObject being passed an empty v8::Local<v8::Context>, and a subsequent crash.

I was wondering if there were some log file or something I could look in, where V8 would tell me why it failed to create a context? I only was able to figure out that this was due to my JS work due to some pretty extensive bisecting. And now I'm in for a fun time commenting out plausible-looking lines in my V8 extra .js file to find which ones are triggering the crash. If there were some way to get V8 to say "I failed while compiling this extra, on line X, because you tried to do bad thing Y," I'd be a very happy developer.

--
--
v8-users mailing list
v8-u...@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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Domenic Denicola

unread,
Jul 2, 2015, 6:01:35 AM7/2/15
to v8-u...@googlegroups.com
I did that, and it threw an exception trying to construct a ScriptState from an empty V8 context, which was less then helpful. Do you know where in the process V8 and/or Blink layout tests decide "something went wrong, I'm going to just return you an empty context and you can take it from there"?

Andy Wingo

unread,
Jul 3, 2015, 4:02:53 AM7/3/15
to Domenic Denicola, v8-u...@googlegroups.com
On Thu 02 Jul 2015 12:01, Domenic Denicola <d...@domenic.me> writes:

> I did that, and it threw an exception trying to construct a ScriptState
> from an empty V8 context, which was less then helpful. Do you know where
> in the process V8 and/or Blink layout tests decide "something went
> wrong, I'm going to just return you an empty context and you can take it
> from there"?

I don't think this is specific to layout tests, right? E.g. just
running the content_shell on any page should get you in this situation.

I would say, be sure you have a debug build, and if you can get a nosnap
build (dunno if that's possible for you) that might be more helpful.
Otherwise it's a bunch of nasty debugger mucking. Printf ftw/ftl...

A

Jochen Eisinger

unread,
Jul 3, 2015, 4:04:57 AM7/3/15
to v8-u...@googlegroups.com, Domenic Denicola
yeah, building without a snapshot is a good idea as well.

I'd set a breakpoint in v8::internal::Genesis::Genesis and step over the compilation and check the isolate's pending exception for what went wrong.

best
-jochen

Reply all
Reply to author
Forward
0 new messages