diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc index 420bfb61c53..0d3338c9158 100644 --- a/runtime/bin/platform_linux.cc +++ b/runtime/bin/platform_linux.cc @@ -22,12 +22,12 @@ char* Platform::resolved_executable_name_ = NULL; int Platform::script_index_ = 1; char** Platform::argv_ = NULL; - static void segv_handler(int signal, siginfo_t* siginfo, void* context) { Dart_DumpNativeStackTrace(context); abort(); } + bool Platform::Initialize() { // Turn off the signal handler for SIGPIPE as it causes the process // to terminate on writing to a closed pipe. Without the signal diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc index 8e2fd187b91..0c6de4ddac9 100644 --- a/runtime/bin/platform_macos.cc +++ b/runtime/bin/platform_macos.cc @@ -28,6 +28,12 @@ char* Platform::resolved_executable_name_ = NULL; int Platform::script_index_ = 1; char** Platform::argv_ = NULL; +static void segv_handler(int signal, siginfo_t* siginfo, void* context) { + Dart_DumpNativeStackTrace(context); + abort(); +} + + bool Platform::Initialize() { // Turn off the signal handler for SIGPIPE as it causes the process // to terminate on writing to a closed pipe. Without the signal diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc index b3161c12a84..2e739e17e74 100644 --- a/runtime/vm/dart_api_impl.cc +++ b/runtime/vm/dart_api_impl.cc @@ -6673,7 +6673,9 @@ DART_EXPORT bool Dart_IsPrecompiledRuntime() { DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { +#ifndef PRODUCT Profiler::DumpStackTrace(context); +#endif } } // namespace dart