Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: test/mjsunit/debug-continue.js

Issue 242034: Redo "running" field in debug-delay.js and support "suspend" command (Closed)
Patch Set: do not remove body from backtrace Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/debug-clearbreakpointgroup.js ('k') | test/mjsunit/debug-evaluate.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 37
38 function safeEval(code) { 38 function safeEval(code) {
39 try { 39 try {
40 return eval('(' + code + ')'); 40 return eval('(' + code + ')');
41 } catch (e) { 41 } catch (e) {
42 assertEquals(void 0, e); 42 assertEquals(void 0, e);
43 return undefined; 43 return undefined;
44 } 44 }
45 } 45 }
46 46
47 function testArguments(dcp, arguments, success) { 47 function testArguments(exec_state, arguments, success) {
48 // Get the debug command processor in paused state.
49 var dcp = exec_state.debugCommandProcessor(false);
50
48 // Generate request with the supplied arguments 51 // Generate request with the supplied arguments
49 var request; 52 var request;
50 if (arguments) { 53 if (arguments) {
51 request = '{' + base_request + ',"arguments":' + arguments + '}'; 54 request = '{' + base_request + ',"arguments":' + arguments + '}';
52 } else { 55 } else {
53 request = '{' + base_request + '}' 56 request = '{' + base_request + '}'
54 } 57 }
55 var response = safeEval(dcp.processDebugJSONRequest(request)); 58 var response = safeEval(dcp.processDebugJSONRequest(request));
56 if (success) { 59 if (success) {
57 assertTrue(response.success, request + ' -> ' + response.message); 60 assertTrue(response.success, request + ' -> ' + response.message);
58 assertTrue(response.running, request + ' -> expected running'); 61 assertTrue(response.running, request + ' -> expected running');
59 } else { 62 } else {
60 assertFalse(response.success, request + ' -> ' + response.message); 63 assertFalse(response.success, request + ' -> ' + response.message);
61 assertFalse(response.running, request + ' -> expected not running'); 64 assertFalse(response.running, request + ' -> expected not running');
62 } 65 }
63 } 66 }
64 67
65 function listener(event, exec_state, event_data, data) { 68 function listener(event, exec_state, event_data, data) {
66 try { 69 try {
67 if (event == Debug.DebugEvent.Break) { 70 if (event == Debug.DebugEvent.Break) {
68 // Get the debug command processor.
69 var dcp = exec_state.debugCommandProcessor();
70 71
71 // Test simple continue request. 72 // Test simple continue request.
72 testArguments(dcp, void 0, true); 73 testArguments(exec_state, void 0, true);
73 74
74 // Test some illegal continue requests. 75 // Test some illegal continue requests.
75 testArguments(dcp, '{"stepaction":"maybe"}', false); 76 testArguments(exec_state, '{"stepaction":"maybe"}', false);
76 testArguments(dcp, '{"stepcount":-1}', false); 77 testArguments(exec_state, '{"stepcount":-1}', false);
77 78
78 // Test some legal continue requests. 79 // Test some legal continue requests.
79 testArguments(dcp, '{"stepaction":"in"}', true); 80 testArguments(exec_state, '{"stepaction":"in"}', true);
80 testArguments(dcp, '{"stepaction":"min"}', true); 81 testArguments(exec_state, '{"stepaction":"min"}', true);
81 testArguments(dcp, '{"stepaction":"next"}', true); 82 testArguments(exec_state, '{"stepaction":"next"}', true);
82 testArguments(dcp, '{"stepaction":"out"}', true); 83 testArguments(exec_state, '{"stepaction":"out"}', true);
83 testArguments(dcp, '{"stepcount":1}', true); 84 testArguments(exec_state, '{"stepcount":1}', true);
84 testArguments(dcp, '{"stepcount":10}', true); 85 testArguments(exec_state, '{"stepcount":10}', true);
85 testArguments(dcp, '{"stepcount":"10"}', true); 86 testArguments(exec_state, '{"stepcount":"10"}', true);
86 testArguments(dcp, '{"stepaction":"next","stepcount":10}', true); 87 testArguments(exec_state, '{"stepaction":"next","stepcount":10}', true);
87 88
88 // Indicate that all was processed. 89 // Indicate that all was processed.
89 listenerComplete = true; 90 listenerComplete = true;
90 } 91 }
91 } catch (e) { 92 } catch (e) {
92 exception = e 93 exception = e
93 }; 94 };
94 }; 95 };
95 96
96 // Add the debug event listener. 97 // Add the debug event listener.
97 Debug.setListener(listener); 98 Debug.setListener(listener);
98 99
99 function f() { 100 function f() {
100 a=1 101 a=1
101 }; 102 };
102 103
103 function g() { 104 function g() {
104 f(); 105 f();
105 }; 106 };
106 107
107 // Set a break point and call to invoke the debug event listener. 108 // Set a break point and call to invoke the debug event listener.
108 Debug.setBreakPoint(g, 0, 0); 109 Debug.setBreakPoint(g, 0, 0);
109 g(); 110 g();
110 111
112 assertFalse(exception, "exception in listener")
111 // Make sure that the debug event listener vas invoked. 113 // Make sure that the debug event listener vas invoked.
112 assertTrue(listenerComplete, "listener did not run to completion"); 114 assertTrue(listenerComplete, "listener did not run to completion");
113 assertFalse(exception, "exception in listener")
OLDNEW
« no previous file with comments | « test/mjsunit/debug-clearbreakpointgroup.js ('k') | test/mjsunit/debug-evaluate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698