LLDB mainline
|
#include <PathMappingList.h>
Public Types | |
typedef void(* | ChangedCallback) (const PathMappingList &path_list, void *baton) |
Public Member Functions | |
PathMappingList () | |
PathMappingList (ChangedCallback callback, void *callback_baton) | |
PathMappingList (const PathMappingList &rhs) | |
~PathMappingList () | |
const PathMappingList & | operator= (const PathMappingList &rhs) |
void | Append (llvm::StringRef path, llvm::StringRef replacement, bool notify) |
void | Append (const PathMappingList &rhs, bool notify) |
bool | AppendUnique (llvm::StringRef path, llvm::StringRef replacement, bool notify) |
Append <path, replacement> pair without duplication. | |
void | Clear (bool notify) |
void | Dump (Stream *s, int pair_index=-1) |
llvm::json::Value | ToJSON () |
bool | IsEmpty () const |
size_t | GetSize () const |
bool | GetPathsAtIndex (uint32_t idx, ConstString &path, ConstString &new_path) const |
void | Insert (llvm::StringRef path, llvm::StringRef replacement, uint32_t insert_idx, bool notify) |
bool | Remove (size_t index, bool notify) |
bool | Remove (ConstString path, bool notify) |
bool | Replace (llvm::StringRef path, llvm::StringRef replacement, bool notify) |
bool | Replace (llvm::StringRef path, llvm::StringRef replacement, uint32_t index, bool notify) |
bool | RemapPath (ConstString path, ConstString &new_path) const |
std::optional< FileSpec > | RemapPath (llvm::StringRef path, bool only_if_exists=false) const |
Remaps a source file given path into new_path. | |
bool | RemapPath (const char *, std::string &) const =delete |
std::optional< llvm::StringRef > | ReverseRemapPath (const FileSpec &file, FileSpec &fixed) const |
Perform reverse source path remap for input file. | |
std::optional< FileSpec > | FindFile (const FileSpec &orig_spec) const |
Finds a source file given a file spec using the path remappings. | |
uint32_t | FindIndexForPath (llvm::StringRef path) const |
uint32_t | GetModificationID () const |
Protected Types | |
typedef std::pair< ConstString, ConstString > | pair |
typedef std::vector< pair > | collection |
typedef collection::iterator | iterator |
typedef collection::const_iterator | const_iterator |
Protected Member Functions | |
iterator | FindIteratorForPath (ConstString path) |
const_iterator | FindIteratorForPath (ConstString path) const |
Protected Attributes | |
std::recursive_mutex | m_mutex |
collection | m_pairs |
ChangedCallback | m_callback = nullptr |
void * | m_callback_baton = nullptr |
uint32_t | m_mod_id = 0 |
Definition at line 23 of file PathMappingList.h.
typedef void(* lldb_private::PathMappingList::ChangedCallback) (const PathMappingList &path_list, void *baton) |
Definition at line 25 of file PathMappingList.h.
|
protected |
Definition at line 147 of file PathMappingList.h.
|
protected |
Definition at line 149 of file PathMappingList.h.
|
protected |
Definition at line 148 of file PathMappingList.h.
|
protected |
Definition at line 146 of file PathMappingList.h.
PathMappingList::PathMappingList | ( | ) |
Definition at line 41 of file PathMappingList.cpp.
PathMappingList::PathMappingList | ( | ChangedCallback | callback, |
void * | callback_baton | ||
) |
Definition at line 43 of file PathMappingList.cpp.
PathMappingList::PathMappingList | ( | const PathMappingList & | rhs | ) |
Definition at line 46 of file PathMappingList.cpp.
|
default |
void PathMappingList::Append | ( | const PathMappingList & | rhs, |
bool | notify | ||
) |
Definition at line 71 of file PathMappingList.cpp.
References m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
void PathMappingList::Append | ( | llvm::StringRef | path, |
llvm::StringRef | replacement, | ||
bool | notify | ||
) |
Definition at line 62 of file PathMappingList.cpp.
References m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
Referenced by AppendUnique(), CommandObjectTargetModulesSearchPathsAdd::DoExecute(), GetModuleSpecInfoFromUUIDDictionary(), lldb_private::Module::RegisterXcodeSDK(), lldb_private::OptionValuePathMappings::SetValueFromString(), and lldb_private::ModuleListProperties::UpdateSymlinkMappings().
bool PathMappingList::AppendUnique | ( | llvm::StringRef | path, |
llvm::StringRef | replacement, | ||
bool | notify | ||
) |
Append <path, replacement> pair without duplication.
Definition at line 83 of file PathMappingList.cpp.
References Append(), m_mutex, and m_pairs.
Referenced by lldb_private::BreakpointResolverFileLine::DeduceSourceMapping().
void PathMappingList::Clear | ( | bool | notify | ) |
Definition at line 167 of file PathMappingList.cpp.
References m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
Referenced by lldb_private::ModuleSpec::Clear(), lldb_private::OptionValuePathMappings::Clear(), lldb_private::Target::Destroy(), CommandObjectTargetModulesSearchPathsClear::DoExecute(), lldb_private::OptionValuePathMappings::SetValueFromString(), and lldb_private::ModuleListProperties::UpdateSymlinkMappings().
void PathMappingList::Dump | ( | Stream * | s, |
int | pair_index = -1 |
||
) |
Definition at line 139 of file PathMappingList.cpp.
References m_mutex, m_pairs, and lldb_private::Stream::Printf().
Referenced by CommandObjectTargetModulesSearchPathsList::DoExecute(), and lldb_private::OptionValuePathMappings::DumpValue().
Finds a source file given a file spec using the path remappings.
Tries to resolve orig_spec by checking the path remappings. It makes sure the file exists by checking with the file system, so this call can be expensive if the remappings are on a network or are even on the local file system, so use this function sparingly (not in a tight debug info parsing loop).
[in] | orig_spec | The original source file path to try and remap. |
Definition at line 254 of file PathMappingList.cpp.
References lldb_private::FileSpec::GetPath(), and RemapPath().
Referenced by lldb_private::Module::FindSourceFile().
uint32_t PathMappingList::FindIndexForPath | ( | llvm::StringRef | path | ) | const |
Definition at line 331 of file PathMappingList.cpp.
References m_mutex, m_pairs, and UINT32_MAX.
Referenced by Replace().
|
protected |
Definition at line 307 of file PathMappingList.cpp.
References m_mutex, and m_pairs.
Referenced by Remove().
|
protected |
Definition at line 293 of file PathMappingList.cpp.
|
inline |
Definition at line 139 of file PathMappingList.h.
bool PathMappingList::GetPathsAtIndex | ( | uint32_t | idx, |
ConstString & | path, | ||
ConstString & | new_path | ||
) | const |
Definition at line 320 of file PathMappingList.cpp.
References m_mutex, and m_pairs.
Referenced by CommandObjectTargetModulesSearchPathsInsert::HandleArgumentCompletion().
|
inline |
Definition at line 60 of file PathMappingList.h.
References m_mutex, and m_pairs.
Referenced by SymbolVendorMacOSX::CreateInstance(), lldb_private::OptionValuePathMappings::DumpValue(), lldb_private::Target::GetOrCreateModule(), CommandObjectTargetModulesSearchPathsInsert::HandleArgumentCompletion(), and lldb_private::OptionValuePathMappings::SetValueFromString().
void PathMappingList::Insert | ( | llvm::StringRef | path, |
llvm::StringRef | replacement, | ||
uint32_t | insert_idx, | ||
bool | notify | ||
) |
Definition at line 97 of file PathMappingList.cpp.
References m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
Referenced by CommandObjectTargetModulesSearchPathsInsert::DoExecute(), and lldb_private::OptionValuePathMappings::SetValueFromString().
|
inline |
Definition at line 55 of file PathMappingList.h.
const PathMappingList & PathMappingList::operator= | ( | const PathMappingList & | rhs | ) |
Definition at line 49 of file PathMappingList.cpp.
References m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
|
delete |
bool PathMappingList::RemapPath | ( | ConstString | path, |
ConstString & | new_path | ||
) | const |
Definition at line 176 of file PathMappingList.cpp.
References lldb_private::ConstString::GetStringRef(), RemapPath(), and lldb_private::ConstString::SetString().
Referenced by CommandObjectTargetModulesSearchPathsQuery::DoExecute(), FindFile(), lldb_private::Target::GetOrCreateModule(), RemapPath(), and lldb_private::Module::RemapSourceFile().
std::optional< FileSpec > PathMappingList::RemapPath | ( | llvm::StringRef | path, |
bool | only_if_exists = false |
||
) | const |
Remaps a source file given path into new_path.
Remaps path if any source remappings match. This function does NOT stat the file system so it can be used in tight loops where debug info is being parsed.
[in] | path | The original source file path to try and remap. |
[in] | only_if_exists | If true, besides matching path with the remapping rules, this tries to check with the filesystem that the remapped file exists. If no valid file is found, std::nullopt is returned. This might be expensive, specially on a network. |
If false, then the existence of the returned remapping is not checked.
Definition at line 197 of file PathMappingList.cpp.
References AppendPathComponents(), lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolNo, lldb_private::eLazyBoolYes, lldb_private::FileSpec::GuessPathStyle(), lldb_private::FileSystem::Instance(), lldb_private::FileSpec::IsRelative(), m_mutex, and m_pairs.
bool PathMappingList::Remove | ( | ConstString | path, |
bool | notify | ||
) |
Definition at line 279 of file PathMappingList.cpp.
References FindIteratorForPath(), m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
bool PathMappingList::Remove | ( | size_t | index, |
bool | notify | ||
) |
Definition at line 124 of file PathMappingList.cpp.
References m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
Referenced by lldb_private::OptionValuePathMappings::SetValueFromString().
bool PathMappingList::Replace | ( | llvm::StringRef | path, |
llvm::StringRef | replacement, | ||
bool | notify | ||
) |
Definition at line 265 of file PathMappingList.cpp.
References FindIndexForPath(), m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
Referenced by lldb_private::Module::RegisterXcodeSDK(), and lldb_private::OptionValuePathMappings::SetValueFromString().
bool PathMappingList::Replace | ( | llvm::StringRef | path, |
llvm::StringRef | replacement, | ||
uint32_t | index, | ||
bool | notify | ||
) |
Definition at line 112 of file PathMappingList.cpp.
References m_callback, m_callback_baton, m_mod_id, m_mutex, and m_pairs.
std::optional< llvm::StringRef > PathMappingList::ReverseRemapPath | ( | const FileSpec & | file, |
FileSpec & | fixed | ||
) | const |
Perform reverse source path remap for input file.
Source maps contains a list of <from_original_path, to_new_path> mappings. Reverse remap means locating a matching entry prefix using "to_new_path" part and replacing it with "from_original_path" part if found.
[in] | file | The source path to reverse remap. |
[in] | fixed | The reversed mapped new path. |
Definition at line 235 of file PathMappingList.cpp.
References AppendPathComponents(), lldb_private::FileSpec::GetPath(), lldb_private::FileSpec::GuessPathStyle(), m_mutex, m_pairs, and lldb_private::FileSpec::SetFile().
Referenced by lldb_private::Target::CreateBreakpoint().
llvm::json::Value PathMappingList::ToJSON | ( | ) |
Definition at line 156 of file PathMappingList.cpp.
References m_mutex, and m_pairs.
Referenced by lldb_private::OptionValuePathMappings::ToJSON().
|
protected |
Definition at line 156 of file PathMappingList.h.
Referenced by Append(), Clear(), Insert(), operator=(), Remove(), and Replace().
|
protected |
Definition at line 157 of file PathMappingList.h.
Referenced by Append(), Clear(), Insert(), operator=(), Remove(), and Replace().
|
protected |
Definition at line 158 of file PathMappingList.h.
Referenced by Append(), Clear(), GetModificationID(), Insert(), operator=(), Remove(), and Replace().
|
mutableprotected |
Definition at line 145 of file PathMappingList.h.
Referenced by Append(), AppendUnique(), Clear(), Dump(), FindIndexForPath(), FindIteratorForPath(), GetModificationID(), GetPathsAtIndex(), GetSize(), Insert(), IsEmpty(), operator=(), RemapPath(), Remove(), Replace(), ReverseRemapPath(), and ToJSON().
|
protected |
Definition at line 155 of file PathMappingList.h.
Referenced by Append(), AppendUnique(), Clear(), Dump(), FindIndexForPath(), FindIteratorForPath(), GetPathsAtIndex(), GetSize(), Insert(), IsEmpty(), operator=(), RemapPath(), Remove(), Replace(), ReverseRemapPath(), and ToJSON().