[PATCH] D88192: Add support for setting the path to llvm-symbolizer through an environment variable

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 22:44:27 PDT 2020


mehdi_amini updated this revision to Diff 293941.
mehdi_amini added a comment.

Address comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88192/new/

https://reviews.llvm.org/D88192

Files:
  llvm/lib/Support/Signals.cpp


Index: llvm/lib/Support/Signals.cpp
===================================================================
--- llvm/lib/Support/Signals.cpp
+++ llvm/lib/Support/Signals.cpp
@@ -45,6 +45,7 @@
                          cl::location(DisableSymbolicationFlag), cl::Hidden);
 
 constexpr char DisableSymbolizationEnv[] = "LLVM_DISABLE_SYMBOLIZATION";
+constexpr char LLVMSymbolizerPathEnv[] = "LLVM_SYMBOLIZER_PATH";
 
 // Callbacks to run in signal handler must be lock-free because a signal handler
 // could be running as we add new callbacks. We don't add unbounded numbers of
@@ -119,7 +120,9 @@
   // Use llvm-symbolizer tool to symbolize the stack traces. First look for it
   // alongside our binary, then in $PATH.
   ErrorOr<std::string> LLVMSymbolizerPathOrErr = std::error_code();
-  if (!Argv0.empty()) {
+  if (const char *Path = getenv(LLVMSymbolizerPathEnv)) {
+    LLVMSymbolizerPathOrErr = sys::findProgramByName(Path);
+  } else if (!Argv0.empty()) {
     StringRef Parent = llvm::sys::path::parent_path(Argv0);
     if (!Parent.empty())
       LLVMSymbolizerPathOrErr = sys::findProgramByName("llvm-symbolizer", Parent);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88192.293941.patch
Type: text/x-patch
Size: 1133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200924/1682bb44/attachment.bin>


More information about the llvm-commits mailing list