[all-commits] [llvm/llvm-project] d031c5: [lldb][debugserver][NFC] Share the expedited-memor...

Yao Qi via All-commits all-commits at lists.llvm.org
Fri Sep 11 09:12:51 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d031c595935b6a697e94b55fddbf59261733eb16
      https://github.com/llvm/llvm-project/commit/d031c595935b6a697e94b55fddbf59261733eb16
  Author: Yao Qi <yao_qi at apple.com>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M lldb/tools/debugserver/source/RNBRemote.cpp

  Log Message:
  -----------
  [lldb][debugserver][NFC] Share the expedited-memory type and emitters (#222911)

Expedited memory had two representations:
- The frame pointer backchain used `StackMemory`, a fixed
`uint8_t[2 * sizeof(nub_addr_t)]` plus a length, held in a `std::map`
keyed
  by frame address.
- Frame 0's window used `ExpeditedMemory`, which owns a
`std::vector<uint8_t>`.

Three call sites then open-coded the same emit loop, twice into a JSON
array
and once into a stop reply.

Keep `ExpeditedMemory` for both and emit through
`AppendExpeditedMemoryToJSON`
and `AppendExpeditedMemoryToStopReply`. `ReadFrameZeroStackMemory`'s
local
`read_range` lambda becomes `AppendExpeditedMemory`. `ReadStackMemory`
keeps
its own read, because it needs the bytes to continue the walk.

`ReadStackMemory` gains an explicit `visited` set. It previously relied
on its
`std::map` to stop a corrupt frame pointer chain that loops back on
itself, by
testing whether the key was already present. A `std::vector` has no such
test,
so the guard becomes explicit. This keeps the existing behavior rather
than
changing it.

Chunk count and chunk sizes are unchanged. Backchain chunks now go out
in
frame-walk order rather than ascending frame address; the bytes for a
given
address are the same either way, so the cache the client builds is
unchanged.

This prepares for expediting the another memory read range, which have
arbitrary address and length. `StackMemory`'s fixed buffer cannot hold a
range
of a few hundred bytes, and appending and emitting one costs three lines
with
these functions in place rather than a fourth copy of the emit loop.

Assited-by: claude



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list