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

Side by Side Diff: test/mjsunit/debug-conditional-breakpoints.js

Issue 2883042: Breakpoint position should be inside function body. (Closed)
Patch Set: Created 10 years, 4 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
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 bp = Debug.setBreakPoint(h, 0, 0, 'x % 2 == 0'); 129 bp = Debug.setBreakPoint(h, 0, 0, 'x % 2 == 0');
130 for (var i = 0; i < 10; i++) { 130 for (var i = 0; i < 10; i++) {
131 g(); 131 g();
132 } 132 }
133 assertEquals(5, break_point_hit_count); 133 assertEquals(5, break_point_hit_count);
134 assertEquals(5, Debug.findBreakPoint(bp, false).hit_count()); 134 assertEquals(5, Debug.findBreakPoint(bp, false).hit_count());
135 Debug.clearBreakPoint(bp); 135 Debug.clearBreakPoint(bp);
136 136
137 // Conditional breakpoint which checks a local variable. 137 // Conditional breakpoint which checks a local variable.
138 break_point_hit_count = 0; 138 break_point_hit_count = 0;
139 bp = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0'); 139 bp = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
140 for (var i = 0; i < 10; i++) { 140 for (var i = 0; i < 10; i++) {
141 g(); 141 g();
142 } 142 }
143 assertEquals(5, break_point_hit_count); 143 assertEquals(5, break_point_hit_count);
144 assertEquals(5, Debug.findBreakPoint(bp, false).hit_count()); 144 assertEquals(5, Debug.findBreakPoint(bp, false).hit_count());
145 Debug.clearBreakPoint(bp); 145 Debug.clearBreakPoint(bp);
146 146
147 // Multiple conditional breakpoint which the same condition. 147 // Multiple conditional breakpoint which the same condition.
148 break_point_hit_count = 0; 148 break_point_hit_count = 0;
149 bp1 = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0'); 149 bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
150 bp2 = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0'); 150 bp2 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
151 for (var i = 0; i < 10; i++) { 151 for (var i = 0; i < 10; i++) {
152 g(); 152 g();
153 } 153 }
154 assertEquals(5, break_point_hit_count); 154 assertEquals(5, break_point_hit_count);
155 assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count()); 155 assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count());
156 assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count()); 156 assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count());
157 Debug.clearBreakPoint(bp1); 157 Debug.clearBreakPoint(bp1);
158 Debug.clearBreakPoint(bp2); 158 Debug.clearBreakPoint(bp2);
159 159
160 // Multiple conditional breakpoint which different conditions. 160 // Multiple conditional breakpoint which different conditions.
161 break_point_hit_count = 0; 161 break_point_hit_count = 0;
162 bp1 = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0'); 162 bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
163 bp2 = Debug.setBreakPoint(h, 0, 23, '(a + 1) % 2 == 0'); 163 bp2 = Debug.setBreakPoint(h, 0, 22, '(a + 1) % 2 == 0');
164 for (var i = 0; i < 10; i++) { 164 for (var i = 0; i < 10; i++) {
165 g(); 165 g();
166 } 166 }
167 assertEquals(10, break_point_hit_count); 167 assertEquals(10, break_point_hit_count);
168 assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count()); 168 assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count());
169 assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count()); 169 assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count());
170 Debug.clearBreakPoint(bp1); 170 Debug.clearBreakPoint(bp1);
171 Debug.clearBreakPoint(bp2); 171 Debug.clearBreakPoint(bp2);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698