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

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

Issue 2799037: Provide actual breakpoints locations in response to setBreakpoint and listBreakpoints requests. (Closed)
Patch Set: Created 10 years, 5 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
« src/debug-debugger.js ('K') | « src/runtime.cc ('k') | no next file » | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (success) { 56 if (success) {
57 assertTrue(response.success, request + ' -> ' + json_response); 57 assertTrue(response.success, request + ' -> ' + json_response);
58 if (is_script) { 58 if (is_script) {
59 assertEquals('scriptName', response.body.type, request + ' -> ' + json_res ponse); 59 assertEquals('scriptName', response.body.type, request + ' -> ' + json_res ponse);
60 } else { 60 } else {
61 assertEquals('scriptId', response.body.type, request + ' -> ' + json_respo nse); 61 assertEquals('scriptId', response.body.type, request + ' -> ' + json_respo nse);
62 } 62 }
63 } else { 63 } else {
64 assertFalse(response.success, request + ' -> ' + json_response); 64 assertFalse(response.success, request + ' -> ' + json_response);
65 } 65 }
66 return response;
66 } 67 }
67 68
68 function listener(event, exec_state, event_data, data) { 69 function listener(event, exec_state, event_data, data) {
69 try { 70 try {
70 if (event == Debug.DebugEvent.Break) { 71 if (event == Debug.DebugEvent.Break) {
71 // Get the debug command processor. 72 // Get the debug command processor.
72 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); 73 var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
73 74
74 // Test some illegal setbreakpoint requests. 75 // Test some illegal setbreakpoint requests.
75 var request = '{' + base_request + '}' 76 var request = '{' + base_request + '}'
76 var response = safeEval(dcp.processDebugJSONRequest(request)); 77 var response = safeEval(dcp.processDebugJSONRequest(request));
77 assertFalse(response.success); 78 assertFalse(response.success);
78 79
79 var mirror; 80 var mirror;
80 81
81 testArguments(dcp, '{}', false); 82 testArguments(dcp, '{}', false);
82 testArguments(dcp, '{"type":"xx"}', false); 83 testArguments(dcp, '{"type":"xx"}', false);
83 testArguments(dcp, '{"type":"function"}', false); 84 testArguments(dcp, '{"type":"function"}', false);
84 testArguments(dcp, '{"type":"script"}', false); 85 testArguments(dcp, '{"type":"script"}', false);
85 testArguments(dcp, '{"target":"f"}', false); 86 testArguments(dcp, '{"target":"f"}', false);
86 testArguments(dcp, '{"type":"xx","target":"xx"}', false); 87 testArguments(dcp, '{"type":"xx","target":"xx"}', false);
87 testArguments(dcp, '{"type":"function","target":1}', false); 88 testArguments(dcp, '{"type":"function","target":1}', false);
88 testArguments(dcp, '{"type":"function","target":"f","line":-1}', false); 89 testArguments(dcp, '{"type":"function","target":"f","line":-1}', false);
(...skipping 22 matching lines...) Expand all
111 testArguments(dcp, '{"type":"scriptId","target":' + g_script_id + ',"line":' + g_line + '}', true, false); 112 testArguments(dcp, '{"type":"scriptId","target":' + g_script_id + ',"line":' + g_line + '}', true, false);
112 testArguments(dcp, '{"type":"scriptId","target":' + h_script_id + ',"line":' + h_line + '}', true, false); 113 testArguments(dcp, '{"type":"scriptId","target":' + h_script_id + ',"line":' + h_line + '}', true, false);
113 114
114 mirror = debug.MakeMirror(f); 115 mirror = debug.MakeMirror(f);
115 testArguments(dcp, '{"type":"handle","target":' + mirror.handle() + '}', tru e, false); 116 testArguments(dcp, '{"type":"handle","target":' + mirror.handle() + '}', tru e, false);
116 mirror = debug.MakeMirror(o.a); 117 mirror = debug.MakeMirror(o.a);
117 testArguments(dcp, '{"type":"handle","target":' + mirror.handle() + '}', tru e, false); 118 testArguments(dcp, '{"type":"handle","target":' + mirror.handle() + '}', tru e, false);
118 119
119 testArguments(dcp, '{"type":"script","target":"sourceUrlScript","line":0}', true, true); 120 testArguments(dcp, '{"type":"script","target":"sourceUrlScript","line":0}', true, true);
120 121
122 // Set a break point on a line with the comment, and check that actual posit ion
123 // is the next line after the comment.
124 request = '{"type":"scriptId","target":' + g_script_id + ',"line":' + (g_lin e + 1) + '}';
125 response = testArguments(dcp, request, true, false);
126 assertEquals(g_line + 2, response.body.actual_locations[0].line);
127
121 // Indicate that all was processed. 128 // Indicate that all was processed.
122 listenerComplete = true; 129 listenerComplete = true;
123 } 130 }
124 } catch (e) { 131 } catch (e) {
125 exception = e 132 exception = e
126 }; 133 };
127 }; 134 };
128 135
129 // Add the debug event listener. 136 // Add the debug event listener.
130 Debug.setListener(listener); 137 Debug.setListener(listener);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 function breakListener(event) { 185 function breakListener(event) {
179 if (event == Debug.DebugEvent.Break) 186 if (event == Debug.DebugEvent.Break)
180 breakListenerCalled = true; 187 breakListenerCalled = true;
181 } 188 }
182 189
183 Debug.setListener(breakListener); 190 Debug.setListener(breakListener);
184 191
185 sourceUrlFunc(); 192 sourceUrlFunc();
186 193
187 assertTrue(breakListenerCalled, "Break listener not called on breakpoint set by sourceURL"); 194 assertTrue(breakListenerCalled, "Break listener not called on breakpoint set by sourceURL");
188
189 // Set a break point on a line with the comment, and check that actual position
190 // is the next line after the comment.
191 var number = Debug.setScriptBreakPointById(g_script_id, g_line + 1);
192 assertEquals(g_line + 2, Debug.findBreakPoint(number).actual_location.line);
OLDNEW
« src/debug-debugger.js ('K') | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698