1 | // Copyright 2018 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 | #ifndef V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_ |
6 | #define V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_ |
7 | |
8 | #include <signal.h> |
9 | #include "include/v8config.h" |
10 | |
11 | namespace v8 { |
12 | namespace internal { |
13 | namespace trap_handler { |
14 | |
15 | #if V8_OS_LINUX |
16 | constexpr int kOobSignal = SIGSEGV; |
17 | #elif V8_OS_MACOSX |
18 | constexpr int kOobSignal = SIGBUS; |
19 | #else |
20 | #error Posix trap handlers are only supported on Linux and MacOSX. |
21 | #endif |
22 | |
23 | void HandleSignal(int signum, siginfo_t* info, void* context); |
24 | |
25 | bool TryHandleSignal(int signum, siginfo_t* info, void* context); |
26 | |
27 | } // namespace trap_handler |
28 | } // namespace internal |
29 | } // namespace v8 |
30 | |
31 | #endif // V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_ |
32 | |