From 9b961cc6043a3b84195ae7d938d2816c96f76303 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 9 Sep 2019 22:05:48 +0000 Subject: [PATCH] [Reproducer] Disconnect when the replay server is out of packets. This is a fix for the issue described in r371144. > On more than one occasion I've found this test got stuck during replay > while waiting for a packet from debugserver when the debugger was in > the process of being destroyed. When the replay server is out of packets we should just disconnect so the debugger doesn't have to do any cleanup that it wouldn't do during capture. llvm-svn: 371459 --- .../Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp index 417f573..39304a6 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp @@ -9,6 +9,7 @@ #include #include "lldb/Host/Config.h" +#include "llvm/ADT/ScopeExit.h" #include "GDBRemoteCommunicationReplayServer.h" #include "ProcessGDBRemoteLog.h" @@ -256,11 +257,10 @@ void GDBRemoteCommunicationReplayServer::ReceivePacket( thread_result_t GDBRemoteCommunicationReplayServer::AsyncThread(void *arg) { GDBRemoteCommunicationReplayServer *server = (GDBRemoteCommunicationReplayServer *)arg; - + auto D = make_scope_exit([&]() { server->Disconnect(); }); EventSP event_sp; bool done = false; - - while (true) { + while (!done) { if (server->m_async_listener_sp->GetEvent(event_sp, llvm::None)) { const uint32_t event_type = event_sp->GetType(); if (event_sp->BroadcasterIs(&server->m_async_broadcaster)) { -- 2.7.4