[Lldb-commits] [PATCH] D70417: Accept g packet responses that don't supply all registers

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 18 18:53:07 PST 2019

jasonmolenda created this revision.
jasonmolenda added a reviewer: clayborg.
jasonmolenda added a project: LLDB.
jasonmolenda added a comment.

It might be worth adding an extra conditional to check for a buffer of 0 bytes returned. I haven't checked if ReadAllRegisters() would return success if a 0-length register context was received.

This was encountered while debugging a cortex m4 board with a Segger J-Link v 6.54. It only supports g/G for reading/writing registers, and it supports an xml register description.  The register description includes the GPRs, the exception registers, and the floating point registers.  But g only provides the general purpose registers.

lldb accepts a g response that is too large for the expected register context size, but it treats a too-small payload as an error.  This change accepts a too-small payload, marking registers not included in the payload as being unavailable for retrieval (so "register read msp" will return the error that the register is unavailable).

The J-Link will accept a G packet (set registers) for the entire register context, so I didn't try to change the write registers path to recognize a register buffer where all the final registers are unavailable, and truncate the payload it sends.

I wrote a small gdb_remote_client test for this.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70417.229961.patch
Type: text/x-patch
Size: 12588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191119/fbeb6000/attachment-0001.bin>

More information about the lldb-commits mailing list