Skip to content

macOS: symbolicate arm64 crashes with atos -arch arm64#3064

Open
tomjn wants to merge 2 commits into
beyond-all-reason:masterfrom
tomjn:macos/crashhandler-arm64-atos
Open

macOS: symbolicate arm64 crashes with atos -arch arm64#3064
tomjn wants to merge 2 commits into
beyond-all-reason:masterfrom
tomjn:macos/crashhandler-arm64-atos

Conversation

@tomjn

@tomjn tomjn commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What

Two fixes to the macOS crash handler (rts/System/Platform/Mac/CrashHandler.cpp):

  1. arm64 symbolication. TranslateStackTrace invoked atos (ADDR2LINE) with a hardcoded -arch x86_64. On Apple Silicon that arch doesn't match the running binary, so symbolication produced no useful output. Select -arch arm64 at compile time on __aarch64__/__arm64__ targets, keeping x86_64 for Intel.

  2. Format/argument mismatch. The debug log of the frame address used 0x%lx against stackFrame.ip, which is a void* — a format/argument mismatch (UB). Changed to %p.

Why

Surfaced bringing up the native macOS (Apple Silicon) build. Without (1), a crash backtrace on arm64 is unsymbolicated and effectively useless for debugging.

Safety

macOS-only file. The arch selection is compile-time, so a binary embeds the atos -arch matching the architecture it runs on. No effect on Linux/Windows.

Verified by inspection; macOS isn't in CI yet. Part of the "big mac" bring-up; an independent change extracted while reviewing #3060 (which re-derived the same arm64 fix).

The macOS crash handler hardcoded '-arch x86_64' when invoking atos
(ADDR2LINE), so backtrace symbolication produced no useful output on
Apple Silicon binaries. Select '-arch arm64' at compile time on
aarch64/arm64 targets, keeping x86_64 for Intel.

Also fix the debug log of the frame address: stackFrame.ip is a void*,
but it was printed with '0x%lx', a format/argument mismatch. Use %p.
Comment thread rts/System/Platform/Mac/CrashHandler.cpp Outdated
Match the architecture-detection convention in Platform/Misc.cpp
(GetArchitectureStr): x86_64 macro set first, then __aarch64__/_M_ARM64,
with #error on anything else. Fold the arch into a string so the atos
command line isn't duplicated per branch.

Addresses review feedback on beyond-all-reason#3064.
@sprunk sprunk added the big mac Part of the big push to support Mac. label Jun 25, 2026
@tomjn tomjn marked this pull request as ready for review June 25, 2026 15:40
tomjn added a commit to tomjn/RecoilEngine that referenced this pull request Jun 25, 2026
Match the architecture-detection convention in Platform/Misc.cpp
(GetArchitectureStr): x86_64 macro set first, then __aarch64__/_M_ARM64,
with #error on anything else. Fold the arch into a string so the atos
command line isn't duplicated per branch.

Addresses review feedback on beyond-all-reason#3064.

(cherry picked from commit 4eacdfe)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

big mac Part of the big push to support Mac.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants