Skip to content

Commit fe19b11

Browse files
hashseedCommit bot
authored andcommitted
[debugger] remove break point hit count and ignore count.
These features are not used by devtools and consequently not exposed through the devtools protocol. They make the debugger unnecessarily complex. If we decide that we need this, we should implement this on a higher layer. R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/1607193003 Cr-Commit-Position: refs/heads/master@{#33436}
1 parent 2e481c1 commit fe19b11

6 files changed

Lines changed: 0 additions & 272 deletions

File tree

src/debug/debug.js

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,8 @@ function BreakPoint(source_position, opt_script_break_point) {
147147
} else {
148148
this.number_ = next_break_point_number++;
149149
}
150-
this.hit_count_ = 0;
151150
this.active_ = true;
152151
this.condition_ = null;
153-
this.ignoreCount_ = 0;
154152
}
155153

156154

@@ -169,11 +167,6 @@ BreakPoint.prototype.source_position = function() {
169167
};
170168

171169

172-
BreakPoint.prototype.hit_count = function() {
173-
return this.hit_count_;
174-
};
175-
176-
177170
BreakPoint.prototype.active = function() {
178171
if (this.script_break_point()) {
179172
return this.script_break_point().active();
@@ -190,11 +183,6 @@ BreakPoint.prototype.condition = function() {
190183
};
191184

192185

193-
BreakPoint.prototype.ignoreCount = function() {
194-
return this.ignoreCount_;
195-
};
196-
197-
198186
BreakPoint.prototype.script_break_point = function() {
199187
return this.script_break_point_;
200188
};
@@ -215,11 +203,6 @@ BreakPoint.prototype.setCondition = function(condition) {
215203
};
216204

217205

218-
BreakPoint.prototype.setIgnoreCount = function(ignoreCount) {
219-
this.ignoreCount_ = ignoreCount;
220-
};
221-
222-
223206
BreakPoint.prototype.isTriggered = function(exec_state) {
224207
// Break point not active - not triggered.
225208
if (!this.active()) return false;
@@ -239,18 +222,6 @@ BreakPoint.prototype.isTriggered = function(exec_state) {
239222
}
240223
}
241224

242-
// Update the hit count.
243-
this.hit_count_++;
244-
if (this.script_break_point_) {
245-
this.script_break_point_.hit_count_++;
246-
}
247-
248-
// If the break point has an ignore count it is not triggered.
249-
if (this.ignoreCount_ > 0) {
250-
this.ignoreCount_--;
251-
return false;
252-
}
253-
254225
// Break point triggered.
255226
return true;
256227
};
@@ -283,10 +254,8 @@ function ScriptBreakPoint(type, script_id_or_name, opt_line, opt_column,
283254
this.groupId_ = opt_groupId;
284255
this.position_alignment_ = IS_UNDEFINED(opt_position_alignment)
285256
? Debug.BreakPositionAlignment.Statement : opt_position_alignment;
286-
this.hit_count_ = 0;
287257
this.active_ = true;
288258
this.condition_ = null;
289-
this.ignoreCount_ = 0;
290259
this.break_points_ = [];
291260
}
292261

@@ -299,10 +268,8 @@ ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) {
299268
copy.number_ = next_break_point_number++;
300269
script_break_points.push(copy);
301270

302-
copy.hit_count_ = this.hit_count_;
303271
copy.active_ = this.active_;
304272
copy.condition_ = this.condition_;
305-
copy.ignoreCount_ = this.ignoreCount_;
306273
return copy;
307274
};
308275

@@ -362,11 +329,6 @@ ScriptBreakPoint.prototype.update_positions = function(line, column) {
362329
};
363330

364331

365-
ScriptBreakPoint.prototype.hit_count = function() {
366-
return this.hit_count_;
367-
};
368-
369-
370332
ScriptBreakPoint.prototype.active = function() {
371333
return this.active_;
372334
};
@@ -377,11 +339,6 @@ ScriptBreakPoint.prototype.condition = function() {
377339
};
378340

379341

380-
ScriptBreakPoint.prototype.ignoreCount = function() {
381-
return this.ignoreCount_;
382-
};
383-
384-
385342
ScriptBreakPoint.prototype.enable = function() {
386343
this.active_ = true;
387344
};
@@ -397,16 +354,6 @@ ScriptBreakPoint.prototype.setCondition = function(condition) {
397354
};
398355

399356

