LLDB  mainline
SBSymbolContextList.cpp
Go to the documentation of this file.
1 //===-- SBSymbolContextList.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 "Utils.h"
11 #include "lldb/API/SBStream.h"
14 
15 using namespace lldb;
16 using namespace lldb_private;
17 
19  : m_opaque_up(new SymbolContextList()) {
20  LLDB_INSTRUMENT_VA(this);
21 }
22 
24  LLDB_INSTRUMENT_VA(this, rhs);
25 
27 }
28 
30 
33  LLDB_INSTRUMENT_VA(this, rhs);
34 
35  if (this != &rhs)
37  return *this;
38 }
39 
41  LLDB_INSTRUMENT_VA(this);
42 
43  if (m_opaque_up)
44  return m_opaque_up->GetSize();
45  return 0;
46 }
47 
49  LLDB_INSTRUMENT_VA(this, idx);
50 
51  SBSymbolContext sb_sc;
52  if (m_opaque_up) {
53  SymbolContext sc;
54  if (m_opaque_up->GetContextAtIndex(idx, sc))
55  sb_sc = sc;
56  }
57  return sb_sc;
58 }
59 
61  LLDB_INSTRUMENT_VA(this);
62 
63  if (m_opaque_up)
64  m_opaque_up->Clear();
65 }
66 
68  LLDB_INSTRUMENT_VA(this, sc);
69 
70  if (sc.IsValid() && m_opaque_up.get())
71  m_opaque_up->Append(*sc);
72 }
73 
75  LLDB_INSTRUMENT_VA(this, sc_list);
76 
77  if (sc_list.IsValid() && m_opaque_up.get())
78  m_opaque_up->Append(*sc_list);
79 }
80 
82  LLDB_INSTRUMENT_VA(this);
83  return this->operator bool();
84 }
85 SBSymbolContextList::operator bool() const {
86  LLDB_INSTRUMENT_VA(this);
87 
88  return m_opaque_up != nullptr;
89 }
90 
92  return m_opaque_up.get();
93 }
94 
96  assert(m_opaque_up.get());
97  return *m_opaque_up;
98 }
99 
101  LLDB_INSTRUMENT_VA(this, description);
102 
103  Stream &strm = description.ref();
104  if (m_opaque_up)
105  m_opaque_up->GetDescription(&strm, lldb::eDescriptionLevelFull, nullptr);
106  return true;
107 }
lldb::SBSymbolContextList::GetSize
uint32_t GetSize() const
Definition: SBSymbolContextList.cpp:40
Instrumentation.h
lldb::SBStream::ref
lldb_private::Stream & ref()
Definition: SBStream.cpp:176
lldb::SBSymbolContextList::operator=
const lldb::SBSymbolContextList & operator=(const lldb::SBSymbolContextList &rhs)
Definition: SBSymbolContextList.cpp:32
lldb::SBSymbolContextList::m_opaque_up
std::unique_ptr< lldb_private::SymbolContextList > m_opaque_up
Definition: SBSymbolContextList.h:53
lldb::SBSymbolContextList::Append
void Append(lldb::SBSymbolContext &sc)
Definition: SBSymbolContextList.cpp:67
lldb::SBSymbolContextList::operator*
lldb_private::SymbolContextList & operator*() const
Definition: SBSymbolContextList.cpp:95
lldb::SBSymbolContextList
Definition: SBSymbolContextList.h:17
lldb_private::SymbolContextList
Definition: SymbolContext.h:379
lldb_private::Stream
Definition: Stream.h:28
lldb_private::SymbolContext
Definition: SymbolContext.h:33
SBSymbolContextList.h
lldb::SBSymbolContext::IsValid
bool IsValid() const
Definition: SBSymbolContext.cpp:44
SBStream.h
lldb::SBSymbolContextList::Clear
void Clear()
Definition: SBSymbolContextList.cpp:60
lldb_private::clone
std::unique_ptr< T > clone(const std::unique_ptr< T > &src)
Definition: Utils.h:17
Utils.h
lldb::eDescriptionLevelFull
@ eDescriptionLevelFull
Definition: lldb-enumerations.h:209
lldb::SBSymbolContextList::GetDescription
bool GetDescription(lldb::SBStream &description)
Definition: SBSymbolContextList.cpp:100
lldb::SBSymbolContextList::IsValid
bool IsValid() const
Definition: SBSymbolContextList.cpp:81
lldb::SBSymbolContext
Definition: SBSymbolContext.h:22
uint32_t
SymbolContext.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::SBSymbolContextList::GetContextAtIndex
lldb::SBSymbolContext GetContextAtIndex(uint32_t idx)
Definition: SBSymbolContextList.cpp:48
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
lldb::SBStream
Definition: SBStream.h:18
lldb::SBSymbolContextList::SBSymbolContextList
SBSymbolContextList()
Definition: SBSymbolContextList.cpp:18
lldb
Definition: SBAddress.h:15
lldb::SBSymbolContextList::operator->
lldb_private::SymbolContextList * operator->() const
Definition: SBSymbolContextList.cpp:91
lldb::SBSymbolContextList::~SBSymbolContextList
~SBSymbolContextList()