ebbc2020a2
Review URL: https://codereview.chromium.org//14341015 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
39 lines
923 B
C++
39 lines
923 B
C++
// 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
|
|
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
static void sig_handler(int sig, siginfo_t* siginfo, void*) {
|
|
if (sig == SIGQUIT) {
|
|
VmStats::DumpStack();
|
|
} else {
|
|
FATAL1("unrequested signal %d received\n", sig);
|
|
}
|
|
}
|
|
|
|
void VmStats::Initialize() {
|
|
// Enable SIGQUIT (ctrl-\) stack dumps.
|
|
struct sigaction sigact;
|
|
memset(&sigact, '\0', sizeof(sigact));
|
|
sigact.sa_sigaction = sig_handler;
|
|
sigact.sa_flags = SA_SIGINFO;
|
|
if (sigaction(SIGQUIT, &sigact, NULL) < 0) {
|
|
perror("sigaction");
|
|
}
|
|
}
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|
|
|
|
#endif // defined(TARGET_OS_LINUX)
|