<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155172>155172</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LLDB `process plugin packet send` truncates responses containing null bytes
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
patryk4815
</td>
</tr>
</table>
<pre>
When using LLDB’s `process plugin packet send` command, responses containing null bytes (`\x00`) are not handled correctly.
This makes it impossible to use Python scripting (via `HandleCommand`) for gdb-remote packets that may legitimately include zeros (for example, memory reads or `vFile` operations).
This limitation blocks implementing certain functionality in downstream tools like https://github.com/pwndbg/pwndbg , which rely on being able to send and receive arbitrary gdb-remote packets.
### Repro
```lldb
(lldb) process plugin packet send vFile:open:2f70726f632f73656c662f657865,00000000,00000000
packet: vFile:open:2f70726f632f73656c662f657865,00000000,00000000
response: F9
(lldb) script
>>> ret = lldb.SBCommandReturnObject()
>>> lldb.debugger.GetCommandInterpreter().HandleCommand(
... "process plugin packet send vFile:pread:9,3E8,0", ret)
2
>>> ret.GetOutput()
' packet: vFile:pread:9,3E8,0\nresponse: F3e8;\x7fELF\x02\x01\x01\n'
```
Notice how the response includes an ELF header, but the null bytes in the ELF data are lost/truncated, so the actual response cannot be fully parsed.
### Expected behavior
- `process plugin packet send` should return full response, not a null-terminated string
- Ideally, add an option like `-hex` to `process plugin packet send` so that the response is returned as a hexadecimal string
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU9v47YT_TT0ZWBBpqx_Bx0cx_79Fgi6xbZAzxQ5lthQpECOnLifvqCkZJM2bfZQQZAJaTjvzfjNowhBdxaxYfkdy-83YqLe-WYU5G-P-2qXb1qnbs1vPVqYgrYdPDzc37ETZ1XK6joAK9LRO4khwGimTlsYhXxEgoBWsSIF6YZBWMX4ETyG0dmAAaSzJLSN-exkDLQ3wgCMV6xIWX58TtO44D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