[Lldb-commits] [lldb] [lldb][debugserver] Expedite the stopped frame's stack memory in jThreadsInfo (PR #212706)
Yao Qi via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 30 09:53:13 PDT 2026
================
@@ -2733,6 +2733,76 @@ static void ReadStackMemory(nub_process_t pid, nub_thread_t tid,
}
}
+// The size of each per-side stack window we expedite. 512 is sized to cover
+// the common case (locals and params sit within a few hundred bytes) while
+// bounding the per-frame cost to 1K bytes regardless of frame size.
+static const nub_size_t k_expedite_stack_window = 512;
+
+// A single contiguous chunk of expedited memory.
+struct ExpeditedMemory {
+ nub_addr_t addr;
+ std::vector<uint8_t> bytes;
+};
+
+// Read the innermost frame's stack memory so that examining its local variables
+// at a public stop is served from the expedited cache instead of generating one
+// memory-read packet.
+//
+// We produce either:
+//
+// - one chunk [$sp, $fp) for a small frame ($fp - $sp <=
+// 2*k_expedite_stack_window), which covers the whole frame with no gap, or
+//
+// - two chunks [$sp, $sp + k_expedite_stack_window) and [$fp -
+// k_expedite_stack_window, $fp) for a large frame, covering the params near
+// $sp and the locals near $fp while leaving the (rarely-interesting) middle
+// spill area out so the cost stays bounded.
+static void ReadFrameZeroStackMemory(nub_process_t pid, nub_thread_t tid,
+ std::vector<ExpeditedMemory> &chunks) {
+ chunks.clear();
+ std::unique_ptr<DNBRegisterValue> sp_value =
+ std::make_unique<DNBRegisterValue>();
+ std::unique_ptr<DNBRegisterValue> fp_value =
----------------
qiyao wrote:
They are from the copy/paste from other part of RNBRemote.cpp, they don't have to be unique pointers. Fixed.
https://github.com/llvm/llvm-project/pull/212706
More information about the lldb-commits
mailing list