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)",
80 exec_fspec ? exec_fspec.
GetFilename().nonEmptyOr(
"<NULL>").str().c_str()
106 return symbol_file_spec;
109 "Locating external symbol file",
112 FileSpecList debug_file_search_paths = default_search_paths;
120 llvm::StringRef file_dir = module_file_spec.
GetDirectory();
122 FileSpec file_spec(file_dir.nonEmptyOr(
"."));
137#if defined(__NetBSD__)
140 FileSpec file_spec(
"/usr/libdata/debug");
147 FileSpec file_spec(
"/usr/lib/debug");
151#if defined(__FreeBSD__)
160 mib[1] = USER_LOCALBASE;
161 if (::sysctl(mib, 2, buf, &len, NULL, 0) == 0) {
173 std::string uuid_str;
179 std::transform(uuid_str.begin(), uuid_str.end(), uuid_str.begin(),
181 uuid_str.insert(2, 1,
'/');
182 uuid_str = uuid_str +
".debug";
185 size_t num_directories = debug_file_search_paths.
GetSize();
186 for (
size_t idx = 0; idx < num_directories; ++idx) {
192 std::vector<std::string> files;
193 std::string dirname = dirspec.
GetPath();
195 if (!uuid_str.empty())
196 files.push_back(dirname +
"/.build-id/" + uuid_str);
198 files.push_back(dirname +
"/" + symbol_file_spec.
GetFilename().str());
199 files.push_back(dirname +
"/.debug/" +
204 if (!file_dir.empty())
205 files.push_back(dirname + file_dir.str() +
"/" +
209 const uint32_t num_files = files.size();
210 for (
size_t idx_file = 0; idx_file < num_files; ++idx_file) {
211 const std::string &filename = files[idx_file];
215 if (llvm::sys::fs::equivalent(file_spec.
GetPath(),
223 bool valid_mspec =
false;
236 "Symbol Vendor supports only a single architecture");
260 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.
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.
llvm::StringRef GetFilename() const
Filename string const get accessor.
bool IsAbsolute() const
Returns true if the filespec represents an absolute path.
void PrependPathComponent(llvm::StringRef component)
llvm::StringRef GetDirectory() const
Directory string const get accessor.
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
uint64_t GetObjectOffset() const
ArchSpec & GetArchitecture()
FileSpec & GetSymbolFileSpec()
lldb::DataExtractorSP GetExtractor() const
ArchSpec * GetArchitecturePtr()
uint64_t GetObjectSize() const
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.