File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -459,6 +459,16 @@ void Profiler::DumpStackTrace(void* context) {
459459#endif
460460}
461461
462+ // We need the call to DumpStackTrace to be a non-tail call and this function to
463+ // not get the shrink wrap optimization, otherwise the frame from which we start
464+ // our stack walk may be clobbered before the stack walk begins.
465+ #ifdef _MSC_VER
466+ #pragma optimize("", off)
467+ #elif __clang__
468+ __attribute__ ((optnone))
469+ #elif __GNUC__
470+ __attribute__ ((optimize(0 )))
471+ #endif
462472void Profiler::DumpStackTrace (bool for_crash) {
463473 uintptr_t sp = OSThread::GetCurrentStackPointer ();
464474 uintptr_t fp = 0 ;
@@ -468,6 +478,9 @@ void Profiler::DumpStackTrace(bool for_crash) {
468478
469479 DumpStackTrace (sp, fp, pc, for_crash);
470480}
481+ #ifdef _MSC_VER
482+ #pragma optimize("", on)
483+ #endif
471484
472485static void DumpCompilerState (Thread* thread) {
473486#if !defined(DART_PRECOMPILED_RUNTIME)
You can’t perform that action at this time.
0 commit comments