Chromium Code Reviews| Index: runtime/bin/vmstats_impl_linux.cc |
| =================================================================== |
| --- runtime/bin/vmstats_impl_linux.cc (revision 0) |
| +++ runtime/bin/vmstats_impl_linux.cc (revision 0) |
| @@ -0,0 +1,26 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +#include "platform/globals.h" |
| +#if defined(TARGET_OS_LINUX) |
| + |
| +#include "bin/vmstats_impl.h" |
| + |
| +#include <signal.h> // NOLINT |
| + |
| + |
| +static void sig_handler(int sig) { |
| + if (sig == SIGQUIT) { |
| + VmStats::DumpStack(); |
| + } |
|
siva
2013/04/04 00:47:15
You should not be handling any other signals right
Tom Ball
2013/04/04 20:05:53
Done.
|
| +} |
| + |
| +void VmStats::Initialize() { |
| + // Enable SIGQUIT (ctrl-\) stack dumps. |
| + if (signal(SIGQUIT, sig_handler) == SIG_ERR) { |
|
siva
2013/04/04 00:47:15
You should be using the sigaction call here and no
Tom Ball
2013/04/04 20:05:53
Replaced with sigaction, except for Windows becaus
|
| + perror("Adding SIGQUIT signal handler failed"); |
| + } |
| +} |
| + |
| +#endif // defined(TARGET_OS_LINUX) |