LLDB mainline
SBFrameList.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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/SBFrame.h"
11#include "lldb/API/SBStream.h"
12#include "lldb/API/SBThread.h"
14#include "lldb/Target/Thread.h"
16
17using namespace lldb;
18using namespace lldb_private;
19
21
26
28
30 LLDB_INSTRUMENT_VA(this, rhs);
31
32 if (this != &rhs)
34 return *this;
35}
36
38 : m_opaque_sp(frame_list_sp) {}
39
41 m_opaque_sp = frame_list_sp;
42}
43
44SBFrameList::operator bool() const {
46
47 return m_opaque_sp.get() != nullptr;
48}
49
52 return this->operator bool();
53}
54
55uint32_t SBFrameList::GetSize() const {
57
58 if (m_opaque_sp)
59 return m_opaque_sp->GetNumFrames();
60 return 0;
61}
62
64 LLDB_INSTRUMENT_VA(this, idx);
65
66 SBFrame sb_frame;
67 if (m_opaque_sp)
68 sb_frame.SetFrameSP(m_opaque_sp->GetFrameAtIndex(idx));
69 return sb_frame;
70}
71
74
75 SBThread sb_thread;
76 if (m_opaque_sp)
77 sb_thread.SetThread(m_opaque_sp->GetThread().shared_from_this());
78 return sb_thread;
79}
80
83
84 if (m_opaque_sp)
85 m_opaque_sp->Clear();
86}
87
88bool SBFrameList::GetDescription(SBStream &description) const {
89 LLDB_INSTRUMENT_VA(this, description);
90
91 if (!m_opaque_sp)
92 return false;
93
94 Stream &strm = description.ref();
95 m_opaque_sp->Dump(&strm);
96 return true;
97}
#define LLDB_INSTRUMENT_VA(...)
void SetFrameList(const lldb::StackFrameListSP &frame_list_sp)
const lldb::SBFrameList & operator=(const lldb::SBFrameList &rhs)
uint32_t GetSize() const
Returns the number of frames in the list.
lldb::SBThread GetThread() const
Get the thread associated with this frame list.
friend class SBThread
Definition SBFrameList.h:77
void Clear()
Clear all frames from this list.
bool IsValid() const
lldb::StackFrameListSP m_opaque_sp
Definition SBFrameList.h:91
bool GetDescription(lldb::SBStream &description) const
Get a description of this frame list.
lldb::SBFrame GetFrameAtIndex(uint32_t idx) const
Returns the frame at the given index.
void SetFrameSP(const lldb::StackFrameSP &lldb_object_sp)
Definition SBFrame.cpp:90
lldb_private::Stream & ref()
Definition SBStream.cpp:177
void SetThread(const lldb::ThreadSP &lldb_object_sp)
Definition SBThread.cpp:315
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StackFrameList > StackFrameListSP