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

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

Issue 2366463002: Fix stepping over await statements (Closed)
Patch Set: Merge branch 'master' into deb Created 4 years, 2 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
« no previous file with comments | « runtime/observatory/tests/service/step_over_await_test.dart ('k') | 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 "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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 bpt->SetIsSingleShot(); 364 bpt->SetIsSingleShot();
365 AddBreakpoint(bpt, dbg); 365 AddBreakpoint(bpt, dbg);
366 } 366 }
367 return bpt; 367 return bpt;
368 } 368 }
369 369
370 370
371 Breakpoint* BreakpointLocation::AddPerClosure(Debugger* dbg, 371 Breakpoint* BreakpointLocation::AddPerClosure(Debugger* dbg,
372 const Instance& closure, 372 const Instance& closure,
373 bool for_over_await) { 373 bool for_over_await) {
374 Breakpoint* bpt = breakpoints(); 374 Breakpoint* bpt = NULL;
375 while (bpt != NULL) { 375 // Do not reuse existing breakpoints for stepping over await clauses.
376 if (bpt->IsPerClosure() && bpt->closure() == closure.raw()) break; 376 // A second async step-over command will set a new breakpoint before
377 bpt = bpt->next(); 377 // the existing one gets deleted when first async step-over resumes.
378 if (!for_over_await) {
379 bpt = breakpoints();
380 while (bpt != NULL) {
381 if (bpt->IsPerClosure() && (bpt->closure() == closure.raw())) break;
382 bpt = bpt->next();
383 }
378 } 384 }
379 if (bpt == NULL) { 385 if (bpt == NULL) {
380 bpt = new Breakpoint(dbg->nextId(), this); 386 bpt = new Breakpoint(dbg->nextId(), this);
381 bpt->SetIsPerClosure(closure); 387 bpt->SetIsPerClosure(closure);
382 bpt->set_is_synthetic_async(for_over_await); 388 bpt->set_is_synthetic_async(for_over_await);
383 AddBreakpoint(bpt, dbg); 389 AddBreakpoint(bpt, dbg);
384 } 390 }
385 return bpt; 391 return bpt;
386 } 392 }
387 393
(...skipping 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after
3326 3332
3327 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 3333 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
3328 ASSERT(bpt->next() == NULL); 3334 ASSERT(bpt->next() == NULL);
3329 bpt->set_next(code_breakpoints_); 3335 bpt->set_next(code_breakpoints_);
3330 code_breakpoints_ = bpt; 3336 code_breakpoints_ = bpt;
3331 } 3337 }
3332 3338
3333 #endif // !PRODUCT 3339 #endif // !PRODUCT
3334 3340
3335 } // namespace dart 3341 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/step_over_await_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698