mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:39:47 +00:00
[llvm-symbolizer] Support reading options from environment
llvm-symbolizer is used by sanitizers to symbolize errors discovered by sanitizer, but there's no way to pass options to llvm-symbolizer since the tool is invoked directly by the sanitizer runtime. Therefore, we don't have a way to pass options needed to find debug symbols such as -dsym-hint or -debug-file-directory. This change enables reading options from the LLVM_SYMBOLIZER_OPTS in addition to command line which can be used to pass those additional options to llvm-symbolizer invocations made by sanitizer runtime. Differential Revision: https://reviews.llvm.org/D71668
This commit is contained in:
parent
113b26aae4
commit
dcf1bd6c94
@ -27,6 +27,8 @@ Here are some of those differences:
|
||||
|
||||
- Uses `--output-style=GNU`_ by default.
|
||||
|
||||
- Parses options from the environment variable ``LLVM_ADDR2LINE_OPTS``.
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
||||
|
@ -28,6 +28,12 @@ Object files can be specified together with the addresses either on standard
|
||||
input or as positional arguments on the command-line, following any "DATA" or
|
||||
"CODE" prefix.
|
||||
|
||||
:program:`llvm-symbolizer` parses options from the environment variable
|
||||
``LLVM_SYMBOLIZER_OPTS`` after parsing options from the command line.
|
||||
``LLVM_SYMBOLIZER_OPTS`` is primarily useful for supplementing the command-line
|
||||
options when :program:`llvm-symbolizer` is invoked by another program or
|
||||
runtime.
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
|
4
test/tools/llvm-symbolizer/options-from-env.test
Normal file
4
test/tools/llvm-symbolizer/options-from-env.test
Normal file
@ -0,0 +1,4 @@
|
||||
RUN: LLVM_SYMBOLIZER_OPTS=--print-address llvm-symbolizer 0x20112f | FileCheck %s
|
||||
RUN: LLVM_ADDR2LINE_OPTS=--print-address llvm-addr2line 0x20112f | FileCheck %s
|
||||
|
||||
CHECK: 0x20112f
|
@ -289,8 +289,10 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
llvm::sys::InitializeCOMRAII COM(llvm::sys::COMThreadingMode::MultiThreaded);
|
||||
cl::ParseCommandLineOptions(argc, argv, IsAddr2Line ? "llvm-addr2line\n"
|
||||
: "llvm-symbolizer\n");
|
||||
cl::ParseCommandLineOptions(
|
||||
argc, argv, IsAddr2Line ? "llvm-addr2line\n" : "llvm-symbolizer\n",
|
||||
/*Errs=*/nullptr,
|
||||
IsAddr2Line ? "LLVM_ADDR2LINE_OPTS" : "LLVM_SYMBOLIZER_OPTS");
|
||||
|
||||
// If both --demangle and --no-demangle are specified then pick the last one.
|
||||
if (ClNoDemangle.getPosition() > ClDemangle.getPosition())
|
||||
|
Loading…
Reference in New Issue
Block a user