RE: Incompatible implementat ion of 'x' packet in GDB vs LLDB

"Aktemur, Tankut Baris via Gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <DM4PR11MB7303F8845229367DDDDED2DEC4E02@DM4PR11MB7303.namprd11.prod.outlook.com>
On Thursday, January 23, 2025 8:13 AM, Robert O'Callahan wrote:
> On Thu, 23 Jan 2025 at 08:57, Robert O'Callahan <[email protected]>
> wrote:
> 
> > GDB (client) 16.1 started sending the gdbserver 'x' packet. It follows the
> > documentation [1] and expects a leading 'b' in the response [2].
> > Unfortunately LLDB has supported this packet for quite a long time [3] and
> > does not expect a leading 'b' in the response. We added support for this
> > packet to rr last year and followed LLDB's format because it was the only
> > user of the packet at that time. So GDB 16.1 doesn't work with rr. [4]
> >
> > I realize that compatibility between GDB and LLDB flavoured gdbserver
> > protocols is not a priority for either team, but until now it has actually
> > worked in practice --- rr hasn't needed a client mode switch. We can add
> > one, but it will be unfortunate if GDB 16.1 and later is incompatible for
> > anyone who's installed the latest rr since May 2024.
> >
> > Could you make a GDB 16.1 point release that removes the 'b'? AFAIK it
> > serves no purpose.
> >
> 
> It has been pointed out that if you want to return different error codes
> then you need the 'b'. Is that the rationale?

Hello Rob,

Essentially, yes.  In case of an error, the server responds with an 'E' packet.
To be able to distinguish an error packet from binary data, 'E' would have to be
added to the list of escaped characters.  Having the 'b' marker avoids that.

Additionally, when the response is empty, per RSP, it means the packet is unsupported.
So, in case of a zero-length request, the 'b' marker could help us distinguish the
unsupported case from an actual zero-response.
LLDB doc says

  To test if this packet is available, send a addr/len of 0:

    x0,0

  You will get an OK response if it is supported. 
  The reply will be the data requested in 8-bit binary data format.

How does LLDB distinguish an "OK" response, an empty binary data, an error,
and an unsupported case?  These were not clear to me from the docs.
Is the x0,0 query special-cased?

For the record, the 'x' packet series were discussed in

  https://inbox.sourceware.org/gdb-patches/[email protected]/#r

with the part specific to the 'b' marker in

  https://inbox.sourceware.org/gdb-patches/[email protected]/

Regards,
-Baris 


> Rob
> --
> Su ot deraeppa sah dna Rehtaf eht htiw saw hcihw, efil lanrete eht uoy ot
> mialcorp ew dna, ti ot yfitset dna ti nees evah ew; deraeppa efil eht. Efil
> fo Drow eht gninrecnoc mialcorp ew siht - dehcuot evah sdnah ruo dna ta
> dekool evah ew hcihw, seye ruo htiw nees evah ew hcihw, draeh evah ew
> hcihw, gninnigeb eht morf saw hcihw taht.


Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.