OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-wasm | 5 // Flags: --expose-wasm |
6 | 6 |
7 load("test/mjsunit/wasm/wasm-constants.js"); | 7 load("test/mjsunit/wasm/wasm-constants.js"); |
8 load("test/mjsunit/wasm/wasm-module-builder.js"); | 8 load("test/mjsunit/wasm/wasm-module-builder.js"); |
9 | 9 |
10 Debug = debug.Debug | 10 Debug = debug.Debug |
11 | 11 |
12 var exception = null; | 12 var exception = null; |
13 var break_count = 0; | 13 var break_count = 0; |
14 | 14 |
15 const expected_frames = [ | 15 const expected_frames = [ |
16 // func-name; wasm?; pos; line; col | 16 // func-name; wasm?; pos; line; col |
17 ['call_debugger', false], // -- | 17 ['call_debugger', false], // -- |
18 ['wasm_2', true, 56, 2, 2], // -- | 18 ['wasm_2', true, 56, 2, 0], // -- |
19 ['wasm_1', true, 52, 3, 2], // -- | 19 ['wasm_1', true, 52, 3, 0], // -- |
20 ['testFrameInspection', false], // -- | 20 ['testFrameInspection', false], // -- |
21 ['', false] | 21 ['', false] |
22 ]; | 22 ]; |
23 | 23 |
24 function listener(event, exec_state, event_data, data) { | 24 function listener(event, exec_state, event_data, data) { |
25 if (event != Debug.DebugEvent.Break) return; | 25 if (event != Debug.DebugEvent.Break) return; |
26 ++break_count; | 26 ++break_count; |
27 try { | 27 try { |
28 var break_id = exec_state.break_id; | 28 var break_id = exec_state.break_id; |
29 var frame_count = exec_state.frameCount(); | 29 var frame_count = exec_state.frameCount(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 var module = builder.instantiate({mod: {func: call_debugger}}); | 63 var module = builder.instantiate({mod: {func: call_debugger}}); |
64 | 64 |
65 (function testFrameInspection() { | 65 (function testFrameInspection() { |
66 Debug.setListener(listener); | 66 Debug.setListener(listener); |
67 module.exports.main(); | 67 module.exports.main(); |
68 Debug.setListener(null); | 68 Debug.setListener(null); |
69 | 69 |
70 assertEquals(1, break_count); | 70 assertEquals(1, break_count); |
71 if (exception) throw exception; | 71 if (exception) throw exception; |
72 })(); | 72 })(); |
OLD | NEW |