summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/PathMappingList.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-03-14 22:52:17 +0000
committerGreg Clayton <gclayton@apple.com>2013-03-14 22:52:17 +0000
commit4a89501f820d6472e680f8187e3fe30a6559f140 (patch)
tree59e7087b9575861f98dfdbe8bc97256ed2d404b8 /lldb/source/Target/PathMappingList.cpp
parent5cdc1937cc5f72bb99c043cd84dca6057cad4f78 (diff)
downloadbcm5719-llvm-4a89501f820d6472e680f8187e3fe30a6559f140.tar.gz
bcm5719-llvm-4a89501f820d6472e680f8187e3fe30a6559f140.zip
<rdar://problem/12537646>
lldb remembers not-found source file, setting target.source-map doesn't make it re-check for it. Now this is fixed. Each time the source path remappings get updated, the modification ID in the PathMappingList gets bumped and then we know the re-check for sources. llvm-svn: 177125
Diffstat (limited to 'lldb/source/Target/PathMappingList.cpp')
-rw-r--r--lldb/source/Target/PathMappingList.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp
index b6a7bca1774..db23a0b2713 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -28,18 +28,17 @@ using namespace lldb_private;
PathMappingList::PathMappingList () :
m_pairs (),
m_callback (NULL),
- m_callback_baton (NULL)
+ m_callback_baton (NULL),
+ m_mod_id (0)
{
}
-PathMappingList::PathMappingList
-(
- ChangedCallback callback,
- void *callback_baton
-) :
+PathMappingList::PathMappingList (ChangedCallback callback,
+ void *callback_baton) :
m_pairs (),
m_callback (callback),
- m_callback_baton (callback_baton)
+ m_callback_baton (callback_baton),
+ m_mod_id (0)
{
}
@@ -47,7 +46,8 @@ PathMappingList::PathMappingList
PathMappingList::PathMappingList (const PathMappingList &rhs) :
m_pairs (rhs.m_pairs),
m_callback (NULL),
- m_callback_baton (NULL)
+ m_callback_baton (NULL),
+ m_mod_id (0)
{
}
@@ -60,6 +60,7 @@ PathMappingList::operator =(const PathMappingList &rhs)
m_pairs = rhs.m_pairs;
m_callback = NULL;
m_callback_baton = NULL;
+ m_mod_id = rhs.m_mod_id;
}
return *this;
}
@@ -77,6 +78,7 @@ PathMappingList::Append (const ConstString &path,
const ConstString &replacement,
bool notify)
{
+ ++m_mod_id;
m_pairs.push_back(pair(path, replacement));
if (notify && m_callback)
m_callback (*this, m_callback_baton);
@@ -85,6 +87,7 @@ PathMappingList::Append (const ConstString &path,
void
PathMappingList::Append (const PathMappingList &rhs, bool notify)
{
+ ++m_mod_id;
if (!rhs.m_pairs.empty())
{
const_iterator pos, end = rhs.m_pairs.end();
@@ -101,6 +104,7 @@ PathMappingList::Insert (const ConstString &path,
uint32_t index,
bool notify)
{
+ ++m_mod_id;
iterator insert_iter;
if (index >= m_pairs.size())
insert_iter = m_pairs.end();
@@ -120,6 +124,7 @@ PathMappingList::Replace (const ConstString &path,
iterator insert_iter;
if (index >= m_pairs.size())
return false;
+ ++m_mod_id;
m_pairs[index] = pair(path, replacement);
if (notify && m_callback)
m_callback (*this, m_callback_baton);
@@ -132,6 +137,7 @@ PathMappingList::Remove (off_t index, bool notify)
if (index >= m_pairs.size())
return false;
+ ++m_mod_id;
iterator iter = m_pairs.begin() + index;
m_pairs.erase(iter);
if (notify && m_callback)
@@ -164,6 +170,8 @@ PathMappingList::Dump (Stream *s, int pair_index)
void
PathMappingList::Clear (bool notify)
{
+ if (!m_pairs.empty())
+ ++m_mod_id;
m_pairs.clear();
if (notify && m_callback)
m_callback (*this, m_callback_baton);
@@ -255,6 +263,7 @@ PathMappingList::Replace (const ConstString &path, const ConstString &new_path,
uint32_t idx = FindIndexForPath (path);
if (idx < m_pairs.size())
{
+ ++m_mod_id;
m_pairs[idx].second = new_path;
if (notify && m_callback)
m_callback (*this, m_callback_baton);
@@ -269,6 +278,7 @@ PathMappingList::Remove (const ConstString &path, bool notify)
iterator pos = FindIteratorForPath (path);
if (pos != m_pairs.end())
{
+ ++m_mod_id;
m_pairs.erase (pos);
if (notify && m_callback)
m_callback (*this, m_callback_baton);
OpenPOWER on IntegriCloud