Reviewers: ulan,
Description:
Merged r14185 into 3.14 branch.
Add an option to dump core when an uncaught exception is thrown.
This is done as a courtesy to node.js, as its current stable version (0.10)
relies on V8 version 3.14.5.
[email protected]
BUG=
Please review this at https://chromiumcodereview.appspot.com/15858003/
SVN Base: https://v8.googlecode.com/svn/branches/3.14
Affected files:
M src/flag-definitions.h
M src/isolate.cc
M src/version.cc
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
4c7c090f40ed273048da1153798bc22cd5726219..0427e7d85282b4bfd0e0156a64ae0e2529aab529
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -449,6 +449,8 @@ DEFINE_int(sim_stack_alignment, 8,
"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,
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index
75e15a454196573fce28a438032a7fe68e966ddb..04a438bfa51a409132875ae2e250ca36051dfe19
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1080,6 +1080,7 @@ bool Isolate::IsErrorObject(Handle<Object> obj) {
return false;
}
+static int fatal_exception_depth = 0;
void Isolate::DoThrow(Object* exception, MessageLocation* location) {
ASSERT(!has_pending_exception());
@@ -1150,6 +1151,20 @@ 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 (fatal_exception_depth == 0 &&
+ FLAG_abort_on_uncaught_exception &&
+ (report_exception || can_be_caught_externally)) {
+ fatal_exception_depth++;
+ fprintf(stderr, "%s\n\nFROM\n",
+ *MessageHandler::GetLocalizedMessage(this, message_obj));
+ 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.
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index
715c2e5393ef1398bdd0afca3467af1a136941e7..f7dcbd30399c9a4ecf8cf11afda8ea156dbd53b9
100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 14
#define BUILD_NUMBER 5
-#define PATCH_LEVEL 8
+#define PATCH_LEVEL 9
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.