LLDB mainline
SBFrameList.h
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
9#ifndef LLDB_API_SBFRAMELIST_H
10#define LLDB_API_SBFRAMELIST_H
11
12#include "lldb/API/SBDefines.h"
13
14namespace lldb_private {
16namespace python {
17class SWIGBridge;
18}
19namespace lua {
20class SWIGBridge;
21}
22} // namespace lldb_private
23
24namespace lldb {
25
26/// Represents a list of SBFrame objects.
27///
28/// SBFrameList provides a way to iterate over stack frames lazily,
29/// materializing frames on-demand as they are accessed. This is more
30/// efficient than eagerly creating all frames upfront.
32public:
34
36
38
40
41 explicit operator bool() const;
42
43 bool IsValid() const;
44
45 /// Returns the number of frames in the list.
46 uint32_t GetSize() const;
47
48 /// Returns the frame at the given index.
49 ///
50 /// \param[in] idx
51 /// The index of the frame to retrieve (0-based).
52 ///
53 /// \return
54 /// An SBFrame object for the frame at the specified index.
55 /// Returns an invalid SBFrame if idx is out of range.
56 lldb::SBFrame GetFrameAtIndex(uint32_t idx) const;
57
58 /// Get the thread associated with this frame list.
59 ///
60 /// \return
61 /// An SBThread object representing the thread.
63
64 /// Clear all frames from this list.
65 void Clear();
66
67 /// Get a description of this frame list.
68 ///
69 /// \param[in] description
70 /// The stream to write the description to.
71 ///
72 /// \return
73 /// True if the description was successfully written.
74 bool GetDescription(lldb::SBStream &description) const;
75
76protected:
77 friend class SBThread;
78
79 friend class lldb_private::python::SWIGBridge;
82
83private:
84 SBFrameList(const lldb::StackFrameListSP &frame_list_sp);
85
86 void SetFrameList(const lldb::StackFrameListSP &frame_list_sp);
87
88 // This needs to be a shared_ptr since an SBFrameList can be passed to
89 // scripting affordances like ScriptedFrameProviders but also out of
90 // convenience because Thread::GetStackFrameList returns a StackFrameListSP.
92};
93
94} // namespace lldb
95
96#endif // LLDB_API_SBFRAMELIST_H
#define LLDB_API
Definition SBDefines.h:28
Represents a list of SBFrame objects.
Definition SBFrameList.h:31
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.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::StackFrameList > StackFrameListSP