Index: runtime/vm/profiler.cc |
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc |
index c41f051ef4b20c68e5bc78617928f70e3694237f..8bfd7299fe6575e1bdc291ee1df6a536b7d74fd9 100644 |
--- a/runtime/vm/profiler.cc |
+++ b/runtime/vm/profiler.cc |
@@ -875,9 +875,9 @@ static bool GetAndValidateThreadStackBounds(Thread* thread, |
#endif |
if (!use_simulator_stack_bounds && |
- !os_thread->GetProfilerStackBounds(stack_lower, stack_upper) && |
!(get_os_thread_bounds && |
- OSThread::GetCurrentStackBounds(stack_lower, stack_upper))) { |
+ OSThread::GetCurrentStackBounds(stack_lower, stack_upper)) && |
+ !os_thread->GetProfilerStackBounds(stack_lower, stack_upper)) { |
// Could not get stack boundary. |
return false; |
} |
@@ -969,7 +969,7 @@ void Profiler::DumpStackTrace(void* context) { |
uword pc = SignalHandler::GetProgramCounter(mcontext); |
uword fp = SignalHandler::GetFramePointer(mcontext); |
uword sp = SignalHandler::GetCStackPointer(mcontext); |
- DumpStackTrace(sp, fp, pc); |
+ DumpStackTrace(sp, fp, pc, true /* for_crash */); |
#else |
// TODO(fschneider): Add support for more platforms. |
// Do nothing on unsupported platforms. |
@@ -977,24 +977,26 @@ void Profiler::DumpStackTrace(void* context) { |
} |
-void Profiler::DumpStackTrace() { |
+void Profiler::DumpStackTrace(bool for_crash) { |
uintptr_t sp = Thread::GetCurrentStackPointer(); |
uintptr_t fp = 0; |
uintptr_t pc = OS::GetProgramCounter(); |
COPY_FP_REGISTER(fp); |
- DumpStackTrace(sp, fp, pc); |
+ DumpStackTrace(sp, fp, pc, for_crash); |
} |
-void Profiler::DumpStackTrace(uword sp, uword fp, uword pc) { |
- // Allow only one stack trace to prevent recursively printing stack traces if |
- // we hit an assert while printing the stack. |
- static uintptr_t started_dump = 0; |
- if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) { |
- OS::PrintErr("Aborting re-entrant request for stack trace.\n"); |
- return; |
+void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) { |
+ if (for_crash) { |
+ // Allow only one stack trace to prevent recursively printing stack traces |
+ // if we hit an assert while printing the stack. |
+ static uintptr_t started_dump = 0; |
+ if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) { |
+ OS::PrintErr("Aborting re-entrant request for stack trace.\n"); |
+ return; |
+ } |
} |
siva
2017/04/13 01:50:18
Why is this logic relevant only when for_crash is
|
Thread* thread = Thread::Current(); |