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

Unified Diff: runtime/vm/exceptions.cc

Issue 22938002: Fix the stack trace when there are C++ frames in between dart frames. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/exceptions.cc
===================================================================
--- runtime/vm/exceptions.cc (revision 26031)
+++ runtime/vm/exceptions.cc (working copy)
@@ -202,49 +202,55 @@
Code& code = Code::Handle();
Smi& offset = Smi::Handle();
bool handler_found = false;
- while (!frame->IsEntryFrame()) {
- if (frame->IsDartFrame()) {
- code = frame->LookupDartCode();
- if (code.is_optimized()) {
- // For optimized frames, extract all the inlined functions if any
- // into the stack trace.
- for (InlinedFunctionsIterator it(frame); !it.Done(); it.Advance()) {
- func = it.function();
- code = it.code();
- uword pc = it.pc();
- ASSERT(pc != 0);
- ASSERT(code.EntryPoint() <= pc);
- ASSERT(pc < (code.EntryPoint() + code.Size()));
+ while (frame != NULL) {
+ while (!frame->IsEntryFrame()) {
+ if (frame->IsDartFrame()) {
+ code = frame->LookupDartCode();
+ if (code.is_optimized()) {
+ // For optimized frames, extract all the inlined functions if any
+ // into the stack trace.
+ for (InlinedFunctionsIterator it(frame); !it.Done(); it.Advance()) {
+ func = it.function();
+ code = it.code();
+ uword pc = it.pc();
+ ASSERT(pc != 0);
+ ASSERT(code.EntryPoint() <= pc);
+ ASSERT(pc < (code.EntryPoint() + code.Size()));
+ if (ShouldShowFunction(func)) {
+ offset = Smi::New(pc - code.EntryPoint());
+ builder->AddFrame(func, code, offset, handler_found);
+ }
+ }
+ } else {
+ offset = Smi::New(frame->pc() - code.EntryPoint());
+ func = code.function();
if (ShouldShowFunction(func)) {
- offset = Smi::New(pc - code.EntryPoint());
builder->AddFrame(func, code, offset, handler_found);
}
}
- } else {
- offset = Smi::New(frame->pc() - code.EntryPoint());
- func = code.function();
- if (ShouldShowFunction(func)) {
- builder->AddFrame(func, code, offset, handler_found);
+ if (!handler_found && frame->FindExceptionHandler(handler_pc)) {
+ *handler_sp = frame->sp();
+ *handler_fp = frame->fp();
+ handler_found = true;
+ if (!builder->FullStacktrace()) {
+ return handler_found;
+ }
}
}
- if (!handler_found && frame->FindExceptionHandler(handler_pc)) {
- *handler_sp = frame->sp();
- *handler_fp = frame->fp();
- handler_found = true;
- if (!builder->FullStacktrace()) {
- return handler_found;
- }
+ frame = frames.NextFrame();
+ ASSERT(frame != NULL);
+ }
+ ASSERT(frame->IsEntryFrame());
+ if (!handler_found) {
+ *handler_pc = frame->pc();
+ *handler_sp = frame->sp();
+ *handler_fp = frame->fp();
+ if (!builder->FullStacktrace()) {
+ return handler_found;
}
}
frame = frames.NextFrame();
- ASSERT(frame != NULL);
}
- ASSERT(frame->IsEntryFrame());
- if (!handler_found) {
- *handler_pc = frame->pc();
- *handler_sp = frame->sp();
- *handler_fp = frame->fp();
- }
return handler_found;
}
« no previous file with comments | « no previous file | tests/corelib/error_stack_trace1_test.dart » ('j') | tests/corelib/error_stack_trace1_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698