v8/include/v8-wasm-trap-handler-win.h
Andreas Haas 3d2bc5d041 Reland: [wasm] Add more unit tests for trap handler
The problem were missing V8_EXPORT_PRIVATE and V8_EXPORT.

The unittests test if the trap handler only handles those traps it
is supposed to handle:
* Only handle traps when the thread-in-wasm flag is set.
* Only handle traps of the right type, i.e. memory access violations.
* Only handle traps at recorded instructions.

The tests also test the consistency of the thread-in-wasm flag. I made
one change in the trap handler where that consistency could be
violated.

All tests are executed with the default trap handler provided by V8,
and with the trap handler callback installed in a test signal/exception
handler.

Patchset 1 is the original CL.

R=mstarzinger@chromium.org

Change-Id: I172d94f24cdba4c3a1f7f344825b059dbb59da79
Reviewed-on: https://chromium-review.googlesource.com/c/1351024
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57947}
2018-11-29 16:33:10 +00:00

28 lines
1007 B
C++

// 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_WASM_TRAP_HANDLER_WIN_H_
#define V8_WASM_TRAP_HANDLER_WIN_H_
#include <windows.h>
#include "include/v8config.h"
namespace v8 {
/**
* This function determines whether a memory access violation has been an
* out-of-bounds memory access in WebAssembly. If so, it will modify the
* exception parameter and add a return address where the execution can continue
* after the exception handling, and return true. Otherwise the return value
* will be false.
*
* The parameter to this function corresponds to the one passed to a Windows
* vectored exception handler. Use this function only on Windows.
*
* \param exception An EXCEPTION_POINTERS* as provided to the exception handler.
*/
V8_EXPORT bool TryHandleWebAssemblyTrapWindows(EXCEPTION_POINTERS* exception);
} // namespace v8
#endif // V8_WASM_TRAP_HANDLER_WIN_H_