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

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

Issue 872643008: Fix bug in processing of latent breakpoints (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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 | tests/standalone/debugger/deferred_code_test.dart » ('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 (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 "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 } 2394 }
2395 Library& lib = Library::Handle(isolate_); 2395 Library& lib = Library::Handle(isolate_);
2396 Script& script = Script::Handle(isolate_); 2396 Script& script = Script::Handle(isolate_);
2397 String& url = String::Handle(isolate_); 2397 String& url = String::Handle(isolate_);
2398 SourceBreakpoint* bpt = latent_breakpoints_; 2398 SourceBreakpoint* bpt = latent_breakpoints_;
2399 SourceBreakpoint* prev_bpt = NULL; 2399 SourceBreakpoint* prev_bpt = NULL;
2400 const GrowableObjectArray& libs = 2400 const GrowableObjectArray& libs =
2401 GrowableObjectArray::Handle(isolate_->object_store()->libraries()); 2401 GrowableObjectArray::Handle(isolate_->object_store()->libraries());
2402 while (bpt != NULL) { 2402 while (bpt != NULL) {
2403 url = bpt->url(); 2403 url = bpt->url();
2404 bool found_match = false;
2404 for (intptr_t i = 0; i < libs.Length(); i++) { 2405 for (intptr_t i = 0; i < libs.Length(); i++) {
2405 lib ^= libs.At(i); 2406 lib ^= libs.At(i);
2406 script = lib.LookupScript(url); 2407 script = lib.LookupScript(url);
2407 if (!script.IsNull()) { 2408 if (!script.IsNull()) {
2408 // Found a script with matching url for this latent breakpoint. 2409 // Found a script with matching url for this latent breakpoint.
2409 // Unlink the latent breakpoint from the list. 2410 // Unlink the latent breakpoint from the list.
2411 found_match = true;
2410 SourceBreakpoint* matched_bpt = bpt; 2412 SourceBreakpoint* matched_bpt = bpt;
2411 bpt = bpt->next(); 2413 bpt = bpt->next();
2412 if (prev_bpt == NULL) { 2414 if (prev_bpt == NULL) {
2413 latent_breakpoints_ = bpt; 2415 latent_breakpoints_ = bpt;
2414 } else { 2416 } else {
2415 prev_bpt->set_next(bpt); 2417 prev_bpt->set_next(bpt);
2416 } 2418 }
2417 // Now find the token range at the requested line and make a 2419 // Now find the token range at the requested line and make a
2418 // new unresolved source breakpoint. 2420 // new unresolved source breakpoint.
2419 intptr_t line_number = matched_bpt->LineNumber(); 2421 intptr_t line_number = matched_bpt->LineNumber();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 // TODO(hausner): There is one possible pitfall here. 2466 // TODO(hausner): There is one possible pitfall here.
2465 // If the user sets a latent breakpoint using a partial url that 2467 // If the user sets a latent breakpoint using a partial url that
2466 // ends up matching more than one script, the breakpoint might 2468 // ends up matching more than one script, the breakpoint might
2467 // get set in the wrong script. 2469 // get set in the wrong script.
2468 // It would be better if we could warn the user if multiple 2470 // It would be better if we could warn the user if multiple
2469 // scripts are matching. 2471 // scripts are matching.
2470 break; 2472 break;
2471 } 2473 }
2472 } 2474 }
2473 } 2475 }
2476 if (!found_match) {
2477 // No matching url found in any of the libraries.
2478 if (FLAG_verbose_debug) {
2479 OS::Print("No match found for latent breakpoint id "
2480 "%" Pd " with url '%s'\n",
2481 bpt->id(),
2482 url.ToCString());
2483 }
2484 bpt = bpt->next();
2485 }
2474 } 2486 }
2475 } 2487 }
2476 2488
2477 2489
2478 // TODO(hausner): Could potentially make this faster by checking 2490 // TODO(hausner): Could potentially make this faster by checking
2479 // whether the call target at pc is a debugger stub. 2491 // whether the call target at pc is a debugger stub.
2480 bool Debugger::HasActiveBreakpoint(uword pc) { 2492 bool Debugger::HasActiveBreakpoint(uword pc) {
2481 CodeBreakpoint* bpt = GetCodeBreakpoint(pc); 2493 CodeBreakpoint* bpt = GetCodeBreakpoint(pc);
2482 return (bpt != NULL) && (bpt->IsEnabled()); 2494 return (bpt != NULL) && (bpt->IsEnabled());
2483 } 2495 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 } 2643 }
2632 2644
2633 2645
2634 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2646 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2635 ASSERT(bpt->next() == NULL); 2647 ASSERT(bpt->next() == NULL);
2636 bpt->set_next(code_breakpoints_); 2648 bpt->set_next(code_breakpoints_);
2637 code_breakpoints_ = bpt; 2649 code_breakpoints_ = bpt;
2638 } 2650 }
2639 2651
2640 } // namespace dart 2652 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/debugger/deferred_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698