summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBTarget.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-02-04 02:27:34 +0000
committerGreg Clayton <gclayton@apple.com>2012-02-04 02:27:34 +0000
commit81e871ed761101fb065a097b5b9351e179964d1a (patch)
tree8c23b46dff2d3d1953620bcebd77d445a2793358 /lldb/source/API/SBTarget.cpp
parentd0ba3793aab037c831a0cefeafda8398591f5497 (diff)
downloadbcm5719-llvm-81e871ed761101fb065a097b5b9351e179964d1a.tar.gz
bcm5719-llvm-81e871ed761101fb065a097b5b9351e179964d1a.zip
Convert all python objects in our API to use overload the __str__ method
instead of the __repr__. __repr__ is a function that should return an expression that can be used to recreate an python object and we were using it to just return a human readable string. Fixed a crasher when using the new implementation of SBValue::Cast(SBType). Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general improvements to the API. Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't correctly handle not having a target. llvm-svn: 149743
Diffstat (limited to 'lldb/source/API/SBTarget.cpp')
-rw-r--r--lldb/source/API/SBTarget.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 376ed78d9a7..ed667cc52ea 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -947,7 +947,7 @@ SBTarget::GetWatchpointAtIndex (uint32_t idx) const
if (target_sp)
{
// The watchpoint list is thread safe, no need to lock
- *sb_watchpoint = target_sp->GetWatchpointList().GetByIndex(idx);
+ sb_watchpoint.SetSP (target_sp->GetWatchpointList().GetByIndex(idx));
}
return sb_watchpoint;
}
@@ -979,17 +979,19 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBWatchpoint sb_watchpoint;
+ lldb::WatchpointSP watchpoint_sp;
TargetSP target_sp(GetSP());
if (target_sp && wp_id != LLDB_INVALID_WATCH_ID)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
- *sb_watchpoint = target_sp->GetWatchpointList().FindByID(wp_id);
+ watchpoint_sp = target_sp->GetWatchpointList().FindByID(wp_id);
+ sb_watchpoint.SetSP (watchpoint_sp);
}
if (log)
{
log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",
- target_sp.get(), (uint32_t) wp_id, sb_watchpoint.get());
+ target_sp.get(), (uint32_t) wp_id, watchpoint_sp.get());
}
return sb_watchpoint;
@@ -1001,19 +1003,24 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write)
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBWatchpoint sb_watchpoint;
+ lldb::WatchpointSP watchpoint_sp;
TargetSP target_sp(GetSP());
- if (target_sp)
+ if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS && size > 0)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
- uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) |
- (write ? LLDB_WATCH_TYPE_WRITE : 0);
- sb_watchpoint = target_sp->CreateWatchpoint(addr, size, watch_type);
+ uint32_t watch_type = 0;
+ if (read)
+ watch_type |= LLDB_WATCH_TYPE_READ;
+ if (write)
+ watch_type |= LLDB_WATCH_TYPE_WRITE;
+ watchpoint_sp = target_sp->CreateWatchpoint(addr, size, watch_type);
+ sb_watchpoint.SetSP (watchpoint_sp);
}
if (log)
{
log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%llx, 0x%u) => SBWatchpoint(%p)",
- target_sp.get(), addr, (uint32_t) size, sb_watchpoint.get());
+ target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get());
}
return sb_watchpoint;
OpenPOWER on IntegriCloud