-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OS-1937 add support for abort_on_uncaught_exception in platform node.
- Loading branch information
1 parent
be56b45
commit 4e9fd77
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
diff --git node-v0.8.20-32.orig/deps/v8/src/flag-definitions.h node-v0.8.20-32/deps/v8/src/flag-definitions.h | ||
index 9fd23f9..8809b35 100644 | ||
--- node-v0.8.20-32.orig/deps/v8/src/flag-definitions.h | ||
+++ node-v0.8.20-32/deps/v8/src/flag-definitions.h | ||
@@ -489,6 +489,8 @@ struct JSArguments { | ||
"Stack alingment in bytes in simulator (4 or 8, 8 is default)") | ||
|
||
// isolate.cc | ||
+DEFINE_bool(abort_on_uncaught_exception, false, | ||
+ "abort program (dump core) when an uncaught exception is thrown") | ||
DEFINE_bool(trace_exception, false, | ||
"print stack trace when throwing exceptions") | ||
DEFINE_bool(preallocate_message_memory, false, | ||
diff --git node-v0.8.20-32.orig/deps/v8/src/isolate.cc node-v0.8.20-32/deps/v8/src/isolate.cc | ||
index 61d2b2d..8ee5204 100644 | ||
--- node-v0.8.20-32.orig/deps/v8/src/isolate.cc | ||
+++ node-v0.8.20-32/deps/v8/src/isolate.cc | ||
@@ -1266,6 +1266,19 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { | ||
thread_local_top()->pending_message_start_pos_ = location->start_pos(); | ||
thread_local_top()->pending_message_end_pos_ = location->end_pos(); | ||
} | ||
+ | ||
+ // If the abort-on-uncaught-exception flag is specified, abort on any | ||
+ // exception not caught by JavaScript, even when an external handler is | ||
+ // present. This flag is intended for use by JavaScript developers, so | ||
+ // print a user-friendly stack trace (not an internal one). | ||
+ if (FLAG_abort_on_uncaught_exception && | ||
+ (report_exception || can_be_caught_externally)) { | ||
+ fprintf(stderr, "UNCAUGHT EXCEPTION (%p): dumping core\n\n", | ||
+ exception); | ||
+ PrintCurrentStackTrace(stderr); | ||
+ OS::Abort(); | ||
+ } | ||
+ | ||
} else if (location != NULL && !location->script().is_null()) { | ||
// We are bootstrapping and caught an error where the location is set | ||
// and we have a script for the location. |