OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --expose-debug-as debug --no-crankshaft |
| 6 |
| 7 Debug = debug.Debug |
| 8 |
| 9 var exception = null; |
| 10 |
| 11 function f() { |
| 12 let a = 0; |
| 13 function g() { |
| 14 let a = 1; |
| 15 { |
| 16 let a = 2; |
| 17 debugger; // Breakpoint. |
| 18 assertEquals(3, a); |
| 19 } |
| 20 assertEquals(1, a); |
| 21 } |
| 22 g.call(1); |
| 23 assertEquals(4, a); |
| 24 } |
| 25 |
| 26 |
| 27 function listener(event, exec_state, event_data, data) { |
| 28 if (event != Debug.DebugEvent.Break) return; |
| 29 try { |
| 30 exec_state.frame(0).evaluate("a = 3"); |
| 31 exec_state.frame(1).evaluate("a = 4"); |
| 32 assertThrows(() => exec_state.frame(0).evaluate("this = 2")); |
| 33 } catch (e) { |
| 34 exception = e; |
| 35 print("Caught something. " + e + " " + e.stack); |
| 36 }; |
| 37 }; |
| 38 |
| 39 Debug.setListener(listener); |
| 40 |
| 41 f(); |
| 42 |
| 43 Debug.setListener(null); |
| 44 assertNull(exception); |
OLD | NEW |