diff options
| author | Greg Clayton <gclayton@apple.com> | 2011-04-23 02:04:55 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2011-04-23 02:04:55 +0000 |
| commit | 7e14f91dbd0c651e2add6384da4e88f510919822 (patch) | |
| tree | 6f6eff5c7bd830b2a2bc09026409de248cb4414a /lldb/source/Target/PathMappingList.cpp | |
| parent | 3d2185ba82ddf4f4a792b4c846390d8c445be311 (diff) | |
| download | bcm5719-llvm-7e14f91dbd0c651e2add6384da4e88f510919822.tar.gz bcm5719-llvm-7e14f91dbd0c651e2add6384da4e88f510919822.zip | |
Fixed the SymbolContext::DumpStopContext() to correctly indent and dump
inline contexts when the deepest most block is not inlined.
Added source path remappings to the lldb_private::Target class that allow it
to remap paths found in debug info so we can find source files that are elsewhere
on the current system.
Fixed disassembly by function name to disassemble inline functions that are
inside other functions much better and to show enough context before the
disassembly output so you can tell where things came from.
Added the ability to get more than one address range from a SymbolContext
class for the case where a block or function has discontiguous address ranges.
llvm-svn: 130044
Diffstat (limited to 'lldb/source/Target/PathMappingList.cpp')
| -rw-r--r-- | lldb/source/Target/PathMappingList.cpp | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index 23eea225900..506742220b1 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -33,6 +33,28 @@ PathMappingList::PathMappingList { } + +PathMappingList::PathMappingList (const PathMappingList &rhs) : + m_pairs (rhs.m_pairs), + m_callback (NULL), + m_callback_baton (NULL) +{ + +} + +const PathMappingList & +PathMappingList::operator =(const PathMappingList &rhs) +{ + if (this != &rhs) + { + m_pairs = rhs.m_pairs; + m_callback = NULL; + m_callback_baton = NULL; + } + return *this; +} + + //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- @@ -124,3 +146,91 @@ PathMappingList::RemapPath (const ConstString &path, ConstString &new_path) } return false; } + +bool +PathMappingList::Replace (const ConstString &path, const ConstString &new_path, bool notify) +{ + uint32_t idx = FindIndexForPath (path); + if (idx < m_pairs.size()) + { + m_pairs[idx].second = new_path; + if (notify && m_callback) + m_callback (*this, m_callback_baton); + return true; + } + return false; +} + +bool +PathMappingList::Remove (const ConstString &path, bool notify) +{ + iterator pos = FindIteratorForPath (path); + if (pos != m_pairs.end()) + { + m_pairs.erase (pos); + if (notify && m_callback) + m_callback (*this, m_callback_baton); + return true; + } + return false; +} + +PathMappingList::const_iterator +PathMappingList::FindIteratorForPath (const ConstString &path) const +{ + const_iterator pos; + const_iterator begin = m_pairs.begin(); + const_iterator end = m_pairs.end(); + + for (pos = begin; pos != end; ++pos) + { + if (pos->first == path) + break; + } + return pos; +} + +PathMappingList::iterator +PathMappingList::FindIteratorForPath (const ConstString &path) +{ + iterator pos; + iterator begin = m_pairs.begin(); + iterator end = m_pairs.end(); + + for (pos = begin; pos != end; ++pos) + { + if (pos->first == path) + break; + } + return pos; +} + +bool +PathMappingList::GetPathsAtIndex (uint32_t idx, ConstString &path, ConstString &new_path) const +{ + if (idx < m_pairs.size()) + { + path = m_pairs[idx].first; + new_path = m_pairs[idx].second; + return true; + } + return false; +} + + + +uint32_t +PathMappingList::FindIndexForPath (const ConstString &path) const +{ + const_iterator pos; + const_iterator begin = m_pairs.begin(); + const_iterator end = m_pairs.end(); + + for (pos = begin; pos != end; ++pos) + { + if (pos->first == path) + return std::distance (begin, pos); + } + return UINT32_MAX; +} + |

