[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
================
@@ -0,0 +1,109 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Target/TargetGroup.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/TargetGroupList.h"
+
+#include <algorithm>
+
+using namespace lldb;
+using namespace lldb_private;
+
+bool TargetGroup::AddTarget(const TargetSP &target_sp, TargetRole role) {
+ if (!target_sp || role == TargetRole::None)
+ return false;
+
+ std::lock_guard<std::recursive_mutex> guard(*m_mutex);
+ if (!m_active || &target_sp->GetDebugger() != m_debugger)
+ return false;
----------------
clayborg wrote:
We might want to return a llvm::Error to this function so we can return an error here:
```
if (&target_sp->GetDebugger() != m_debugger)
return llvm::Error("the target doesn't belong to this debugger");
```
Ditto for other error cases below. The code above is not correct for returning an llvm::Error that has a string, but it was just to show the idea.
https://github.com/llvm/llvm-project/pull/229180
More information about the lldb-commits
mailing list