| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 #include "platform/globals.h" | |
| 6 #if defined(TARGET_OS_LINUX) | |
| 7 | |
| 8 #include "bin/vmstats_impl.h" | |
| 9 | |
| 10 #include <signal.h> // NOLINT | |
| 11 | |
| 12 | |
| 13 namespace dart { | |
| 14 namespace bin { | |
| 15 | |
| 16 static void sig_handler(int sig, siginfo_t* siginfo, void*) { | |
| 17 if (sig == SIGQUIT) { | |
| 18 VmStats::DumpStack(); | |
| 19 } else { | |
| 20 FATAL1("unrequested signal %d received\n", sig); | |
| 21 } | |
| 22 } | |
| 23 | |
| 24 void VmStats::Initialize() { | |
| 25 // Enable SIGQUIT (ctrl-\) stack dumps. | |
| 26 struct sigaction sigact; | |
| 27 memset(&sigact, '\0', sizeof(sigact)); | |
| 28 sigact.sa_sigaction = sig_handler; | |
| 29 sigact.sa_flags = SA_SIGINFO; | |
| 30 if (sigaction(SIGQUIT, &sigact, NULL) < 0) { | |
| 31 perror("sigaction"); | |
| 32 } | |
| 33 } | |
| 34 | |
| 35 } // namespace bin | |
| 36 } // namespace dart | |
| 37 | |
| 38 #endif // defined(TARGET_OS_LINUX) | |
| OLD | NEW |