-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
Description
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) 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
toprocess plugin packet send
so that the response is returned as a hexadecimal string