// Copyright 2020 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. #include "src/debug/wasm/gdb-server/wasm-module-debug.h" #include "src/api/api-inl.h" #include "src/api/api.h" #include "src/base/platform/wrappers.h" #include "src/execution/frames-inl.h" #include "src/execution/frames.h" #include "src/objects/script.h" #include "src/wasm/module-instantiate.h" #include "src/wasm/wasm-debug.h" #include "src/wasm/wasm-value.h" namespace v8 { namespace internal { namespace wasm { namespace gdb_server { WasmModuleDebug::WasmModuleDebug(v8::Isolate* isolate, Local wasm_script) { DCHECK_EQ(Script::TYPE_WASM, Utils::OpenHandle(*wasm_script)->type()); isolate_ = isolate; wasm_script_ = Global(isolate, wasm_script); } std::string WasmModuleDebug::GetModuleName() const { v8::Local wasm_script = wasm_script_.Get(isolate_); v8::Local name; std::string module_name; if (wasm_script->Name().ToLocal(&name)) { module_name = *(v8::String::Utf8Value(isolate_, name)); } return module_name; } Handle WasmModuleDebug::GetFirstWasmInstance() { v8::Local wasm_script = wasm_script_.Get(isolate_); Handle