| Index: runtime/vm/profiler.cc
|
| diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
|
| index a3fb9c6c90a7e83438908ef7d0907464d963b576..82053db9f58dac80b7d4b9b9a42e3ebf6cba232e 100644
|
| --- a/runtime/vm/profiler.cc
|
| +++ b/runtime/vm/profiler.cc
|
| @@ -406,17 +406,20 @@ void ClearProfileVisitor::VisitSample(Sample* sample) {
|
| }
|
|
|
| static void DumpStackFrame(intptr_t frame_index, uword pc) {
|
| - Isolate* isolate = Isolate::Current();
|
| - if ((isolate != NULL) && isolate->is_runnable()) {
|
| - Code& code = Code::Handle(Code::LookupCodeInVmIsolate(pc));
|
| - if (!code.IsNull()) {
|
| - OS::PrintErr(" [0x%" Pp "] %s\n", pc, code.QualifiedName());
|
| - return;
|
| - }
|
| - code = Code::LookupCode(pc);
|
| - if (!code.IsNull()) {
|
| - OS::PrintErr(" [0x%" Pp "] %s\n", pc, code.QualifiedName());
|
| - return;
|
| + Thread* thread = Thread::Current();
|
| + if ((thread != NULL) && !thread->IsAtSafepoint()) {
|
| + Isolate* isolate = thread->isolate();
|
| + if ((isolate != NULL) && isolate->is_runnable()) {
|
| + // Only attempt to symbolize Dart frames if we can safely iterate the
|
| + // current isolate's heap.
|
| + Code& code = Code::Handle(Code::LookupCodeInVmIsolate(pc));
|
| + if (!code.IsNull()) {
|
| + code = Code::LookupCode(pc); // In current isolate.
|
| + }
|
| + if (!code.IsNull()) {
|
| + OS::PrintErr(" [0x%" Pp "] %s\n", pc, code.QualifiedName());
|
| + return;
|
| + }
|
| }
|
| }
|
|
|
|
|