[Lldb-commits] [lldb] r371459 - [Reproducer] Disconnect when the replay server is out of packets.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 9 15:05:48 PDT 2019


Author: jdevlieghere
Date: Mon Sep  9 15:05:48 2019
New Revision: 371459

URL: http://llvm.org/viewvc/llvm-project?rev=371459&view=rev
Log:
[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.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp?rev=371459&r1=371458&r2=371459&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp Mon Sep  9 15:05:48 2019
@@ -9,6 +9,7 @@
 #include <errno.h>
 
 #include "lldb/Host/Config.h"
+#include "llvm/ADT/ScopeExit.h"
 
 #include "GDBRemoteCommunicationReplayServer.h"
 #include "ProcessGDBRemoteLog.h"
@@ -256,11 +257,10 @@ void GDBRemoteCommunicationReplayServer:
 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)) {




More information about the lldb-commits mailing list