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

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 6 19:36:09 PST 2024


================
@@ -608,11 +608,10 @@ static bool Evaluate_DW_OP_entry_value(std::vector<Value> &stack,
   StackFrameSP parent_frame = nullptr;
   addr_t return_pc = LLDB_INVALID_ADDRESS;
   uint32_t current_frame_idx = current_frame->GetFrameIndex();
-  uint32_t num_frames = thread->GetStackFrameCount();
-  for (uint32_t parent_frame_idx = current_frame_idx + 1;
-       parent_frame_idx < num_frames; ++parent_frame_idx) {
+
+  for (uint32_t parent_frame_idx = current_frame_idx + 1;;parent_frame_idx++) {
----------------
bulbazord wrote:

Suggestion: If you initialize `parent_frame` to `thread->GetStackFrameAtIndex(current_frame_idx + 1)` and move the `parent_frame = ...` bit to the end of the loop, you can have the loop condition be `parent_frame != nullptr` instead of relying on a break statement.

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


More information about the lldb-commits mailing list