Commit Graph

10 Commits

Author SHA1 Message Date
Daniel Thornburgh 7917b3c695 [Debuginfod] Don't depend on Content-Length.
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
2022-03-21 17:27:45 +00:00
Daniel Thornburgh 4a6553f4c2 [Debuginfod] [Symbolizer] Break debuginfod out of libLLVM.
Debuginfod can pull in libcurl as a dependency, which isn't appropriate
for libLLVM. (See
https://gitlab.freedesktop.org/mesa/mesa/-/issues/5732).

This change breaks out debuginfod into a separate non-component library
that can be used directly in llvm-symbolizer. The tool can inject
debuginfod into the Symbolizer library via an abstract DebugInfoFetcher
interface, breaking the dependency of Symbolizer on debuinfod.

See https://github.com/llvm/llvm-project/issues/52731

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D118413
2022-02-08 19:14:18 +00:00
Daniel Thornburgh 6b92bb4790 [Support] [DebugInfo] Lazily create cache dir.
This change defers creating Support/Caching.cpp's cache directory until
it actually writes to the cache.

This allows using Caching library in a read-only fashion. If read-only,
the cache is guaranteed not to write to disk. This keeps tools using
DebugInfod (currently llvm-symbolizer) hermetic when not configured to
perform remote lookups.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D117589
2022-01-20 19:27:15 +00:00
Noah Shutty 3d595eccc7 [Debuginfod] Fix debuginfod unit test when $HOME is not writable.
The directory returned from `cache_directory` may not be writable if the unit tests are run with limited permissions (e.g. if $HOME is not writable).
This fixes a unit test of the debuginfod client to set the cache path to the system temporary directory to avoid this issue.

Reviewed By: estewart08

Differential Revision: https://reviews.llvm.org/D115813
2021-12-15 22:13:13 +00:00
Noah Shutty d9941f7454 [Support] [Debuginfod] Move HTTPClient to Debuginfod library.
Following the discussion in D112753, this moves the HTTPClient from Support to Debuginfod library so that tools depending on Support do not automatically depend on Curl as well. This also removes `HTTPClient::initialize()` and `HTTPClient::cleanup()` from `InitLLVM` so these steps should be implemented by user tools instead.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D115131
2021-12-07 01:19:21 +00:00
Noah Shutty 0e0f1b28fc [llvm] [Debuginfo] Debuginfod client library.
This adds a Debuginfod client library which queries servers specified by the `DEBUGINFOD_URLS` environment variable for the debuginfo, executable, or a specified source file associated with a given build id.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D112758
2021-12-06 21:52:38 +00:00
Noah Shutty f45c9c56c5 Revert "[llvm] [Debuginfo] Debuginfod client library."
This reverts commit 4a16fe1369 because it
caused failures on Windows builds.
2021-12-06 19:19:14 +00:00
Noah Shutty 4a16fe1369 [llvm] [Debuginfo] Debuginfod client library.
This adds a Debuginfod client library which queries servers specified by the `DEBUGINFOD_URLS` environment variable for the debuginfo, executable, or a specified source file associated with a given build id.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D112758
2021-12-06 17:52:35 +00:00
Noah Shutty b5bb05d355 Revert "[llvm] [Debuginfo] Debuginfod client library."
This reverts commit af69947e70 because it
caused buildbot failures.
2021-12-06 05:39:05 +00:00
Noah Shutty af69947e70 [llvm] [Debuginfo] Debuginfod client library.
This adds a Debuginfod library containing the `fetchDebuginfo` function which queries servers specified by the `DEBUGINFOD_URLS` environment variable for the debuginfo, executable, or a specified source file associated with a given build id.

This diff was split out from D111252.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D112758
2021-12-06 04:38:14 +00:00