summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-04-12 18:49:31 +0000
committerJim Ingham <jingham@apple.com>2012-04-12 18:49:31 +0000
commitb1e2e848f3308d38c19f6d8d321df4f636be5f7c (patch)
tree66bf971d417617cf9a9d36d40429d39c22bb8bbe /lldb/source/Plugins
parent5b7a845a0ac7fcf4246fe126fdb4fd25d91a72fd (diff)
downloadbcm5719-llvm-b1e2e848f3308d38c19f6d8d321df4f636be5f7c.tar.gz
bcm5719-llvm-b1e2e848f3308d38c19f6d8d321df4f636be5f7c.zip
Make sure that DoResume doesn't stall if we shut down the async thread while DoResume is waiting
for packet confirmation. Also added a bit more logging. Also, unlock the writer end of the run lock in Process.cpp on our way out of the private state thread so that the Process can shut down cleanly. <rdar://problem/11228538> llvm-svn: 154601
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp22
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h3
2 files changed, 24 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 9b875012a6a..4dba00bb43f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -175,6 +175,7 @@ ProcessGDBRemote::ProcessGDBRemote(Target& target, Listener &listener) :
{
m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadShouldExit, "async thread should exit");
m_async_broadcaster.SetEventName (eBroadcastBitAsyncContinue, "async thread continue");
+ m_async_broadcaster.SetEventName (eBroadcastBitAsyncThreadDidExit, "async thread did exit");
}
//----------------------------------------------------------------------
@@ -927,6 +928,8 @@ ProcessGDBRemote::DoResume ()
Listener listener ("gdb-remote.resume-packet-sent");
if (listener.StartListeningForEvents (&m_gdb_comm, GDBRemoteCommunication::eBroadcastBitRunPacketSent))
{
+ listener.StartListeningForEvents (&m_async_broadcaster, ProcessGDBRemote::eBroadcastBitAsyncThreadDidExit);
+
StreamString continue_packet;
bool continue_packet_error = false;
if (m_gdb_comm.HasAnyVContSupport ())
@@ -1122,10 +1125,29 @@ ProcessGDBRemote::DoResume ()
TimeValue timeout;
timeout = TimeValue::Now();
timeout.OffsetWithSeconds (5);
+ if (!IS_VALID_LLDB_HOST_THREAD(m_async_thread))
+ {
+ error.SetErrorString ("Trying to resume but the async thread is dead.");
+ if (log)
+ log->Printf ("ProcessGDBRemote::DoResume: Trying to resume but the async thread is dead.");
+ return error;
+ }
+
m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (continue_packet.GetData(), continue_packet.GetSize()));
if (listener.WaitForEvent (&timeout, event_sp) == false)
+ {
error.SetErrorString("Resume timed out.");
+ if (log)
+ log->Printf ("ProcessGDBRemote::DoResume: Resume timed out.");
+ }
+ else if (event_sp->BroadcasterIs (&m_async_broadcaster))
+ {
+ error.SetErrorString ("Broadcast continue, but the async thread was killed before we got an ack back.");
+ if (log)
+ log->Printf ("ProcessGDBRemote::DoResume: Broadcast continue, but the async thread was killed before we got an ack back.");
+ return error;
+ }
}
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 6a0758bf199..f0cd5aab18b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -293,7 +293,8 @@ protected:
enum
{
eBroadcastBitAsyncContinue = (1 << 0),
- eBroadcastBitAsyncThreadShouldExit = (1 << 1)
+ eBroadcastBitAsyncThreadShouldExit = (1 << 1),
+ eBroadcastBitAsyncThreadDidExit = (1 << 2)
};
lldb_private::Flags m_flags; // Process specific flags (see eFlags enums)
OpenPOWER on IntegriCloud