fix: Provide macos-specific backtrace printing to avoid terminal death #17869
+21
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In my development environment on MacOS, any time I hit a failing
GGML_ASSERT, my entireTerminal.appcrashes (all windows, all processes, not just the ones involving the failing binary). I traced this down to the attempt to uselldbto print out a backtrace here.The simplest fix is simply setting
GGML_NO_BACKTRACEin the environment, but this is unset by default and needs to be discovered. It also needs to either be set in a global.bash_profileor set on every terminal.This PR adds an
__APPLE__-specific code path that uses the nativebacktrace()function and avoids attempting to attach to the parent from the forkedlldbprocess.Testing
To repro this, add a failing
GGML_ASSERTsomewhere, for example:Once built, run it and hit the assert:
Sources
(Found with the help of Claude Code)