amccarth created this revision. amccarth added a reviewer: zturner. amccarth added a subscriber: lldb-commits.
I don't understand how this works before, but this fixes the recent test regressions on Windows in TestConsecutiveBreakpoints.py. LLDB wasn't stopping when single-stepping onto a breakpoint. (Note that `process continue` from one breakpoint starts with a single-step, so you don't have to be explicitly single-stepping to run into this problem.) The solution is to check if the single step lands on a breakpoint, and, if it does, to treat that like a breakpoint hint. Note there's a subtle difference in the PC (program counter) compared to actually hitting a breakpoint. This fixes TestConsecutiveBreakpoints.py on Windows, and no other tests regress. Ran clang-format. http://reviews.llvm.org/D16825 Files: source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp Index: source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp =================================================================== --- source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp +++ source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp @@ -554,11 +554,25 @@ { case EXCEPTION_SINGLE_STEP: { - stop_info = StopInfo::CreateStopReasonToTrace(*stop_thread); - stop_thread->SetStopInfo(stop_info); - WINLOG_IFANY(WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_STEP, "RefreshStateAfterStop single stepping thread %u", - stop_thread->GetID()); - stop_thread->SetStopInfo(stop_info); + RegisterContextSP register_context = stop_thread->GetRegisterContext(); + const uint64_t pc = register_context->GetPC(); + BreakpointSiteSP site(GetBreakpointSiteList().FindByAddress(pc)); + if (site && site->ValidForThisThread(stop_thread.get())) + { + WINLOG_IFANY(WINDOWS_LOG_BREAKPOINTS | WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_STEP, + "Single-stepped onto a breakpoint in process %I64u at " + "address 0x%I64x with breakpoint site %d", + m_session_data->m_debugger->GetProcess().GetProcessId(), pc, site->GetID()); + stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(*stop_thread, site->GetID()); + stop_thread->SetStopInfo(stop_info); + } + else + { + WINLOG_IFANY(WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_STEP, + "RefreshStateAfterStop single stepping thread %u", stop_thread->GetID()); + stop_info = StopInfo::CreateStopReasonToTrace(*stop_thread); + stop_thread->SetStopInfo(stop_info); + } return; }
Index: source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp =================================================================== --- source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp +++ source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp @@ -554,11 +554,25 @@ { case EXCEPTION_SINGLE_STEP: { - stop_info = StopInfo::CreateStopReasonToTrace(*stop_thread); - stop_thread->SetStopInfo(stop_info); - WINLOG_IFANY(WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_STEP, "RefreshStateAfterStop single stepping thread %u", - stop_thread->GetID()); - stop_thread->SetStopInfo(stop_info); + RegisterContextSP register_context = stop_thread->GetRegisterContext(); + const uint64_t pc = register_context->GetPC(); + BreakpointSiteSP site(GetBreakpointSiteList().FindByAddress(pc)); + if (site && site->ValidForThisThread(stop_thread.get())) + { + WINLOG_IFANY(WINDOWS_LOG_BREAKPOINTS | WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_STEP, + "Single-stepped onto a breakpoint in process %I64u at " + "address 0x%I64x with breakpoint site %d", + m_session_data->m_debugger->GetProcess().GetProcessId(), pc, site->GetID()); + stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(*stop_thread, site->GetID()); + stop_thread->SetStopInfo(stop_info); + } + else + { + WINLOG_IFANY(WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_STEP, + "RefreshStateAfterStop single stepping thread %u", stop_thread->GetID()); + stop_info = StopInfo::CreateStopReasonToTrace(*stop_thread); + stop_thread->SetStopInfo(stop_info); + } return; }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits