35#include "llvm/ADT/SmallSet.h"
36#include "llvm/Support/FileSystem.h"
37#include "llvm/Support/ThreadPool.h"
62 return "Default symbol locator.";
75 "LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
99 return symbol_file_spec;
102 "Locating external symbol file",
105 FileSpecList debug_file_search_paths = default_search_paths;
130#if defined(__NetBSD__)
133 FileSpec file_spec(
"/usr/libdata/debug");
140 FileSpec file_spec(
"/usr/lib/debug");
148 std::string uuid_str;
154 std::transform(uuid_str.begin(), uuid_str.end(), uuid_str.begin(),
156 uuid_str.insert(2, 1,
'/');
157 uuid_str = uuid_str +
".debug";
160 size_t num_directories = debug_file_search_paths.
GetSize();
161 for (
size_t idx = 0; idx < num_directories; ++idx) {
167 std::vector<std::string> files;
168 std::string dirname = dirspec.
GetPath();
170 if (!uuid_str.empty())
171 files.push_back(dirname +
"/.build-id/" + uuid_str);
173 files.push_back(dirname +
"/" +
175 files.push_back(dirname +
"/.debug/" +
181 files.push_back(dirname + file_dir.
AsCString() +
"/" +
185 const uint32_t num_files = files.size();
186 for (
size_t idx_file = 0; idx_file < num_files; ++idx_file) {
187 const std::string &filename = files[idx_file];
191 if (llvm::sys::fs::equivalent(file_spec.
GetPath(),
197 const size_t num_specs =
200 bool valid_mspec =
false;
201 if (num_specs == 2) {
212 assert(num_specs <= 1 &&
213 "Symbol Vendor supports only a single architecture");
214 if (num_specs == 1) {
237 bool copy_executable) {
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_PLUGIN_DEFINE(PluginName)
#define LLDB_SCOPED_TIMERF(...)
An architecture specification class.
llvm::Triple & GetTriple()
Architecture triple accessor.
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
const char * GetCString() const
Get the string value as a C string.
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
size_t GetSize() const
Get the number of files in the file list.
bool AppendIfUnique(const FileSpec &file)
Append a FileSpec object if unique.
const ConstString & GetFilename() const
Filename string const get accessor.
const ConstString & GetDirectory() const
Directory string const get accessor.
bool IsAbsolute() const
Returns true if the filespec represents an absolute path.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst)
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
static ModuleListProperties & GetGlobalModuleListProperties()
bool GetModuleSpecAtIndex(size_t i, ModuleSpec &module_spec) const
bool FindMatchingModuleSpec(const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
ArchSpec & GetArchitecture()
FileSpec & GetSymbolFileSpec()
ArchSpec * GetArchitecturePtr()
static size_t GetModuleSpecifications(const FileSpec &file, lldb::offset_t file_offset, lldb::offset_t file_size, ModuleSpecList &specs, lldb::DataBufferSP data_sp=lldb::DataBufferSP())
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A Progress indicator helper class.
static llvm::StringRef GetPluginNameStatic()
static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, Status &error, bool force_lookup, bool copy_executable)
static llvm::StringRef GetPluginDescriptionStatic()
static std::optional< FileSpec > LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths)
static std::optional< ModuleSpec > LocateExecutableObjectFile(const ModuleSpec &module_spec)
static lldb_private::SymbolLocator * CreateInstance()
std::string GetAsString(llvm::StringRef separator="-") const
A class that represents a running process on the host machine.