From a4797c8609effb89b082441fd5d956d04b05c052 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Mon, 14 Oct 2019 11:32:18 +0000 Subject: [PATCH] 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 Reviewed-by: Benedikt Meurer Commit-Queue: Ingvar Stepanyan Cr-Original-Commit-Position: refs/heads/master@{#705515} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 6411844977f839675e37fb7d90a59e164aaa9432 --- front_end/bindings/CompilerScriptMapping.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/front_end/bindings/CompilerScriptMapping.js b/front_end/bindings/CompilerScriptMapping.js index a53e3afa1e..dc2f398de3 100644 --- a/front_end/bindings/CompilerScriptMapping.js +++ b/front_end/bindings/CompilerScriptMapping.js @@ -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; } /**