[lldb] Handle malformed qfThreadInfo reply
authorTed Woodward <tedwood@quicinc.com>
Thu, 16 Sep 2021 23:40:09 +0000 (18:40 -0500)
committerTed Woodward <tedwood@quicinc.com>
Thu, 23 Sep 2021 22:03:47 +0000 (17:03 -0500)
commit953ddded1aa2b459a939e0f1649691c9086ba416
tree6dfd5396f88d9fa50d57bd7d890b8e8f724b8077
parentd83ca624a1d52b600ddbd8bfcbb3d5d7c6003af7
[lldb] Handle malformed qfThreadInfo reply

If the remote gdbserver's qfThreadInfo reply has a trailing comma,
GDBRemoteCommunicationClient::GetCurrentProcessAndThreadIDs will return
an empty vector of thread ids. This will cause lldb to recurse through
three functions trying to get the list of threads, until it blows its
stack and crashes.

A trailing comma is a malformed response, but it shouldn't cause lldb to
crash. This patch will return the tids received before the malformed
response.

Reviewed By: clayborg, labath

Differential Revision: https://reviews.llvm.org/D109937
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py [new file with mode: 0644]