Crash when there is fatal error in V8.

This commit is contained in:
Cheng Zhao 2014-01-23 20:30:44 +08:00
parent 71fd147c47
commit 8655dec00e
2 changed files with 9 additions and 1 deletions

View file

@ -53,6 +53,13 @@ void UvOnCallback(uv_async_t* handle, int status) {
g_v8_callback->NewHandle()->Call(global, 0, NULL);
}
// Called when there is a fatal error in V8, we just crash the process here so
// we can get the stack trace.
void FatalErrorCallback(const char* location, const char* message) {
LOG(ERROR) << "Fatal error in V8: " << location << " " << message;
static_cast<DummyClass*>(NULL)->crash = true;
}
v8::Handle<v8::Object> DumpStackFrame(v8::Handle<v8::StackFrame> stack_frame) {
v8::Local<v8::Object> result = v8::Object::New();
result->Set(ToV8Value("line"), ToV8Value(stack_frame->GetLineNumber()));
@ -76,6 +83,7 @@ node::node_module_struct* GetBuiltinModule(const char *name, bool is_browser);
AtomBindings::AtomBindings() {
uv_async_init(uv_default_loop(), &g_next_tick_uv_handle, UvCallNextTick);
uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback);
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
}
AtomBindings::~AtomBindings() {

2
vendor/node vendored

@ -1 +1 @@
Subproject commit 7fa644854f91c8dd23d8cec21be1310f0b69d813
Subproject commit 80c5e17c09fdf2fc0b74353b285bb33a6ecf5e62