summaryrefslogtreecommitdiff
path: root/llvm/lib/Debuginfod/Debuginfod.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Debuginfod/Debuginfod.cpp')
-rw-r--r--llvm/lib/Debuginfod/Debuginfod.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index 12f817c9e4bf..77a8011ca82a 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -567,10 +567,10 @@ Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) {
return getCachedOrDownloadDebuginfo(ID);
}
-DebuginfodServer::DebuginfodServer(DebuginfodLog &Log,
- DebuginfodCollection &Collection)
- : Log(Log), Collection(Collection) {
- cantFail(
+Error DebuginfodServer::init(DebuginfodLog &Log,
+ DebuginfodCollection &Collection) {
+
+ Error Err =
Server.get(R"(/buildid/(.*)/debuginfo)", [&](HTTPServerRequest Request) {
Log.push("GET " + Request.UrlPath);
std::string IDString;
@@ -587,8 +587,11 @@ DebuginfodServer::DebuginfodServer(DebuginfodLog &Log,
return;
}
streamFile(Request, *PathOrErr);
- }));
- cantFail(
+ });
+ if (Err)
+ return Err;
+
+ Err =
Server.get(R"(/buildid/(.*)/executable)", [&](HTTPServerRequest Request) {
Log.push("GET " + Request.UrlPath);
std::string IDString;
@@ -605,7 +608,18 @@ DebuginfodServer::DebuginfodServer(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