Skip to content

Commit 4a1e27e

Browse files
committed
fix: Add GGML_BACKTRACE_LLDB env var to enable using lldb for backtrace
Branch: MacOSSafeBacktrace Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
1 parent aa25b42 commit 4a1e27e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ggml/src/ggml.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,13 @@ void ggml_print_backtrace(void) {
147147
// 1. libdispatch "poisons" forked child processes
148148
// 2. lldb has issues attaching to parent from forked child
149149
// Use simple backtrace() instead to avoid Terminal.app crashes
150-
ggml_print_backtrace_symbols();
151-
return;
150+
const char * GGML_BACKTRACE_LLDB = getenv("GGML_BACKTRACE_LLDB");
151+
if (!GGML_BACKTRACE_LLDB) {
152+
fprintf(stderr, "WARNING: Using native backtrace. (dangrous) Set GGML_BACKTRACE_LLDB for more info.\n");
153+
fprintf(stderr, "See: https://github.com/ggml-org/llama.cpp/pull/17869\n");
154+
ggml_print_backtrace_symbols();
155+
return;
156+
}
152157
#endif
153158
#if defined(__linux__)
154159
FILE * f = fopen("/proc/self/status", "r");

0 commit comments

Comments
 (0)