summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-03-21 04:08:31 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-03-21 04:08:31 +0000
commita262531dd2ed2c5591c72adf4949a0cdc65ef061 (patch)
treee2f094199c7cbb5116ded12420076b7712a5125d /lldb/source/Plugins/Process/gdb-remote
parent60212be619a3fd570300e685933d39fe201a096f (diff)
downloadbcm5719-llvm-a262531dd2ed2c5591c72adf4949a0cdc65ef061.tar.gz
bcm5719-llvm-a262531dd2ed2c5591c72adf4949a0cdc65ef061.zip
[Reproducers] Properly handle QEnvironment packets
On Linux, a QEnvironment packet is sent for every environment variable. This breaks replay when the number of environment variables is different then during capture. The solution is to always reply with OK. llvm-svn: 356643
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
index 2aa121b11e8..1fdb688b0ca 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
@@ -107,6 +107,13 @@ GDBRemoteCommunicationReplayServer::GetPacketAndSendResponse(
m_send_acks = false;
}
+ // A QEnvironment packet is sent for every environment variable. If the
+ // number of environment variables is different during replay, the replies
+ // become out of sync.
+ if (packet.GetStringRef().find("QEnvironment") == 0) {
+ return SendRawPacketNoLock("$OK#9a", true);
+ }
+
Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
while (!m_packet_history.empty()) {
// Pop last packet from the history.
@@ -122,6 +129,14 @@ GDBRemoteCommunicationReplayServer::GetPacketAndSendResponse(
"GDBRemoteCommunicationReplayServer actual packet: '{}'\n",
packet.GetStringRef());
}
+
+ // Ignore QEnvironment packets as they're handled earlier.
+ if (entry.packet.data.find("QEnvironment") == 1) {
+ assert(m_packet_history.back().type ==
+ GDBRemoteCommunicationHistory::ePacketTypeRecv);
+ m_packet_history.pop_back();
+ }
+
continue;
}
OpenPOWER on IntegriCloud