| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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: --noturbo-osr --noturbo-inlining --expose-debug-as debug | 5 // Flags: --noturbo-osr --noturbo-inlining |
| 6 | 6 |
| 7 var stdlib = this; | 7 var stdlib = this; |
| 8 var buffer = new ArrayBuffer(64 * 1024); | 8 var buffer = new ArrayBuffer(64 * 1024); |
| 9 var foreign = { thrower: thrower, debugme: debugme } | 9 var foreign = { thrower: thrower, debugme: debugme } |
| 10 | 10 |
| 11 // Get the Debug object exposed from the debug context global object. | |
| 12 Debug = debug.Debug; | 11 Debug = debug.Debug; |
| 13 | 12 |
| 14 var listenerCalled = false; | 13 var listenerCalled = false; |
| 15 function listener(event, exec_state, event_data, data) { | 14 function listener(event, exec_state, event_data, data) { |
| 16 try { | 15 try { |
| 17 if (event == Debug.DebugEvent.Break) { | 16 if (event == Debug.DebugEvent.Break) { |
| 18 var frame = exec_state.frame(1); | 17 var frame = exec_state.frame(1); |
| 19 assertEquals(m.foo, frame.func().value()); | 18 assertEquals("foo", frame.func().name()); |
| 20 listenerCalled = true; | 19 listenerCalled = true; |
| 21 } | 20 } |
| 22 } catch (e) { | 21 } catch (e) { |
| 23 print("Caught: " + e + " " + e.stack); | 22 print("Caught: " + e + " " + e.stack); |
| 24 }; | 23 }; |
| 25 } | 24 } |
| 26 | 25 |
| 27 function thrower() { throw "boom"; } | 26 function thrower() { throw "boom"; } |
| 28 function debugme() { Debug.setListener(listener); debugger; } | 27 function debugme() { Debug.setListener(listener); debugger; } |
| 29 | 28 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 46 return i|0; | 45 return i|0; |
| 47 } | 46 } |
| 48 return { foo: foo }; | 47 return { foo: foo }; |
| 49 } | 48 } |
| 50 | 49 |
| 51 var m = Module(stdlib, foreign, buffer); | 50 var m = Module(stdlib, foreign, buffer); |
| 52 | 51 |
| 53 assertThrows("m.foo(0)"); | 52 assertThrows("m.foo(0)"); |
| 54 assertEquals(23, m.foo(1)); | 53 assertEquals(23, m.foo(1)); |
| 55 assertTrue(listenerCalled); | 54 assertTrue(listenerCalled); |
| OLD | NEW |