Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: src/api.cc

Issue 2536763002: [inspector] [wasm] Implement GetPossibleBreakpoints (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 3ad31c95034f5fae843bac552aed83fe5544887d..96d1780174bfd50edfa34c3fc48b88e14ecc08aa 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9008,8 +9008,9 @@ bool DebugInterface::Script::GetPossibleBreakpoints(
CHECK(!start.IsEmpty());
i::Handle<i::Script> script = Utils::OpenHandle(this);
if (script->type() == i::Script::TYPE_WASM) {
- // TODO(clemensh): Return the proper thing once we support wasm breakpoints.
- return false;
+ i::Handle<i::WasmCompiledModule> compiled_module(
+ i::WasmCompiledModule::cast(script->wasm_compiled_module()));
+ return compiled_module->GetPossibleBreakpoints(start, end, locations);
}
i::Script::InitLineEnds(script);
@@ -9127,6 +9128,23 @@ int DebugInterface::WasmScript::NumImportedFunctions() const {
return static_cast<int>(compiled_module->module()->num_imported_functions);
}
+std::pair<int, int> DebugInterface::WasmScript::GetFunctionRange(
+ int function_index) const {
+ i::DisallowHeapAllocation no_gc;
+ i::Handle<i::Script> script = Utils::OpenHandle(this);
+ DCHECK_EQ(i::Script::TYPE_WASM, script->type());
+ i::WasmCompiledModule* compiled_module =
+ i::WasmCompiledModule::cast(script->wasm_compiled_module());
+ DCHECK_LE(0, function_index);
+ DCHECK_GT(compiled_module->module()->functions.size(), function_index);
+ i::wasm::WasmFunction& func =
+ compiled_module->module()->functions[function_index];
+ DCHECK_GE(i::kMaxInt, func.code_start_offset);
+ DCHECK_GE(i::kMaxInt, func.code_end_offset);
+ return std::make_pair(static_cast<int>(func.code_start_offset),
+ static_cast<int>(func.code_end_offset));
+}
+
std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>>
DebugInterface::WasmScript::DisassembleFunction(int function_index) {
i::DisallowHeapAllocation no_gc;
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698