LLDB mainline
lldb_private::TargetGroup Class Reference

A group of related targets and the roles they play in that relationship. More...

#include <TargetGroup.h>

Inheritance diagram for lldb_private::TargetGroup:
[legend]

Classes

struct  Entry

Public Types

enum class  Role { CPU , Accelerator }
 Describes the part a target plays in this group. More...

Public Member Functions

 TargetGroup (const TargetGroup &)=delete
 Target groups have identity and maintain backlinks in their member targets, so they cannot be copied or moved.
TargetGroup & operator= (const TargetGroup &)=delete
 TargetGroup (TargetGroup &&)=delete
TargetGroup & operator= (TargetGroup &&)=delete
 ~TargetGroup ()
llvm::StringRef GetDescription () const
llvm::Error AddTarget (const lldb::TargetSP &target_sp, Role role)
 Add target_sp to the group with role.
bool RemoveTarget (const lldb::TargetSP &target_sp)
 Remove target_sp from the group.
std::optional< Role > GetRole (const lldb::TargetSP &target_sp) const
 Return the role assigned to target_sp, if it is a member.
std::vector< lldb::TargetSP > GetTargets () const
 Return every target in the group.
std::vector< lldb::TargetSP > GetTargets (Role role) const
 Return targets whose role is role.

Private Member Functions

 TargetGroup (const lldb::DebuggerSP &debugger_sp, llvm::StringRef description, std::shared_ptr< std::recursive_mutex > mutex)

Private Attributes

lldb::DebuggerWP m_debugger_wp
std::string m_description
std::shared_ptr< std::recursive_mutex > m_mutex
std::vector< Entry > m_entries
 Targets are weakly held so membership does not extend their lifetime.

Friends

class TargetGroupList

Detailed Description

A group of related targets and the roles they play in that relationship.

Target::Destroy() automatically removes a target from all its groups; clients do not need to remove memberships during target destruction.

Definition at line 29 of file TargetGroup.h.

Member Enumeration Documentation

◆ Role

Describes the part a target plays in this group.

Enumerator
CPU 
Accelerator 

Definition at line 32 of file TargetGroup.h.

Constructor & Destructor Documentation

◆ TargetGroup() [1/3]

lldb_private::TargetGroup::TargetGroup ( const TargetGroup & )
delete

Target groups have identity and maintain backlinks in their member targets, so they cannot be copied or moved.

Create one with Debugger::GetTargetGroupList().CreateTargetGroup().

References TargetGroup().

Referenced by operator=(), operator=(), TargetGroup(), and TargetGroup().

◆ TargetGroup() [2/3]

lldb_private::TargetGroup::TargetGroup ( TargetGroup && )
delete

References TargetGroup().

◆ ~TargetGroup()

TargetGroup::~TargetGroup ( )

Definition at line 19 of file TargetGroup.cpp.

References m_entries.

◆ TargetGroup() [3/3]

lldb_private::TargetGroup::TargetGroup ( const lldb::DebuggerSP & debugger_sp,
llvm::StringRef description,
std::shared_ptr< std::recursive_mutex > mutex )
inlineprivate

Definition at line 72 of file TargetGroup.h.

References m_debugger_wp, m_description, and m_mutex.

Member Function Documentation

◆ AddTarget()

llvm::Error TargetGroup::AddTarget ( const lldb::TargetSP & target_sp,
Role role )

Add target_sp to the group with role.

Adding an existing member succeeds only when its role matches role.

Definition at line 24 of file TargetGroup.cpp.

References m_debugger_wp, m_entries, and m_mutex.

◆ GetDescription()

llvm::StringRef lldb_private::TargetGroup::GetDescription ( ) const
inline

Definition at line 46 of file TargetGroup.h.

References m_description.

◆ GetRole()

std::optional< TargetGroup::Role > TargetGroup::GetRole ( const lldb::TargetSP & target_sp) const

Return the role assigned to target_sp, if it is a member.

Definition at line 81 of file TargetGroup.cpp.

References m_entries, and m_mutex.

◆ GetTargets() [1/2]

std::vector< TargetSP > TargetGroup::GetTargets ( ) const

Return every target in the group.

Definition at line 95 of file TargetGroup.cpp.

References m_entries, and m_mutex.

◆ GetTargets() [2/2]

std::vector< TargetSP > TargetGroup::GetTargets ( Role role) const

Return targets whose role is role.

Definition at line 107 of file TargetGroup.cpp.

References m_entries, and m_mutex.

◆ operator=() [1/2]

TargetGroup & lldb_private::TargetGroup::operator= ( const TargetGroup & )
delete

References TargetGroup().

◆ operator=() [2/2]

TargetGroup & lldb_private::TargetGroup::operator= ( TargetGroup && )
delete

References TargetGroup().

◆ RemoveTarget()

bool TargetGroup::RemoveTarget ( const lldb::TargetSP & target_sp)

Remove target_sp from the group.

Definition at line 57 of file TargetGroup.cpp.

References m_entries, and m_mutex.

◆ TargetGroupList

friend class TargetGroupList
friend

Definition at line 65 of file TargetGroup.h.

References TargetGroupList.

Referenced by TargetGroupList.

Member Data Documentation

◆ m_debugger_wp

lldb::DebuggerWP lldb_private::TargetGroup::m_debugger_wp
private

Definition at line 77 of file TargetGroup.h.

Referenced by AddTarget(), and TargetGroup().

◆ m_description

std::string lldb_private::TargetGroup::m_description
private

Definition at line 78 of file TargetGroup.h.

Referenced by GetDescription(), and TargetGroup().

◆ m_entries

std::vector<Entry> lldb_private::TargetGroup::m_entries
private

Targets are weakly held so membership does not extend their lifetime.

Definition at line 81 of file TargetGroup.h.

Referenced by AddTarget(), GetRole(), GetTargets(), GetTargets(), RemoveTarget(), and ~TargetGroup().

◆ m_mutex

std::shared_ptr<std::recursive_mutex> lldb_private::TargetGroup::m_mutex
private

Definition at line 79 of file TargetGroup.h.

Referenced by AddTarget(), GetRole(), GetTargets(), GetTargets(), RemoveTarget(), and TargetGroup().


The documentation for this class was generated from the following files: