26template <
typename ELFT>
27std::optional<BuildIDRef>
getBuildID(
const ELFFile<ELFT> &Obj) {
28 auto PhdrsOrErr = Obj.program_headers();
33 for (
const auto &
P : *PhdrsOrErr) {
37 for (
auto N : Obj.notes(
P, Err))
61 auto GetDebugPath = [&](
StringRef Directory) {
65 llvm::toHex(
BuildID.slice(1),
true));
69 if (DebugFileDirectories.empty()) {
71#
if defined(__NetBSD__)
80 return std::string(Path);
82 for (
const auto &Directory : DebugFileDirectories) {
86 return std::string(Path);
This file declares a library for handling Build IDs and using them to find debug info.
static ErrorSuccess success()
Create a success value.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
virtual std::optional< std::string > fetch(BuildIDRef BuildID) const
Returns the path to the debug file with the given build ID.
This class is the base class for all object file types.
constexpr const char * ELF_NOTE_GNU
std::optional< BuildIDRef > getBuildID(const ObjectFile *Obj)
Returns the build ID, if any, contained in the given object file.
bool exists(const basic_file_status &status)
Does file exist?
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
void consumeError(Error Err)
Consume a Error without doing anything.