aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBDebugger.cpp11
-rw-r--r--lldb/source/API/SBTarget.cpp8
2 files changed, 19 insertions, 0 deletions
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);