I found our internal usage of LLDB failed symbolicate on Linux even though
llvm-symbolizer is next to it. Turns out that our lldb is distributed as
as symbolic link so printSymbolizedStackTrace() will try to find the
llvm-symbolizer next to the symlink instead of the real executable parent
directory.
This patch fixes this issue by adding an extra search path after resolving
symlink.
You will run into lifetime issues with the returned StringRef in ResolvedParent if we have a symlink as the data in the ResolvedParent will point to data in the "Resolved" variable. This variable contains the storage for the string in this scope, which will free its string when it destructs before returning from this function. Most of the time it will be ok because it is on the stack, but we can check this in. I would suggest inlining this code into the function below so that object lifetimes stay around long enough to get used. Or you can store "llvm::SmallString<128> Resolved;" in the printSymbolizedStackTrace() function as a local, and pass a reference to it into this function. That way the buffer will stay along long enough for the StringRef to not point to stale data.