[PATCH] D71668: [llvm-symbolizer] Support reading options from environment
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 18 16:14:18 PST 2019
phosek updated this revision to Diff 234634.
phosek added a comment.
Test case added.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71668/new/
https://reviews.llvm.org/D71668
Files:
llvm/test/tools/llvm-symbolizer/Inputs/.build-id/ab/b50d82b6bdc861.debug
llvm/test/tools/llvm-symbolizer/options-from-env.test
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Index: llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
===================================================================
--- llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -289,8 +289,9 @@
}
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 ? nullptr : "LLVM_SYMBOLIZER_OPTIONS");
// If both --demangle and --no-demangle are specified then pick the last one.
if (ClNoDemangle.getPosition() > ClDemangle.getPosition())
Index: llvm/test/tools/llvm-symbolizer/options-from-env.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-symbolizer/options-from-env.test
@@ -0,0 +1,29 @@
+# REQUIRES: shell
+# RUN: yaml2obj %s -o %t
+
+# RUN: llvm-symbolizer --obj=%t 0x20112f | FileCheck --check-prefix=UNKNOWN %s
+
+# UNKNOWN: ??
+# UNKNOWN-NEXT: ??:0:0
+
+# RUN: LLVM_SYMBOLIZER_OPTIONS=--debug-file-directory=%p/Inputs llvm-symbolizer --obj=%t 0x20112f | FileCheck --check-prefix=FOUND %s
+
+# FOUND: main
+# FOUND-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: EM_X86_64
+Sections:
+ - Name: .note.gnu.build-id
+ Type: SHT_NOTE
+ Flags: [ SHF_ALLOC ]
+ Content: 040000000800000003000000474e5500abb50d82b6bdc861
+ProgramHeaders:
+ - Type: PT_NOTE
+ Flags: [ PF_R ]
+ Sections:
+ - Section: .note.gnu.build-id
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71668.234634.patch
Type: text/x-patch
Size: 1804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191219/0c1a2371/attachment.bin>
More information about the llvm-commits
mailing list