From b8af31d4b60bee8dc4faefad30764cbce219e2a9 Mon Sep 17 00:00:00 2001 From: Chaoren Lin Date: Tue, 3 Feb 2015 01:50:51 +0000 Subject: Fix some bugs in llgs thread state handling. * When the thread state coordinator is told to skip sending a stop request for a running thread that is ignored (e.g. the thread that steps in a step operation is technically running and should not have a stop sent to it, since it will stop of its own accord per the kernel step operation), ensure the deferred signal notification logic still waits for the skipped thread. (i.e. we want to defer the notification until the stepping thread is indeed stopped, we just don't want to send it a tgkill). * Add ThreadStateCoordinator::RequestResumeAsNeeded(). This variant of the RequestResume() method does not call the error function when the thread is already running. Instead, it just logs that the thread is already running and skips the resume operation. This is useful for the case of vCont;c handling, where we tell all threads that they should be running. At the place we're calling, all we know is "we want this thread running if it isn't already," and that's exactly what this command does. * Formatting change (minor) in NativeThreadLinux logging. llvm-svn: 227913 --- .../Plugins/Process/Linux/NativeProcessLinux.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 5c2975891727..da71e15f991f 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -166,7 +166,7 @@ namespace { Log *const log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD); if (log) - log->Printf ("NativePlatformLinux::%s ThreadStateCoordinator error received: %s", __FUNCTION__, error_message.c_str ()); + log->Printf ("NativePlatformLinux::%s %s", __FUNCTION__, error_message.c_str ()); assert (false && "ThreadStateCoordinator error reported"); } @@ -2689,14 +2689,14 @@ NativeProcessLinux::Resume (const ResumeActionList &resume_actions) { // Run the thread, possibly feeding it the signal. const int signo = action->signal; - m_coordinator_up->RequestThreadResume (thread_sp->GetID (), - [=](lldb::tid_t tid_to_resume) - { - reinterpret_cast (thread_sp.get ())->SetRunning (); - // Pass this signal number on to the inferior to handle. - Resume (tid_to_resume, (signo > 0) ? signo : LLDB_INVALID_SIGNAL_NUMBER); - }, - CoordinatorErrorHandler); + m_coordinator_up->RequestThreadResumeAsNeeded (thread_sp->GetID (), + [=](lldb::tid_t tid_to_resume) + { + reinterpret_cast (thread_sp.get ())->SetRunning (); + // Pass this signal number on to the inferior to handle. + Resume (tid_to_resume, (signo > 0) ? signo : LLDB_INVALID_SIGNAL_NUMBER); + }, + CoordinatorErrorHandler); ++resume_count; break; } -- cgit v1.2.3