35#include "llvm/ADT/SmallSet.h"
36#include "llvm/Support/FileSystem.h"
37#include "llvm/Support/ThreadPool.h"
39#if defined(__FreeBSD__)
40#include <sys/sysctl.h>
66 return "Default symbol locator.";
79 "LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
104 return symbol_file_spec;
107 "Locating external symbol file",
110 FileSpecList debug_file_search_paths = default_search_paths;
135#if defined(__NetBSD__)
138 FileSpec file_spec(
"/usr/libdata/debug");
145 FileSpec file_spec(
"/usr/lib/debug");
149#if defined(__FreeBSD__)
158 mib[1] = USER_LOCALBASE;
159 if (::sysctl(mib, 2, buf, &len, NULL, 0) == 0) {
171 std::string uuid_str;
177 std::transform(uuid_str.begin(), uuid_str.end(), uuid_str.begin(),
179 uuid_str.insert(2, 1,
'/');
180 uuid_str = uuid_str +
".debug";
183 size_t num_directories = debug_file_search_paths.
GetSize();
184 for (
size_t idx = 0; idx < num_directories; ++idx) {
190 std::vector<std::string> files;
191 std::string dirname = dirspec.
GetPath();
193 if (!uuid_str.empty())
194 files.push_back(dirname +
"/.build-id/" + uuid_str);
196 files.push_back(dirname +
"/" +
198 files.push_back(dirname +
"/.debug/" +
204 files.push_back(dirname + file_dir.
AsCString() +
"/" +
208 const uint32_t num_files = files.size();
209 for (
size_t idx_file = 0; idx_file < num_files; ++idx_file) {
210 const std::string &filename = files[idx_file];
214 if (llvm::sys::fs::equivalent(file_spec.
GetPath(),
222 bool valid_mspec =
false;
235 "Symbol Vendor supports only a single architecture");
259 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.
void PrependPathComponent(llvm::StringRef component)
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst)
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
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 ModuleSpecList GetModuleSpecifications(const FileSpec &file, lldb::offset_t file_offset, lldb::offset_t file_size, lldb::DataExtractorSP=lldb::DataExtractorSP())
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()
Represents UUID's of various sizes.
std::string GetAsString(llvm::StringRef separator="-") const
A class that represents a running process on the host machine.