Enhance auto-stepping behaviour

Previously, auto-stepping experiment would only work when mapping is not
found at all, that is, there is no source file associated with a
particular byte offset.

This is not ideal in situations where a file exists, but underlying
JavaScript / Wasm instructions don't map 1:1 to the source language,
which is usually the case for compiled languages. In this case trying to
perform step-by-step debugging would lead to user visibly staying on the
same line and column in the source file, while V8 is stepping over
individual instructions / statements.

The reason for this is that SourceMap.findEntry doesn't look for an
exact match, but rather for a most suitable position in the source it
can map a byte offset to. This is what you usually want when stopping on
an exception, but not what you want when trying to step over some
statement in the source code.

This change enhances auto-stepping to detect such situations and
continue until a precise match is found.

Change-Id: I69ced14f0bdb219ec8f6b58864dbf23616a6230b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1855967
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Ingvar Stepanyan <rreverser@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#705515}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 6411844977f839675e37fb7d90a59e164aaa9432
This commit is contained in:
Ingvar Stepanyan
2019-10-14 11:32:18 +00:00
committed by Commit Bot
parent 2eb8c14505
commit a4797c8609
+2 -1
View File
@@ -119,7 +119,8 @@ export default class CompilerScriptMapping {
if (!sourceMap) {
return true;
}
return !!sourceMap.findEntry(rawLocation.lineNumber, rawLocation.columnNumber);
const entry = sourceMap.findEntry(rawLocation.lineNumber, rawLocation.columnNumber);
return !!entry && entry.lineNumber === rawLocation.lineNumber && entry.columnNumber === rawLocation.columnNumber;
}
/**