[lldb-dev] [Bug 42471] New: GDB remote protocol 'A' packet format is not spec-compliant

via lldb-dev lldb-dev at lists.llvm.org
Mon Jul 1 12:54:45 PDT 2019


            Bug ID: 42471
           Summary: GDB remote protocol 'A' packet format is not
           Product: lldb
           Version: 8.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: spmichaels.work at gmail.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

LLDB's GDB remote protocol implementation defines a parser for the 'A' packet
at tools/debugger/source/RNBRemote.cpp:1538 (i.e. RNBRemote::HandlePacket_A()).
This packet is used to pass an argv[] array to the program.

GDB's remote protocol spec defines the A packet as follows (see

‘A arglen,argnum,arg,…’

Initialized argv[] array passed into program. arglen specifies the number of
bytes in the hex encoded byte stream arg. See gdbserver for more details.

Note that `gdbserver` does not actually implement the A packet (see
https://github.com/bminor/binutils-gdb/blob/master/gdb/gdbserver/server.c), so
the note to "See gdbserver for more details" is moot.

LLDB's implementation assumes that 'arglen' and 'argnum' are base-10 unsigned
integers. However, the GDB remote protocol overview specifies that (see

Except where otherwise noted all numbers are represented in HEX with leading
zeros suppressed.

Since the 'A' packet definition does not explicitly specify a base for arglen
and argnum, thesei should actually be base-16, not base-10 as they are now.

This would require changes to the two `strtoul()` calls on lines 1562 and 1574
of `RNBRemote.cpp`.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190701/2c5458a0/attachment.html>

More information about the lldb-dev mailing list