v8  8.6.395 (node 15.0.1)
V8 is Google's open source JavaScript engine
v8-wasm-trap-handler-posix.h
Go to the documentation of this file.
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_WASM_TRAP_HANDLER_POSIX_H_
6 #define V8_WASM_TRAP_HANDLER_POSIX_H_
7 
8 #include <signal.h>
9 
10 #include "v8config.h" // NOLINT(build/include_directory)
11 
12 namespace v8 {
13 /**
14  * This function determines whether a memory access violation has been an
15  * out-of-bounds memory access in WebAssembly. If so, it will modify the context
16  * parameter and add a return address where the execution can continue after the
17  * signal handling, and return true. Otherwise, false will be returned.
18  *
19  * The parameters to this function correspond to those passed to a Posix signal
20  * handler. Use this function only on Linux and Mac.
21  *
22  * \param sig_code The signal code, e.g. SIGSEGV.
23  * \param info A pointer to the siginfo_t struct provided to the signal handler.
24  * \param context A pointer to a ucontext_t struct provided to the signal
25  * handler.
26  */
27 V8_EXPORT bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info,
28  void* context);
29 
30 } // namespace v8
31 #endif // V8_WASM_TRAP_HANDLER_POSIX_H_