Blob Blame History Raw
commit 2d1a32ab4b0ce488726dd8929c85840dc73ed7dd
Author: Andy Lutomirski <luto@kernel.org>
Date:   Tue Sep 15 18:27:52 2015 -0700

    Switch show_stackframe to backtrace_symbols_fd
    
    It's simpler and avoids calling into fprintf in contexts in which
    it might crash or deadlock.

diff --git a/src/common.cpp b/src/common.cpp
index 78d0e23865c5..f5eb2ca5b921 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -90,17 +90,8 @@ void show_stackframe()
     int trace_size = 0;
 
     trace_size = backtrace(trace, 32);
-    char **messages = backtrace_symbols(trace, trace_size);
-
-    if (messages)
-    {
-        debug(0, L"Backtrace:");
-        for (int i=0; i<trace_size; i++)
-        {
-            fwprintf(stderr, L"%s\n", messages[i]);
-        }
-        free(messages);
-    }
+    debug(0, L"Backtrace:");
+    backtrace_symbols_fd(trace, trace_size, STDERR_FILENO);
 }
 
 int fgetws2(wcstring *s, FILE *f)