<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - GDB remote protocol 'A' packet format is not spec-compliant"
href="https://bugs.llvm.org/show_bug.cgi?id=42471">42471</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>GDB remote protocol 'A' packet format is not spec-compliant
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>8.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>spmichaels.work@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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 href="https://sourceware.org/gdb/onlinedocs/gdb/Packets.html">https://sourceware.org/gdb/onlinedocs/gdb/Packets.html</a>):
---
‘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
<a href="https://github.com/bminor/binutils-gdb/blob/master/gdb/gdbserver/server.c">https://github.com/bminor/binutils-gdb/blob/master/gdb/gdbserver/server.c</a>), 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
<a href="https://sourceware.org/gdb/onlinedocs/gdb/Overview.html#Overview">https://sourceware.org/gdb/onlinedocs/gdb/Overview.html#Overview</a>):
---
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`.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>