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

Unified Diff: src/inspector/wasm-translation.cc

Issue 2720813002: [wasm] Fix importing wasm functions which are being debugged (Closed)
Patch Set: Awesome inspector test now :) Created 3 years, 10 months 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/wasm/wasm-module.cc » ('j') | test/inspector/protocol-test.js » ('J')
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 00f1aabbf64b739df42ae748e28eba741ea33802..87e3e2b9f05f2315c870d817fdc91b06245991d1 100644
--- a/src/inspector/wasm-translation.cc
+++ b/src/inspector/wasm-translation.cc
@@ -123,16 +123,18 @@ 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).
+ // [left] is <= <line,column>, or left==0 and [0] > <line,column>.
+ // We are searching for the smallest entry >= <line,column> which is still
+ // on the same line. This must be either [left] or [left + 1].
+ // If we don't find such an entry, 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 ((*reverse_table)[left].line == loc->line &&
- (*reverse_table)[left].column == loc->column) {
+ (*reverse_table)[left].column >= loc->column) {
found_byte_offset = (*reverse_table)[left].byte_offset;
} else if (left + 1 < reverse_table->size() &&
- (*reverse_table)[left + 1].line == loc->line) {
+ (*reverse_table)[left + 1].line == loc->line &&
+ (*reverse_table)[left + 1].column >= loc->column) {
found_byte_offset = (*reverse_table)[left + 1].byte_offset;
} else if (left == reverse_table->size() - 1 &&
(*reverse_table)[left].line == loc->line - 1 &&
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | test/inspector/protocol-test.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698