================ @@ -93,25 +94,37 @@ class StackFrameList { bool show_frame_info, uint32_t num_frames_with_source, bool show_unique = false, bool show_hidden = false, const char *frame_marker = nullptr); + + /// Returns whether we have currently fetched all the frames of a stack. + bool WereAllFramesFetched() const; protected: friend class Thread; friend class ScriptedThread; + /// Use this API to build a stack frame list (used for scripted threads, for + /// instance.) This API is not meant for StackFrameLists that have unwinders + /// and partake in lazy stack filling (using GetFramesUpTo). Rather if you + /// are building StackFrameLists with this API, you should build the entire + /// list before making it available for use. bool SetFrameAtIndex(uint32_t idx, lldb::StackFrameSP &frame_sp); - /// Realizes frames up to (and including) end_idx (which can be greater than - /// the actual number of frames.) + /// Ensures that frames up to (and including) `end_idx` are realized in the + /// StackFrameList. `end_idx` can be larger than the actual number of frames, + /// in which case all the frames will be fetched. Acquires the writer end of + /// the list mutex. /// Returns true if the function was interrupted, false otherwise. - bool GetFramesUpTo(uint32_t end_idx, - InterruptionControl allow_interrupt = AllowInterruption); - - void GetOnlyConcreteFramesUpTo(uint32_t end_idx, Unwind &unwinder); - - void SynthesizeTailCallFrames(StackFrame &next_frame); - - bool GetAllFramesFetched() { return m_concrete_frames_fetched == UINT32_MAX; } + /// Callers should first check (under the shared mutex) whether we need to + /// fetch frames or not. ---------------- labath wrote:
(optional) I'd consider putting the read-locked check into the function itself. I think then you wouldn't need the `WereAllFramesFetched` check in `GetNumFrames`, and I don't think it should hurt the other callers. https://github.com/llvm/llvm-project/pull/117252 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits