| Index: runtime/bin/platform_linux.cc
|
| diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc
|
| index 9c12c1943e63e0a2b8111cb5e5f2e9df99d207f9..420bfb61c53053b299751446e20458fef7eb8804 100644
|
| --- a/runtime/bin/platform_linux.cc
|
| +++ b/runtime/bin/platform_linux.cc
|
| @@ -22,6 +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
|
| @@ -33,6 +39,21 @@ bool Platform::Initialize() {
|
| perror("Setting signal handler failed");
|
| return false;
|
| }
|
| +
|
| + act.sa_flags = SA_SIGINFO;
|
| + act.sa_sigaction = &segv_handler;
|
| + if (sigemptyset(&act.sa_mask) != 0) {
|
| + perror("sigemptyset() failed.");
|
| + return false;
|
| + }
|
| + if (sigaddset(&act.sa_mask, SIGPROF) != 0) {
|
| + perror("sigaddset() failed");
|
| + return false;
|
| + }
|
| + if (sigaction(SIGSEGV, &act, NULL) != 0) {
|
| + perror("sigaction() failed.");
|
| + return false;
|
| + }
|
| return true;
|
| }
|
|
|
|
|