aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Debuginfod
AgeCommit message (Collapse)AuthorFilesLines
2025-09-02Reverts recent debuginfod patches (#156532)Haowei2-23/+7
This patch reverts 44e791c6ff1a982de9651aad7d1c83d1ad96da8a, 3cc1031a827d319c6cb48df1c3aafc9ba7e96d72 and adbd43250ade1d5357542d8bd7c3dfed212ddec0. Which breaks debuginfod build and tests when httplib is used.
2025-08-29Fix debuginfod build failure when httplib is used. (#156107)Haowei1-0/+2
This is a follow up of adbd43250ade1d5357542d8bd7c3dfed212ddec0. The problem is, HTTPServer class will lost its implicit move ctor if httplib is used. This patch adds the move ctor explicitly to solve this issue. The default move ctor is not added in the header due to a limitation that "httplib::Server" is a forward declaration and it is incomplete.
2025-08-29[Debuginfod] Fix warningsKazu Hirata1-2/+2
This patch fixes: llvm/lib/Debuginfod/Debuginfod.cpp:592:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] llvm/lib/Debuginfod/Debuginfod.cpp:613:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
2025-08-29[Debuginfo] add debuginfod factory method (#154633)RISHIK RAM1-7/+21
Fix #63873
2025-06-04[Debuginfod] Restore an includeKazu Hirata1-0/+1
A breakage has been reported in: https://github.com/llvm/llvm-project/issues/142852
2025-06-04[Debuginfod] Restore a couple of includesKazu Hirata1-0/+2
This patch adds back a couple of includes to HTTPClient.cpp. A breakage has been reported in: https://github.com/llvm/llvm-project/issues/142852
2025-06-04[llvm] Remove unused includes (NFC) (#142733)Kazu Hirata2-3/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-05-11[Debuginfod] Use StringRef::consume_back (NFC) (#139483)Kazu Hirata1-2/+1
2025-04-22Modify the localCache API to require an explicit commit on CachedFile… ↵anjenner1-0/+13
(#136121) …Stream. CachedFileStream has previously performed the commit step in its destructor, but this means its only recourse for error handling is report_fatal_error. Modify this to add an explicit commit() method, and call this in the appropriate places with appropriate error handling for the location. Currently the destructor of CacheStream gives an assert failure in Debug builds if commit() was not called. This will help track down any remaining uses of the API that assume the old destructior behaviour. In Release builds we fall back to the previous behaviour and call report_fatal_error if the commit fails. This is version 2 of this PR, superseding reverted PR https://github.com/llvm/llvm-project/pull/115331 . I have incorporated a change to the testcase to make it more reliable on Windows, as well as two follow-up changes (https://github.com/llvm/llvm-project/commit/df79000896101acc9b8d7435e59f767b36c00ac8 and https://github.com/llvm/llvm-project/commit/b0baa1d8bd68a2ce2f7c5f2b62333e410e9122a1) that were also reverted when 115331 was reverted. --------- Co-authored-by: Augie Fackler <augie@google.com> Co-authored-by: Vitaly Buka <vitalybuka@google.com>
2025-03-08Revert "Modify the localCache API to require an explicit commit on ↵Douglas Yung1-13/+0
CachedFile… (#115331)" This reverts commit ce9e1d3c15ed6290f1cb07b482939976fa8115cd. The unittest added in this commit seems to be flaky causing random failure on buildbots: - https://lab.llvm.org/buildbot/#/builders/46/builds/13235 - https://lab.llvm.org/buildbot/#/builders/46/builds/13232 - https://lab.llvm.org/buildbot/#/builders/46/builds/13228 - https://lab.llvm.org/buildbot/#/builders/46/builds/13224 - https://lab.llvm.org/buildbot/#/builders/46/builds/13220 - https://lab.llvm.org/buildbot/#/builders/46/builds/13210 - https://lab.llvm.org/buildbot/#/builders/46/builds/13208 - https://lab.llvm.org/buildbot/#/builders/46/builds/13207 - https://lab.llvm.org/buildbot/#/builders/46/builds/13202 - https://lab.llvm.org/buildbot/#/builders/46/builds/13196 and - https://lab.llvm.org/buildbot/#/builders/180/builds/14266 - https://lab.llvm.org/buildbot/#/builders/180/builds/14254 - https://lab.llvm.org/buildbot/#/builders/180/builds/14250 - https://lab.llvm.org/buildbot/#/builders/180/builds/14245 - https://lab.llvm.org/buildbot/#/builders/180/builds/14244 - https://lab.llvm.org/buildbot/#/builders/180/builds/14226
2025-03-08Revert "[clangd] fix warning by adding missing parens"Douglas Yung1-1/+1
This reverts commit df79000896101acc9b8d7435e59f767b36c00ac8. Reverting follow-up commit to ce9e1d3c15ed6290f1cb07b482939976fa8115cd since the original commit test is flaky.
2025-03-07[clangd] fix warning by adding missing parensAugie Fackler1-1/+1
2025-03-07Modify the localCache API to require an explicit commit on CachedFile… ↵anjenner1-0/+13
(#115331) …Stream. CachedFileStream has previously performed the commit step in its destructor, but this means its only recourse for error handling is report_fatal_error. Modify this to add an explicit commit() method, and call this in the appropriate places with appropriate error handling for the location. Currently the destructor of CacheStream gives an assert failure in Debug builds if commit() was not called. This will help track down any remaining uses of the API that assume the old destructior behaviour. In Release builds we fall back to the previous behaviour and call report_fatal_error if the commit fails.
2025-01-13Revert "[lldb] Switch debuginfod cache to use lldb index cache settings" ↵GeorgeHuyubo1-20/+9
(#122816) This reverts commit 7b808e73aa0193c8a42eae8f2420a803f424bee1. Previous commit which change default debuginfod cache path and pruning policy settings is problematic. It broke multiple tests across lldb and llvm. Reverting for now. Co-authored-by: George Hu <georgehuyubo@gmail.com>
2025-01-10Debuginfod cache use index cache settings and include real file name (#120814)GeorgeHuyubo1-9/+20
This PR include two changes: 1. Change debuginfod cache file name to include origin file name, the new file name would be something like: llvmcache-13267c5f5d2e3df472c133c8efa45fb3331ef1ea-liblzma.so.5.2.2.debuginfo.dwp So it will provide more information in image list instead of a plain llvmcache-123 2. Switch debuginfod cache to use lldb index cache settings. Currently we don't have proper settings for setting the cache path or the cache expiration time for debuginfod cache. We want to use the lldb index cache settings, as they make sense to be in the same place and have the same TTL. --------- Co-authored-by: George Hu <georgehuyubo@gmail.com>
2024-03-02Split the llvm::ThreadPool into an abstract base class and an implementation ↵Mehdi Amini1-1/+2
(#82094) This decouples the public API used to enqueue tasks and wait for completion from the actual implementation, and opens up the possibility for clients to set their own thread pool implementation for the pool. https://discourse.llvm.org/t/construct-threadpool-from-vector-of-existing-threads/76883
2024-02-19Rename `ThreadPool::getThreadCount()` to `getMaxConcurrency()` (NFC) (#82296)Mehdi Amini1-1/+1
This is addressing a long-time TODO to rename this misleading API. The old one is preserved for now but marked deprecated.
2024-01-22Added settings for DEBUGINFOD cache location and timeout (#78605)Kevin Frei1-10/+26
I've been working on more/better configuration for improving DEBUGINFOD support. This is the first (and easiest) slice of the work. I've added `timeout` and `cache-path` settings that can override the DEBUGINFOD library defaults (and environment variables.) I also renamed the `plugin.symbol-locator.debuginfod.server_urls` setting to `server-urls` to be more consistent with the rest of LLDB's settings (the underscore switch is switched to a hyphen) I've got a few tests that validate the cache-path setting (as a side-effect), but they've exposed a few bugs that I'll be putting up a separate PR for (which will include the tests). --------- Co-authored-by: Kevin Frei <freik@meta.com>
2023-12-04Switch from the std::shared_mutex to an LLVM RWMutex (#74383)Kevin Frei1-4/+4
@nico pointed out that my usage of `std::shared_mutex` broke builds on older macOS devices. Switching to `llvm::sys::RWMutex` is the solution that they provided. Tracked in issue #74382 Co-authored-by: Kevin Frei <freik@meta.com>
2023-12-04DEBUGINFOD based DWP acquisition for LLDB (#70996)Kevin Frei1-6/+27
I've plumbed the LLVM DebugInfoD client into LLDB, and added automatic downloading of DWP files to the SymbolFileDWARF.cpp plugin. If you have DEBUGINFOD_URLS set to a space delimited set of web servers, LLDB will try to use them as a last resort when searching for DWP files. If you do *not* have that environment variable set, nothing should be changed. There's also a setting, per @clayborg 's suggestion, that will override the environment variable, or can be used instead of the environment variable. The setting is why I also needed to add an API to the llvm-debuginfod library ### Test Plan: Suggestions are welcome here. I should probably have some positive and negative tests, but I wanted to get the diff up for people who have a clue what they're doing to rip it to pieces before spending too much time validating the initial implementation. --------- Co-authored-by: Kevin Frei <freik@meta.com> Co-authored-by: Alex Langford <nirvashtzero@gmail.com>
2023-10-03[Debuginfod] Accept compressed encodings in client (#68055)Daniel Thornburgh1-0/+2
All encodings that the underlying libcurl supports are automatically detected and accepted. libcurl will then decompress on the fly. This improves effective network transfer rate and prevents server-side decompression for files stored compressed. Fixes #63534
2023-09-01[llvm] Fix duplicate word typos. NFCFangrui Song1-1/+1
Those fixes were taken from https://reviews.llvm.org/D137338
2023-08-11[llvm-debuginfod] Switch to xxh3_64bitsFangrui Song1-1/+3
Many sources show that xxh3 is much better than xxh64. This particular instance may or may not have noticeable difference, but this change moves us toward removing xxHash64. This change will invalid cache. Reviewed By: mysterymath Differential Revision: https://reviews.llvm.org/D155993
2023-07-14[CMake] Don't exclude llvm-debuginfod if httplib isn't availablePetr Hosek1-7/+16
This will result in a tool that's not usable, but it'll still link correctly rather than failing with a CMake error. This matches what we do for other tools that have dependencies such as llvm-mt. Differential Revision: https://reviews.llvm.org/D155323
2023-04-05[Object] Refactor build ID parsing into Object lib.Daniel Thornburgh1-3/+3
This makes parsing for build IDs in the markup filter slightly more permissive, in line with fromHex. It also removes the distinction between missing build ID and empty build ID; empty build IDs aren't a useful concept, since their purpose is to uniquely identify a binary. This removes a layer of indirection wherever build IDs are obtained. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D147485
2023-03-10[Debuginfod] Prune cache after fetch.Daniel Thornburgh1-10/+18
Previously, the size of the debuginfod cache would grow without bound. This change prunes the cache after a successful debuginfod lookup, as is done in libdebuginfod. The cache pruning behavior is configured by a new DEBUGINFOD_CACHE_POLICY environment variable. The semantics of this are the same as --thinlto_cache_policy. Reviewed By: gulfem Differential Revision: https://reviews.llvm.org/D145618
2023-01-26Reland: [llvm-cov] Look up object files using debuginfodDaniel Thornburgh1-9/+10
Reviewed By: gulfem Differential Revision: https://reviews.llvm.org/D136702
2023-01-25Revert "[llvm-cov] Look up object files using debuginfod"Douglas Yung1-10/+9
This reverts commit efbc8bb18eda63007216ad0cb5a8de04963eddd5. This change is causing failures when detecting curl on several build bots: - https://lab.llvm.org/buildbot/#/builders/247/builds/884 - https://lab.llvm.org/buildbot/#/builders/231/builds/7688 - https://lab.llvm.org/buildbot/#/builders/121/builds/27389 - https://lab.llvm.org/buildbot/#/builders/230/builds/8464 - https://lab.llvm.org/buildbot/#/builders/57/builds/24209 - https://lab.llvm.org/buildbot/#/builders/127/builds/42722
2023-01-25[llvm-cov] Look up object files using debuginfodDaniel Thornburgh1-9/+10
Reviewed By: gulfem Differential Revision: https://reviews.llvm.org/D136702
2022-12-20[llvm] Use std::optional instead of OptionalKazu Hirata1-6/+6
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-17[llvm] llvm::Optional::value => operator*/operator->Fangrui Song1-2/+2
std::optional::value() has undesired exception checking semantics and is unavailable in some older Xcode. The call sites block std::optional migration.
2022-12-17std::optional::value => operator*/operator->Fangrui Song1-3/+3
value() has undesired exception checking semantics and calls __throw_bad_optional_access in libc++. Moreover, the API is unavailable without _LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). This fixes check-llvm.
2022-12-04[Object] llvm::Optional => std::optionalFangrui Song2-3/+3
2022-12-02[llvm] Use std::nullopt instead of None (NFC)Kazu Hirata2-3/+3
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-22Reland "[LTO][COFF] Use bitcode file names in lto native object file names."Zequan Wu1-3/+3
This reverts commit 34108082947c964ae9bbfcd9808f2fd31c0d672f with fixes.
2022-11-23Revert "Reland "[LTO][COFF] Use bitcode file names in lto native object file ↵Roman Lebedev1-3/+3
names."" Breaks build of LLVMgold here: ``` /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1108:19: error: no matching function for call to 'localCache' Cache = check(localCache("ThinLTO", "Thin", options::cache_dir, AddBuffer)); ^~~~~~~~~~ /repositories/llvm-project/llvm/include/llvm/Support/Caching.h:72:21: note: candidate function not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1102:20)' to 'llvm::AddBufferFn' (aka 'function<void (unsigned int, const llvm::Twine &, std::unique_ptr<MemoryBuffer>)>') for 4th argument Expected<FileCache> localCache( ^ /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1110:18: error: no viable conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'llvm::AddStreamFn' (aka 'function<Expected<std::unique_ptr<CachedFileStream>> (unsigned int, const llvm::Twine &)>') check(Lto->run(AddStream, Cache)); ^~~~~~~~~ /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:375:7: note: candidate constructor not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'std::nullptr_t' for 1st argument function(nullptr_t) noexcept ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:386:7: note: candidate constructor not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'const std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream>> (unsigned int, const llvm::Twine &)> &' for 1st argument function(const function& __x) ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:404:7: note: candidate constructor not viable: no known conversion from '(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' to 'std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream>> (unsigned int, const llvm::Twine &)> &&' for 1st argument function(function&& __x) noexcept ^ /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:435:2: note: candidate template ignored: requirement '_Callable<(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) &, (lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20), std::__invoke_result<(lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) &, unsigned int, const llvm::Twine &>>::value' was not satisfied [with _Functor = (lambda at /repositories/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) &] function(_Functor&& __f) ^ /repositories/llvm-project/llvm/include/llvm/LTO/LTO.h:278:25: note: passing argument to parameter 'AddStream' here Error run(AddStreamFn AddStream, FileCache Cache = nullptr); ^ ``` This reverts commit 387620aa8cea33174b6c1fb80c1af713fee732ac.
2022-11-22Reland "[LTO][COFF] Use bitcode file names in lto native object file names."Zequan Wu1-3/+3
This reverts commit eef5405f74ae208e3e2eb7daacecac923d7338f2.
2022-11-22Revert "[LTO][COFF] Use bitcode file names in lto native object file names."Zequan Wu1-3/+3
This reverts commit 531ed6d5aa65f41c6dfe2e74905d5c6c88fc95a7.
2022-11-22[LTO][COFF] Use bitcode file names in lto native object file names.Zequan Wu1-3/+3
Currently the lto native object files have names like main.exe.lto.1.obj. In PDB, those names are used as names for each compiland. Microsoft’s tool SizeBench uses those names to present to users the size of each object files. So, names like main.exe.lto.1.obj is not user friendly. This patch makes the lto native object file names more readable by using the bitcode file names as part of the file names. For example, if the input bitcode file has path like "path/to/foo.obj", its corresponding lto native object file path would be "path/to/main.exe.lto.foo.obj". Since the lto native object file name only bothers PDB, this patch only changes the lld-linker's behavior. Reviewed By: tejohnson, MaskRay, #lld-macho Differential Revision: https://reviews.llvm.org/D137217
2022-11-08[llvm-debuginfod-find] Fix test/behavior on Windows.Daniel Thornburgh1-2/+2
2022-11-07[Debuginfod] DEBUGINFOD_HEADERS_FILE environment variableDaniel Thornburgh2-0/+47
This change adds a DEBUGINFOD_HEADERS_FILE environment variable provides a file containing HTTP headers to attach to outgoing HTTP requests, one per line. This allows a file permissioned with OS access control mechanisms to supply bearer credentials for Debuginfod requests. This matches the mechanism recently added to elfutils' libdebuginfod. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D136303
2022-09-28[NFC] [Object] Create library to fetch debug info by build ID.Daniel Thornburgh3-20/+15
This creates a library for fetching debug info by build ID, whether locally or remotely via debuginfod. The functionality was refactored out of existing code in the Symboliize library. Existing utilities were refactored to use this library. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D132504
2022-08-16[LLVM][Debuginfod] Add missing thread includeDavid Spickett1-0/+1
One of our silent bots is currently failing: https://lab.llvm.org/staging/#/builders/171/builds/169 With: <...>/Debuginfod.cpp:298:23: error: no type named 'sleep_for' in namespace 'std::this_thread' std::this_thread::sleep_for(Interval); ~~~~~~~~~~~~~~~~~~^ Add missing thread include to that file, which is what all the other users of sleep_for do. I think we are seeing this now because we disabled llvm threading for this builder. Maybe debuginfod should account for that but that's for another time.
2022-07-13[llvm] Use value instead of getValue (NFC)Kazu Hirata1-3/+3
2022-07-07[Debuginfod] Try to fix clang-ppc64le-rhel buildNoah Shutty1-0/+5
2022-07-06[Debuginfod] Try to fix shared library build after babef908cc1 (D114845) and ↵Noah Shutty1-0/+2
39ed08f8d452.
2022-07-06[llvm] [Debuginfod] DebuginfodCollection and DebuginfodServer for tracking ↵Noah Shutty2-5/+311
local debuginfo. This library implements the class `DebuginfodCollection`, which scans a set of directories for binaries, classifying them according to whether they contain debuginfo. This also provides the `DebuginfodServer`, an `HTTPServer` which serves debuginfod's `/debuginfo` and `/executable` endpoints. This is intended as the final new supporting library required for `llvm-debuginfod`. As implemented here, `DebuginfodCollection` only finds ELF binaries and DWARF debuginfo. All other files are ignored. However, the class interface is format-agnostic. Generalizing to support other platforms will require refactoring of LLVM's object parsing libraries to eliminate use of `report_fatal_error` ([[ https://github.com/llvm/llvm-project/blob/main/llvm/lib/Object/WasmObjectFile.cpp#L74 | e.g. when reading WASM files ]]), so that the debuginfod daemon does not crash when it encounters a malformed file on the disk. The `DebuginfodCollection` is tested by end-to-end tests of the debuginfod server (D114846). Reviewed By: mysterymath Differential Revision: https://reviews.llvm.org/D114845
2022-07-06[llvm] [Debuginfod] Add HTTP Server to Debuginfod library.Noah Shutty2-0/+195
This provides a minimal HTTP server interface and an implementation wrapping [[ https://github.com/yhirose/cpp-httplib | cpp-httplib ]] in the Debuginfod library. If the Curl HTTP client is available (D112753) the server is tested by pinging it with the client. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D114415
2022-03-21Fix buildbot failures from 7917b3c6.Daniel Thornburgh1-1/+2
2022-03-21[Debuginfod] Don't depend on Content-Length.Daniel Thornburgh2-93/+54
The present implementation of debuginfod lookups requires the Content-Length field to be populated in the HTTP server response. Unfortunately, Content-Length is optional, and there are some real scenarios where it's missing. (For example, a Google Cloud Storage server doing on-the-fly gunzipping.) This changes the debuginfod response handler to directly stream the output to the cache file as it is received. In addition to allowing lookups to proceed without a Content-Lenght, it seems somewhat more straightforward to implement, and it allows the disk I/O to be interleaved with the network I/O. Reviewed By: noajshu Differential Revision: https://reviews.llvm.org/D121720