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

Unified Diff: src/inspector/wasm-translation.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 | « src/inspector/v8-debugger-script.cc ('k') | src/wasm/wasm-objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/wasm-translation.cc
diff --git a/src/inspector/wasm-translation.cc b/src/inspector/wasm-translation.cc
index b448c72de5472b93ea29c78e3be901f9e9f5dafa..151328557190c7d50292538467eee73a53f80413 100644
--- a/src/inspector/wasm-translation.cc
+++ b/src/inspector/wasm-translation.cc
@@ -102,6 +102,7 @@ class WasmTranslation::TranslatorImpl::DisassemblingTranslator
const OffsetTable *reverse_table = GetReverseTable(func_index);
if (!reverse_table) return;
DCHECK(!reverse_table->empty());
+ v8::Isolate *isolate = loc->translation->isolate_;
// Binary search for the given line and column.
unsigned left = 0; // inclusive
@@ -121,15 +122,24 @@ class WasmTranslation::TranslatorImpl::DisassemblingTranslator
int found_byte_offset = 0;
// If we found an exact match, use it. Otherwise check whether the next
// bigger entry is still in the same line. Report that one then.
+ // Otherwise we might have hit the special case of pointing after the last
+ // line, which is translated to the end of the function (one byte after the
+ // last function byte).
if (std::get<1>((*reverse_table)[left]) == loc->line &&
std::get<2>((*reverse_table)[left]) == loc->column) {
found_byte_offset = std::get<0>((*reverse_table)[left]);
} else if (left + 1 < reverse_table->size() &&
std::get<1>((*reverse_table)[left + 1]) == loc->line) {
found_byte_offset = std::get<0>((*reverse_table)[left + 1]);
+ } else if (left == reverse_table->size() - 1 &&
+ std::get<1>((*reverse_table)[left]) == loc->line - 1 &&
+ loc->column == 0) {
+ std::pair<int, int> func_range =
+ script_.Get(isolate)->GetFunctionRange(func_index);
+ DCHECK_LE(func_range.first, func_range.second);
+ found_byte_offset = func_range.second - func_range.first;
}
- v8::Isolate *isolate = loc->translation->isolate_;
loc->script_id = String16::fromInteger(script_.Get(isolate)->Id());
loc->line = func_index;
loc->column = found_byte_offset;
@@ -172,8 +182,9 @@ class WasmTranslation::TranslatorImpl::DisassemblingTranslator
std::make_pair(func_idx, std::move(disassembly.second)));
String16 source(disassembly.first.data(), disassembly.first.length());
std::unique_ptr<V8DebuggerScript> fake_script =
- V8DebuggerScript::CreateWasm(isolate, script, fake_script_id,
- std::move(fake_script_url), source);
+ V8DebuggerScript::CreateWasm(isolate, script, translation,
+ fake_script_id, std::move(fake_script_url),
+ source);
translation->AddFakeScript(fake_script->scriptId(), this);
agent->didParseSource(std::move(fake_script), true);
« no previous file with comments | « src/inspector/v8-debugger-script.cc ('k') | src/wasm/wasm-objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698