[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 10:25:40 PST 2019


phosek created this revision.
phosek added reviewers: dblaikie, rupprecht.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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_OPTIONS in addition to command line which can
be used to pass those additional options to llvm-symbolizer invocations
made by sanitizer runtime.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71668

Files:
  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())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71668.234571.patch
Type: text/x-patch
Size: 816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191218/76a1497b/attachment.bin>


More information about the llvm-commits mailing list