Index: runtime/vm/profiler.cc |
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc |
index c4fe878ba9d7d2216b055b5fa0006118bbe603cf..1018cf4bc4184a95a4409f82ee1992551d7f7740 100644 |
--- a/runtime/vm/profiler.cc |
+++ b/runtime/vm/profiler.cc |
@@ -1858,6 +1858,12 @@ void Profiler::RecordSampleInterruptCallback( |
return; |
} |
ASSERT(isolate != Dart::vm_isolate()); |
+ if (StubCode::InJumpToExceptionHandlerStub(state.pc)) { |
+ // The JumpToExceptionHandler stub manually adjusts the stack pointer, |
+ // frame pointer, and some isolate state before jumping to a catch entry. |
+ // It is not safe to walk the stack when executing this stub. |
+ return; |
+ } |
VMTagCounters* counters = isolate->vm_tag_counters(); |
ASSERT(counters != NULL); |
counters->Increment(isolate->vm_tag()); |
@@ -1890,8 +1896,9 @@ void Profiler::RecordSampleInterruptCallback( |
stackWalker.walk(isolate->heap()); |
} else { |
if ((isolate->stub_code() != NULL) && |
- (isolate->top_exit_frame_info() != 0)) { |
- // Collect only Dart frames. |
+ (isolate->top_exit_frame_info() != 0) && |
+ (isolate->vm_tag() != VMTag::kScriptTagId)) { |
+ // We have a valid exit frame info, use the Dart stack walker. |
ProfilerDartStackWalker stackWalker(isolate, sample); |
stackWalker.walk(); |
} else { |