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 "SBReproducerPrivate.h"
11 #include "lldb/API/SBThread.h"
12 #include "lldb/Target/ThreadList.h"
13 
14 using namespace lldb;
15 using namespace lldb_private;
16 
19 }
20 
22  : m_opaque_sp(rhs.m_opaque_sp) {
24  (const lldb::SBThreadCollection &), rhs);
25 }
26 
31  SBThreadCollection, operator=,(const lldb::SBThreadCollection &), rhs);
32 
33  if (this != &rhs)
35  return LLDB_RECORD_RESULT(*this);
36 }
37 
38 SBThreadCollection::SBThreadCollection(const ThreadCollectionSP &threads)
39  : m_opaque_sp(threads) {}
40 
42 
43 void SBThreadCollection::SetOpaque(const lldb::ThreadCollectionSP &threads) {
44  m_opaque_sp = threads;
45 }
46 
48  return m_opaque_sp.get();
49 }
50 
52  return m_opaque_sp.operator->();
53 }
54 
55 lldb::ThreadCollectionSP &SBThreadCollection::operator*() {
56  return m_opaque_sp;
57 }
58 
59 const lldb::ThreadCollectionSP &SBThreadCollection::operator*() const {
60  return m_opaque_sp;
61 }
62 
65  return this->operator bool();
66 }
67 SBThreadCollection::operator bool() const {
69 
70  return m_opaque_sp.get() != nullptr;
71 }
72 
75 
76  if (m_opaque_sp)
77  return m_opaque_sp->GetSize();
78  return 0;
79 }
80 
83  (size_t), idx);
84 
85  SBThread thread;
86  if (m_opaque_sp && idx < m_opaque_sp->GetSize())
87  thread = m_opaque_sp->GetThreadAtIndex(idx);
88  return LLDB_RECORD_RESULT(thread);
89 }
90 
91 namespace lldb_private {
92 namespace repro {
93 
94 template <>
98  (const lldb::SBThreadCollection &));
100  const lldb::SBThreadCollection &,
101  SBThreadCollection, operator=,(const lldb::SBThreadCollection &));
103  LLDB_REGISTER_METHOD_CONST(bool, SBThreadCollection, operator bool, ());
104  LLDB_REGISTER_METHOD(size_t, SBThreadCollection, GetSize, ());
106  (size_t));
107 }
108 
109 }
110 }
lldb::SBThread
Definition: SBThread.h:20
lldb::SBThreadCollection::m_opaque_sp
lldb::ThreadCollectionSP m_opaque_sp
Definition: SBThreadCollection.h:52
LLDB_RECORD_RESULT
#define LLDB_RECORD_RESULT(Result)
Definition: ReproducerInstrumentation.h:211
LLDB_RECORD_METHOD_CONST_NO_ARGS
#define LLDB_RECORD_METHOD_CONST_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:168
lldb::SBThreadCollection::operator*
lldb::ThreadCollectionSP & operator*()
Definition: SBThreadCollection.cpp:55
LLDB_RECORD_METHOD_NO_ARGS
#define LLDB_RECORD_METHOD_NO_ARGS(Result, Class, Method)
Definition: ReproducerInstrumentation.h:165
lldb::SBThreadCollection::SetOpaque
void SetOpaque(const lldb::ThreadCollectionSP &threads)
Definition: SBThreadCollection.cpp:43
lldb::SBThreadCollection
Definition: SBThreadCollection.h:16
LLDB_RECORD_CONSTRUCTOR_NO_ARGS
#define LLDB_RECORD_CONSTRUCTOR_NO_ARGS(Class)
Definition: ReproducerInstrumentation.h:136
lldb::SBThreadCollection::SBThreadCollection
SBThreadCollection()
Definition: SBThreadCollection.cpp:17
LLDB_REGISTER_METHOD_CONST
#define LLDB_REGISTER_METHOD_CONST(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:98
SBReproducerPrivate.h
LLDB_REGISTER_CONSTRUCTOR
#define LLDB_REGISTER_CONSTRUCTOR(Class, Signature)
Definition: ReproducerInstrumentation.h:89
lldb::SBThreadCollection::GetThreadAtIndex
lldb::SBThread GetThreadAtIndex(size_t idx)
Definition: SBThreadCollection.cpp:81
lldb::SBThreadCollection::IsValid
bool IsValid() const
Definition: SBThreadCollection.cpp:63
LLDB_RECORD_METHOD
#define LLDB_RECORD_METHOD(Result, Class, Method, Signature,...)
Definition: ReproducerInstrumentation.h:158
SBThread.h
lldb::SBThreadCollection::operator=
const SBThreadCollection & operator=(const SBThreadCollection &rhs)
Definition: SBThreadCollection.cpp:28
lldb::SBThreadCollection::~SBThreadCollection
~SBThreadCollection()
ThreadList.h
LLDB_RECORD_CONSTRUCTOR
#define LLDB_RECORD_CONSTRUCTOR(Class, Signature,...)
Definition: ReproducerInstrumentation.h:133
lldb_private::repro::Registry
The registry contains a unique mapping between functions and their ID.
Definition: ReproducerInstrumentation.h:517
lldb::SBThreadCollection::GetSize
size_t GetSize()
Definition: SBThreadCollection.cpp:73
lldb_private::ThreadCollection
Definition: ThreadCollection.h:20
lldb::SBThreadCollection::get
lldb_private::ThreadCollection * get() const
Definition: SBThreadCollection.cpp:47
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
SBThreadCollection.h
lldb
Definition: SBAddress.h:15
lldb::SBThreadCollection::operator->
lldb_private::ThreadCollection * operator->() const
Definition: SBThreadCollection.cpp:51
lldb_private::repro::RegisterMethods< SBThreadCollection >
void RegisterMethods< SBThreadCollection >(Registry &R)
Definition: SBThreadCollection.cpp:95
LLDB_REGISTER_METHOD
#define LLDB_REGISTER_METHOD(Result, Class, Method, Signature)
Definition: ReproducerInstrumentation.h:93