File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,13 @@ static void ggml_print_backtrace_symbols(void) {
124124 int nptrs = backtrace (trace , sizeof (trace )/sizeof (trace [0 ]));
125125 backtrace_symbols_fd (trace , nptrs , STDERR_FILENO );
126126}
127+ #elif defined(__APPLE__ )
128+ #include <execinfo.h>
129+ static void ggml_print_backtrace_symbols (void ) {
130+ void * trace [100 ];
131+ int nptrs = backtrace (trace , sizeof (trace )/sizeof (trace [0 ]));
132+ backtrace_symbols_fd (trace , nptrs , STDERR_FILENO );
133+ }
127134#else
128135static void ggml_print_backtrace_symbols (void ) {
129136 // platform not supported
@@ -135,6 +142,14 @@ void ggml_print_backtrace(void) {
135142 if (GGML_NO_BACKTRACE ) {
136143 return ;
137144 }
145+ #if defined(__APPLE__ )
146+ // On macOS, fork+debugger attachment is problematic due to:
147+ // 1. libdispatch "poisons" forked child processes
148+ // 2. lldb has issues attaching to parent from forked child
149+ // Use simple backtrace() instead to avoid Terminal.app crashes
150+ ggml_print_backtrace_symbols ();
151+ return ;
152+ #endif
138153#if defined(__linux__ )
139154 FILE * f = fopen ("/proc/self/status" , "r" );
140155 size_t size = 0 ;
You can’t perform that action at this time.
0 commit comments