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

Side by Side Diff: runtime/vm/debugger.cc

Issue 10698051: Fix Dart_RemoveBreakpoint (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/debugger.h" 5 #include "vm/debugger.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/code_patcher.h" 8 #include "vm/code_patcher.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 ASSERT(src_breakpoints_ != NULL); 1454 ASSERT(src_breakpoints_ != NULL);
1455 SourceBreakpoint* prev_bpt = NULL; 1455 SourceBreakpoint* prev_bpt = NULL;
1456 SourceBreakpoint* curr_bpt = src_breakpoints_; 1456 SourceBreakpoint* curr_bpt = src_breakpoints_;
1457 while (curr_bpt != NULL) { 1457 while (curr_bpt != NULL) {
1458 if (curr_bpt->id() == bp_id) { 1458 if (curr_bpt->id() == bp_id) {
1459 if (prev_bpt == NULL) { 1459 if (prev_bpt == NULL) {
1460 src_breakpoints_ = src_breakpoints_->next(); 1460 src_breakpoints_ = src_breakpoints_->next();
1461 } else { 1461 } else {
1462 prev_bpt->set_next(curr_bpt->next()); 1462 prev_bpt->set_next(curr_bpt->next());
1463 } 1463 }
1464 // Remove references from code breakpoints to this source breakpoint. 1464 // Remove references from code breakpoints to this source breakpoint,
1465 // and disable the code breakpoints.
1465 UnlinkCodeBreakpoints(curr_bpt); 1466 UnlinkCodeBreakpoints(curr_bpt);
1466 delete curr_bpt; 1467 delete curr_bpt;
1467 return; 1468 return;
1468 } 1469 }
1469 prev_bpt = curr_bpt; 1470 prev_bpt = curr_bpt;
1470 curr_bpt = curr_bpt->next(); 1471 curr_bpt = curr_bpt->next();
1471 } 1472 }
1472 // bpt is not a registered breakpoint, nothing to do. 1473 // bpt is not a registered breakpoint, nothing to do.
1473 } 1474 }
1474 1475
1475 1476
1476 // Turn code breakpoints associated with the given source breakpoint into 1477 // Turn code breakpoints associated with the given source breakpoint into
1477 // internal breakpoints. They will later be deleted when control 1478 // internal breakpoints. They will later be deleted when control
1478 // returns from the user-defined breakpoint callback. 1479 // returns from the user-defined breakpoint callback. Also, disable the
1479 // Breakpoints can only be deleted by the user when we are stopped 1480 // breakpoint so it no longer fires if it should be hit before it gets
1480 // at another breakpoint, so we are guaranteed to remove the unlinked 1481 // deleted.
1481 // code breakpoints when returning from the handler.
1482 void Debugger::UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt) { 1482 void Debugger::UnlinkCodeBreakpoints(SourceBreakpoint* src_bpt) {
1483 ASSERT(src_bpt != NULL); 1483 ASSERT(src_bpt != NULL);
1484 CodeBreakpoint* curr_bpt = code_breakpoints_; 1484 CodeBreakpoint* curr_bpt = code_breakpoints_;
1485 while (curr_bpt != NULL) { 1485 while (curr_bpt != NULL) {
1486 if (curr_bpt->src_bpt() == src_bpt) { 1486 if (curr_bpt->src_bpt() == src_bpt) {
1487 curr_bpt->Disable();
1487 curr_bpt->set_src_bpt(NULL); 1488 curr_bpt->set_src_bpt(NULL);
1488 } 1489 }
1489 curr_bpt = curr_bpt->next(); 1490 curr_bpt = curr_bpt->next();
1490 } 1491 }
1491 } 1492 }
1492 1493
1493 1494
1494 // Remove and delete internal breakpoints, i.e. breakpoints that 1495 // Remove and delete internal breakpoints, i.e. breakpoints that
1495 // are not associated with a source breakpoint. 1496 // are not associated with a source breakpoint.
1496 void Debugger::RemoveInternalBreakpoints() { 1497 void Debugger::RemoveInternalBreakpoints() {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 } 1549 }
1549 1550
1550 1551
1551 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 1552 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
1552 ASSERT(bpt->next() == NULL); 1553 ASSERT(bpt->next() == NULL);
1553 bpt->set_next(code_breakpoints_); 1554 bpt->set_next(code_breakpoints_);
1554 code_breakpoints_ = bpt; 1555 code_breakpoints_ = bpt;
1555 } 1556 }
1556 1557
1557 } // namespace dart 1558 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698