Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <signal.h> | |
| 6 #include <stdlib.h> | |
| 7 | |
| 8 #include "include/v8.h" | |
| 9 #include "src/trap-handler/trap-handler-internal.h" | |
|
jochen (gone - plz use gerrit)
2017/01/02 07:35:08
this should either go into src/api.cc or src/api/t
Eric Holk
2017/01/10 23:10:48
I'd like to keep the signal handling code all unde
| |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 void HandleSignal(int signum, siginfo_t* info, void* arg) { | |
| 14 if (!v8::V8::MaybeHandleFault(signum, info, arg)) { | |
| 15 abort(); | |
| 16 } | |
| 17 } | |
| 18 } // namespace | |
| 19 | |
| 20 namespace v8 { | |
| 21 | |
| 22 bool V8::MaybeHandleFault(int signum, void* info, void* context) { | |
| 23 return v8::internal::trap_handler::MaybeHandleFault(signum, info, context); | |
| 24 } | |
| 25 | |
| 26 bool V8::RegisterDefaultSignalHandler() { | |
| 27 struct sigaction action; | |
| 28 action.sa_sigaction = HandleSignal; | |
| 29 action.sa_flags = SA_SIGINFO; | |
| 30 sigemptyset(&action.sa_mask); | |
| 31 return sigaction(SIGSEGV, &action, nullptr) == 0; | |
| 32 } | |
| 33 | |
| 34 } // namespace v8 | |
| OLD | NEW |