Reverts recent debuginfod patches (#156532)

This patch reverts 44e791c6ff1a982de9651aad7d1c83d1ad96da8a,
3cc1031a827d319c6cb48df1c3aafc9ba7e96d72 and
adbd43250ade1d5357542d8bd7c3dfed212ddec0. Which breaks debuginfod build
and tests when httplib is used.
This commit is contained in:
Haowei 2025-09-02 14:22:42 -07:00 committed by GitHub
parent 49fcfaa15a
commit 81131f3745
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 34 deletions

View File

@ -152,16 +152,11 @@ public:
Expected<std::string> findBinaryPath(object::BuildIDRef);
};
class DebuginfodServer {
public:
struct DebuginfodServer {
HTTPServer Server;
DebuginfodLog &Log;
DebuginfodCollection &Collection;
DebuginfodServer(DebuginfodLog &Log, DebuginfodCollection &Collection);
static Expected<DebuginfodServer> create(DebuginfodLog &Log,
DebuginfodCollection &Collection);
private:
DebuginfodServer() = default;
Error init(DebuginfodLog &Log, DebuginfodCollection &Collection);
};
} // end namespace llvm

View File

@ -104,7 +104,6 @@ class HTTPServer {
public:
HTTPServer();
~HTTPServer();
HTTPServer(HTTPServer &&);
/// Returns true only if LLVM has been compiled with a working HTTPServer.
static bool isAvailable();

View File

@ -567,10 +567,10 @@ Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) {
return getCachedOrDownloadDebuginfo(ID);
}
Error DebuginfodServer::init(DebuginfodLog &Log,
DebuginfodCollection &Collection) {
Error Err =
DebuginfodServer::DebuginfodServer(DebuginfodLog &Log,
DebuginfodCollection &Collection)
: Log(Log), Collection(Collection) {
cantFail(
Server.get(R"(/buildid/(.*)/debuginfo)", [&](HTTPServerRequest Request) {
Log.push("GET " + Request.UrlPath);
std::string IDString;
@ -587,11 +587,8 @@ Error DebuginfodServer::init(DebuginfodLog &Log,
return;
}
streamFile(Request, *PathOrErr);
});
if (Err)
return Err;
Err =
}));
cantFail(
Server.get(R"(/buildid/(.*)/executable)", [&](HTTPServerRequest Request) {
Log.push("GET " + Request.UrlPath);
std::string IDString;
@ -608,18 +605,7 @@ Error DebuginfodServer::init(DebuginfodLog &Log,
return;
}
streamFile(Request, *PathOrErr);
});
if (Err)
return Err;
return Error::success();
}
Expected<DebuginfodServer>
DebuginfodServer::create(DebuginfodLog &Log, DebuginfodCollection &Collection) {
DebuginfodServer Serverd;
if (llvm::Error Err = Serverd.init(Log, Collection))
return std::move(Err);
return std::move(Serverd);
}));
}
} // namespace llvm

View File

@ -62,8 +62,6 @@ bool llvm::streamFile(HTTPServerRequest &Request, StringRef FilePath) {
return true;
}
HTTPServer::HTTPServer(HTTPServer &&) = default;
#ifdef LLVM_ENABLE_HTTPLIB
bool HTTPServer::isAvailable() { return true; }

View File

@ -131,8 +131,8 @@ int llvm_debuginfod_main(int argc, char **argv, const llvm::ToolContext &) {
DefaultThreadPool Pool(hardware_concurrency(MaxConcurrency));
DebuginfodLog Log;
DebuginfodCollection Collection(Paths, Log, Pool, MinInterval);
DebuginfodServer Server =
ExitOnErr(DebuginfodServer::create(Log, Collection));
DebuginfodServer Server(Log, Collection);
if (!Port)
Port = ExitOnErr(Server.Server.bind(HostInterface.c_str()));
else