From 499b31e222b15cfcc01f0ef54f02508c299e3ca3 Mon Sep 17 00:00:00 2001 From: "dcarney@chromium.org" Date: Tue, 25 Feb 2014 13:53:06 +0000 Subject: [PATCH] Crash like chrome. Currently, most chrome crashes do not yield useful stack traces as v8 does a silent abort and chrome's crash symbolization does not kick in. R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/179793004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19544 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/flag-definitions.h | 2 +- src/globals.h | 6 ++++++ src/platform-posix.cc | 6 +++--- src/platform-win32.cc | 9 ++++----- tools/run-deopt-fuzzer.py | 4 ++-- tools/run-tests.py | 4 ++-- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 13de6b5..e7da42e 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -470,7 +470,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") +DEFINE_bool(hard_abort, true, "abort by crashing") // execution.cc // Slightly less than 1MB on 64-bit, since Windows' default stack size for diff --git a/src/globals.h b/src/globals.h index 8a67632..ac5b710 100644 --- a/src/globals.h +++ b/src/globals.h @@ -390,6 +390,12 @@ F FUNCTION_CAST(Address addr) { #define DISABLE_ASAN #endif +#if V8_CC_GNU +#define V8_IMMEDIATE_CRASH() __builtin_trap() +#else +#define V8_IMMEDIATE_CRASH() ((void(*)())0)() +#endif + // ----------------------------------------------------------------------------- // Forward declarations for frequently used classes diff --git a/src/platform-posix.cc b/src/platform-posix.cc index b5ab0cf..c91cf24 100644 --- a/src/platform-posix.cc +++ b/src/platform-posix.cc @@ -265,10 +265,10 @@ void OS::Sleep(int milliseconds) { void OS::Abort() { - // Redirect to std abort to signal abnormal program termination. - if (FLAG_break_on_abort) { - DebugBreak(); + if (FLAG_hard_abort) { + V8_IMMEDIATE_CRASH(); } + // Redirect to std abort to signal abnormal program termination. abort(); } diff --git a/src/platform-win32.cc b/src/platform-win32.cc index 5626173..446caee 100644 --- a/src/platform-win32.cc +++ b/src/platform-win32.cc @@ -923,12 +923,11 @@ void OS::Sleep(int milliseconds) { void OS::Abort() { - if (IsDebuggerPresent() || FLAG_break_on_abort) { - DebugBreak(); - } else { - // Make the MSVCRT do a silent abort. - raise(SIGABRT); + if (FLAG_hard_abort) { + V8_IMMEDIATE_CRASH(); } + // Make the MSVCRT do a silent abort. + raise(SIGABRT); } diff --git a/tools/run-deopt-fuzzer.py b/tools/run-deopt-fuzzer.py index 489f447..b809fdf 100755 --- a/tools/run-deopt-fuzzer.py +++ b/tools/run-deopt-fuzzer.py @@ -55,11 +55,11 @@ TIMEOUT_SCALEFACTOR = {"debug" : 4, "release" : 1 } MODE_FLAGS = { - "debug" : ["--nobreak-on-abort", "--nodead-code-elimination", + "debug" : ["--nohard-abort", "--nodead-code-elimination", "--nofold-constants", "--enable-slow-asserts", "--debug-code", "--verify-heap", "--noconcurrent-recompilation"], - "release" : ["--nobreak-on-abort", "--nodead-code-elimination", + "release" : ["--nohard-abort", "--nodead-code-elimination", "--nofold-constants", "--noconcurrent-recompilation"]} SUPPORTED_ARCHS = ["android_arm", diff --git a/tools/run-tests.py b/tools/run-tests.py index de45934..46f5db0 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -63,10 +63,10 @@ VARIANT_FLAGS = { VARIANTS = ["default", "stress", "nocrankshaft"] MODE_FLAGS = { - "debug" : ["--nobreak-on-abort", "--nodead-code-elimination", + "debug" : ["--nohard-abort", "--nodead-code-elimination", "--nofold-constants", "--enable-slow-asserts", "--debug-code", "--verify-heap"], - "release" : ["--nobreak-on-abort", "--nodead-code-elimination", + "release" : ["--nohard-abort", "--nodead-code-elimination", "--nofold-constants"]} GC_STRESS_FLAGS = ["--gc-interval=500", "--stress-compaction", -- 2.7.4