I'm exploring modifying Node.js to call abort(3c) (dump core) when an uncaught JavaScript exception is thrown. Importantly, I want to invoke abort() while the function that threw the exception is still on the stack, so that the stack in the core would look like this:
80476f8 v8::internal::Isolate::DoThrow+0x35 > 8047718 v8::internal::Isolate::Throw+0x1f unknown (SeqAsciiString: > 3dd0f805) > 8047748 v8::internal::Runtime_Throw+0x3f unknown (FixedArray: 26d2d571) > 804776c 0x4040a336 internal (Code: 4040a2c1) > 8047780 0x404711f2 foo (4477d23d) > 80477c0 0x404290c4 <anonymous> (as > startup.processNextTick.process._tickCallback) (26d43271) > 80477dc 0x40421bf9 <InternalFrame> > 8047818 0x40412c2a <EntryFrame> > 8047898 > _ZN2v88internalL6InvokeEbNS0_6HandleINS0_10JSFunctionEEENS1_INS0_6ObjectEEEiPS5_Pb+0x100 > 80478e8 v8::internal::Execution::Call+0xd5 > 8047958 v8::Function::Call+0xda > 80479d8 _ZN4nodeL4TickEv+0xb5 > 8047a08 ev_invoke_pending+0x63 <EntryFrame> > 8047ab8 ev_run+0x857 > 8047ad8 uv_run+0x1c > 8047b68 node::Start+0x158 > 8047b88 main+0x1b > 8047ba4 _start+0x83 It looks like I want to interpose about right here: https://github.com/v8/v8/blob/master/src/isolate.cc#L1076 And if report_exception is true, I'd call abort(). What's the best way to go about doing this? It looks like I could use the debugger interface, but I want this always on in production, so I don't want to have to run a debugger in order to do it. Would it be reasonable to register a callback with V8 that gets invoked when an exception is thrown? Thanks, Dave -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users