summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2010-11-17 02:32:00 +0000
committerJim Ingham <jingham@apple.com>2010-11-17 02:32:00 +0000
commit0d8bcc79f436d21a79b3e0e92287e51e00540ba5 (patch)
treedfc84faaed0b50edc6745f9abeb6e67fbd43e7b5 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent9f49b37f25d0b0ebeaf711fcd013b4285e43610d (diff)
downloadbcm5719-llvm-0d8bcc79f436d21a79b3e0e92287e51e00540ba5.tar.gz
bcm5719-llvm-0d8bcc79f436d21a79b3e0e92287e51e00540ba5.zip
Added an "Interrupted" bit to the ProcessEventData. Halt now generates an event
with the Interrupted bit set. Process::HandlePrivateEvent ignores Interrupted events. DoHalt is changed to ensure that the stop even is processed, and an event with the Interrupted event is posted. Finally ClangFunction is rationalized to use this facility so the that Halt is handled more deterministically. llvm-svn: 119453
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 52499ba173a..fcbd523699f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -895,9 +895,15 @@ ProcessGDBRemote::WillResume ()
Error
ProcessGDBRemote::DoResume ()
{
+ Error error;
ProcessGDBRemoteLog::LogIf (GDBR_LOG_PROCESS, "ProcessGDBRemote::Resume()");
m_async_broadcaster.BroadcastEvent (eBroadcastBitAsyncContinue, new EventDataBytes (m_continue_packet.GetData(), m_continue_packet.GetSize()));
- return Error();
+ const uint32_t timedout_sec = 1;
+ if (m_gdb_comm.WaitForIsRunning (timedout_sec))
+ {
+ error.SetErrorString("Resume timed out.");
+ }
+ return error;
}
size_t
@@ -1115,20 +1121,47 @@ ProcessGDBRemote::RefreshStateAfterStop ()
}
Error
-ProcessGDBRemote::DoHalt ()
+ProcessGDBRemote::DoHalt (bool &caused_stop)
{
Error error;
+ caused_stop = false;
+
if (m_gdb_comm.IsRunning())
{
+ PausePrivateStateThread();
bool timed_out = false;
Mutex::Locker locker;
- if (!m_gdb_comm.SendInterrupt (locker, 2, &timed_out))
+
+ if (m_gdb_comm.SendInterrupt (locker, 2, &timed_out))
+ {
+ EventSP event_sp;
+ TimeValue timeout_time;
+ timeout_time = TimeValue::Now();
+ timeout_time.OffsetWithSeconds(2);
+
+ StateType state = WaitForStateChangedEventsPrivate (&timeout_time, event_sp);
+
+ if (!StateIsStoppedState (state))
+ {
+ LogSP log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
+ if (log)
+ log->Printf("ProcessGDBRemote::DoHalt() failed to stop after sending interrupt");
+ error.SetErrorString ("Did not get stopped event after interrupt succeeded.");
+ }
+ else
+ caused_stop = true;
+ }
+ else
{
if (timed_out)
error.SetErrorString("timed out sending interrupt packet");
else
error.SetErrorString("unknown error sending interrupt packet");
}
+
+ // Resume the private state thread at this point.
+ ResumePrivateStateThread();
+
}
return error;
}
@@ -2082,6 +2115,9 @@ ProcessGDBRemote::AsyncThread (void *arg)
if (listener.WaitForEvent (NULL, event_sp))
{
const uint32_t event_type = event_sp->GetType();
+ if (log)
+ log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) Got an event of type: %d...", __FUNCTION__, arg, process->GetID(), event_type);
+
switch (event_type)
{
case eBroadcastBitAsyncContinue:
OpenPOWER on IntegriCloud