LLDB  mainline
SBThreadCollection.cpp
Go to the documentation of this file.
1 //===-- SBThreadCollection.cpp --------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "lldb/API/SBThread.h"
11 #include "lldb/Target/ThreadList.h"
13 
14 using namespace lldb;
15 using namespace lldb_private;
16 
18 
20  : m_opaque_sp(rhs.m_opaque_sp) {
21  LLDB_INSTRUMENT_VA(this, rhs);
22 }
23 
26  LLDB_INSTRUMENT_VA(this, rhs);
27 
28  if (this != &rhs)
30  return *this;
31 }
32 
33 SBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)
34  : m_opaque_sp(threads) {}
35 
37 
38 void SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) {
39  m_opaque_sp = threads;
40 }
41 
43  return m_opaque_sp.get();
44 }
45 
47  return m_opaque_sp.operator->();
48 }
49 
50 lldb::ThreadCollectionSP &SBThreadCollection::operator*() {
51  return m_opaque_sp;
52 }
53 
54 const lldb::ThreadCollectionSP &SBThreadCollection::operator*() const {
55  return m_opaque_sp;
56 }
57 
59  LLDB_INSTRUMENT_VA(this);
60  return this->operator bool();
61 }
62 SBThreadCollection::operator bool() const {
63  LLDB_INSTRUMENT_VA(this);
64 
65  return m_opaque_sp.get() != nullptr;
66 }
67 
69  LLDB_INSTRUMENT_VA(this);
70 
71  if (m_opaque_sp)
72  return m_opaque_sp->GetSize();
73  return 0;
74 }
75 
77  LLDB_INSTRUMENT_VA(this, idx);
78 
79  SBThread thread;
80  if (m_opaque_sp && idx < m_opaque_sp->GetSize())
81  thread = m_opaque_sp->GetThreadAtIndex(idx);
82  return thread;
83 }
Instrumentation.h
lldb::SBThread
Definition: SBThread.h:20
lldb::SBThreadCollection::m_opaque_sp
lldb::ThreadCollectionSP m_opaque_sp
Definition: SBThreadCollection.h:52
lldb::SBThreadCollection::operator*
lldb::ThreadCollectionSP & operator*()
Definition: SBThreadCollection.cpp:50
lldb::SBThreadCollection::SetOpaque
void SetOpaque(const lldb::ThreadCollectionSP &threads)
Definition: SBThreadCollection.cpp:38
lldb::SBThreadCollection
Definition: SBThreadCollection.h:16
lldb::SBThreadCollection::SBThreadCollection
SBThreadCollection()
Definition: SBThreadCollection.cpp:17
lldb::SBThreadCollection::GetThreadAtIndex
lldb::SBThread GetThreadAtIndex(size_t idx)
Definition: SBThreadCollection.cpp:76
lldb::SBThreadCollection::IsValid
bool IsValid() const
Definition: SBThreadCollection.cpp:58
SBThread.h
lldb::SBThreadCollection::operator=
const SBThreadCollection & operator=(const SBThreadCollection &rhs)
Definition: SBThreadCollection.cpp:25
lldb::SBThreadCollection::~SBThreadCollection
~SBThreadCollection()
ThreadList.h
lldb::SBThreadCollection::GetSize
size_t GetSize()
Definition: SBThreadCollection.cpp:68
lldb_private::ThreadCollection
Definition: ThreadCollection.h:20
lldb::SBThreadCollection::get
lldb_private::ThreadCollection * get() const
Definition: SBThreadCollection.cpp:42
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
SBThreadCollection.h
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
lldb
Definition: SBAddress.h:15
lldb::SBThreadCollection::operator->
lldb_private::ThreadCollection * operator->() const
Definition: SBThreadCollection.cpp:46