From d7e23bef6ad497cd5a100126957c381e053dda9b Mon Sep 17 00:00:00 2001 From: dlav-sc Date: Mon, 30 Jun 2025 16:27:44 +0300 Subject: [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (#146072) lldb-server had limited support for single-stepping through the lr/sc atomic sequence. This patch enhances that support for all possible atomic sequences. The previous version contained an incorrect regex pattern in the test, causing the riscv-specific test to run on other platforms. This reland fixes the regex (see lldb/test/API/riscv/step/TestSoftwareStep.py) --- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 7f2aba0e4eb2..9c798cb1cc8f 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -833,7 +833,7 @@ void NativeProcessLinux::MonitorBreakpoint(NativeThreadLinux &thread) { auto stepping_with_bp_it = m_threads_stepping_with_breakpoint.find(thread.GetID()); if (stepping_with_bp_it != m_threads_stepping_with_breakpoint.end() && - stepping_with_bp_it->second == reg_ctx.GetPC()) + llvm::is_contained(stepping_with_bp_it->second, reg_ctx.GetPC())) thread.SetStoppedByTrace(); StopRunningThreads(thread.GetID()); @@ -1960,10 +1960,12 @@ void NativeProcessLinux::SignalIfAllThreadsStopped() { // Clear any temporary breakpoints we used to implement software single // stepping. for (const auto &thread_info : m_threads_stepping_with_breakpoint) { - Status error = RemoveBreakpoint(thread_info.second); - if (error.Fail()) - LLDB_LOG(log, "pid = {0} remove stepping breakpoint: {1}", - thread_info.first, error); + for (auto &&bp_addr : thread_info.second) { + Status error = RemoveBreakpoint(bp_addr); + if (error.Fail()) + LLDB_LOG(log, "pid = {0} remove stepping breakpoint: {1}", + thread_info.first, error); + } } m_threads_stepping_with_breakpoint.clear(); -- cgit v1.2.3