400-
ScriptBreakPoint.prototype.setIgnoreCount = function(ignoreCount) {
401-
this.ignoreCount_ = ignoreCount;
402-
403-
// Set ignore count on all break points created from this script break point.
404-
for (var i = 0; i < this.break_points_.length; i++) {
405-
this.break_points_[i].setIgnoreCount(ignoreCount);
406-
}
407-
};
408-
409-
410357
// Check whether a script matches this script break point. Currently this is
411358
// only based on script name.
412359
ScriptBreakPoint.prototype.matchesScript = function(script) {
@@ -461,7 +408,6 @@ ScriptBreakPoint.prototype.set = function (script) {
461408

462409
// Create a break point object and set the break point.
463410
var break_point = MakeBreakPoint(position, this);
464-
break_point.setIgnoreCount(this.ignoreCount());
465411
var actual_position = %SetScriptBreakPoint(script, position,
466412
this.position_alignment_,
467413
break_point);
@@ -726,13 +672,6 @@ Debug.changeBreakPointCondition = function(break_point_number, condition) {
726672
};
727673

728674

729-
Debug.changeBreakPointIgnoreCount = function(break_point_number, ignoreCount) {
730-
if (ignoreCount < 0) throw MakeError(kDebugger, 'Invalid argument');
731-
var break_point = this.findBreakPoint(break_point_number, false);
732-
break_point.setIgnoreCount(ignoreCount);
733-
};
734-
735-
736675
Debug.clearBreakPoint = function(break_point_number) {
737676
var break_point = this.findBreakPoint(break_point_number, true);
738677
if (break_point) {
@@ -857,14 +796,6 @@ Debug.changeScriptBreakPointCondition = function(
857796
};
858797

859798

860-
Debug.changeScriptBreakPointIgnoreCount = function(
861-
break_point_number, ignoreCount) {
862-
if (ignoreCount < 0) throw MakeError(kDebugger, 'Invalid argument');
863-
var script_break_point = this.findScriptBreakPoint(break_point_number, false);
864-
script_break_point.setIgnoreCount(ignoreCount);
865-
};
866-
867-
868799
Debug.scriptBreakPoints = function() {
869800
return script_break_points;
870801
};
@@ -1503,7 +1434,6 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
15031434
var enabled = IS_UNDEFINED(request.arguments.enabled) ?
15041435
true : request.arguments.enabled;
15051436
var condition = request.arguments.condition;
1506-
var ignoreCount = request.arguments.ignoreCount;
15071437
var groupId = request.arguments.groupId;
15081438

15091439
// Check for legal arguments.
@@ -1569,9 +1499,6 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
15691499

15701500
// Set additional break point properties.
15711501
var break_point = Debug.findBreakPoint(break_point_number);
1572-
if (ignoreCount) {
1573-
Debug.changeBreakPointIgnoreCount(break_point_number, ignoreCount);
1574-
}
15751502
if (!enabled) {
15761503
Debug.disableBreakPoint(break_point_number);
15771504
}
@@ -1617,7 +1544,6 @@ DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(
16171544
var break_point = TO_NUMBER(request.arguments.breakpoint);
16181545
var enabled = request.arguments.enabled;
16191546
var condition = request.arguments.condition;
1620-
var ignoreCount = request.arguments.ignoreCount;
16211547

16221548
// Check for legal arguments.
16231549
if (!break_point) {
@@ -1638,11 +1564,6 @@ DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(
16381564
if (!IS_UNDEFINED(condition)) {
16391565
Debug.changeBreakPointCondition(break_point, condition);
16401566
}
1641-
1642-
// Change ignore count if supplied
1643-
if (!IS_UNDEFINED(ignoreCount)) {
1644-
Debug.changeBreakPointIgnoreCount(break_point, ignoreCount);
1645-
}
16461567
};
16471568

16481569

@@ -1717,10 +1638,8 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(
17171638
line: break_point.line(),
17181639
column: break_point.column(),
17191640
groupId: break_point.groupId(),
1720-
hit_count: break_point.hit_count(),
17211641
active: break_point.active(),
17221642
condition: break_point.condition(),
1723-
ignoreCount: break_point.ignoreCount(),
17241643
actual_locations: break_point.actual_locations()
17251644
};
17261645

test/cctest/test-debug.cc

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,6 @@ static void ChangeScriptBreakPointConditionFromJS(v8::Isolate* isolate,
302302
}
303303

304304

305-
static void ChangeScriptBreakPointIgnoreCountFromJS(v8::Isolate* isolate,
306-
int break_point_number,
307-
int ignoreCount) {
308-
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
309-
SNPrintF(buffer,
310-
"debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)",
311-
break_point_number, ignoreCount);
312-
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
313-
CompileRunChecked(isolate, buffer.start());
314-
}
315-
316-
317305
// Change break on exception.
318306
static void ChangeBreakOnException(bool caught, bool uncaught) {
319307
v8::internal::Debug* debug = CcTest::i_isolate()->debug();
@@ -1717,72 +1705,6 @@ TEST(ConditionalScriptBreakPoint) {
17171705
}
17181706

17191707

1720-
// Test ignore count on script break points.
1721-
TEST(ScriptBreakPointIgnoreCount) {
1722-
break_point_hit_count = 0;
1723-
DebugLocalContext env;
1724-
v8::HandleScope scope(env->GetIsolate());
1725-
env.ExposeDebug();
1726-
1727-
v8::Debug::SetDebugEventListener(env->GetIsolate(),
1728-
DebugEventBreakPointHitCount);
1729-
1730-
v8::Local<v8::String> script = v8_str(env->GetIsolate(),
1731-
"function f() {\n"
1732-
" a = 0; // line 1\n"
1733-
"};");
1734-
1735-
// Compile the script and get function f.
1736-
v8::Local<v8::Context> context = env.context();
1737-
v8::ScriptOrigin origin = v8::ScriptOrigin(v8_str(env->GetIsolate(), "test"));
1738-
v8::Script::Compile(context, script, &origin)
1739-
.ToLocalChecked()
1740-
->Run(context)
1741-
.ToLocalChecked();
1742-
v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
1743-
env->Global()
1744-
->Get(context, v8_str(env->GetIsolate(), "f"))
1745-
.ToLocalChecked());
1746-
1747-
// Set script break point on line 1 (in function f).
1748-
int sbp = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 1, 0);
1749-
1750-
// Call f with different ignores on the script break point.
1751-
break_point_hit_count = 0;
1752-
ChangeScriptBreakPointIgnoreCountFromJS(env->GetIsolate(), sbp, 1);
1753-
f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
1754-
CHECK_EQ(0, break_point_hit_count);
1755-
f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
1756-
CHECK_EQ(1, break_point_hit_count);
1757-
1758-
ChangeScriptBreakPointIgnoreCountFromJS(env->GetIsolate(), sbp, 5);
1759-
break_point_hit_count = 0;
1760-
for (int i = 0; i < 10; i++) {
1761-
f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
1762-
}
1763-
CHECK_EQ(5, break_point_hit_count);
1764-
1765-
// Reload the script and get f again checking that the ignore survives.
1766-
v8::Script::Compile(context, script, &origin)
1767-
.ToLocalChecked()
1768-
->Run(context)
1769-
.ToLocalChecked();
1770-
f = v8::Local<v8::Function>::Cast(
1771-
env->Global()
1772-
->Get(context, v8_str(env->GetIsolate(), "f"))
1773-
.ToLocalChecked());
1774-
1775-
break_point_hit_count = 0;
1776-
for (int i = 0; i < 10; i++) {
1777-
f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
1778-
}
1779-
CHECK_EQ(5, break_point_hit_count);
1780-
1781-
v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
1782-
CheckDebuggerUnloaded(env->GetIsolate());
1783-
}
1784-
1785-
17861708
// Test that script break points survive when a script is reloaded.
17871709
TEST(ScriptBreakPointReload) {
17881710
break_point_hit_count = 0;

test/mjsunit/debug-changebreakpoint.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ function listener(event, exec_state, event_data, data) {
7979
testArguments(dcp, '{' + bp_str + ',"enabled":"false"}', true);
8080
testArguments(dcp, '{' + bp_str + ',"condition":"1==2"}', true);
8181
testArguments(dcp, '{' + bp_str + ',"condition":"false"}', true);
82-
testArguments(dcp, '{' + bp_str + ',"ignoreCount":7}', true);
83-
testArguments(dcp, '{' + bp_str + ',"ignoreCount":0}', true);
84-
testArguments(
85-
dcp,
86-
'{' + bp_str + ',"enabled":"true","condition":"false","ignoreCount":0}',
87-
true);
8882

8983
// Indicate that all was processed.
9084
listenerComplete = true;

0 commit comments

Comments
 (0)