From a37bbbd43203eb383172e216ce7a979fe7f6e9e8 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 17 Feb 2017 11:48:34 +0000 Subject: NPL: Fix one more bug in the single step workaround In the case we are stepping over the thread creation instruction, we will end up calling Thread::SingleStep back-to-back twice (because of the intermediate PTRACE_EVENT_CLONE stop). This will cause the cpu mask to be set inappropriately (because the old SingleStepCheck object will be destroyed after we create the new one), and the single-step will fail. Before the refactor the code was still incorrect in this case, but in a different way (the thread was left with the incorrect mask after the stepping was complete), so this was not easy to spot. This fixes TestCreateDuringInstructionStep on the affected devices. llvm-svn: 295440 --- lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp index c2e1214b6ca6..a50ea7e3d0a5 100644 --- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -225,7 +225,13 @@ Error NativeThreadLinux::SingleStep(uint32_t signo) { MaybeLogStateChange(new_state); m_state = new_state; m_stop_info.reason = StopReason::eStopReasonNone; - m_step_workaround = SingleStepWorkaround::Get(m_tid); + + if(!m_step_workaround) { + // If we already hava a workaround inplace, don't reset it. Otherwise, the + // destructor of the existing instance will run after the new instance has + // fetched the cpu mask, and the thread will end up with the wrong mask. + m_step_workaround = SingleStepWorkaround::Get(m_tid); + } intptr_t data = 0; if (signo != LLDB_INVALID_SIGNAL_NUMBER) -- cgit v1.2.3