V8 x64 backend doesn't emit ABI compliant stack frames
On 64 bit Windows, stack walking does not work across stack frames generated
by V8 because the V8 x64 backend doesn't emit unwinding info and because it does
not emi ABI compliant stack frames. (bug v8:3598).
This should be fixed with this CL:
https://chromium-review.googlesource.com/c/v8/v8/+/1469329
The fix consists in having V8 register dynamically PDATA/XDATA for the whole
code-range address space of an isolate every time a new isolate is initialized,
and unregister them when the Isolate is destroyed.
A more detailed description of the V8 fix can be found here:
https://docs.google.com/document/d/1-wf50jFlii0c_Pr52lm2ZU-49m220nhYMrHDi3vXnh0/edit
This V8 changes are currently experimental, behind the v8_win64_unwinding_info
build flag and the '--win64-unwinding-info' command line flag.
However Crashpad already registers PDATA/XDATA for the code range of a V8
isolate, in order to be able to handle and report unhandled exceptions that have
V8 dynamic code in the call stack. For more details, see:
https://chromium.googlesource.com/v8/v8.git/+/9b32bb22c1e516a4931ac647656bdf07bd7332be
Since it is not possible to register multiple PDATA entries for the same
address range, a new functions has been added to the V8 API:
- SetUnhandledExceptionCallback() can be used by an embedder to register its
own unhandled exception handler for exceptions that arise in V8-generated code.
This CL contains a few small changes to use this updated V8 API:
Crashpad calls v8::Isolate::SetUnhandledExceptionCallback() to register its own
custom exception handler for V8-code.
- When the '--win64-unwinding-info' flag is set, V8 will register the specified
exception handler as part of the Win64 unwind info, for jitted code and for
embedded builtins code.
- When the '--win64-unwinding-info' flag is not set, V8 will still register the
specified exception handler (but no precise unwind data) for the code range of
jitted code only, as Crashpad currently does.
Bug: v8:3598
Change-Id: Iba4a724a04a3bc3420c986d3e3b22f3b4aea279a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1474703
Reviewed-by: Jochen Eisinger <[email protected]>
Reviewed-by: Jeremy Roman <[email protected]>
Reviewed-by: Ross McIlroy <[email protected]>
Commit-Queue: Paolo Severini <[email protected]>
Cr-Commit-Position: refs/heads/master@{#651075}
diff --git a/gin/debug_impl.cc b/gin/debug_impl.cc
index 5c3b7ffc..ca0577e 100644
--- a/gin/debug_impl.cc
+++ b/gin/debug_impl.cc
@@ -8,10 +8,6 @@
namespace {
v8::JitCodeEventHandler g_jit_code_event_handler = NULL;
-#if defined(OS_WIN)
-Debug::CodeRangeCreatedCallback g_code_range_created_callback = NULL;
-Debug::CodeRangeDeletedCallback g_code_range_deleted_callback = NULL;
-#endif
} // namespace
// static
@@ -21,13 +17,9 @@
#if defined(OS_WIN)
// static
-void Debug::SetCodeRangeCreatedCallback(CodeRangeCreatedCallback callback) {
- g_code_range_created_callback = callback;
-}
-
-// static
-void Debug::SetCodeRangeDeletedCallback(CodeRangeDeletedCallback callback) {
- g_code_range_deleted_callback = callback;
+void Debug::SetUnhandledExceptionCallback(
+ v8::UnhandledExceptionCallback callback) {
+ v8::V8::SetUnhandledExceptionCallback(callback);
}
#endif
@@ -36,16 +28,4 @@
return g_jit_code_event_handler;
}
-#if defined(OS_WIN)
-// static
-Debug::CodeRangeCreatedCallback DebugImpl::GetCodeRangeCreatedCallback() {
- return g_code_range_created_callback;
-}
-
-// static
-Debug::CodeRangeDeletedCallback DebugImpl::GetCodeRangeDeletedCallback() {
- return g_code_range_deleted_callback;
-}
-#endif
-
} // namespace gin