format of gdb remote P command with thread id suffix

Hey guys,

What would a gdb remote P command with a thread suffix look like when well formed? From RNBRemote::ExtractThreadIDFromThreadSuffix (…), it looks like it could be anywhere in the packet as I read HandlePacket_P(…).

Maybe this?

Or is there an expectation of a semi after the value,


(Well not exactly anywhere - the HandlePacket_P would have already parsed out the P{reg-index-hex}={value-hex} portion, so the real question is how much content, if any, is expected to come between the end of the parsed hex value and the start of the “thread” keyword).

Hah ok forgot I have client code in LLDB I can look at. Got my answer. “…;thread:{tid-hex}” is what I needed (semi-colon separated).

Register read example:


Register write example:


Thanks, Greg!

It is easy to trigger these on MacOSX with:

(lldb) log enable gdb-remote packets
(lldb) file /bin/ls
(lldb) b malloc
(lldb) run

This will print out a register read packet. To trigger memory writes:

(lldb) p (int)puts("hello")

Then you will see some individual register writes from the expression parser.

Great, thanks Greg.