Commit 55865f77 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[inspector] Move Wasm related inspector functionality to src/debug.

Previously the implementation of the scope iterator objects and the
debug proxy lived in src/wasm, and they are now being moved to
src/debug, to better align with the JavaScript debugging interface,
which also lives in src/debug.

Bug: chromium:1162229, chromium:1071432
Change-Id: I7f89ced88a1231ad6a923be6e85a93f1876a2024
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2621084Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72007}
parent b3d09001
...@@ -2540,6 +2540,8 @@ v8_source_set("v8_base_without_compiler") { ...@@ -2540,6 +2540,8 @@ v8_source_set("v8_base_without_compiler") {
"src/debug/debug-stack-trace-iterator.h", "src/debug/debug-stack-trace-iterator.h",
"src/debug/debug-type-profile.cc", "src/debug/debug-type-profile.cc",
"src/debug/debug-type-profile.h", "src/debug/debug-type-profile.h",
"src/debug/debug-wasm-support.cc",
"src/debug/debug-wasm-support.h",
"src/debug/debug.cc", "src/debug/debug.cc",
"src/debug/debug.h", "src/debug/debug.h",
"src/debug/interface-types.h", "src/debug/interface-types.h",
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "src/common/globals.h" #include "src/common/globals.h"
#include "src/debug/debug-frames.h" #include "src/debug/debug-frames.h"
#include "src/debug/debug-scopes.h" #include "src/debug/debug-scopes.h"
#include "src/debug/debug-wasm-support.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/execution/frames-inl.h" #include "src/execution/frames-inl.h"
#include "src/execution/isolate-inl.h" #include "src/execution/isolate-inl.h"
...@@ -17,7 +18,6 @@ ...@@ -17,7 +18,6 @@
#include "src/interpreter/bytecodes.h" #include "src/interpreter/bytecodes.h"
#include "src/objects/contexts.h" #include "src/objects/contexts.h"
#include "src/snapshot/snapshot.h" #include "src/snapshot/snapshot.h"
#include "src/wasm/wasm-debug.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -100,7 +100,7 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate, ...@@ -100,7 +100,7 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
WasmFrame* frame = WasmFrame::cast(it.frame()); WasmFrame* frame = WasmFrame::cast(it.frame());
Handle<SharedFunctionInfo> outer_info( Handle<SharedFunctionInfo> outer_info(
isolate->native_context()->empty_function().shared(), isolate); isolate->native_context()->empty_function().shared(), isolate);
Handle<JSObject> context_extension = wasm::GetJSDebugProxy(frame); Handle<JSObject> context_extension = GetJSDebugProxy(frame);
Handle<ScopeInfo> scope_info = Handle<ScopeInfo> scope_info =
ScopeInfo::CreateForWithScope(isolate, Handle<ScopeInfo>::null()); ScopeInfo::CreateForWithScope(isolate, Handle<ScopeInfo>::null());
Handle<Context> context = isolate->factory()->NewWithContext( Handle<Context> context = isolate->factory()->NewWithContext(
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "src/debug/debug-scope-iterator.h" #include "src/debug/debug-scope-iterator.h"
#include "src/api/api-inl.h" #include "src/api/api-inl.h"
#include "src/debug/debug-wasm-support.h"
#include "src/debug/debug.h" #include "src/debug/debug.h"
#include "src/debug/liveedit.h" #include "src/debug/liveedit.h"
#include "src/execution/frames-inl.h" #include "src/execution/frames-inl.h"
...@@ -173,19 +174,15 @@ v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() { ...@@ -173,19 +174,15 @@ v8::Local<v8::Object> DebugWasmScopeIterator::GetObject() {
case debug::ScopeIterator::ScopeTypeModule: { case debug::ScopeIterator::ScopeTypeModule: {
Handle<WasmInstanceObject> instance = Handle<WasmInstanceObject> instance =
FrameSummary::GetTop(frame_).AsWasm().wasm_instance(); FrameSummary::GetTop(frame_).AsWasm().wasm_instance();
return Utils::ToLocal(wasm::GetModuleScopeObject(instance)); return Utils::ToLocal(GetModuleScopeObject(instance));
} }
case debug::ScopeIterator::ScopeTypeLocal: { case debug::ScopeIterator::ScopeTypeLocal: {
DCHECK(frame_->is_inspectable()); DCHECK(frame_->is_inspectable());
wasm::DebugInfo* debug_info = frame_->native_module()->GetDebugInfo(); return Utils::ToLocal(GetLocalScopeObject(frame_));
return Utils::ToLocal(debug_info->GetLocalScopeObject(
isolate_, frame_->pc(), frame_->fp(), frame_->callee_fp()));
} }
case debug::ScopeIterator::ScopeTypeWasmExpressionStack: { case debug::ScopeIterator::ScopeTypeWasmExpressionStack: {
DCHECK(frame_->is_inspectable()); DCHECK(frame_->is_inspectable());
wasm::DebugInfo* debug_info = frame_->native_module()->GetDebugInfo(); return Utils::ToLocal(GetStackScopeObject(frame_));
return Utils::ToLocal(debug_info->GetStackScopeObject(
isolate_, frame_->pc(), frame_->fp(), frame_->callee_fp()));
} }
default: default:
return {}; return {};
......
This diff is collapsed.
// Copyright 2021 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_DEBUG_DEBUG_WASM_SUPPORT_H_
#define V8_DEBUG_DEBUG_WASM_SUPPORT_H_
namespace v8 {
namespace internal {
template <typename T>
class Handle;
class JSObject;
class WasmFrame;
class WasmInstanceObject;
Handle<JSObject> GetModuleScopeObject(Handle<WasmInstanceObject> instance);
Handle<JSObject> GetLocalScopeObject(WasmFrame* frame);
Handle<JSObject> GetStackScopeObject(WasmFrame* frame);
Handle<JSObject> GetJSDebugProxy(WasmFrame* frame);
} // namespace internal
} // namespace v8
#endif // V8_DEBUG_DEBUG_WASM_SUPPORT_H_
This diff is collapsed.
...@@ -20,12 +20,9 @@ namespace internal { ...@@ -20,12 +20,9 @@ namespace internal {
template <typename T> template <typename T>
class Handle; class Handle;
class JSObject;
class JSProxy;
template <typename T> template <typename T>
class Vector; class Vector;
class WasmFrame; class WasmFrame;
class WasmInstanceObject;
namespace wasm { namespace wasm {
...@@ -137,10 +134,6 @@ class DebugSideTable { ...@@ -137,10 +134,6 @@ class DebugSideTable {
std::vector<Entry> entries_; std::vector<Entry> entries_;
}; };
// Get the module scope for a given instance. This will contain the wasm memory
// (if the instance has a memory) and the values of all globals.
Handle<JSObject> GetModuleScopeObject(Handle<WasmInstanceObject>);
// Debug info per NativeModule, created lazily on demand. // Debug info per NativeModule, created lazily on demand.
// Implementation in {wasm-debug.cc} using PIMPL. // Implementation in {wasm-debug.cc} using PIMPL.
class V8_EXPORT_PRIVATE DebugInfo { class V8_EXPORT_PRIVATE DebugInfo {
...@@ -161,12 +154,6 @@ class V8_EXPORT_PRIVATE DebugInfo { ...@@ -161,12 +154,6 @@ class V8_EXPORT_PRIVATE DebugInfo {
WasmValue GetStackValue(int index, Address pc, Address fp, WasmValue GetStackValue(int index, Address pc, Address fp,
Address debug_break_fp); Address debug_break_fp);
Handle<JSObject> GetLocalScopeObject(Isolate*, Address pc, Address fp,
Address debug_break_fp);
Handle<JSObject> GetStackScopeObject(Isolate*, Address pc, Address fp,
Address debug_break_fp);
WireBytesRef GetLocalName(int func_index, int local_index); WireBytesRef GetLocalName(int func_index, int local_index);
void SetBreakpoint(int func_index, int offset, Isolate* current_isolate); void SetBreakpoint(int func_index, int offset, Isolate* current_isolate);
...@@ -195,8 +182,6 @@ class V8_EXPORT_PRIVATE DebugInfo { ...@@ -195,8 +182,6 @@ class V8_EXPORT_PRIVATE DebugInfo {
std::unique_ptr<DebugInfoImpl> impl_; std::unique_ptr<DebugInfoImpl> impl_;
}; };
Handle<JSObject> GetJSDebugProxy(WasmFrame* frame);
} // namespace wasm } // namespace wasm
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
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