From aab78371b9273426a13d76bea5855640e650a056 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 28 Oct 2011 01:11:35 +0000 Subject: Fix up how we shut down the communication with debugserver so we don't rely on debugserver being responsive to shut down. llvm-svn: 143174 --- .../Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp') diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 917fc4df360..7f842c2ecc1 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1511,9 +1511,6 @@ ProcessGDBRemote::DoDetach() // Sleep for one second to let the process get all detached... StopAsyncThread (); - m_gdb_comm.StopReadThread(); - m_gdb_comm.Disconnect(); // Disconnect from the debug server. - SetPrivateState (eStateDetached); ResumePrivateStateThread(); @@ -1532,13 +1529,7 @@ ProcessGDBRemote::DoDestroy () // Interrupt if our inferior is running... if (m_gdb_comm.IsConnected()) { - if (m_public_state.GetValue() == eStateAttaching) - { - // We are being asked to halt during an attach. We need to just close - // our file handle and debugserver will go away, and we can be done... - m_gdb_comm.Disconnect(); - } - else + if (m_public_state.GetValue() != eStateAttaching) { StringExtractorGDBRemote response; @@ -1561,9 +1552,7 @@ ProcessGDBRemote::DoDestroy () } } StopAsyncThread (); - m_gdb_comm.StopReadThread(); KillDebugserverProcess (); - m_gdb_comm.Disconnect(); // Disconnect from the debug server. return error; } @@ -2294,6 +2283,9 @@ ProcessGDBRemote::StopAsyncThread () log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__); m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncThreadShouldExit); + + // This will shut down the async thread. + m_gdb_comm.Disconnect(); // Disconnect from the debug server. // Stop the stdio thread if (IS_VALID_LLDB_HOST_THREAD(m_async_thread)) -- cgit v1.2.3