llvm-project/lldb/source/Plugins/Process/gdb-remote
Jim Ingham 72ba78c29e When SendContinuePacketAndWaitForResponse returns eStateInvalid, don't fetch more packets.
This looks like just an oversight in the AsyncThread function.  It gets a result of
eStateInvalid, and then marks the process as exited, but doesn't set "done" to true,
so we go to fetch another event.  That is not safe, since you don't know when that
extra packet is going to arrive.  If it arrives while you are tearing down the
process, the internal-state-thread might try to handle it when the process in not
in a good state.

Rather than put more effort into checking all the shutdown paths to make sure this
extra packet doesn't cause problems, just don't fetch it.  We weren't going to do
anything useful with it anyway.

The main part of the patch is setting "done = true" when we get the eStateInvalid.
I also added a check at the beginning of the while(done) loop to prevent another error
from getting us to fetch packets for an exited process.

I added a test case to ensure that if an Interrupt fails, we call the process
exited.  I can't test exactly the error I'm fixing, there's no good way to know
that the stop reply for the failed interrupt wasn't fetched.  But at least this
asserts that the overall behavior is correct.

Differential Revision: https://reviews.llvm.org/D101933
2021-05-06 14:11:42 -07:00
..
CMakeLists.txt [lldb] Allows customizing libxml2 for darwin 2020-05-20 12:27:08 -07:00
GDBRemoteClientBase.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
GDBRemoteClientBase.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
GDBRemoteCommunication.cpp [lldb/ipv6] Support running lldb tests in an ipv6-only environment. 2020-09-30 11:08:41 -07:00
GDBRemoteCommunication.h [lldb] NFC remove DISALLOW_COPY_AND_ASSIGN 2020-06-02 13:23:53 -04:00
GDBRemoteCommunicationClient.cpp [lldb] Set addressable bits from qHostInfo 2021-04-16 13:49:38 -07:00
GDBRemoteCommunicationClient.h [lldb] Set addressable bits from qHostInfo 2021-04-16 13:49:38 -07:00
GDBRemoteCommunicationHistory.cpp [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
GDBRemoteCommunicationHistory.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
GDBRemoteCommunicationReplayServer.cpp [lldb/Reproducers] Move connection logic into replay server (NFC) 2020-05-19 10:55:35 -07:00
GDBRemoteCommunicationReplayServer.h [lldb] NFC remove DISALLOW_COPY_AND_ASSIGN 2020-06-02 13:23:53 -04:00
GDBRemoteCommunicationServer.cpp [trace][intel-pt] Implement trace start and trace stop 2021-03-30 17:31:37 -07:00
GDBRemoteCommunicationServer.h [trace][intel-pt] Implement trace start and trace stop 2021-03-30 17:31:37 -07:00
GDBRemoteCommunicationServerCommon.cpp [lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs 2021-04-14 21:08:55 +02:00
GDBRemoteCommunicationServerCommon.h [lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs 2021-04-14 21:08:55 +02:00
GDBRemoteCommunicationServerLLGS.cpp [lldb] [gdb-remote] Report QPassSignals and qXfer via extensions API 2021-04-27 19:34:00 +02:00
GDBRemoteCommunicationServerLLGS.h [lldb] [llgs] Support owning and detaching extra processes 2021-04-24 11:08:33 +02:00
GDBRemoteCommunicationServerPlatform.cpp [lldb] Fix TestPlatformProcessConnect.py 2021-01-14 09:49:19 +01:00
GDBRemoteCommunicationServerPlatform.h [lldb] Use llvm::Optional for port in LaunchGDBServer 2020-11-30 11:20:39 +00:00
GDBRemoteRegisterContext.cpp Support GDB remote g packet partial read 2021-03-02 17:21:48 +05:00
GDBRemoteRegisterContext.h Support GDB remote g packet partial read 2021-03-02 17:21:48 +05:00
ProcessGDBRemote.cpp When SendContinuePacketAndWaitForResponse returns eStateInvalid, don't fetch more packets. 2021-05-06 14:11:42 -07:00
ProcessGDBRemote.h [lldb] [client] Support for multiprocess extension 2021-04-08 13:45:07 +02:00
ProcessGDBRemoteLog.cpp [lldb][NFC] Fix all formatting errors in .cpp file headers 2020-01-24 08:52:55 +01:00
ProcessGDBRemoteLog.h [lldb] Update header guards to be consistent and compliant with LLVM (NFC) 2020-02-17 23:15:40 -08:00
ProcessGDBRemoteProperties.td [lldb/gdb-remote] Change default value of use-libraries-svr4 to true 2020-05-14 12:17:37 +02:00
ThreadGDBRemote.cpp [LLDB] Add per-thread register infos shared pointer in gdb-remote 2021-01-15 16:11:17 +05:00
ThreadGDBRemote.h [LLDB] Add per-thread register infos shared pointer in gdb-remote 2021-01-15 16:11:17 +05:00