summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBTarget.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-05-31 22:56:36 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-05-31 22:56:36 +0000
commit7385a5ae0b8d8de1ccc73552e2eb97675678f52c (patch)
tree6bb9864fea22ef95b392deb352f7e870eef85815 /lldb/source/API/SBTarget.cpp
parent7d00061d876f91f4f82343113336b5735e670460 (diff)
downloadbcm5719-llvm-7385a5ae0b8d8de1ccc73552e2eb97675678f52c.tar.gz
bcm5719-llvm-7385a5ae0b8d8de1ccc73552e2eb97675678f52c.zip
Thread-hardening the SB API calls related to watchpoint operations.
llvm-svn: 157776
Diffstat (limited to 'lldb/source/API/SBTarget.cpp')
-rw-r--r--lldb/source/API/SBTarget.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 80a152971de..d26788642ae 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1634,6 +1634,8 @@ SBTarget::DeleteWatchpoint (watch_id_t wp_id)
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ Mutex::Locker locker;
+ target_sp->GetWatchpointList().GetListMutex(locker);
result = target_sp->RemoveWatchpointByID (wp_id);
}
@@ -1656,6 +1658,8 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)
if (target_sp && wp_id != LLDB_INVALID_WATCH_ID)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ Mutex::Locker locker;
+ target_sp->GetWatchpointList().GetListMutex(locker);
watchpoint_sp = target_sp->GetWatchpointList().FindByID(wp_id);
sb_watchpoint.SetSP (watchpoint_sp);
}
@@ -1685,6 +1689,7 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write)
watch_type |= LLDB_WATCH_TYPE_READ;
if (write)
watch_type |= LLDB_WATCH_TYPE_WRITE;
+ // Target::CreateWatchpoint() is thread safe.
watchpoint_sp = target_sp->CreateWatchpoint(addr, size, watch_type);
sb_watchpoint.SetSP (watchpoint_sp);
}
@@ -1705,6 +1710,8 @@ SBTarget::EnableAllWatchpoints ()
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ Mutex::Locker locker;
+ target_sp->GetWatchpointList().GetListMutex(locker);
target_sp->EnableAllWatchpoints ();
return true;
}
@@ -1718,6 +1725,8 @@ SBTarget::DisableAllWatchpoints ()
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ Mutex::Locker locker;
+ target_sp->GetWatchpointList().GetListMutex(locker);
target_sp->DisableAllWatchpoints ();
return true;
}
@@ -1731,6 +1740,8 @@ SBTarget::DeleteAllWatchpoints ()
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ Mutex::Locker locker;
+ target_sp->GetWatchpointList().GetListMutex(locker);
target_sp->RemoveAllWatchpoints ();
return true;
}
OpenPOWER on IntegriCloud