[llvm] r219541 - Follow-up to r219534 to make symbolization more robust.

Alexey Samsonov vonosmas at gmail.com
Fri Oct 10 15:58:26 PDT 2014


Author: samsonov
Date: Fri Oct 10 17:58:26 2014
New Revision: 219541

URL: http://llvm.org/viewvc/llvm-project?rev=219541&view=rev
Log:
Follow-up to r219534 to make symbolization more robust.

1) Explicitly provide important arguments to llvm-symbolizer,
not relying on defaults.
2) Be more defensive about symbolizer output.

This might fix weird failures on ninja-x64-msvc-RA-centos6 buildbot.

Modified:
    llvm/trunk/lib/Support/Unix/Signals.inc

Modified: llvm/trunk/lib/Support/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=219541&r1=219540&r2=219541&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Signals.inc (original)
+++ llvm/trunk/lib/Support/Unix/Signals.inc Fri Oct 10 17:58:26 2014
@@ -363,9 +363,10 @@ static bool printSymbolizedStackTrace(vo
     }
   }
 
-  const char *args[] = {"llvm-symbolizer", nullptr};
+  const char *Args[] = {"llvm-symbolizer", "--functions=linkage", "--inlining",
+                        "--demangle", nullptr};
   int RunResult =
-      sys::ExecuteAndWait(LLVMSymbolizerPath, args, nullptr, Redirects.data());
+      sys::ExecuteAndWait(LLVMSymbolizerPath, Args, nullptr, Redirects.data());
   if (RunResult != 0)
     return false;
 
@@ -385,12 +386,16 @@ static bool printSymbolizedStackTrace(vo
     // Read pairs of lines (function name and file/line info) until we
     // encounter empty line.
     for (;;) {
+      if (CurLine == Lines.end())
+        return false;
       StringRef FunctionName = *CurLine++;
       if (FunctionName.empty())
         break;
       fprintf(FD, "#%d %p ", frame_no++, StackTrace[i]);
       if (!FunctionName.startswith("??"))
         fprintf(FD, "%s ", FunctionName.str().c_str());
+      if (CurLine == Lines.end())
+        return false;
       StringRef FileLineInfo = *CurLine++;
       if (!FileLineInfo.startswith("??"))
         fprintf(FD, "%s", FileLineInfo.str().c_str());





More information about the llvm-commits mailing list