Skip to content

Commit a3bb942

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[vm] Fix stack traces from ASSERT/FATAL.
TEST=vm/dart/symbolized_crash_test Bug: #60987 Cq-Include-Trybots: luci.dart.try:vm-linux-release-arm64-try,vm-aot-linux-release-arm64-try Change-Id: I6e1859a99079087161d5af8a10d1728277740218 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436760 Commit-Queue: Ryan Macnak <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]>
1 parent fa62265 commit a3bb942

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

runtime/vm/profiler.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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
462472
void 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

472485
static void DumpCompilerState(Thread* thread) {
473486
#if !defined(DART_PRECOMPILED_RUNTIME)

0 commit comments

Comments
 (0)