diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 25 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 6 |
2 files changed, 28 insertions, 3 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index fa074b24737..f4ad92dc027 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -871,19 +871,40 @@ SBTarget::GetNumWatchpointLocations () const { if (m_opaque_sp) { - // The breakpoint list is thread safe, no need to lock + // The watchpoint location list is thread safe, no need to lock return m_opaque_sp->GetWatchpointLocationList().GetSize(); } return 0; } SBWatchpointLocation +SBTarget::GetLastCreatedWatchpointLocation () +{ + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + SBWatchpointLocation sb_watchpoint_location; + if (m_opaque_sp) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + sb_watchpoint_location = m_opaque_sp->GetLastCreatedWatchpointLocation(); + } + + if (log) + { + log->Printf ("SBTarget(%p)::GetLastCreateWatchpointLocation () => SBWatchpointLocation(%p)", + m_opaque_sp.get(), sb_watchpoint_location.get()); + } + + return sb_watchpoint_location; +} + +SBWatchpointLocation SBTarget::GetWatchpointLocationAtIndex (uint32_t idx) const { SBWatchpointLocation sb_watchpoint_location; if (m_opaque_sp) { - // The breakpoint list is thread safe, no need to lock + // The watchpoint location list is thread safe, no need to lock *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().GetByIndex(idx); } return sb_watchpoint_location; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 6a742c28e59..7209382c789 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -167,6 +167,7 @@ Target::Destroy() m_breakpoint_list.RemoveAll(notify); m_internal_breakpoint_list.RemoveAll(notify); m_last_created_breakpoint.reset(); + m_last_created_watchpoint_location.reset(); m_search_filter_sp.reset(); m_image_search_paths.Clear(notify); m_scratch_ast_context_ap.reset(); @@ -452,7 +453,10 @@ Target::CreateWatchpointLocation(lldb::addr_t addr, size_t size, uint32_t type) rc.Success() ? "succeeded" : "failed", wp_loc_sp->GetID()); - if (rc.Fail()) wp_loc_sp.reset(); + if (rc.Fail()) + wp_loc_sp.reset(); + else + m_last_created_watchpoint_location = wp_loc_sp; return wp_loc_sp; } |