Reviewers: Vyacheslav Egorov,

Description:
Add flag to always call DebugBreak on abort

[email protected]


Please review this at https://chromiumcodereview.appspot.com/9706097/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/flag-definitions.h
  M src/platform-linux.cc
  M src/platform-win32.cc


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 7a064fc7b546f916fc40cb05f149ab00b9017687..2d6d179f7b63aced857fafc258f002b5bc571784 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -307,6 +307,7 @@ DEFINE_bool(debugger_auto_break, true,
"automatically set the debug break flag when debugger commands are "
             "in the queue")
 DEFINE_bool(enable_liveedit, true, "enable liveedit experimental feature")
+DEFINE_bool(break_on_abort, true, "always cause a debug break before aborting")

 // execution.cc
 DEFINE_int(stack_size, kPointerSize * 128,
Index: src/platform-linux.cc
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index 8be9609d4522b5a0a2575671f6c0f7d174293971..08f4495b53b389cf95de81d74c0f1e582d20ff5d 100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -388,6 +388,9 @@ void OS::Sleep(int milliseconds) {

 void OS::Abort() {
   // Redirect to std abort to signal abnormal program termination.
+  if (FLAG_break_on_abort) {
+    DebugBreak();
+  }
   abort();
 }

Index: src/platform-win32.cc
diff --git a/src/platform-win32.cc b/src/platform-win32.cc
index 5600542ba031e8ee02eabc7947080450f3111b93..2801b711bf7afc73dd1040938e53aff67aab6e6d 100644
--- a/src/platform-win32.cc
+++ b/src/platform-win32.cc
@@ -961,11 +961,11 @@ void OS::Sleep(int milliseconds) {


 void OS::Abort() {
-  if (!IsDebuggerPresent()) {
+  if (IsDebuggerPresent() || FLAG_break_on_abort) {
+    DebugBreak();
+  } else {
     // Make the MSVCRT do a silent abort.
     raise(SIGABRT);
-  } else {
-    DebugBreak();
   }
 }



--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to