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

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

Issue 1607193003: [debugger] remove break point hit count and ignore count. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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-changebreakpoint.js ('k') | test/mjsunit/debug-ignore-breakpoints.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 function f() {}; 46 function f() {};
47 function g() {h(count++)}; 47 function g() {h(count++)};
48 function h(x) {var a=x; return a}; 48 function h(x) {var a=x; return a};
49 49
50 50
51 // Conditional breakpoint which syntax error. 51 // Conditional breakpoint which syntax error.
52 break_point_hit_count = 0; 52 break_point_hit_count = 0;
53 bp = Debug.setBreakPoint(f, 0, 0, '{{{'); 53 bp = Debug.setBreakPoint(f, 0, 0, '{{{');
54 f(); 54 f();
55 assertEquals(0, break_point_hit_count); 55 assertEquals(0, break_point_hit_count);
56 assertEquals(0, Debug.findBreakPoint(bp, false).hit_count());
57 Debug.clearBreakPoint(bp); 56 Debug.clearBreakPoint(bp);
58 57
59 // Conditional breakpoint which evaluates to false. 58 // Conditional breakpoint which evaluates to false.
60 break_point_hit_count = 0; 59 break_point_hit_count = 0;
61 bp = Debug.setBreakPoint(f, 0, 0, 'false'); 60 bp = Debug.setBreakPoint(f, 0, 0, 'false');
62 f(); 61 f();
63 assertEquals(0, break_point_hit_count); 62 assertEquals(0, break_point_hit_count);
64 assertEquals(0, Debug.findBreakPoint(bp, false).hit_count());
65 Debug.clearBreakPoint(bp); 63 Debug.clearBreakPoint(bp);
66 64
67 // Conditional breakpoint which evaluates to true. 65 // Conditional breakpoint which evaluates to true.
68 break_point_hit_count = 0; 66 break_point_hit_count = 0;
69 bp = Debug.setBreakPoint(f, 0, 0, 'true'); 67 bp = Debug.setBreakPoint(f, 0, 0, 'true');
70 f(); 68 f();
71 assertEquals(1, break_point_hit_count); 69 assertEquals(1, break_point_hit_count);
72 assertEquals(1, Debug.findBreakPoint(bp, false).hit_count());
73 Debug.clearBreakPoint(bp); 70 Debug.clearBreakPoint(bp);
74 71
75 // Conditional breakpoint which different types of quotes. 72 // Conditional breakpoint which different types of quotes.
76 break_point_hit_count = 0; 73 break_point_hit_count = 0;
77 bp = Debug.setBreakPoint(f, 0, 0, '"a" == "a"'); 74 bp = Debug.setBreakPoint(f, 0, 0, '"a" == "a"');
78 f(); 75 f();
79 assertEquals(1, break_point_hit_count); 76 assertEquals(1, break_point_hit_count);
80 assertEquals(1, Debug.findBreakPoint(bp, false).hit_count());
81 Debug.clearBreakPoint(bp); 77 Debug.clearBreakPoint(bp);
82 break_point_hit_count = 0; 78 break_point_hit_count = 0;
83 bp = Debug.setBreakPoint(f, 0, 0, "'a' == 'a'"); 79 bp = Debug.setBreakPoint(f, 0, 0, "'a' == 'a'");
84 f(); 80 f();
85 assertEquals(1, break_point_hit_count); 81 assertEquals(1, break_point_hit_count);
86 assertEquals(1, Debug.findBreakPoint(bp, false).hit_count());
87 Debug.clearBreakPoint(bp); 82 Debug.clearBreakPoint(bp);
88 83
89 // Changing condition. 84 // Changing condition.
90 break_point_hit_count = 0; 85 break_point_hit_count = 0;
91 bp = Debug.setBreakPoint(f, 0, 0, '"ab".indexOf("b") > 0'); 86 bp = Debug.setBreakPoint(f, 0, 0, '"ab".indexOf("b") > 0');
92 f(); 87 f();
93 assertEquals(1, break_point_hit_count); 88 assertEquals(1, break_point_hit_count);
94 assertEquals(1, Debug.findBreakPoint(bp, false).hit_count());
95 Debug.changeBreakPointCondition(bp, 'Math.sin(Math.PI/2) > 1'); 89 Debug.changeBreakPointCondition(bp, 'Math.sin(Math.PI/2) > 1');
96 f(); 90 f();
97 assertEquals(1, break_point_hit_count); 91 assertEquals(1, break_point_hit_count);
98 assertEquals(1, Debug.findBreakPoint(bp, false).hit_count());
99 Debug.changeBreakPointCondition(bp, '1==1'); 92 Debug.changeBreakPointCondition(bp, '1==1');
100 f(); 93 f();
101 assertEquals(2, break_point_hit_count); 94 assertEquals(2, break_point_hit_count);
102 assertEquals(2, Debug.findBreakPoint(bp, false).hit_count());
103 Debug.clearBreakPoint(bp); 95 Debug.clearBreakPoint(bp);
104 96
105 // Conditional breakpoint which checks global variable. 97 // Conditional breakpoint which checks global variable.
106 break_point_hit_count = 0; 98 break_point_hit_count = 0;
107 bp = Debug.setBreakPoint(f, 0, 0, 'x==1'); 99 bp = Debug.setBreakPoint(f, 0, 0, 'x==1');
108 f(); 100 f();
109 assertEquals(0, break_point_hit_count); 101 assertEquals(0, break_point_hit_count);
110 assertEquals(0, Debug.findBreakPoint(bp, false).hit_count());
111 x=1; 102 x=1;
112 f(); 103 f();
113 assertEquals(1, break_point_hit_count); 104 assertEquals(1, break_point_hit_count);
114 assertEquals(1, Debug.findBreakPoint(bp, false).hit_count());
115 Debug.clearBreakPoint(bp); 105 Debug.clearBreakPoint(bp);
116 106
117 // Conditional breakpoint which checks global variable. 107 // Conditional breakpoint which checks global variable.
118 break_point_hit_count = 0; 108 break_point_hit_count = 0;
119 bp = Debug.setBreakPoint(g, 0, 0, 'count % 2 == 0'); 109 bp = Debug.setBreakPoint(g, 0, 0, 'count % 2 == 0');
120 for (var i = 0; i < 10; i++) { 110 for (var i = 0; i < 10; i++) {
121 g(); 111 g();
122 } 112 }
123 assertEquals(5, break_point_hit_count); 113 assertEquals(5, break_point_hit_count);
124 assertEquals(5, Debug.findBreakPoint(bp, false).hit_count());
125 Debug.clearBreakPoint(bp); 114 Debug.clearBreakPoint(bp);
126 115
127 // Conditional breakpoint which checks a parameter. 116 // Conditional breakpoint which checks a parameter.
128 break_point_hit_count = 0; 117 break_point_hit_count = 0;
129 bp = Debug.setBreakPoint(h, 0, 0, 'x % 2 == 0'); 118 bp = Debug.setBreakPoint(h, 0, 0, 'x % 2 == 0');
130 for (var i = 0; i < 10; i++) { 119 for (var i = 0; i < 10; i++) {
131 g(); 120 g();
132 } 121 }
133 assertEquals(5, break_point_hit_count); 122 assertEquals(5, break_point_hit_count);
134 assertEquals(5, Debug.findBreakPoint(bp, false).hit_count());
135 Debug.clearBreakPoint(bp); 123 Debug.clearBreakPoint(bp);
136 124
137 // Conditional breakpoint which checks a local variable. 125 // Conditional breakpoint which checks a local variable.
138 break_point_hit_count = 0; 126 break_point_hit_count = 0;
139 bp = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0'); 127 bp = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
140 for (var i = 0; i < 10; i++) { 128 for (var i = 0; i < 10; i++) {
141 g(); 129 g();
142 } 130 }
143 assertEquals(5, break_point_hit_count); 131 assertEquals(5, break_point_hit_count);
144 assertEquals(5, Debug.findBreakPoint(bp, false).hit_count());
145 Debug.clearBreakPoint(bp); 132 Debug.clearBreakPoint(bp);
146 133
147 // Multiple conditional breakpoint which the same condition. 134 // Multiple conditional breakpoint which the same condition.
148 break_point_hit_count = 0; 135 break_point_hit_count = 0;
149 bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0'); 136 bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
150 bp2 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0'); 137 bp2 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
151 for (var i = 0; i < 10; i++) { 138 for (var i = 0; i < 10; i++) {
152 g(); 139 g();
153 } 140 }
154 assertEquals(5, break_point_hit_count); 141 assertEquals(5, break_point_hit_count);
155 assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count());
156 assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count());
157 Debug.clearBreakPoint(bp1); 142 Debug.clearBreakPoint(bp1);
158 Debug.clearBreakPoint(bp2); 143 Debug.clearBreakPoint(bp2);
159 144
160 // Multiple conditional breakpoint which different conditions. 145 // Multiple conditional breakpoint which different conditions.
161 break_point_hit_count = 0; 146 break_point_hit_count = 0;
162 bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0'); 147 bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
163 bp2 = Debug.setBreakPoint(h, 0, 22, '(a + 1) % 2 == 0'); 148 bp2 = Debug.setBreakPoint(h, 0, 22, '(a + 1) % 2 == 0');
164 for (var i = 0; i < 10; i++) { 149 for (var i = 0; i < 10; i++) {
165 g(); 150 g();
166 } 151 }
167 assertEquals(10, break_point_hit_count); 152 assertEquals(10, break_point_hit_count);
168 assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count());
169 assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count());
170 Debug.clearBreakPoint(bp1); 153 Debug.clearBreakPoint(bp1);
171 Debug.clearBreakPoint(bp2); 154 Debug.clearBreakPoint(bp2);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-changebreakpoint.js ('k') | test/mjsunit/debug-ignore-breakpoints.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698