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

Unified Diff: src/debug/debug.cc

Issue 2221333002: [debugger] reapply break points after clearing one shots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug/debug.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 4556206e5bfa4d4feddaa1b6e558179668036a0e..43ce183aa4a86fcce18ca2dcfbbb91ba22f95d07 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -336,6 +336,13 @@ void BreakLocation::ClearBreakPoint(Handle<Object> break_point_object) {
}
}
+void BreakLocation::ReapplyBreakPoint() {
+ // We indeed have a break point here to re-apply.
+ DCHECK(HasBreakPoint());
+ // The break point is currently not applied to code.
+ DCHECK(!IsDebugBreak());
+ SetDebugBreak();
+}
void BreakLocation::SetOneShot() {
// Debugger statement always calls debugger. No need to modify it.
@@ -356,12 +363,6 @@ void BreakLocation::ClearOneShot() {
// Debugger statement always calls debugger. No need to modify it.
if (IsDebuggerStatement()) return;
- // If there is a real break point here no more to do.
- if (HasBreakPoint()) {
- DCHECK(IsDebugBreak());
- return;
- }
-
// Patch code removing debug break.
ClearDebugBreak();
DCHECK(!IsDebugBreak());
@@ -1127,13 +1128,28 @@ void Debug::ClearOneShot() {
// The current implementation just runs through all the breakpoints. When the
// last break point for a function is removed that function is automatically
// removed from the list.
+ DisallowHeapAllocation no_gc;
for (DebugInfoListNode* node = debug_info_list_; node != NULL;
node = node->next()) {
+ Handle<DebugInfo> debug_info = node->debug_info();
for (std::unique_ptr<BreakLocation::Iterator> it(
- BreakLocation::GetIterator(node->debug_info()));
+ BreakLocation::GetIterator(debug_info));
!it->Done(); it->Next()) {
it->GetBreakLocation().ClearOneShot();
}
+ // Re-apply break points after having cleared everything.
+ if (debug_info->break_points()->IsUndefined(isolate_)) continue;
+ FixedArray* break_points = debug_info->break_points();
+ for (int i = 0; i < break_points->length(); i++) {
+ if (break_points->get(i)->IsUndefined(isolate_)) continue;
+ BreakPointInfo* break_point_info =
+ BreakPointInfo::cast(break_points->get(i));
+ if (break_point_info->GetBreakPointCount() == 0) continue;
+ BreakLocation break_location = BreakLocation::FromPosition(
+ debug_info, break_point_info->source_position(),
+ BREAK_POSITION_ALIGNED);
+ break_location.ReapplyBreakPoint();
+ }
}
}
« no previous file with comments | « src/debug/debug.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698