| Index: test/mjsunit/wasm/frame-inspection.js
|
| diff --git a/test/mjsunit/wasm/frame-inspection.js b/test/mjsunit/wasm/frame-inspection.js
|
| index 9d45239e4ae2000d4557279f1ccfb757c91897de..01f9142d3a3df4b82c099b9c4765d371766e234d 100644
|
| --- a/test/mjsunit/wasm/frame-inspection.js
|
| +++ b/test/mjsunit/wasm/frame-inspection.js
|
| @@ -12,10 +12,14 @@ Debug = debug.Debug
|
| var exception = null;
|
| var break_count = 0;
|
|
|
| -const expected_num_frames = 5;
|
| -const expected_wasm_frames = [false, true, true, false, false];
|
| -const expected_wasm_positions = [0, 1, 2, 0, 0];
|
| -const expected_function_names = ["call_debugger", "wasm_2", "wasm_1", "testFrameInspection", ""];
|
| +const expected_frames = [
|
| + // func-name; wasm?; pos; line; col
|
| + ['call_debugger', false], // --
|
| + ['wasm_2', true, 56, 2, 1], // --
|
| + ['wasm_1', true, 52, 1, 2], // --
|
| + ['testFrameInspection', false], // --
|
| + ['', false]
|
| +];
|
|
|
| function listener(event, exec_state, event_data, data) {
|
| if (event != Debug.DebugEvent.Break) return;
|
| @@ -23,20 +27,24 @@ function listener(event, exec_state, event_data, data) {
|
| try {
|
| var break_id = exec_state.break_id;
|
| var frame_count = exec_state.frameCount();
|
| - assertEquals(expected_num_frames, frame_count);
|
| + assertEquals(expected_frames.length, frame_count, 'frame count');
|
|
|
| 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_wasm_frames[i], !frame.func().resolved());
|
| - assertEquals(expected_function_names[i], frame.func().name());
|
| - if (expected_wasm_frames[i]) {
|
| + 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);
|
| - assertEquals(expected_wasm_positions[i], frame.details().sourcePosition());
|
| + 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_wasm_positions[i], loc.column);
|
| - assertEquals(expected_wasm_positions[i], loc.position);
|
| + 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);
|
| }
|
| }
|
| } catch (e) {
|
| @@ -49,14 +57,13 @@ var builder = new WasmModuleBuilder();
|
| // wasm_1 calls wasm_2 on offset 2.
|
| // wasm_2 calls call_debugger on offset 1.
|
|
|
| -builder.addImport("func", kSig_v_v);
|
| +builder.addImport('func', kSig_v_v);
|
|
|
| -builder.addFunction("wasm_1", kSig_v_v)
|
| - .addBody([kExprNop, kExprCallFunction, 2])
|
| - .exportAs("main");
|
| +builder.addFunction('wasm_1', kSig_v_v)
|
| + .addBody([kExprNop, kExprCallFunction, 2])
|
| + .exportAs('main');
|
|
|
| -builder.addFunction("wasm_2", kSig_v_v)
|
| - .addBody([kExprCallFunction, 0]);
|
| +builder.addFunction('wasm_2', kSig_v_v).addBody([kExprCallFunction, 0]);
|
|
|
| function call_debugger() {
|
| debugger;
|
|
|