This is an archive of the discontinued LLVM Phabricator instance.

Search for llvm-symbolizer binary in same directory as argv[0]
ClosedPublic

Authored by rsmith on May 18 2016, 4:56 PM.

Details

Reviewers
samsonov
rnk
Summary

Currently we search for the llvm-symbolizer binary along $PATH. This doesn't work very well if the LLVM binary is run from the build area, or is installed in some directory that's not on the $PATH. This patch changes the crash reporter to look for the symbolizer binary in directory of argv[0] before it searches $PATH; most of the changes here are wiring argv[0] from each of our main functions through to the crash reporter.

Diff Detail

Repository
rL LLVM

Event Timeline

rsmith updated this revision to Diff 57712.May 18 2016, 4:56 PM
rsmith retitled this revision from to Search for llvm-symbolizer binary in same directory as argv[0].
rsmith updated this object.
rsmith added reviewers: samsonov, rnk.
rsmith set the repository for this revision to rL LLVM.
rsmith added a subscriber: llvm-commits.
rnk added inline comments.May 23 2016, 4:08 PM
lib/Support/Signals.cpp
85–86

So, if 'clang' was on PATH, argv0 would be 'clang', parent_path will return an empty string, and then we'll try './llvm-symbolizer'? Are you sure that's what we want? Maybe just skip to the PATH search in that case?

rsmith updated this revision to Diff 60117.Jun 8 2016, 4:53 PM
rsmith marked an inline comment as done.
rsmith added inline comments.
lib/Support/Signals.cpp
85–86

argv[0] typically has the corresponding element of $PATH prepended to it in that case, but I agree it makes sense to skip the search entirely if we get a weird argv[0] rather than searching in ..

rsmith added inline comments.Jun 8 2016, 4:55 PM
projects/libcxx/include/algorithm
637

Ignore this, I diffed too many subprojects :)

rnk accepted this revision.Jun 8 2016, 5:49 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Jun 8 2016, 5:49 PM
rsmith closed this revision.Jun 8 2016, 6:01 PM

Committed as r272232 - r272235.