diff options
Diffstat (limited to 'lldb/source/API/SBTarget.cpp')
| -rw-r--r-- | lldb/source/API/SBTarget.cpp | 132 |
1 files changed, 116 insertions, 16 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 74580c431e2..fa074b24737 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -766,6 +766,49 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex, return sb_bp; } +uint32_t +SBTarget::GetNumBreakpoints () const +{ + if (m_opaque_sp) + { + // The breakpoint list is thread safe, no need to lock + return m_opaque_sp->GetBreakpointList().GetSize(); + } + return 0; +} + +SBBreakpoint +SBTarget::GetBreakpointAtIndex (uint32_t idx) const +{ + SBBreakpoint sb_breakpoint; + if (m_opaque_sp) + { + // The breakpoint list is thread safe, no need to lock + *sb_breakpoint = m_opaque_sp->GetBreakpointList().GetBreakpointAtIndex(idx); + } + return sb_breakpoint; +} + +bool +SBTarget::BreakpointDelete (break_id_t bp_id) +{ + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + bool result = false; + if (m_opaque_sp) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + result = m_opaque_sp->RemoveBreakpointByID (bp_id); + } + + if (log) + { + log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) bp_id, result); + } + + return result; +} + SBBreakpoint SBTarget::FindBreakpointByID (break_id_t bp_id) { @@ -787,31 +830,67 @@ SBTarget::FindBreakpointByID (break_id_t bp_id) return sb_breakpoint; } +bool +SBTarget::EnableAllBreakpoints () +{ + if (m_opaque_sp) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + m_opaque_sp->EnableAllBreakpoints (); + return true; + } + return false; +} + +bool +SBTarget::DisableAllBreakpoints () +{ + if (m_opaque_sp) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + m_opaque_sp->DisableAllBreakpoints (); + return true; + } + return false; +} + +bool +SBTarget::DeleteAllBreakpoints () +{ + if (m_opaque_sp) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + m_opaque_sp->RemoveAllBreakpoints (); + return true; + } + return false; +} + uint32_t -SBTarget::GetNumBreakpoints () const +SBTarget::GetNumWatchpointLocations () const { if (m_opaque_sp) { // The breakpoint list is thread safe, no need to lock - return m_opaque_sp->GetBreakpointList().GetSize(); + return m_opaque_sp->GetWatchpointLocationList().GetSize(); } return 0; } -SBBreakpoint -SBTarget::GetBreakpointAtIndex (uint32_t idx) const +SBWatchpointLocation +SBTarget::GetWatchpointLocationAtIndex (uint32_t idx) const { - SBBreakpoint sb_breakpoint; + SBWatchpointLocation sb_watchpoint_location; if (m_opaque_sp) { // The breakpoint list is thread safe, no need to lock - *sb_breakpoint = m_opaque_sp->GetBreakpointList().GetBreakpointAtIndex(idx); + *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().GetByIndex(idx); } - return sb_breakpoint; + return sb_watchpoint_location; } bool -SBTarget::BreakpointDelete (break_id_t bp_id) +SBTarget::WatchpointLocationDelete (watch_id_t wp_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -819,48 +898,69 @@ SBTarget::BreakpointDelete (break_id_t bp_id) if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - result = m_opaque_sp->RemoveBreakpointByID (bp_id); + result = m_opaque_sp->RemoveWatchpointLocationByID (wp_id); } if (log) { - log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) bp_id, result); + log->Printf ("SBTarget(%p)::WatchpointLocationDelete (wp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) wp_id, result); } return result; } +SBWatchpointLocation +SBTarget::FindWatchpointLocationByID (watch_id_t wp_id) +{ + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + SBWatchpointLocation sb_watchpoint_location; + if (m_opaque_sp && wp_id != LLDB_INVALID_WATCH_ID) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); + } + + if (log) + { + log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpointLocation(%p)", + m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint_location.get()); + } + + return sb_watchpoint_location; +} + bool -SBTarget::EnableAllBreakpoints () +SBTarget::EnableAllWatchpointLocations () { if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - m_opaque_sp->EnableAllBreakpoints (); + m_opaque_sp->EnableAllWatchpointLocations (); return true; } return false; } bool -SBTarget::DisableAllBreakpoints () +SBTarget::DisableAllWatchpointLocations () { if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - m_opaque_sp->DisableAllBreakpoints (); + m_opaque_sp->DisableAllWatchpointLocations (); return true; } return false; } bool -SBTarget::DeleteAllBreakpoints () +SBTarget::DeleteAllWatchpointLocations () { if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - m_opaque_sp->RemoveAllBreakpoints (); + m_opaque_sp->RemoveAllWatchpointLocations (); return true; } return false; |

