From 2f3de27e1142aa0d5d1b5fe82c5c632786390c8a Mon Sep 17 00:00:00 2001 From: clemensh Date: Wed, 18 Jan 2017 02:28:40 -0800 Subject: [PATCH] [wasm] Set and store breakpoints in wasm Store breakpoint positions in the WasmSharedModuleData in order to set them on new instantiations. Also redirect them to all live instances at the time the breakpoint is set. Inside the WasmDebugInfo, we store the BreakPointInfo objects to find hit breakpoints. R=titzer@chromium.org, yangguo@chromium.org BUG=v8:5822 Review-Url: https://codereview.chromium.org/2626253002 Cr-Commit-Position: refs/heads/master@{#42443} --- src/debug/debug.cc | 32 ++--- src/factory.cc | 7 + src/factory.h | 2 + src/objects.cc | 7 +- src/wasm/wasm-module.cc | 7 + src/wasm/wasm-objects.cc | 292 +++++++++++++++++++++++++++++++++++++++ src/wasm/wasm-objects.h | 22 +++ 7 files changed, 344 insertions(+), 25 deletions(-) diff --git a/src/debug/debug.cc b/src/debug/debug.cc index 5cb9c6f8b2..ac2c99eba1 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -29,6 +29,7 @@ #include "src/messages.h" #include "src/snapshot/natives.h" #include "src/wasm/wasm-module.h" +#include "src/wasm/wasm-objects.h" #include "include/v8-debug.h" @@ -516,30 +517,18 @@ void Debug::Break(JavaScriptFrame* frame) { // Postpone interrupt during breakpoint processing. PostponeInterruptsScope postpone(isolate_); - // Return if we fail to retrieve debug info for javascript frames. - if (frame->is_java_script()) { - JavaScriptFrame* js_frame = JavaScriptFrame::cast(frame); - - // Get the debug info (create it if it does not exist). - Handle function(js_frame->function()); - Handle shared(function->shared()); - if (!EnsureDebugInfo(shared, function)) return; - } + // Return if we fail to retrieve debug info. + Handle function(frame->function()); + Handle shared(function->shared()); + if (!EnsureDebugInfo(shared, function)) return; BreakLocation location = BreakLocation::FromFrame(frame); // Find actual break points, if any, and trigger debug break event. MaybeHandle break_points_hit; - if (!break_points_active()) { - // Don't try to find hit breakpoints. - } else if (frame->is_wasm_interpreter_entry()) { - // TODO(clemensh): Find hit breakpoints for wasm. - UNIMPLEMENTED(); - } else { + if (break_points_active()) { // Get the debug info, which must exist if we reach here. - Handle debug_info( - JavaScriptFrame::cast(frame)->function()->shared()->GetDebugInfo(), - isolate_); + Handle debug_info(shared->GetDebugInfo(), isolate_); break_points_hit = CheckBreakPoints(debug_info, &location); } @@ -722,9 +711,12 @@ bool Debug::SetBreakPointForScript(Handle