From 404e370892a8548cf6656b0913b51701001123fa Mon Sep 17 00:00:00 2001 From: Todd Fiala Date: Thu, 2 Oct 2014 14:41:15 +0000 Subject: thread state coordinator: requesting resume now signals error appropriately. Added tests to verify that the coordinator signals an error if the given thread to resume is unknown, and if the thread is through to be running already. Modified resume handling code to match tests. llvm-svn: 218872 --- .../Plugins/Process/Linux/ThreadStateCoordinator.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/ThreadStateCoordinator.cpp') diff --git a/lldb/source/Plugins/Process/Linux/ThreadStateCoordinator.cpp b/lldb/source/Plugins/Process/Linux/ThreadStateCoordinator.cpp index 429c70b9030..7f20717f3bf 100644 --- a/lldb/source/Plugins/Process/Linux/ThreadStateCoordinator.cpp +++ b/lldb/source/Plugins/Process/Linux/ThreadStateCoordinator.cpp @@ -333,18 +333,25 @@ public: EventLoopResult ProcessEvent(ThreadStateCoordinator &coordinator) override { - // Tell the thread to resume if we don't already think it is running. + // Ensure we know about the thread. auto find_it = coordinator.m_tid_stop_map.find (m_tid); if (find_it == coordinator.m_tid_stop_map.end ()) { - // Skip the resume call - we think it is already running because we don't know anything about the thread. - coordinator.Log ("EventRequestResume::%s skipping resume request because we don't know about tid %" PRIu64 " and we therefore assume it is running.", __FUNCTION__, m_tid); + // We don't know about this thread. This is an error condition. + std::ostringstream error_message; + error_message << "error: tid " << m_tid << " asked to resume but tid is unknown"; + m_error_function (error_message.str ()); return eventLoopResultContinue; } - else if (!find_it->second) + + // Tell the thread to resume if we don't already think it is running. + const bool is_stopped = find_it->second; + if (!is_stopped) { // Skip the resume call - we have tracked it to be running. - coordinator.Log ("EventRequestResume::%s skipping resume request because tid %" PRIu64 " is already running according to our state tracking.", __FUNCTION__, m_tid); + std::ostringstream error_message; + error_message << "error: tid " << m_tid << " asked to resume but we think it is already running"; + m_error_function (error_message.str ()); return eventLoopResultContinue; } -- cgit v1.2.3