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

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

Issue 10645003: Do not collect stack trace unnecessarily (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 631 }
632 } 632 }
633 633
634 634
635 bool Debugger::IsActive() { 635 bool Debugger::IsActive() {
636 // TODO(hausner): The code generator uses this function to prevent 636 // TODO(hausner): The code generator uses this function to prevent
637 // generation of optimized code when Dart code is being debugged. 637 // generation of optimized code when Dart code is being debugged.
638 // This is probably not conservative enough (we could set the first 638 // This is probably not conservative enough (we could set the first
639 // breakpoint after optimized code has already been produced). 639 // breakpoint after optimized code has already been produced).
640 // Long-term, we need to be able to de-optimize code. 640 // Long-term, we need to be able to de-optimize code.
641 return (src_breakpoints_ != NULL) || (code_breakpoints_ != NULL); 641 return (src_breakpoints_ != NULL) ||
642 (code_breakpoints_ != NULL) ||
643 (exc_pause_info_ != kNoPauseOnExceptions);
642 } 644 }
643 645
644 646
645 static RawFunction* ResolveLibraryFunction( 647 static RawFunction* ResolveLibraryFunction(
646 const Library& library, 648 const Library& library,
647 const String& fname) { 649 const String& fname) {
648 ASSERT(!library.IsNull()); 650 ASSERT(!library.IsNull());
649 Function& function = Function::Handle(); 651 Function& function = Function::Handle();
650 const Object& object = Object::Handle(library.LookupObject(fname)); 652 const Object& object = Object::Handle(library.LookupObject(fname));
651 if (!object.IsNull() && object.IsFunction()) { 653 if (!object.IsNull() && object.IsFunction()) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 new ActivationFrame(frame->pc(), frame->fp(), frame->sp(), ctx); 749 new ActivationFrame(frame->pc(), frame->fp(), frame->sp(), ctx);
748 ctx = activation->CallerContext(); 750 ctx = activation->CallerContext();
749 stack_trace->AddActivation(activation); 751 stack_trace->AddActivation(activation);
750 frame = iterator.NextFrame(); 752 frame = iterator.NextFrame();
751 } 753 }
752 return stack_trace; 754 return stack_trace;
753 } 755 }
754 756
755 757
756 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) { 758 void Debugger::SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info) {
759 ASSERT((pause_info == kNoPauseOnExceptions) ||
760 (pause_info == kPauseOnUnhandledExceptions) ||
761 (pause_info == kPauseOnAllExceptions));
757 exc_pause_info_ = pause_info; 762 exc_pause_info_ = pause_info;
758 } 763 }
759 764
760 765
761 // TODO(hausner): Determine whether the exception is handled or not. 766 // TODO(hausner): Determine whether the exception is handled or not.
762 bool Debugger::ShouldPauseOnException(DebuggerStackTrace* stack_trace, 767 bool Debugger::ShouldPauseOnException(DebuggerStackTrace* stack_trace,
763 const Object& exc) { 768 const Object& exc) {
764 if (exc_pause_info_ == kNoPauseOnExceptions) { 769 if (exc_pause_info_ == kNoPauseOnExceptions) {
765 return false; 770 return false;
766 } 771 }
767 if ((exc_pause_info_ & kPauseOnAllExceptions) != 0) { 772 if ((exc_pause_info_ & kPauseOnAllExceptions) != 0) {
768 return true; 773 return true;
769 } 774 }
770 // Assume TypeError and AssertionError exceptions are unhandled. 775 // Assume TypeError and AssertionError exceptions are unhandled.
771 const Class& exc_class = Class::Handle(exc.clazz()); 776 const Class& exc_class = Class::Handle(exc.clazz());
772 const String& class_name = String::Handle(exc_class.Name()); 777 const String& class_name = String::Handle(exc_class.Name());
773 // TODO(hausner): Note the poor man's type test. This code will go 778 // TODO(hausner): Note the poor man's type test. This code will go
774 // away when we have a way to determine whether an exception is unhandled. 779 // away when we have a way to determine whether an exception is unhandled.
775 if (class_name.Equals("TypeError")) { 780 if (class_name.Equals("TypeError")) {
776 return true; 781 return true;
777 } 782 }
778 if (class_name.Equals("AssertionError")) { 783 if (class_name.Equals("AssertionError")) {
779 return true; 784 return true;
780 } 785 }
781 return false; 786 return false;
782 } 787 }
783 788
784 789
785 void Debugger::SignalExceptionThrown(const Object& exc) { 790 void Debugger::SignalExceptionThrown(const Object& exc) {
786 if (ignore_breakpoints_ || (event_handler_ == NULL)) { 791 if (ignore_breakpoints_ ||
792 (event_handler_ == NULL) ||
793 (exc_pause_info_ == kNoPauseOnExceptions)) {
787 return; 794 return;
788 } 795 }
789 DebuggerStackTrace* stack_trace = CollectStackTrace(); 796 DebuggerStackTrace* stack_trace = CollectStackTrace();
790 if (!ShouldPauseOnException(stack_trace, exc)) { 797 if (!ShouldPauseOnException(stack_trace, exc)) {
791 return; 798 return;
792 } 799 }
793 // No single-stepping possible after this pause event. 800 // No single-stepping possible after this pause event.
794 last_bpt_line_ = -1; 801 last_bpt_line_ = -1;
795 ASSERT(stack_trace_ == NULL); 802 ASSERT(stack_trace_ == NULL);
796 stack_trace_ = stack_trace; 803 stack_trace_ = stack_trace;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 } 1472 }
1466 1473
1467 1474
1468 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 1475 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
1469 ASSERT(bpt->next() == NULL); 1476 ASSERT(bpt->next() == NULL);
1470 bpt->set_next(code_breakpoints_); 1477 bpt->set_next(code_breakpoints_);
1471 code_breakpoints_ = bpt; 1478 code_breakpoints_ = bpt;
1472 } 1479 }
1473 1480
1474 } // namespace dart 1481 } // 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