Commit 9eec1c86 authored by jgruber's avatar jgruber Committed by Commit bot

[debug-wrapper] Migrate wasm/frame-inspection test

Wasm frames are special in that they have a non-integer script id
in inspector. The way we treat script ids currently is a bit of a mess -
our runtime functions expected integer IDs while inspector has string
IDs (which contain integers, except for Wasm frames). This will need to
be cleaned up once more Wasm tests are added.

The meaning of line/column numbers has also changed; the old JS debug
API encoded the function index and byte offset into line/column numbers,
while inspector-based API actually translates into lines/columns in the
disassembly.

BUG=v8:5530

Review-Url: https://codereview.chromium.org/2515133003
Cr-Commit-Position: refs/heads/master@{#41182}
parent 5894d0e4
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --expose-debug-as debug
// Flags: --expose-wasm
load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
......@@ -15,8 +15,8 @@ var break_count = 0;
const expected_frames = [
// func-name; wasm?; pos; line; col
['call_debugger', false], // --
['wasm_2', true, 56, 2, 1], // --
['wasm_1', true, 52, 1, 2], // --
['wasm_2', true, 56, 2, 0], // --
['wasm_1', true, 52, 3, 0], // --
['testFrameInspection', false], // --
['', false]
];
......@@ -32,19 +32,10 @@ function listener(event, exec_state, event_data, data) {
for (var i = 0; i < frame_count; ++i) {
var frame = exec_state.frame(i);
assertEquals(expected_frames[i][0], frame.func().name(), 'name at ' + i);
// wasm frames have unresolved function, others resolved ones.
assertEquals(
expected_frames[i][1], !frame.func().resolved(), 'resolved at ' + i);
if (expected_frames[i][1]) { // wasm frame?
var script = frame.details().script();
assertNotNull(script, 'script at ' + i);
assertEquals(
expected_frames[i][2], frame.details().sourcePosition(),
'source pos at ' + i);
var loc = script.locationFromPosition(frame.details().sourcePosition());
assertEquals(expected_frames[i][2], loc.position, 'pos at ' + i);
assertEquals(expected_frames[i][3], loc.line, 'line at ' + i);
assertEquals(expected_frames[i][4], loc.column, 'column at ' + i);
assertEquals(expected_frames[i][3], frame.sourceLine(), 'line at ' + i);
assertEquals(expected_frames[i][4], frame.sourceColumn(),
'column at ' + i);
}
}
} catch (e) {
......
......@@ -684,8 +684,8 @@ class DebugWrapper {
return scopes;
};
return { sourceColumn : () => loc.column,
sourceLine : () => loc.line + 1,
return { sourceColumn : () => column,
sourceLine : () => line + 1,
sourceLineText : () => loc.sourceText,
evaluate : (expr) => this.evaluateOnCallFrame(frame, expr),
functionName : () => frame.functionName,
......@@ -738,7 +738,7 @@ class DebugWrapper {
return { id : () => id,
name : () => name,
source : () => this.eventDataScriptSource(id),
source : () => this.eventDataScriptSource(params.scriptId),
setSource : (src) => this.eventDataScriptSetSource(id, src)
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment