[Lldb-commits] [lldb] [lldb][Windows] WoA HW Break and Watchpoint support in LLDB (PR #108072)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 11 01:44:19 PDT 2024
================
@@ -491,24 +491,47 @@ NativeProcessWindows::OnDebugException(bool first_chance,
return ExceptionResult::MaskException;
}
case DWORD(STATUS_BREAKPOINT):
- case STATUS_WX86_BREAKPOINT:
- if (FindSoftwareBreakpoint(record.GetExceptionAddress())) {
- LLDB_LOG(log, "Hit non-loader breakpoint at address {0:x}.",
- record.GetExceptionAddress());
-
- StopThread(record.GetThreadID(), StopReason::eStopReasonBreakpoint);
-
- if (NativeThreadWindows *stop_thread =
- GetThreadByID(record.GetThreadID())) {
- auto ®ister_context = stop_thread->GetRegisterContext();
+ case STATUS_WX86_BREAKPOINT: {
+ bool breakpoint_hit = false;
+ NativeThreadWindows *stop_thread = GetThreadByID(record.GetThreadID());
+
+ if (stop_thread) {
+ uint32_t hw_id = LLDB_INVALID_INDEX32;
+ auto ®_ctx = stop_thread->GetRegisterContext();
+ reg_ctx.GetHardwareBreakHitIndex(hw_id, record.GetExceptionAddress());
+ if (hw_id != LLDB_INVALID_INDEX32) {
+ breakpoint_hit = true;
+ LLDB_LOG(log, "Hit hardware breakpoint at address {0:x}.",
+ record.GetExceptionAddress());
+ } else if (FindSoftwareBreakpoint(record.GetExceptionAddress())) {
+ breakpoint_hit = true;
+ LLDB_LOG(log, "Hit non-loader breakpoint at address {0:x}.",
+ record.GetExceptionAddress());
uint32_t breakpoint_size = GetSoftwareBreakpointPCOffset();
// The current PC is AFTER the BP opcode, on all architectures.
- uint64_t pc = register_context.GetPC() - breakpoint_size;
- register_context.SetPC(pc);
+ uint64_t pc = reg_ctx.GetPC() - breakpoint_size;
+ reg_ctx.SetPC(pc);
}
- SetState(eStateStopped, true);
- return ExceptionResult::MaskException;
+ if (breakpoint_hit) {
+ StopThread(record.GetThreadID(), StopReason::eStopReasonBreakpoint);
+ SetState(eStateStopped, true);
+ return ExceptionResult::MaskException;
+ } else {
+ const std::vector<ULONG_PTR> &args = record.GetExceptionArguments();
+ if (args.size() >= 2) {
----------------
DavidSpickett wrote:
What does this function return if this is false?
https://github.com/llvm/llvm-project/pull/108072
More information about the lldb-commits
mailing list