[compiler-rt] afa3c14 - Revert "[Symbolizer][Debuginfo] Add debuginfod client to llvm-symbolizer."

Noah Shutty via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 17:00:46 PST 2021


Author: Noah Shutty
Date: 2021-12-10T00:59:13Z
New Revision: afa3c14e2ff95c6b4e1a2db4e197a7297c7f73ec

URL: https://github.com/llvm/llvm-project/commit/afa3c14e2ff95c6b4e1a2db4e197a7297c7f73ec
DIFF: https://github.com/llvm/llvm-project/commit/afa3c14e2ff95c6b4e1a2db4e197a7297c7f73ec.diff

LOG: Revert "[Symbolizer][Debuginfo] Add debuginfod client to llvm-symbolizer."

This reverts commit e2ad4f1756027cd27f6c82db620042e9877f900c because it
does not correctly fix the sanitizer buildbot breakage.

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt
    llvm/include/llvm/Debuginfod/HTTPClient.h
    llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
    llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
    llvm/lib/Debuginfod/Debuginfod.cpp
    llvm/lib/Debuginfod/HTTPClient.cpp
    llvm/tools/llvm-symbolizer/CMakeLists.txt
    llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
    llvm/utils/gn/secondary/llvm/lib/DebugInfo/Symbolize/BUILD.gn

Removed: 
    llvm/test/tools/llvm-symbolizer/debuginfod.test


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt
index 161b4d412b58e..29b2960e11fe4 100644
--- a/compiler-rt/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt
+++ b/compiler-rt/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt
@@ -71,10 +71,6 @@ fputc U
 free U
 freelocale U
 fwrite U
-getCachedOrDownloadDebuginfoENS_8ArrayRef T
-getDefaultDebuginfodCacheDirectory T
-getDefaultDebuginfodTimeout T
-getDefaultDebuginfodUrls T
 getc U
 getcwd U
 getenv U

diff  --git a/llvm/include/llvm/Debuginfod/HTTPClient.h b/llvm/include/llvm/Debuginfod/HTTPClient.h
index 51de66629544f..687b1b62addae 100644
--- a/llvm/include/llvm/Debuginfod/HTTPClient.h
+++ b/llvm/include/llvm/Debuginfod/HTTPClient.h
@@ -79,14 +79,13 @@ class BufferedHTTPResponseHandler final : public HTTPResponseHandler {
 class HTTPClient {
 #ifdef LLVM_ENABLE_CURL
   void *Curl = nullptr;
+  static bool IsInitialized;
 #endif
 
 public:
   HTTPClient();
   ~HTTPClient();
 
-  static bool IsInitialized;
-
   /// Returns true only if LLVM has been compiled with a working HTTPClient.
   static bool isAvailable();
 

diff  --git a/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt b/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
index c20ba897e0b80..acfb3bd0e1ad9 100644
--- a/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
+++ b/llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
@@ -9,7 +9,6 @@ add_llvm_component_library(LLVMSymbolize
   LINK_COMPONENTS
   DebugInfoDWARF
   DebugInfoPDB
-  Debuginfod
   Object
   Support
   Demangle

diff  --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index 5ec79df17fed9..f3f09584fdc97 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -20,7 +20,6 @@
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/DebugInfo/PDB/PDB.h"
 #include "llvm/DebugInfo/PDB/PDBContext.h"
-#include "llvm/Debuginfod/Debuginfod.h"
 #include "llvm/Demangle/Demangle.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/MachO.h"
@@ -385,14 +384,7 @@ bool findDebugBinary(const std::vector<std::string> &DebugFileDirectory,
       }
     }
   }
-  // Try debuginfod client cache and known servers.
-  Expected<std::string> PathOrErr = getCachedOrDownloadDebuginfo(BuildID);
-  if (!PathOrErr) {
-    consumeError(PathOrErr.takeError());
-    return false;
-  }
-  Result = *PathOrErr;
-  return true;
+  return false;
 }
 
 } // end anonymous namespace

