@@ -99,30 +99,21 @@ class StackFrameList {
9999 friend class Thread ;
100100 friend class ScriptedThread ;
101101
102+ // / Use this API to build a stack frame list (used for scripted threads, for
103+ // / instance.) This API is not meant for StackFrameLists that have unwinders
104+ // / and partake in lazy stack filling (using GetFramesUpTo). Rather if you
105+ // / are building StackFrameLists with this API, you should build the entire
106+ // / list before making it available for use.
102107 bool SetFrameAtIndex (uint32_t idx, lldb::StackFrameSP &frame_sp);
103108
104- // / Realizes frames up to (and including) end_idx (which can be greater than
105- // / the actual number of frames.)
109+ // / Ensures that frames up to (and including) `end_idx` are realized in the
110+ // / StackFrameList. `end_idx` can be larger than the actual number of frames,
111+ // / in which case all the frames will be fetched.
106112 // / Returns true if the function was interrupted, false otherwise.
107- // / Must be called with a shared_locked mutex locked.
113+ // / Must be called with a shared mutex locked in `guard` .
108114 bool GetFramesUpTo (uint32_t end_idx, InterruptionControl allow_interrupt,
109115 std::shared_lock<std::shared_mutex> &guard);
110116
111- // / These two Fetch frames APIs must be called with the stack mutex shared
112- // / lock acquired. They are the only places where we acquire the writer
113- // / end of the stack list mutex to add frames, but they will always exit with
114- // / the shared side reacquired.
115- // / Returns true if fetching frames was interrupted, false otherwise
116- bool FetchFramesUpTo (uint32_t end_idx, InterruptionControl allow_interrupt,
117- std::shared_lock<std::shared_mutex> &guard);
118-
119- void FetchOnlyConcreteFramesUpTo (uint32_t end_idx,
120- std::shared_lock<std::shared_mutex> &guard);
121-
122- // This gets called without the StackFrameList lock held, callers should
123- // hold the lock.
124- void SynthesizeTailCallFrames (StackFrame &next_frame);
125-
126117 bool GetAllFramesFetched () { return m_concrete_frames_fetched == UINT32_MAX; }
127118
128119 void SetAllFramesFetched () { m_concrete_frames_fetched = UINT32_MAX; }
@@ -197,6 +188,23 @@ class StackFrameList {
197188 GetFrameAtIndexNoLock (uint32_t idx,
198189 std::shared_lock<std::shared_mutex> &guard);
199190
191+ // / These two Fetch frames APIs are called in GetFramesUpTo, they are the ones
192+ // / that actually add frames. They must be called with the stack list shared
193+ // / lock acquired. They will acquire the writer end of the stack list mutex
194+ // / to add frames, but they will always exit with the shared side reacquired.
195+ // / Returns true if fetching frames was interrupted, false otherwise.
196+ bool FetchFramesUpTo (uint32_t end_idx, InterruptionControl allow_interrupt,
197+ std::shared_lock<std::shared_mutex> &guard);
198+
199+ // / This is the same as FetchFramesUpTo, but only fetches concrete frames.
200+ // / It is not currently interruptible - so it returns nothing.
201+ void FetchOnlyConcreteFramesUpTo (uint32_t end_idx,
202+ std::shared_lock<std::shared_mutex> &guard);
203+
204+ // This is a utility function, called by FetchFramesUpTo. It must be called
205+ // with the writer end of the stack list mutex held.
206+ void SynthesizeTailCallFrames (StackFrame &next_frame);
207+
200208 StackFrameList (const StackFrameList &) = delete ;
201209 const StackFrameList &operator =(const StackFrameList &) = delete ;
202210};
0 commit comments