[Lldb-commits] [lldb] Don't count all the frames just to skip the current inlined ones. (PR #80918)

via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 7 10:37:21 PST 2024


jimingham wrote:

> > Should the Doxygen comment of GetStackFrameCount warn that this is an expensive operation? https://lldb.llvm.org/cpp_reference/classlldb__private_1_1Thread.html#afc54feef950a58b625bbb198dc4cf57c
> 
> It might be nice to add a "std::optional<uint32_t> max_frame_count" to this function to allow it to stop when it hits "max_frame_count". Like:
> 
> ```
> /// Get the number of frames in a thread.
> ///
> /// If \a max_frame_count is valid, return a number that is less than or equal 
> /// to max_frame_count, else calculate the true number of frames. Calculating
> /// the total number of frames can be expensive.
> virtual uint32_t lldb_private::Thread::GetStackFrameCount(std::optional<uint32_t> max_frame_count);
> ```

That seems an okay idea, but I wouldn't really want to use the new API in this patch.  I know I'm only looking to get past all the inlined frames, which is pretty cheap, but I have no way of knowing how many there are.  So it really wouldn't be a good idea to try to guess a max_frame_count.
I'd rather not add an API to a patch that doesn't actually use the API...

https://github.com/llvm/llvm-project/pull/80918


More information about the lldb-commits mailing list