Add a minimal support for the multiprocess extension in gdb-remote
client. It accepts PIDs as part of thread-ids, and rejects PIDs that
do not match the current inferior.
Details
Diff Detail
Event Timeline
@labath, split GetCurrentThreadIDs() as suggested. I've also modified GetCurrentProcessID() to prefer explicit PID over TID when available.
Added better PID mismatch handling in SetThreadStopInfo(). Not that most of the call sites actually check the return value...
I think this looks fine. Could you also create a gdb-client test case (you can ignore the default thread thingy)?
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | ||
---|---|---|
1131 | It looks like this is only used in the (probably completely broken) non-stop mode. I should put that on my to-delete list... | |
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h | ||
370 | lets make this an actual return value |
Changed GetCurrentProcessAndThreadIDs() to return the vector, and reformatted.
Tests next.
Add some tests.
@labath, I'd use some help now. When the stop reason includes wrong PID, the GDB exchange seems to enter a dead loop:
b-remote.async> < 5> send packet: $c#63 b-remote.async> < 25> read packet: $S02thread:p404.10210;#cc intern-state < 16> send packet: $qfThreadInfo#bb intern-state < 26> read packet: $mp400.10200,p400.10204#e7 intern-state < 16> send packet: $qsThreadInfo#c8 intern-state < 5> read packet: $l#6c
I think this is because most of the code doesn't really care about SetThreadStopInfo()'s return value, and I'm not really convinced that's the best way of reporting an error. Could you suggest how to handle 'wrong PID' error here?
Yeah, that's tricky. For a inconsistent/unsupported response like this, probably the only reasonable thing we can do print some error message, terminate the connection and put the inferior into some terminal state. However, I don't think we have anything like that (and I suspect there are plenty of other ways one could trigger a loop like this). I'd say we should just delete the test right now.
lets make this an actual return value