GDB Remote target descriptions

Hi all,

I’ve been adding support for the qXfer:features:read:target.xml message for our tools at $WORK and have run into a couple hiccups to puzzle over.

First off, the request message as defined at https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#qXfer%20target%20description%20read is in the form qXfer:features:read:annex:offset,size. When talking to GDB it works to respond with a ‘l’ or ‘m’ message smaller than size, then GDB proceeds to request the next chunk, and so on until the debug server says there is no more data. I believe there is a bug in lldb’s handling of this message in that if the response is shorter than ‘size’ while also being incomplete, lldb requests the next chunk with a giant offset. This patch fixes the behavior:

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Never got a response to this, did I miss it somehow? If not, please see below.

That first change looks ok. Feel free to submit a patch for the multiple request. Someone added this on linux a while back and was probably just working with their gdbserver that only sent a single packet. Shouldn’t be too hard to fix.

Feel free to submit a patch via Phabricator:

http://llvm.org/docs/Phabricator.html