diff options
Diffstat (limited to 'lldb/source/API')
-rw-r--r-- | lldb/source/API/SBBreakpoint.cpp | 11 | ||||
-rw-r--r-- | lldb/source/API/SBBreakpointLocation.cpp | 11 | ||||
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 11 | ||||
-rw-r--r-- | lldb/source/API/SBTarget.cpp | 8 |
4 files changed, 37 insertions, 4 deletions
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 07c0a2e..23dba46 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -275,7 +275,11 @@ void SBBreakpoint::SetCondition(const char *condition) { if (bkpt_sp) { std::lock_guard<std::recursive_mutex> guard( bkpt_sp->GetTarget().GetAPIMutex()); - bkpt_sp->SetCondition(StopCondition(condition)); + // Treat a null pointer as resetting the condition. + if (!condition) + bkpt_sp->SetCondition(StopCondition()); + else + bkpt_sp->SetCondition(StopCondition(condition)); } } @@ -288,7 +292,10 @@ const char *SBBreakpoint::GetCondition() { std::lock_guard<std::recursive_mutex> guard( bkpt_sp->GetTarget().GetAPIMutex()); - return ConstString(bkpt_sp->GetCondition().GetText()).GetCString(); + StopCondition cond = bkpt_sp->GetCondition(); + if (!cond) + return nullptr; + return ConstString(cond.GetText()).GetCString(); } void SBBreakpoint::SetAutoContinue(bool auto_continue) { diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index e786435..2feaa5c 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -160,7 +160,11 @@ void SBBreakpointLocation::SetCondition(const char *condition) { if (loc_sp) { std::lock_guard<std::recursive_mutex> guard( loc_sp->GetTarget().GetAPIMutex()); - loc_sp->SetCondition(StopCondition(condition)); + // Treat a nullptr as clearing the condition + if (!condition) + loc_sp->SetCondition(StopCondition()); + else + loc_sp->SetCondition(StopCondition(condition)); } } @@ -173,7 +177,10 @@ const char *SBBreakpointLocation::GetCondition() { std::lock_guard<std::recursive_mutex> guard( loc_sp->GetTarget().GetAPIMutex()); - return ConstString(loc_sp->GetCondition().GetText()).GetCString(); + StopCondition cond = loc_sp->GetCondition(); + if (!cond) + return nullptr; + return ConstString(cond.GetText()).GetCString(); } void SBBreakpointLocation::SetAutoContinue(bool auto_continue) { diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 603e306..5c4c653 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -983,6 +983,17 @@ uint32_t SBDebugger::GetIndexOfTarget(lldb::SBTarget target) { return m_opaque_sp->GetTargetList().GetIndexOfTarget(target.GetSP()); } +SBTarget SBDebugger::FindTargetByGloballyUniqueID(lldb::user_id_t id) { + LLDB_INSTRUMENT_VA(this, id); + SBTarget sb_target; + if (m_opaque_sp) { + // No need to lock, the target list is thread safe + sb_target.SetSP( + m_opaque_sp->GetTargetList().FindTargetByGloballyUniqueID(id)); + } + return sb_target; +} + SBTarget SBDebugger::FindTargetWithProcessID(lldb::pid_t pid) { LLDB_INSTRUMENT_VA(this, pid); diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 0d03250..98d10aa 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -1633,6 +1633,14 @@ const char *SBTarget::GetLabel() const { return nullptr; } +lldb::user_id_t SBTarget::GetGloballyUniqueID() const { + LLDB_INSTRUMENT_VA(this); + + if (TargetSP target_sp = GetSP()) + return target_sp->GetGloballyUniqueID(); + return LLDB_INVALID_GLOBALLY_UNIQUE_TARGET_ID; +} + SBError SBTarget::SetLabel(const char *label) { LLDB_INSTRUMENT_VA(this, label); |