OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 25 matching lines...) Expand all Loading... |
36 try { // Line 3. | 36 try { // Line 3. |
37 throw 'stuff'; // Line 4. | 37 throw 'stuff'; // Line 4. |
38 } catch (e) { // Line 5. | 38 } catch (e) { // Line 5. |
39 x = 2; // Line 6. | 39 x = 2; // Line 6. |
40 } | 40 } |
41 } | 41 } |
42 }; | 42 }; |
43 | 43 |
44 // Get the Debug object exposed from the debug context global object. | 44 // Get the Debug object exposed from the debug context global object. |
45 Debug = debug.Debug | 45 Debug = debug.Debug |
46 // Set breakpoint on line 6. | |
47 var bp = Debug.setBreakPoint(f, 6); | |
48 | 46 |
49 function listener(event, exec_state, event_data, data) { | 47 function listener(event, exec_state, event_data, data) { |
50 if (event == Debug.DebugEvent.Break) { | 48 if (event == Debug.DebugEvent.Break) { |
51 result = exec_state.frame().evaluate("i").value(); | 49 result = exec_state.frame().evaluate("i").value(); |
52 } | 50 } |
53 }; | 51 }; |
54 | 52 |
55 // Add the debug event listener. | 53 // Add the debug event listener. |
56 Debug.setListener(listener); | 54 Debug.setListener(listener); |
| 55 |
| 56 //Set breakpoint on line 6. |
| 57 var bp = Debug.setBreakPoint(f, 6); |
| 58 |
57 result = -1; | 59 result = -1; |
58 f(); | 60 f(); |
59 assertEquals(1, result); | 61 assertEquals(1, result); |
60 | 62 |
61 // Clear breakpoint. | 63 // Clear breakpoint. |
62 Debug.clearBreakPoint(bp); | 64 Debug.clearBreakPoint(bp); |
63 // Get rid of the debug event listener. | 65 // Get rid of the debug event listener. |
64 Debug.setListener(null); | 66 Debug.setListener(null); |
OLD | NEW |