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

Unified Diff: runtime/vm/debugger.cc

Issue 2869573002: Use latent breakpoints list when looking up or removing breakpoints. (Closed)
Patch Set: Created 3 years, 7 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
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 2bd07a4ba09af7f89d7ad6a6f8d5fb33a313a8b6..13ae822e549aa7d3e710410198f5cbe42de485fd 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -532,7 +532,13 @@ bool Debugger::HasBreakpoint(const Code& code) {
void Debugger::PrintBreakpointsToJSONArray(JSONArray* jsarr) const {
- BreakpointLocation* sbpt = breakpoint_locations_;
+ PrintBreakpointsListToJSONArray(breakpoint_locations_, jsarr);
+ PrintBreakpointsListToJSONArray(latent_locations_, jsarr);
+}
+
+
+void Debugger::PrintBreakpointsListToJSONArray(BreakpointLocation* sbpt,
+ JSONArray* jsarr) const {
while (sbpt != NULL) {
Breakpoint* bpt = sbpt->breakpoints();
while (bpt != NULL) {
@@ -1655,8 +1661,7 @@ void Debugger::Shutdown() {
}
-void Debugger::OnIsolateRunnable() {
-}
+void Debugger::OnIsolateRunnable() {}
static RawFunction* ResolveLibraryFunction(const Library& library,
@@ -4197,8 +4202,20 @@ RawCode* Debugger::GetPatchedStubAddress(uword breakpoint_address) {
// Remove and delete the source breakpoint bpt and its associated
// code breakpoints.
void Debugger::RemoveBreakpoint(intptr_t bp_id) {
+ if (RemoveBreakpointFromTheList(bp_id, &breakpoint_locations_)) {
+ return;
+ }
+ RemoveBreakpointFromTheList(bp_id, &latent_locations_);
+}
+
+
+// Remove and delete the source breakpoint bpt and its associated
+// code breakpoints. Returns true, if breakpoint was found and removed,
+// returns false, if breakpoint was not found.
+bool Debugger::RemoveBreakpointFromTheList(intptr_t bp_id,
+ BreakpointLocation** list) {
BreakpointLocation* prev_loc = NULL;
- BreakpointLocation* curr_loc = breakpoint_locations_;
+ BreakpointLocation* curr_loc = *list;
while (curr_loc != NULL) {
Breakpoint* prev_bpt = NULL;
Breakpoint* curr_bpt = curr_loc->breakpoints();
@@ -4230,7 +4247,7 @@ void Debugger::RemoveBreakpoint(intptr_t bp_id) {
// breakpoints at that location.
if (curr_loc->breakpoints() == NULL) {
if (prev_loc == NULL) {
- breakpoint_locations_ = curr_loc->next();
+ *list = curr_loc->next();
} else {
prev_loc->set_next(curr_loc->next());
}
@@ -4245,7 +4262,7 @@ void Debugger::RemoveBreakpoint(intptr_t bp_id) {
// The code breakpoints will be deleted when the VM resumes
// after the pause event.
- return;
+ return true;
}
prev_bpt = curr_bpt;
@@ -4255,6 +4272,7 @@ void Debugger::RemoveBreakpoint(intptr_t bp_id) {
curr_loc = curr_loc->next();
}
// breakpoint with bp_id does not exist, nothing to do.
+ return false;
}
@@ -4317,7 +4335,17 @@ BreakpointLocation* Debugger::GetBreakpointLocation(const Script& script,
Breakpoint* Debugger::GetBreakpointById(intptr_t id) {
- BreakpointLocation* loc = breakpoint_locations_;
+ Breakpoint* bpt = GetBreakpointByIdInTheList(id, breakpoint_locations_);
+ if (bpt != NULL) {
+ return bpt;
+ }
+ return GetBreakpointByIdInTheList(id, latent_locations_);
+}
+
+
+Breakpoint* Debugger::GetBreakpointByIdInTheList(intptr_t id,
+ BreakpointLocation* list) {
+ BreakpointLocation* loc = list;
while (loc != NULL) {
Breakpoint* bpt = loc->breakpoints();
while (bpt != NULL) {
« runtime/vm/debugger.h ('K') | « runtime/vm/debugger.h ('k') | runtime/vm/debugger_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698