Skip to content

Commit

Permalink
Revert "[Symbolizer][Debuginfo] Add debuginfod client to llvm-symboli…
Browse files Browse the repository at this point in the history
…zer."

This reverts commit e2ad4f1 because it
does not correctly fix the sanitizer buildbot breakage.
  • Loading branch information
noajshu committed Dec 10, 2021
1 parent 7b9ab06 commit afa3c14
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 64 deletions.
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/Debuginfod/HTTPClient.h
Expand Up @@ -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();

Expand Down
1 change: 0 additions & 1 deletion llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
Expand Up @@ -9,7 +9,6 @@ add_llvm_component_library(LLVMSymbolize
LINK_COMPONENTS
DebugInfoDWARF
DebugInfoPDB
Debuginfod
Object
Support
Demangle
Expand Down
10 changes: 1 addition & 9 deletions llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions llvm/lib/Debuginfod/Debuginfod.cpp
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down
10 changes: 2 additions & 8 deletions llvm/lib/Debuginfod/HTTPClient.cpp
Expand Up @@ -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))
Expand All @@ -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);
Expand Down
27 changes: 0 additions & 27 deletions llvm/test/tools/llvm-symbolizer/debuginfod.test

This file was deleted.

1 change: 0 additions & 1 deletion llvm/tools/llvm-symbolizer/CMakeLists.txt
Expand Up @@ -10,7 +10,6 @@ add_public_tablegen_target(SymbolizerOptsTableGen)
set(LLVM_LINK_COMPONENTS
DebugInfoDWARF
DebugInfoPDB
Debuginfod
Demangle
Object
Option
Expand Down
3 changes: 0 additions & 3 deletions llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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");
Expand Down
Expand Up @@ -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",
Expand Down

0 comments on commit afa3c14

Please sign in to comment.