[Lldb-commits] [lldb] [lldb] Add target groups for related targets (PR #229180)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 12 11:51:20 PDT 2026


================
@@ -411,6 +416,43 @@ void Target::Destroy() {
   ClearDummySignals(signal_args);
 }
 
+std::vector<TargetGroupSP> Target::GetTargetGroups() const {
+  const auto &mutex = m_debugger.GetTargetGroupList().m_mutex;
+  std::lock_guard<std::recursive_mutex> guard(*mutex);
+  std::vector<TargetGroupSP> groups;
+  groups.reserve(m_target_groups.size());
+  for (const TargetGroupWP &group_wp : m_target_groups) {
+    if (TargetGroupSP group_sp = group_wp.lock())
+      groups.push_back(std::move(group_sp));
+  }
+  return groups;
+}
----------------
clayborg wrote:

move this functionality into TargetGroupList, so this function should be:
```
std::vector<TargetGroupSP> Target::GetTargetGroups() const {
  return m_target_groups.GetGroups();
}
```
Then `TargetGroupList` will lock its own mutex and make a copy and return the copy.

https://github.com/llvm/llvm-project/pull/229180


More information about the lldb-commits mailing list