[PATCH] [RFC] Use llvm-symbolizer to symbolize LLVM/Clang crash dumps
emaste at freebsd.org
Fri Oct 10 15:22:38 PDT 2014
Comment at: lib/Support/Unix/Signals.inc:287
@@ +286,3 @@
+ DlIteratePhdrData *data = (DlIteratePhdrData*)arg;
+ const char *name = data->first ? data->main_exec_name : info->dlpi_name;
+ data->first = false;
> emaste wrote:
> > This conditional is not be needed on FreeBSD, since on FreeBSD dl_iterate_phdr returns the executable with full path name in dlpi_name.
> I'd prefer to leave this condition as is, and don't special-case on it. We already have main executable at this point, why not use it?
On FreeBSD the main executable path is returned by the first callback from dl_iterate_phdr, rather than a blank string as on Linux. This is true in practice at least, that it's first is not explicitly guaranteed.
On FreeBSD the path passed to the callback may be more reliable, as well; the path returned by my change (what we'll pass in data->main_exec_name) on FreeBSD comes through vn_fullpath in the kernel, which has the following note in the man page:
The vn_fullpath() function makes a ``best effort'' attempt to generate a
string pathname for the passed vnode; the resulting path, if any, will be
relative to the root directory of the process associated with the passed
thread pointer. The vn_fullpath() function is implemented by inspecting
the VFS name cache, and attempting to reconstruct a path from the process
root to the object.
whereas the executable's dlpi_name is stored by rtld at the time the process starts.
More information about the llvm-commits