| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Flags: --expose-debug-as debug | 28 // Flags: --expose-debug-as debug |
| 29 // Flags: --turbo-deoptimization | 29 // Flags: --turbo-deoptimization |
| 30 // Get the Debug object exposed from the debug context global object. | 30 // Get the Debug object exposed from the debug context global object. |
| 31 var Debug = debug.Debug | 31 var Debug = debug.Debug |
| 32 | 32 |
| 33 // Simple function which stores the last debug event. | 33 // Simple function which stores the last debug event. |
| 34 var listenerComplete = false; | 34 var listenerComplete = false; |
| 35 var exception = false; | 35 var exception = false; |
| 36 var ignore_events = false; |
| 36 | 37 |
| 37 var base_request = '"seq":0,"type":"request","command":"clearbreakpointgroup"'; | 38 var base_request = '"seq":0,"type":"request","command":"clearbreakpointgroup"'; |
| 38 var scriptId = null; | 39 var scriptId = null; |
| 39 | 40 |
| 40 function safeEval(code) { | 41 function safeEval(code) { |
| 41 try { | 42 try { |
| 42 return eval('(' + code + ')'); | 43 return eval('(' + code + ')'); |
| 43 } catch (e) { | 44 } catch (e) { |
| 44 assertEquals(void 0, e); | 45 assertEquals(void 0, e); |
| 45 return undefined; | 46 return undefined; |
| 46 } | 47 } |
| 47 } | 48 } |
| 48 | 49 |
| 49 function testArguments(dcp, arguments, success) { | 50 function testArguments(dcp, arguments, success) { |
| 50 var request = '{' + base_request + ',"arguments":' + arguments + '}' | 51 var request = '{' + base_request + ',"arguments":' + arguments + '}' |
| 51 var json_response = dcp.processDebugJSONRequest(request); | 52 var json_response = dcp.processDebugJSONRequest(request); |
| 53 ignore_events = true; |
| 52 var response = safeEval(json_response); | 54 var response = safeEval(json_response); |
| 55 ignore_events = false; |
| 53 if (success) { | 56 if (success) { |
| 54 assertTrue(response.success, json_response); | 57 assertTrue(response.success, json_response); |
| 55 } else { | 58 } else { |
| 56 assertFalse(response.success, json_response); | 59 assertFalse(response.success, json_response); |
| 57 } | 60 } |
| 58 } | 61 } |
| 59 | 62 |
| 60 function listener(event, exec_state, event_data, data) { | 63 function listener(event, exec_state, event_data, data) { |
| 64 if (ignore_events) return; |
| 61 try { | 65 try { |
| 62 if (event == Debug.DebugEvent.Break) { | 66 if (event == Debug.DebugEvent.Break) { |
| 63 // Get the debug command processor. | 67 // Get the debug command processor. |
| 64 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); | 68 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); |
| 65 | 69 |
| 66 // Clear breakpoint group 1. | 70 // Clear breakpoint group 1. |
| 67 testArguments(dcp, '{"groupId":1}', true); | 71 testArguments(dcp, '{"groupId":1}', true); |
| 68 | 72 |
| 69 // Indicate that all was processed. | 73 // Indicate that all was processed. |
| 70 listenerComplete = true; | 74 listenerComplete = true; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Check that all breakpoints from group 1 were deleted and all the | 118 // Check that all breakpoints from group 1 were deleted and all the |
| 115 // rest are preserved. | 119 // rest are preserved. |
| 116 assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); | 120 assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); |
| 117 | 121 |
| 118 assertFalse(exception, "exception in listener"); | 122 assertFalse(exception, "exception in listener"); |
| 119 | 123 |
| 120 // Clear all breakpoints to allow the test to run again (--stress-opt). | 124 // Clear all breakpoints to allow the test to run again (--stress-opt). |
| 121 Debug.clearBreakPoint(bp2); | 125 Debug.clearBreakPoint(bp2); |
| 122 Debug.clearBreakPoint(bp3); | 126 Debug.clearBreakPoint(bp3); |
| 123 Debug.clearBreakPoint(bp5); | 127 Debug.clearBreakPoint(bp5); |
| OLD | NEW |