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

Side by Side Diff: test/debugger/debug/debug-breakpoints.js

Issue 2497973002: [debug-wrapper] Further extend the debug wrapper (Closed)
Patch Set: Address comments Created 4 years, 1 month 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/debugger/debug/debug-break-native.js ('k') | test/debugger/debug/debug-compile-event.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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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
29 // Get the Debug object exposed from the debug context global object.
30 Debug = debug.Debug 28 Debug = debug.Debug
31 29
32 Debug.setListener(function() {}); 30 Debug.setListener(function() {});
33 31
34 function f() {a=1;b=2} 32 function f() {a=1;b=2}
35 function g() { 33 function g() {
36 a=1; 34 a=1;
37 b=2; 35 b=2;
38 } 36 }
39 37
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // b=2; 111 // b=2;
114 // }[B0] 112 // }[B0]
115 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]}") > 0); 113 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]}") > 0);
116 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0); 114 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0);
117 Debug.clearBreakPoint(bp3); 115 Debug.clearBreakPoint(bp3);
118 // function g() { 116 // function g() {
119 // a=1; 117 // a=1;
120 // b=2; 118 // b=2;
121 // } 119 // }
122 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); 120 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0);
123
124
125 // Tests for setting break points by script id and position.
126 function setBreakpointByPosition(f, position, opt_position_alignment)
127 {
128 var break_point = Debug.setBreakPointByScriptIdAndPosition(
129 Debug.findScript(f).id,
130 position + Debug.sourcePosition(f),
131 "",
132 true, opt_position_alignment);
133 return break_point.number();
134 }
135
136 bp = setBreakpointByPosition(f, 0);
137 assertEquals("() {[B0]a=1;b=2}", Debug.showBreakPoints(f));
138 Debug.clearBreakPoint(bp);
139 assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f));
140 bp1 = setBreakpointByPosition(f, 8);
141 assertEquals("() {a=1;[B0]b=2}", Debug.showBreakPoints(f));
142 bp2 = setBreakpointByPosition(f, 4);
143 assertEquals("() {[B0]a=1;[B1]b=2}", Debug.showBreakPoints(f));
144 bp3 = setBreakpointByPosition(f, 11);
145 assertEquals("() {[B0]a=1;[B1]b=2[B2]}", Debug.showBreakPoints(f));
146 Debug.clearBreakPoint(bp1);
147 assertEquals("() {[B0]a=1;b=2[B1]}", Debug.showBreakPoints(f));
148 Debug.clearBreakPoint(bp2);
149 assertEquals("() {a=1;b=2[B0]}", Debug.showBreakPoints(f));
150 Debug.clearBreakPoint(bp3);
151 assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f));
152
153 bp = setBreakpointByPosition(g, 0);
154 //function g() {
155 //[B0]a=1;
156 //b=2;
157 //}
158 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0);
159 Debug.clearBreakPoint(bp);
160 //function g() {
161 //a=1;
162 //b=2;
163 //}
164 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0);
165
166 //Second test set and clear breakpoints on lines 1, 2 and 3 (column = 0).
167 bp1 = setBreakpointByPosition(g, 12);
168 //function g() {
169 //a=1;
170 //[B0]b=2;
171 //}
172 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]b=2;") > 0);
173 bp2 = setBreakpointByPosition(g, 5);
174 //function g() {
175 //[B0]a=1;
176 //[B1]b=2;
177 //}
178 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0);
179 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]b=2;") > 0);
180 bp3 = setBreakpointByPosition(g, 19);
181 //function g() {
182 //[B0]a=1;
183 //[B1]b=2;
184 //}[B2]
185 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0);
186 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]b=2;") > 0);
187 assertTrue(Debug.showBreakPoints(g).indexOf("[B2]}") > 0);
188 Debug.clearBreakPoint(bp1);
189 //function g() {
190 //[B0]a=1;
191 //b=2;
192 //}[B1]
193 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0);
194 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]}") > 0);
195 assertTrue(Debug.showBreakPoints(g).indexOf("[B2]") < 0);
196 Debug.clearBreakPoint(bp2);
197 //function g() {
198 //a=1;
199 //b=2;
200 //}[B0]
201 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]}") > 0);
202 assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0);
203 Debug.clearBreakPoint(bp3);
204 //function g() {
205 //a=1;
206 //b=2;
207 //}
208 assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0);
209
210 // Tests for setting break points without statement aligment.
211 // (This may be sensitive to compiler break position map generation).
212 function h() {a=f(f2(1,2),f3())+f3();b=f3();}
213 var scenario = [
214 [6, "{a=[B0]f("],
215 [7, "{a=f([B0]f2("],
216 [16, "f2(1,2),[B0]f3()"],
217 [22, "+[B0]f3()"]
218 ];
219 for(var i = 0; i < scenario.length; i++) {
220 bp1 = setBreakpointByPosition(h, scenario[i][0],
221 Debug.BreakPositionAlignment.BreakPosition);
222 assertTrue(Debug.showBreakPoints(h, undefined,
223 Debug.BreakPositionAlignment.BreakPosition).indexOf(scenario[i][1]) > 0);
224 Debug.clearBreakPoint(bp1);
225 }
OLDNEW
« no previous file with comments | « test/debugger/debug/debug-break-native.js ('k') | test/debugger/debug/debug-compile-event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698