|
| 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 | + |
| 14 | +namespace lldb { |
| 15 | + |
| 16 | +/// Represents a list of SBFrame objects. |
| 17 | +/// |
| 18 | +/// SBFrameList provides a way to iterate over stack frames lazily, |
| 19 | +/// materializing frames on-demand as they are accessed. This is more |
| 20 | +/// efficient than eagerly creating all frames upfront. |
| 21 | +class LLDB_API SBFrameList { |
| 22 | +public: |
| 23 | + SBFrameList(); |
| 24 | + |
| 25 | + SBFrameList(const lldb::SBFrameList &rhs); |
| 26 | + |
| 27 | + ~SBFrameList(); |
| 28 | + |
| 29 | + const lldb::SBFrameList &operator=(const lldb::SBFrameList &rhs); |
| 30 | + |
| 31 | + explicit operator bool() const; |
| 32 | + |
| 33 | + bool IsValid() const; |
| 34 | + |
| 35 | + /// Returns the number of frames in the list. |
| 36 | + uint32_t GetSize() const; |
| 37 | + |
| 38 | + /// Returns the frame at the given index. |
| 39 | + /// |
| 40 | + /// \param[in] idx |
| 41 | + /// The index of the frame to retrieve (0-based). |
| 42 | + /// |
| 43 | + /// \return |
| 44 | + /// An SBFrame object for the frame at the specified index. |
| 45 | + /// Returns an invalid SBFrame if idx is out of range. |
| 46 | + lldb::SBFrame GetFrameAtIndex(uint32_t idx) const; |
| 47 | + |
| 48 | + /// Get the thread associated with this frame list. |
| 49 | + /// |
| 50 | + /// \return |
| 51 | + /// An SBThread object representing the thread. |
| 52 | + lldb::SBThread GetThread() const; |
| 53 | + |
| 54 | + /// Clear all frames from this list. |
| 55 | + void Clear(); |
| 56 | + |
| 57 | + /// Get a description of this frame list. |
| 58 | + /// |
| 59 | + /// \param[in] description |
| 60 | + /// The stream to write the description to. |
| 61 | + /// |
| 62 | + /// \return |
| 63 | + /// True if the description was successfully written. |
| 64 | + bool GetDescription(lldb::SBStream &description) const; |
| 65 | + |
| 66 | +protected: |
| 67 | + friend class SBThread; |
| 68 | + |
| 69 | +private: |
| 70 | + SBFrameList(const lldb::StackFrameListSP &frame_list_sp); |
| 71 | + |
| 72 | + void SetFrameList(const lldb::StackFrameListSP &frame_list_sp); |
| 73 | + |
| 74 | + // This needs to be a shared_ptr since an SBFrameList can be passed to |
| 75 | + // scripting affordances like ScriptedFrameProviders but also out of |
| 76 | + // convenience because Thread::GetStackFrameList returns a StackFrameListSP. |
| 77 | + lldb::StackFrameListSP m_opaque_sp; |
| 78 | +}; |
| 79 | + |
| 80 | +} // namespace lldb |
| 81 | + |
| 82 | +#endif // LLDB_API_SBFRAMELIST_H |
0 commit comments