1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

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.

llvm-svn: 219541
This commit is contained in:
Alexey Samsonov 2014-10-10 22:58:26 +00:00
parent 72c32a25ce
commit 8bdcdd9e37

View File

@ -363,9 +363,10 @@ static bool printSymbolizedStackTrace(void **StackTrace, int Depth, FILE *FD) {
} }
} }
const char *args[] = {"llvm-symbolizer", nullptr}; const char *Args[] = {"llvm-symbolizer", "--functions=linkage", "--inlining",
"--demangle", nullptr};
int RunResult = int RunResult =
sys::ExecuteAndWait(LLVMSymbolizerPath, args, nullptr, Redirects.data()); sys::ExecuteAndWait(LLVMSymbolizerPath, Args, nullptr, Redirects.data());
if (RunResult != 0) if (RunResult != 0)
return false; return false;
@ -385,12 +386,16 @@ static bool printSymbolizedStackTrace(void **StackTrace, int Depth, FILE *FD) {
// Read pairs of lines (function name and file/line info) until we // Read pairs of lines (function name and file/line info) until we
// encounter empty line. // encounter empty line.
for (;;) { for (;;) {
if (CurLine == Lines.end())
return false;
StringRef FunctionName = *CurLine++; StringRef FunctionName = *CurLine++;
if (FunctionName.empty()) if (FunctionName.empty())
break; break;
fprintf(FD, "#%d %p ", frame_no++, StackTrace[i]); fprintf(FD, "#%d %p ", frame_no++, StackTrace[i]);
if (!FunctionName.startswith("??")) if (!FunctionName.startswith("??"))
fprintf(FD, "%s ", FunctionName.str().c_str()); fprintf(FD, "%s ", FunctionName.str().c_str());
if (CurLine == Lines.end())
return false;
StringRef FileLineInfo = *CurLine++; StringRef FileLineInfo = *CurLine++;
if (!FileLineInfo.startswith("??")) if (!FileLineInfo.startswith("??"))
fprintf(FD, "%s", FileLineInfo.str().c_str()); fprintf(FD, "%s", FileLineInfo.str().c_str());