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

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

Issue 14664006: Instrument debugger to track down stack trace problems (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 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 "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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 RawContext* ActivationFrame::GetSavedCurrentContext() { 360 RawContext* ActivationFrame::GetSavedCurrentContext() {
361 GetVarDescriptors(); 361 GetVarDescriptors();
362 intptr_t var_desc_len = var_descriptors_.Length(); 362 intptr_t var_desc_len = var_descriptors_.Length();
363 for (int i = 0; i < var_desc_len; i++) { 363 for (int i = 0; i < var_desc_len; i++) {
364 RawLocalVarDescriptors::VarInfo var_info; 364 RawLocalVarDescriptors::VarInfo var_info;
365 var_descriptors_.GetInfo(i, &var_info); 365 var_descriptors_.GetInfo(i, &var_info);
366 if (var_info.kind == RawLocalVarDescriptors::kSavedCurrentContext) { 366 if (var_info.kind == RawLocalVarDescriptors::kSavedCurrentContext) {
367 return reinterpret_cast<RawContext*>(GetLocalVarValue(var_info.index)); 367 return reinterpret_cast<RawContext*>(GetLocalVarValue(var_info.index));
368 } 368 }
369 } 369 }
370 UNREACHABLE();
371 return Context::null(); 370 return Context::null();
372 } 371 }
373 372
374 373
375 ActivationFrame* DebuggerStackTrace::GetHandlerFrame( 374 ActivationFrame* DebuggerStackTrace::GetHandlerFrame(
376 const Instance& exc_obj) const { 375 const Instance& exc_obj) const {
377 ExceptionHandlers& handlers = ExceptionHandlers::Handle(); 376 ExceptionHandlers& handlers = ExceptionHandlers::Handle();
378 Array& handled_types = Array::Handle(); 377 Array& handled_types = Array::Handle();
379 AbstractType& type = Type::Handle(); 378 AbstractType& type = Type::Handle();
380 const TypeArguments& no_instantiator = TypeArguments::Handle(); 379 const TypeArguments& no_instantiator = TypeArguments::Handle();
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 frame->fp(), 909 frame->fp(),
911 frame->sp(), 910 frame->sp(),
912 code); 911 code);
913 // If this activation frame called a closure, the function has 912 // If this activation frame called a closure, the function has
914 // saved its context before the call. 913 // saved its context before the call.
915 if (stack_trace->Length() > 0) { 914 if (stack_trace->Length() > 0) {
916 ActivationFrame* callee_frame = 915 ActivationFrame* callee_frame =
917 stack_trace->ActivationFrameAt(stack_trace->Length() - 1); 916 stack_trace->ActivationFrameAt(stack_trace->Length() - 1);
918 if (callee_frame->function().IsClosureFunction()) { 917 if (callee_frame->function().IsClosureFunction()) {
919 ctx = activation->GetSavedCurrentContext(); 918 ctx = activation->GetSavedCurrentContext();
919 if (FLAG_verbose_debug && ctx.IsNull()) {
920 const Function& caller = activation->function();
921 const Function& callee = callee_frame->function();
922 const Script& script =
923 Script::Handle(Class::Handle(caller.Owner()).script());
924 intptr_t line, col;
925 script.GetTokenLocation(activation->TokenPos(), &line, &col);
926 printf("CollectStackTrace error: no saved context in function "
927 "'%s' which calls closure '%s' "
928 " in line %"Pd" column %"Pd"\n",
929 caller.ToFullyQualifiedCString(),
930 callee.ToFullyQualifiedCString(),
931 line, col);
932 }
933 ASSERT(!ctx.IsNull());
920 } 934 }
921 } 935 }
922 if (optimized_frame_found || code.is_optimized()) { 936 if (optimized_frame_found || code.is_optimized()) {
923 // Set context to null, to avoid returning bad context variable values. 937 // Set context to null, to avoid returning bad context variable values.
924 activation->SetContext(Context::Handle()); 938 activation->SetContext(Context::Handle());
925 optimized_frame_found = true; 939 optimized_frame_found = true;
926 } else { 940 } else {
927 activation->SetContext(ctx); 941 activation->SetContext(ctx);
928 } 942 }
929 stack_trace->AddActivation(activation); 943 stack_trace->AddActivation(activation);
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 } 1677 }
1664 bpt = bpt->next(); 1678 bpt = bpt->next();
1665 } 1679 }
1666 return NULL; 1680 return NULL;
1667 } 1681 }
1668 1682
1669 1683
1670 // Remove and delete the source breakpoint bpt and its associated 1684 // Remove and delete the source breakpoint bpt and its associated
1671 // code breakpoints. 1685 // code breakpoints.
1672 void Debugger::RemoveBreakpoint(intptr_t bp_id) { 1686 void Debugger::RemoveBreakpoint(intptr_t bp_id) {
1673 ASSERT(src_breakpoints_ != NULL);
1674 SourceBreakpoint* prev_bpt = NULL; 1687 SourceBreakpoint* prev_bpt = NULL;
1675 SourceBreakpoint* curr_bpt = src_breakpoints_; 1688 SourceBreakpoint* curr_bpt = src_breakpoints_;
1676 while (curr_bpt != NULL) { 1689 while (curr_bpt != NULL) {
1677 if (curr_bpt->id() == bp_id) { 1690 if (curr_bpt->id() == bp_id) {
1678 if (prev_bpt == NULL) { 1691 if (prev_bpt == NULL) {
1679 src_breakpoints_ = src_breakpoints_->next(); 1692 src_breakpoints_ = src_breakpoints_->next();
1680 } else { 1693 } else {
1681 prev_bpt->set_next(curr_bpt->next()); 1694 prev_bpt->set_next(curr_bpt->next());
1682 } 1695 }
1683 // Remove references from code breakpoints to this source breakpoint, 1696 // Remove references from code breakpoints to this source breakpoint,
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 } 1781 }
1769 1782
1770 1783
1771 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 1784 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
1772 ASSERT(bpt->next() == NULL); 1785 ASSERT(bpt->next() == NULL);
1773 bpt->set_next(code_breakpoints_); 1786 bpt->set_next(code_breakpoints_);
1774 code_breakpoints_ = bpt; 1787 code_breakpoints_ = bpt;
1775 } 1788 }
1776 1789
1777 } // namespace dart 1790 } // 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