Commit e34425a2 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug] Remove debugging capabilities from WasmDebugInfo

This CL removes all debugging capabilities from the API provided by
WasmDebugInfo:
- setting and removing breakpoints
- stepping
- stack inspection

The WasmDebugInfo is still kept, since it's used from tests to
instantiate the interpreter.

R=thibaudm@chromium.org, bmeurer@chromium.org

Bug: v8:10389
Change-Id: I297bfc8df2104dae8b9f9f9b13078026c47698da
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2164791Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67418}
parent 138ac70f
...@@ -129,11 +129,9 @@ bool DebugScopeIterator::SetVariableValue(v8::Local<v8::String> name, ...@@ -129,11 +129,9 @@ bool DebugScopeIterator::SetVariableValue(v8::Local<v8::String> name,
} }
DebugWasmScopeIterator::DebugWasmScopeIterator(Isolate* isolate, DebugWasmScopeIterator::DebugWasmScopeIterator(Isolate* isolate,
StandardFrame* frame, StandardFrame* frame)
int inlined_frame_index)
: isolate_(isolate), : isolate_(isolate),
frame_(frame), frame_(frame),
inlined_frame_index_(inlined_frame_index),
type_(debug::ScopeIterator::ScopeTypeModule) {} type_(debug::ScopeIterator::ScopeTypeModule) {}
bool DebugWasmScopeIterator::Done() { bool DebugWasmScopeIterator::Done() {
...@@ -172,13 +170,6 @@ v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() { ...@@ -172,13 +170,6 @@ v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() {
return Utils::ToLocal(wasm::GetModuleScopeObject(instance)); return Utils::ToLocal(wasm::GetModuleScopeObject(instance));
} }
case debug::ScopeIterator::ScopeTypeLocal: { case debug::ScopeIterator::ScopeTypeLocal: {
if (frame_->is_wasm_interpreter_entry()) {
Handle<WasmDebugInfo> debug_info(
WasmInterpreterEntryFrame::cast(frame_)->debug_info(), isolate_);
return Utils::ToLocal(WasmDebugInfo::GetLocalScopeObject(
debug_info, frame_->fp(), inlined_frame_index_));
}
// Compiled code.
DCHECK(frame_->is_wasm_compiled()); DCHECK(frame_->is_wasm_compiled());
wasm::DebugInfo* debug_info = wasm::DebugInfo* debug_info =
WasmCompiledFrame::cast(frame_)->native_module()->GetDebugInfo(); WasmCompiledFrame::cast(frame_)->native_module()->GetDebugInfo();
...@@ -186,13 +177,6 @@ v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() { ...@@ -186,13 +177,6 @@ v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() {
isolate_, frame_->pc(), frame_->fp(), frame_->callee_fp())); isolate_, frame_->pc(), frame_->fp(), frame_->callee_fp()));
} }
case debug::ScopeIterator::ScopeTypeWasmExpressionStack: { case debug::ScopeIterator::ScopeTypeWasmExpressionStack: {
if (frame_->is_wasm_interpreter_entry()) {
Handle<WasmDebugInfo> debug_info(
WasmInterpreterEntryFrame::cast(frame_)->debug_info(), isolate_);
return Utils::ToLocal(WasmDebugInfo::GetStackScopeObject(
debug_info, frame_->fp(), inlined_frame_index_));
}
// Compiled code.
DCHECK(frame_->is_wasm_compiled()); DCHECK(frame_->is_wasm_compiled());
wasm::DebugInfo* debug_info = wasm::DebugInfo* debug_info =
WasmCompiledFrame::cast(frame_)->native_module()->GetDebugInfo(); WasmCompiledFrame::cast(frame_)->native_module()->GetDebugInfo();
......
...@@ -39,8 +39,7 @@ class DebugScopeIterator final : public debug::ScopeIterator { ...@@ -39,8 +39,7 @@ class DebugScopeIterator final : public debug::ScopeIterator {
class DebugWasmScopeIterator final : public debug::ScopeIterator { class DebugWasmScopeIterator final : public debug::ScopeIterator {
public: public:
DebugWasmScopeIterator(Isolate* isolate, StandardFrame* frame, DebugWasmScopeIterator(Isolate* isolate, StandardFrame* frame);
int inlined_frame_index);
bool Done() override; bool Done() override;
void Advance() override; void Advance() override;
...@@ -57,7 +56,6 @@ class DebugWasmScopeIterator final : public debug::ScopeIterator { ...@@ -57,7 +56,6 @@ class DebugWasmScopeIterator final : public debug::ScopeIterator {
private: private:
Isolate* isolate_; Isolate* isolate_;
StandardFrame* frame_; StandardFrame* frame_;
int inlined_frame_index_;
ScopeType type_; ScopeType type_;
}; };
} // namespace internal } // namespace internal
......
...@@ -160,8 +160,8 @@ DebugStackTraceIterator::GetScopeIterator() const { ...@@ -160,8 +160,8 @@ DebugStackTraceIterator::GetScopeIterator() const {
DCHECK(!Done()); DCHECK(!Done());
StandardFrame* frame = iterator_.frame(); StandardFrame* frame = iterator_.frame();
if (frame->is_wasm()) { if (frame->is_wasm()) {
return std::make_unique<DebugWasmScopeIterator>(isolate_, iterator_.frame(), return std::make_unique<DebugWasmScopeIterator>(isolate_,
inlined_frame_index_); iterator_.frame());
} }
return std::make_unique<DebugScopeIterator>(isolate_, frame_inspector_.get()); return std::make_unique<DebugScopeIterator>(isolate_, frame_inspector_.get());
} }
......
...@@ -1026,14 +1026,6 @@ void Debug::PrepareStep(StepAction step_action) { ...@@ -1026,14 +1026,6 @@ void Debug::PrepareStep(StepAction step_action) {
thread_local_.last_frame_count_ = current_frame_count; thread_local_.last_frame_count_ = current_frame_count;
// No longer perform the current async step. // No longer perform the current async step.
clear_suspended_generator(); clear_suspended_generator();
} else if (frame->is_wasm_interpreter_entry()) {
// Handle stepping in wasm functions via the wasm interpreter.
WasmInterpreterEntryFrame* wasm_frame =
WasmInterpreterEntryFrame::cast(frame);
if (wasm_frame->NumberOfActiveFrames() > 0) {
wasm_frame->debug_info().PrepareStep(step_action);
return;
}
} else if (frame->is_wasm_compiled()) { } else if (frame->is_wasm_compiled()) {
// Handle stepping in Liftoff code. // Handle stepping in Liftoff code.
WasmCompiledFrame* wasm_frame = WasmCompiledFrame::cast(frame); WasmCompiledFrame* wasm_frame = WasmCompiledFrame::cast(frame);
......
...@@ -533,13 +533,6 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() { ...@@ -533,13 +533,6 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
if (thrower_->error()) return {}; if (thrower_->error()) return {};
} }
//--------------------------------------------------------------------------
// Debugging support.
//--------------------------------------------------------------------------
// Set all breakpoints that were set on the shared module.
WasmScript::SetBreakpointsOnNewInstance(
handle(module_object_->script(), isolate_), instance);
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Create a wrapper for the start function. // Create a wrapper for the start function.
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
......
This diff is collapsed.
...@@ -843,28 +843,11 @@ class WasmDebugInfo : public Struct { ...@@ -843,28 +843,11 @@ class WasmDebugInfo : public Struct {
V8_EXPORT_PRIVATE static wasm::WasmInterpreter* SetupForTesting( V8_EXPORT_PRIVATE static wasm::WasmInterpreter* SetupForTesting(
Handle<WasmInstanceObject>); Handle<WasmInstanceObject>);
// Prepare WasmDebugInfo for stepping in the given function.
V8_EXPORT_PRIVATE static void PrepareStepIn(Handle<WasmDebugInfo>,
int func_index);
// Set a breakpoint in the given function at the given byte offset within that
// function. This will redirect all future calls to this function to the
// interpreter and will always pause at the given offset.
V8_EXPORT_PRIVATE static void SetBreakpoint(Handle<WasmDebugInfo>,
int func_index, int offset);
// Clear a previously set breakpoint in the given function at the given byte
// offset within that function.
V8_EXPORT_PRIVATE static void ClearBreakpoint(Handle<WasmDebugInfo>,
int func_index, int offset);
// Make a set of functions always execute in the interpreter without setting // Make a set of functions always execute in the interpreter without setting
// breakpoints. // breakpoints.
V8_EXPORT_PRIVATE static void RedirectToInterpreter(Handle<WasmDebugInfo>, V8_EXPORT_PRIVATE static void RedirectToInterpreter(Handle<WasmDebugInfo>,
Vector<int> func_indexes); Vector<int> func_indexes);
void PrepareStep(StepAction);
// Execute the specified function in the interpreter. Read arguments from the // Execute the specified function in the interpreter. Read arguments from the
// {argument_values} vector and write to {return_values} on regular exit. // {argument_values} vector and write to {return_values} on regular exit.
// The frame_pointer will be used to identify the new activation of the // The frame_pointer will be used to identify the new activation of the
...@@ -890,18 +873,6 @@ class WasmDebugInfo : public Struct { ...@@ -890,18 +873,6 @@ class WasmDebugInfo : public Struct {
// Returns the number of calls / function frames executed in the interpreter. // Returns the number of calls / function frames executed in the interpreter.
V8_EXPORT_PRIVATE uint64_t NumInterpretedCalls(); V8_EXPORT_PRIVATE uint64_t NumInterpretedCalls();
// Get local scope details for a specific interpreted frame. It contains
// information about parameters, locals, and stack values.
static Handle<JSObject> GetLocalScopeObject(Handle<WasmDebugInfo>,
Address frame_pointer,
int frame_index);
// Get stack scope details for a specific interpreted frame. It contains
// information about stack values.
static Handle<JSObject> GetStackScopeObject(Handle<WasmDebugInfo>,
Address frame_pointer,
int frame_index);
V8_EXPORT_PRIVATE static Handle<Code> GetCWasmEntry(Handle<WasmDebugInfo>, V8_EXPORT_PRIVATE static Handle<Code> GetCWasmEntry(Handle<WasmDebugInfo>,
const wasm::FunctionSig*); const wasm::FunctionSig*);
...@@ -942,9 +913,6 @@ class WasmScript : public AllStatic { ...@@ -942,9 +913,6 @@ class WasmScript : public AllStatic {
V8_EXPORT_PRIVATE static bool ClearBreakPointById(Handle<Script>, V8_EXPORT_PRIVATE static bool ClearBreakPointById(Handle<Script>,
int breakpoint_id); int breakpoint_id);
static void SetBreakpointsOnNewInstance(Handle<Script>,
Handle<WasmInstanceObject>);
// Get a list of all possible breakpoints within a given range of this module. // Get a list of all possible breakpoints within a given range of this module.
V8_EXPORT_PRIVATE static bool GetPossibleBreakpoints( V8_EXPORT_PRIVATE static bool GetPossibleBreakpoints(
wasm::NativeModule* native_module, const debug::Location& start, wasm::NativeModule* native_module, const debug::Location& start,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment