9#ifndef LLDB_CORE_MODULESPEC_H
10#define LLDB_CORE_MODULESPEC_H
22#include "llvm/Support/Chrono.h"
178 explicit operator bool()
const {
201 bool dumped_something =
false;
206 dumped_something =
true;
209 if (dumped_something)
214 dumped_something =
true;
217 if (dumped_something)
222 dumped_something =
true;
225 if (dumped_something)
229 dumped_something =
true;
232 if (dumped_something)
236 dumped_something =
true;
239 if (dumped_something)
242 dumped_something =
true;
245 if (dumped_something)
248 dumped_something =
true;
251 if (dumped_something)
254 dumped_something =
true;
257 if (dumped_something)
259 strm.
Format(
"object_mod_time = {0:x+}",
261 dumped_something =
true;
264 if (dumped_something)
267 dumped_something =
true;
272 bool exact_arch_match)
const {
293 if (exact_arch_match) {
343 std::lock_guard<std::recursive_mutex> lhs_guard(
m_mutex);
344 std::lock_guard<std::recursive_mutex> rhs_guard(rhs.
m_mutex);
353 std::lock_guard<std::recursive_mutex> lhs_guard(
m_mutex, std::adopt_lock);
354 std::lock_guard<std::recursive_mutex> rhs_guard(rhs.
m_mutex,
362 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
367 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
372 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
377 std::lock_guard<std::recursive_mutex> lhs_guard(
m_mutex);
378 std::lock_guard<std::recursive_mutex> rhs_guard(rhs.
m_mutex);
387 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
398 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
399 bool exact_arch_match =
true;
401 if (spec.Matches(module_spec, exact_arch_match)) {
402 match_module_spec = spec;
409 exact_arch_match =
false;
411 if (spec.Matches(module_spec, exact_arch_match)) {
412 match_module_spec = spec;
417 match_module_spec.
Clear();
423 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
424 bool exact_arch_match =
true;
425 const size_t initial_match_count = matching_list.
GetSize();
427 if (spec.Matches(module_spec, exact_arch_match))
428 matching_list.
Append(spec);
434 (initial_match_count == matching_list.
GetSize())) {
435 exact_arch_match =
false;
437 if (spec.Matches(module_spec, exact_arch_match))
438 matching_list.
Append(spec);
444 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
447 strm.
Printf(
"[%u] ", idx);
An architecture specification class.
A uniqued constant string class.
static bool Match(const FileSpec &pattern, const FileSpec &file)
Match FileSpec pattern against FileSpec file.
static FileSystem & Instance()
std::recursive_mutex m_mutex
ModuleSpecList & operator=(const ModuleSpecList &rhs)
collection m_specs
The collection of modules.
std::vector< ModuleSpec > collection
ModuleSpecIterable ModuleSpecs()
~ModuleSpecList()=default
bool GetModuleSpecAtIndex(size_t i, ModuleSpec &module_spec) const
void Append(const ModuleSpec &spec)
bool FindMatchingModuleSpec(const ModuleSpec &module_spec, ModuleSpec &match_module_spec) const
LockingAdaptedIterable< std::recursive_mutex, collection > ModuleSpecIterable
ModuleSpecList(const ModuleSpecList &rhs)
ModuleSpec & GetModuleSpecRefAtIndex(size_t i)
void Append(const ModuleSpecList &rhs)
void FindMatchingModuleSpecs(const ModuleSpec &module_spec, ModuleSpecList &matching_list) const
PathMappingList & GetSourceMappingList() const
void SetPlatform(lldb::PlatformSP platform)
Set the platform to be used when resolving a module.
const UUID & GetUUID() const
void SetObjectSize(uint64_t object_size)
uint64_t GetObjectOffset() const
void SetLoadAddress(lldb::addr_t addr)
Set the load address of a module in process memory.
lldb::DataExtractorSP m_extractor_sp
void Dump(Stream &strm) const
const ArchSpec * GetArchitecturePtr() const
bool Matches(const ModuleSpec &match_module_spec, bool exact_arch_match) const
ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
ConstString & GetObjectName()
std::weak_ptr< Target > m_target_wp
The target used when resolving a module.
FileSpec & GetPlatformFileSpec()
PathMappingList m_source_mappings
const FileSpec * GetSymbolFileSpecPtr() const
FileSpec * GetSymbolFileSpecPtr()
const FileSpec * GetFileSpecPtr() const
const FileSpec & GetPlatformFileSpec() const
const FileSpec * GetPlatformFileSpecPtr() const
FileSpec * GetPlatformFileSpecPtr()
lldb::PlatformSP GetPlatformSP() const
ArchSpec & GetArchitecture()
void SetObjectOffset(uint64_t object_offset)
FileSpec * GetFileSpecPtr()
FileSpec & GetSymbolFileSpec()
const FileSpec & GetFileSpec() const
const ArchSpec & GetArchitecture() const
const UUID * GetUUIDPtr() const
std::weak_ptr< Platform > m_platform_wp
The platform used when resolving a module.
llvm::sys::TimePoint & GetObjectModificationTime()
lldb::DataExtractorSP GetExtractor() const
ArchSpec * GetArchitecturePtr()
void SetTarget(lldb::TargetSP target)
Set the target to be used when resolving a module.
ConstString m_object_name
const FileSpec & GetSymbolFileSpec() const
std::optional< lldb::addr_t > m_load_addr
The load address of the module in a process.
ConstString GetObjectName() const
llvm::sys::TimePoint m_object_mod_time
const llvm::sys::TimePoint & GetObjectModificationTime() const
uint64_t GetObjectSize() const
lldb::TargetSP GetTargetSP() const
ModuleSpec(const FileSpec &file_spec, const UUID &uuid=UUID(), lldb::DataExtractorSP extractor_sp=lldb::DataExtractorSP())
If the extractor_sp argument is passed, its contents will be used as the module contents instead of t...
std::optional< lldb::addr_t > GetLoadAddress() const
Get the load address of a module in process memory.
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
Forwards the arguments to llvm::formatv and writes to the stream.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
Represents UUID's of various sizes.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Platform > PlatformSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP