handler-inside-posix.h 847 Bytes
Newer Older
1 2 3 4 5 6 7 8
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_
#define V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_

#include <signal.h>
9
#include "include/v8config.h"
10 11 12 13 14

namespace v8 {
namespace internal {
namespace trap_handler {

15
#if V8_OS_LINUX || V8_OS_FREEBSD
16 17 18 19
constexpr int kOobSignal = SIGSEGV;
#elif V8_OS_MACOSX
constexpr int kOobSignal = SIGBUS;
#else
20
#error Posix trap handlers are only supported on Linux, MacOSX and FreeBSD.
21 22
#endif

23 24 25 26 27 28 29 30 31
void HandleSignal(int signum, siginfo_t* info, void* context);

bool TryHandleSignal(int signum, siginfo_t* info, void* context);

}  // namespace trap_handler
}  // namespace internal
}  // namespace v8

#endif  // V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_