Chromium Code Reviews| Index: runtime/vm/debugger.cc |
| =================================================================== |
| --- runtime/vm/debugger.cc (revision 22213) |
| +++ runtime/vm/debugger.cc (working copy) |
| @@ -900,6 +900,7 @@ |
| Code& code = Code::Handle(isolate); |
| StackFrameIterator iterator(false); |
| StackFrame* frame = iterator.NextFrame(); |
| + ActivationFrame* callee_activation = NULL; |
| bool optimized_frame_found = false; |
| while (frame != NULL) { |
| ASSERT(frame->IsValid()); |
| @@ -911,27 +912,24 @@ |
| code); |
| // If this activation frame called a closure, the function has |
| // saved its context before the call. |
| - if (stack_trace->Length() > 0) { |
| - ActivationFrame* callee_frame = |
| - stack_trace->ActivationFrameAt(stack_trace->Length() - 1); |
| - if (callee_frame->function().IsClosureFunction()) { |
| - ctx = activation->GetSavedCurrentContext(); |
| - if (FLAG_verbose_debug && ctx.IsNull()) { |
| - const Function& caller = activation->function(); |
| - const Function& callee = callee_frame->function(); |
| - const Script& script = |
| - Script::Handle(Class::Handle(caller.Owner()).script()); |
| - intptr_t line, col; |
| - script.GetTokenLocation(activation->TokenPos(), &line, &col); |
| - printf("CollectStackTrace error: no saved context in function " |
| - "'%s' which calls closure '%s' " |
| - " in line %"Pd" column %"Pd"\n", |
| - caller.ToFullyQualifiedCString(), |
| - callee.ToFullyQualifiedCString(), |
| - line, col); |
| - } |
| - ASSERT(!ctx.IsNull()); |
| + if ((callee_activation != NULL) && |
| + (callee_activation->function().IsClosureFunction())) { |
| + ctx = activation->GetSavedCurrentContext(); |
| + if (FLAG_verbose_debug && ctx.IsNull()) { |
| + const Function& caller = activation->function(); |
| + const Function& callee = callee_activation->function(); |
| + const Script& script = |
| + Script::Handle(Class::Handle(caller.Owner()).script()); |
| + intptr_t line, col; |
| + script.GetTokenLocation(activation->TokenPos(), &line, &col); |
| + printf("CollectStackTrace error: no saved context in function " |
|
siva
2013/05/01 18:21:19
maybe use OS::Print here.
hausner
2013/05/01 18:32:53
Yes.
|
| + "'%s' which calls closure '%s' " |
| + " in line %"Pd" column %"Pd"\n", |
| + caller.ToFullyQualifiedCString(), |
| + callee.ToFullyQualifiedCString(), |
| + line, col); |
| } |
| + ASSERT(!ctx.IsNull()); |
| } |
| if (optimized_frame_found || code.is_optimized()) { |
| // Set context to null, to avoid returning bad context variable values. |
| @@ -941,10 +939,12 @@ |
| activation->SetContext(ctx); |
| } |
| stack_trace->AddActivation(activation); |
| + callee_activation = activation; |
| // Get caller's context if this function saved it on entry. |
| ctx = activation->GetSavedEntryContext(ctx); |
| } else if (frame->IsEntryFrame()) { |
| ctx = reinterpret_cast<EntryFrame*>(frame)->SavedContext(); |
| + callee_activation = NULL; |
| } |
| frame = iterator.NextFrame(); |
| } |