diff  --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index 389b18fd62ac8..eafd9d2eeda7e 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -139,13 +139,6 @@ Expected<std::string> getCachedOrDownloadArtifact(
     return createStringError(errc::io_error,
                              "No working HTTP client is available.");
 
-  if (!HTTPClient::IsInitialized)
-    return createStringError(
-        errc::io_error,
-        "A working HTTP client is available, but it is not initialized. To "
-        "allow Debuginfod to make HTTP requests, call HTTPClient::initialize() "
-        "at the beginning of main.");
-
   HTTPClient Client;
   Client.setTimeout(Timeout);
   for (StringRef ServerUrl : DebuginfodUrls) {
@@ -164,7 +157,7 @@ Expected<std::string> getCachedOrDownloadArtifact(
     // file cache.
     Expected<std::unique_ptr<CachedFileStream>> FileStreamOrErr =
         CacheAddStream(Task);
-    if (!FileStreamOrErr)
+    if (FileStreamOrErr)
       return FileStreamOrErr.takeError();
     std::unique_ptr<CachedFileStream> &FileStream = *FileStreamOrErr;
     if (!Response.Body)

diff  --git a/llvm/lib/Debuginfod/HTTPClient.cpp b/llvm/lib/Debuginfod/HTTPClient.cpp
index 65f457933b92d..5ba51502b34c2 100644
--- a/llvm/lib/Debuginfod/HTTPClient.cpp
+++ b/llvm/lib/Debuginfod/HTTPClient.cpp
@@ -72,14 +72,6 @@ Error BufferedHTTPResponseHandler::handleStatusCode(unsigned Code) {
   return Error::success();
 }
 
-bool HTTPClient::IsInitialized = false;
-
-class HTTPClientCleanup {
-public:
-  ~HTTPClientCleanup() { HTTPClient::cleanup(); }
-};
-static const HTTPClientCleanup Cleanup;
-
 Expected<HTTPResponseBuffer> HTTPClient::perform(const HTTPRequest &Request) {
   BufferedHTTPResponseHandler Handler;
   if (Error Err = perform(Request, Handler))
@@ -96,6 +88,8 @@ Expected<HTTPResponseBuffer> HTTPClient::get(StringRef Url) {
 
 bool HTTPClient::isAvailable() { return true; }
 
+bool HTTPClient::IsInitialized = false;
+
 void HTTPClient::initialize() {
   if (!IsInitialized) {
     curl_global_init(CURL_GLOBAL_ALL);

diff  --git a/llvm/test/tools/llvm-symbolizer/debuginfod.test b/llvm/test/tools/llvm-symbolizer/debuginfod.test
deleted file mode 100644
index 93160f395d39e..0000000000000
--- a/llvm/test/tools/llvm-symbolizer/debuginfod.test
+++ /dev/null
@@ -1,27 +0,0 @@
-# This test uses the local debuginfod cache to test the symbolizer integration
-# with the debuginfod client.
-RUN: rm -rf %t
-RUN: mkdir %t
-
-# Produce a stripped copy of the input binary addr.exe
-RUN: llvm-objcopy --strip-debug %p/Inputs/addr.exe %t/addr.exe
-
-# Symbolizing the stripped binary should fail.
-RUN: env DEBUGINFOD_CACHE_PATH=%t llvm-symbolizer --print-address \
-RUN:   --obj=%t/addr.exe 0x40054d | FileCheck %s --check-prefix=NOTFOUND
-NOTFOUND: 0x40054d
-NOTFOUND-NEXT: main
-NOTFOUND-NEXT: ??:0:0
-
-# Use llvm-objcopy to write the debuginfo of the addr.exe binary to an
-# appropriately-named file in the llvm debuginfod cache. The filename is
-# determined by the debuginfod client's caching scheme, so it is manually
-# specified here as llvmcache-98...19
-RUN: llvm-objcopy --keep-section=.debug_info %p/Inputs/addr.exe \
-RUN:   %t/llvmcache-9800707741016212219
-
-# The symbolizer should call the debuginfod client library, which finds the
-# debuginfo placed in the cache, enabling symbolization of the address.
-RUN: env DEBUGINFOD_CACHE_PATH=%t llvm-symbolizer \
-RUN:   --obj=%t/addr.exe 0x40054d | FileCheck %s --check-prefix=FOUND
-FOUND: {{[/\]+}}tmp{{[/\]+}}x.c:14:0

diff  --git a/llvm/tools/llvm-symbolizer/CMakeLists.txt b/llvm/tools/llvm-symbolizer/CMakeLists.txt
index 583caec560184..c112e344da7ea 100644
--- a/llvm/tools/llvm-symbolizer/CMakeLists.txt
+++ b/llvm/tools/llvm-symbolizer/CMakeLists.txt
@@ -10,7 +10,6 @@ add_public_tablegen_target(SymbolizerOptsTableGen)
 set(LLVM_LINK_COMPONENTS
   DebugInfoDWARF
   DebugInfoPDB
-  Debuginfod
   Demangle
   Object
   Option

diff  --git a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index 66a2e703129bf..2adbf1f1731df 100644
--- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -19,7 +19,6 @@
 #include "llvm/Config/config.h"
 #include "llvm/DebugInfo/Symbolize/DIPrinter.h"
 #include "llvm/DebugInfo/Symbolize/Symbolize.h"
-#include "llvm/Debuginfod/HTTPClient.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
@@ -262,8 +261,6 @@ static FunctionNameKind decideHowToPrintFunctions(const opt::InputArgList &Args,
 
 int main(int argc, char **argv) {
   InitLLVM X(argc, argv);
-  // The HTTPClient must be initialized for use by the debuginfod client.
-  HTTPClient::initialize();
   sys::InitializeCOMRAII COM(sys::COMThreadingMode::MultiThreaded);
 
   bool IsAddr2Line = sys::path::stem(argv[0]).contains("addr2line");

diff  --git a/llvm/utils/gn/secondary/llvm/lib/DebugInfo/Symbolize/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/DebugInfo/Symbolize/BUILD.gn
index c9fedfdc36905..ecd59c311534d 100644
--- a/llvm/utils/gn/secondary/llvm/lib/DebugInfo/Symbolize/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/DebugInfo/Symbolize/BUILD.gn
@@ -4,7 +4,6 @@ static_library("Symbolize") {
     "//llvm/include/llvm/Config:config",
     "//llvm/lib/DebugInfo/DWARF",
     "//llvm/lib/DebugInfo/PDB",
-    "//llvm/lib/Debuginfod",
     "//llvm/lib/Demangle",
     "//llvm/lib/Object",
     "//llvm/lib/Support",


        


More information about the llvm-commits mailing list