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

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
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/exceptions.cc
===================================================================
--- runtime/vm/exceptions.cc (revision 26042)
+++ runtime/vm/exceptions.cc (working copy)
@@ -201,51 +201,60 @@
Function& func = Function::Handle();
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()));
+ bool dart_handler_found = false;
+ bool handler_pc_set = false;
+ 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, dart_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);
+ builder->AddFrame(func, code, offset, dart_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_pc_set && frame->FindExceptionHandler(handler_pc)) {
+ handler_pc_set = true;
+ *handler_sp = frame->sp();
+ *handler_fp = frame->fp();
+ dart_handler_found = true;
+ if (!builder->FullStacktrace()) {
+ return dart_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_pc_set) {
+ handler_pc_set = true;
+ *handler_pc = frame->pc();
+ *handler_sp = frame->sp();
+ *handler_fp = frame->fp();
+ if (!builder->FullStacktrace()) {
+ return dart_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;
+ return dart_handler_found;
}
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698