Lines Matching +full:client +full:- +full:id
1 //===-- llvm/Debuginfod/Debuginfod.cpp - Debuginfod client library --------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 /// This file contains several definitions for the debuginfod client and server.
12 /// For the client, this file defines the fetchInfo function. For the server,
16 /// debuginfo, source file) associated with a build-id from debuginfod servers.
22 //===----------------------------------------------------------------------===//
63 static std::string buildIDToString(BuildIDRef ID) { in buildIDToString() argument
64 return llvm::toHex(ID, /*LowerCase=*/true); in buildIDToString()
81 .split(DebuginfodUrls.value(), " ", -1, false); in getDefaultDebuginfodUrls()
95 /// Finds a default local file caching directory for the debuginfod client,
105 sys::path::append(CacheDirectory, "llvm-debuginfod", "client"); in getDefaultDebuginfodCacheDirectory()
123 std::string getDebuginfodSourceUrlPath(BuildIDRef ID, in getDebuginfodSourceUrlPath() argument
127 buildIDToString(ID), "source", in getDebuginfodSourceUrlPath()
132 Expected<std::string> getCachedOrDownloadSource(BuildIDRef ID, in getCachedOrDownloadSource() argument
134 std::string UrlPath = getDebuginfodSourceUrlPath(ID, SourceFilePath); in getCachedOrDownloadSource()
138 std::string getDebuginfodExecutableUrlPath(BuildIDRef ID) { in getDebuginfodExecutableUrlPath() argument
141 buildIDToString(ID), "executable"); in getDebuginfodExecutableUrlPath()
145 Expected<std::string> getCachedOrDownloadExecutable(BuildIDRef ID) { in getCachedOrDownloadExecutable() argument
146 std::string UrlPath = getDebuginfodExecutableUrlPath(ID); in getCachedOrDownloadExecutable()
150 std::string getDebuginfodDebuginfoUrlPath(BuildIDRef ID) { in getDebuginfodDebuginfoUrlPath() argument
153 buildIDToString(ID), "debuginfo"); in getDebuginfodDebuginfoUrlPath()
157 Expected<std::string> getCachedOrDownloadDebuginfo(BuildIDRef ID) { in getCachedOrDownloadDebuginfo() argument
158 std::string UrlPath = getDebuginfodDebuginfoUrlPath(ID); in getCachedOrDownloadDebuginfo()
185 HTTPClient &Client; member in llvm::__anon098c1f4d0211::StreamedHTTPResponseHandler
189 StreamedHTTPResponseHandler(CreateStreamFn CreateStream, HTTPClient &Client) in StreamedHTTPResponseHandler() argument
190 : CreateStream(CreateStream), Client(Client) {} in StreamedHTTPResponseHandler()
200 unsigned Code = Client.responseCode(); in handleBodyChunk()
209 *FileStream->OS << BodyChunk; in handleBodyChunk()
213 // An over-accepting simplification of the HTTP RFC 7230 spec.
235 for (StringRef Line : llvm::split((*HeadersFile)->getBuffer(), '\n')) { in getHeaders()
256 "llvmcache-" + UniqueKey); in getCachedOrDownloadArtifact()
259 localCache("Debuginfod-client", ".debuginfod-client", CacheDirectoryPath); in getCachedOrDownloadArtifact()
276 "No working HTTP client is available."); in getCachedOrDownloadArtifact()
281 "A working HTTP client is available, but it is not initialized. To " in getCachedOrDownloadArtifact()
285 HTTPClient Client; in getCachedOrDownloadArtifact() local
286 Client.setTimeout(Timeout); in getCachedOrDownloadArtifact()
295 [&]() { return CacheAddStream(Task, ""); }, Client); in getCachedOrDownloadArtifact()
298 Error Err = Client.perform(Request, Handler); in getCachedOrDownloadArtifact()
302 unsigned Code = Client.responseCode(); in getCachedOrDownloadArtifact()
317 return createStringError(errc::argument_out_of_domain, "build id not found"); in getCachedOrDownloadArtifact()
420 IteratorGroup.async([&, this]() -> void { in findBinaries()
430 FilePath = I->path(); in findBinaries()
446 if (!Bin->isObject()) in findBinaries()
449 // TODO: Support non-ELF binaries in findBinaries()
455 BuildIDRef ID = getBuildID(Object); in findBinaries() local
456 if (ID.empty()) in findBinaries()
459 std::string IDString = buildIDToString(ID); in findBinaries()
460 if (Object->hasDebugInfo()) { in findBinaries()
478 DebuginfodCollection::getBinaryPath(BuildIDRef ID) { in getBinaryPath() argument
479 Log.push("getting binary path of ID " + buildIDToString(ID)); in getBinaryPath()
481 auto Loc = Binaries.find(buildIDToString(ID)); in getBinaryPath()
483 std::string Path = Loc->getValue(); in getBinaryPath()
490 DebuginfodCollection::getDebugBinaryPath(BuildIDRef ID) { in getDebugBinaryPath() argument
491 Log.push("getting debug binary path of ID " + buildIDToString(ID)); in getDebugBinaryPath()
493 auto Loc = DebugBinaries.find(buildIDToString(ID)); in getDebugBinaryPath()
495 std::string Path = Loc->getValue(); in getDebugBinaryPath()
501 Expected<std::string> DebuginfodCollection::findBinaryPath(BuildIDRef ID) { in findBinaryPath() argument
503 // Check collection; perform on-demand update if stale. in findBinaryPath()
504 Expected<std::optional<std::string>> PathOrErr = getBinaryPath(ID); in findBinaryPath()
514 PathOrErr = getBinaryPath(ID); in findBinaryPath()
525 Expected<std::string> PathOrErr = getCachedOrDownloadExecutable(ID); in findBinaryPath()
530 return findDebugBinaryPath(ID); in findBinaryPath()
533 Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) { in findDebugBinaryPath() argument
534 // Check collection; perform on-demand update if stale. in findDebugBinaryPath()
535 Expected<std::optional<std::string>> PathOrErr = getDebugBinaryPath(ID); in findDebugBinaryPath()
545 PathOrErr = getBinaryPath(ID); in findDebugBinaryPath()
555 return getCachedOrDownloadDebuginfo(ID); in findDebugBinaryPath()
567 {404, "text/plain", "Build ID is not a hex string\n"}); in DebuginfodServer()
570 object::BuildID ID(IDString.begin(), IDString.end()); in DebuginfodServer() local
571 Expected<std::string> PathOrErr = Collection.findDebugBinaryPath(ID); in DebuginfodServer()
574 Request.setResponse({404, "text/plain", "Build ID not found\n"}); in DebuginfodServer()
585 {404, "text/plain", "Build ID is not a hex string\n"}); in DebuginfodServer()
588 object::BuildID ID(IDString.begin(), IDString.end()); in DebuginfodServer() local
589 Expected<std::string> PathOrErr = Collection.findBinaryPath(ID); in DebuginfodServer()
592 Request.setResponse({404, "text/plain", "Build ID not found\n"}); in DebuginfodServer()