gdbstub icon indicating copy to clipboard operation
gdbstub copied to clipboard

Support `x` packet for binary memory read.

Open daniel5151 opened this issue 11 months ago • 3 comments

GDB recently (Dec 2024) gained support for this packet, via https://github.com/bminor/binutils-gdb/commit/e16e6389a7f1f6112868f470d7a001cb02e43d5d

Much like #82, which implemented x's sibling packet (X - for binary memory writes), this should be a simple, straightforward packet to add support for. It will simply hook into the existing Target-facing read_memory methods, and work as expected.

One other minor thing to keep in mind: we'll also want to add a new fn use_x_packet(&self) -> bool method to Target, in order to give space-constrained users the ability to opt-out of support for this packet, just as #82 added use_x_upcase_packet when it implemented support for X.


Note that LLDB has already supported this packet for quite a while now. See https://lldb.llvm.org/resources/lldbgdbremote.html#x-binary-memory-read

Fortunately, GDB and LLDB share the exact same syntax and semantics for this packet, so no extra handling will be required to maintain compatibility between the two clients.

daniel5151 avatar Jan 06 '25 23:01 daniel5151

I have spent some time on this, I'll prepare a PR in the coming days

dblnz avatar Nov 19 '25 23:11 dblnz

I got distracted and haven't prepared the PR yet, I'm planing for this end of the week

dblnz avatar Nov 27 '25 13:11 dblnz

No worries. I'll be in Japan for vacation for the next 2 weeks, so its unlikely I'll be able to review it until I get back in ~mid December anyway.

daniel5151 avatar Nov 27 '25 15:11 daniel5151