Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp =================================================================== --- source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -2131,15 +2131,24 @@ // If the thread was already tracked, it means the created thread already received its SI_USER notification of creation. if (!created_now) { - // We can now resume the newly created thread since it is fully created. NotifyThreadCreateStopped (tid); - m_coordinator_up->RequestThreadResume (tid, - [=](lldb::tid_t tid_to_resume, bool supress_signal) - { - std::static_pointer_cast (new_thread_sp)->SetRunning (); - return Resume (tid_to_resume, LLDB_INVALID_SIGNAL_NUMBER); - }, - CoordinatorErrorHandler); + if (m_coordinator_up->IsPendingThreadStop()) + { + // If there is a pending stop for some other reason, + // don't resume the thread and mark it as stopped. + std::static_pointer_cast(new_thread_sp)->SetStoppedBySignal(0); + } + else + { + // We can now resume the newly created thread since it is fully created. + m_coordinator_up->RequestThreadResume( + tid, [=](lldb::tid_t tid_to_resume, bool supress_signal) + { + std::static_pointer_cast(new_thread_sp)->SetRunning(); + return Resume(tid_to_resume, LLDB_INVALID_SIGNAL_NUMBER); + }, + CoordinatorErrorHandler); + } } else { @@ -2154,14 +2163,23 @@ log->Printf ("NativeProcessLinux::%s() pid %" PRIu64 " received thread creation event but GetEventMessage failed so we don't know the new tid", __FUNCTION__, pid); } - // In all cases, we can resume the main thread here. - m_coordinator_up->RequestThreadResume (pid, - [=](lldb::tid_t tid_to_resume, bool supress_signal) - { - std::static_pointer_cast (thread_sp)->SetRunning (); - return Resume (tid_to_resume, LLDB_INVALID_SIGNAL_NUMBER); - }, - CoordinatorErrorHandler); + if (m_coordinator_up->IsPendingThreadStop()) + { + // If there is a pending stop for some other reason, + // don't resume the thread and mark it as stopped. + std::static_pointer_cast(thread_sp)->SetStoppedBySignal(0); + } + else + { + // If no stop is pending, we can resume the main thread here. + m_coordinator_up->RequestThreadResume( + pid, [=](lldb::tid_t tid_to_resume, bool supress_signal) + { + std::static_pointer_cast(thread_sp)->SetRunning(); + return Resume(tid_to_resume, LLDB_INVALID_SIGNAL_NUMBER); + }, + CoordinatorErrorHandler); + } break; } @@ -2482,15 +2500,24 @@ // If the thread was already tracked, it means the main thread already received its SIGTRAP for the create. if (!created_now) { - // We can now resume the newly created thread since it is fully created. NotifyThreadCreateStopped (pid); - m_coordinator_up->RequestThreadResume (pid, - [=](lldb::tid_t tid_to_resume, bool supress_signal) - { - std::static_pointer_cast (thread_sp)->SetRunning (); - return Resume (tid_to_resume, LLDB_INVALID_SIGNAL_NUMBER); - }, - CoordinatorErrorHandler); + if (m_coordinator_up->IsPendingThreadStop()) + { + // If there is a pending stop for some other reason, + // don't resume the thread and mark it as stopped. + std::static_pointer_cast(thread_sp)->SetStoppedBySignal(0); + } + else + { + // We can now resume the newly created thread since it is fully created. + m_coordinator_up->RequestThreadResume( + pid, [=](lldb::tid_t tid_to_resume, bool supress_signal) + { + std::static_pointer_cast(thread_sp)->SetRunning(); + return Resume(tid_to_resume, LLDB_INVALID_SIGNAL_NUMBER); + }, + CoordinatorErrorHandler); + } } else { Index: source/Plugins/Process/Linux/ThreadStateCoordinator.h =================================================================== --- source/Plugins/Process/Linux/ThreadStateCoordinator.h +++ source/Plugins/Process/Linux/ThreadStateCoordinator.h @@ -148,6 +148,10 @@ void LogEnableEventProcessing (bool enabled); + bool + IsPendingThreadStop() { + return GetPendingThreadStopNotification(); + } private: // Typedefs. Index: test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py =================================================================== --- test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py +++ test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py @@ -32,7 +32,6 @@ @python_api_test @dwarf_test - @expectedFailureLinux # fails in 10/100 dosep runs def test_watch_location_with_dwarf(self): """Exercise SBValue.WatchPointee() API to set a watchpoint.""" self.buildDwarf() Index: test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py =================================================================== --- test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -32,7 +32,6 @@ @python_api_test @dwarf_test - @expectedFailureLinux # failed 11/100 dosep runs def test_watch_address_with_dwarf(self): """Exercise SBTarget.WatchAddress() API to set a watchpoint.""" self.buildDwarf()