[Lldb-commits] [lldb] [lldb][Windows] WoA HW Watchpoint support in LLDB (PR #108072)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 10 02:26:31 PDT 2024


================
@@ -492,23 +492,36 @@ NativeProcessWindows::OnDebugException(bool first_chance,
   }
   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 &register_context = stop_thread->GetRegisterContext();
-        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);
+    if (NativeThreadWindows *stop_thread =
+            GetThreadByID(record.GetThreadID())) {
+      auto &reg_ctx = stop_thread->GetRegisterContext();
+      const auto exception_addr = record.GetExceptionAddress();
+      const auto thread_id = record.GetThreadID();
+
+      if (FindSoftwareBreakpoint(exception_addr)) {
+        LLDB_LOG(log, "Hit non-loader breakpoint at address {0:x}.",
+                 exception_addr);
+
+        reg_ctx.SetPC(reg_ctx.GetPC() - GetSoftwareBreakpointPCOffset());
----------------
DavidSpickett wrote:

Does the call to GetSoftwareBreakpointPCOffset replace the comment:
```
// The current PC is AFTER the BP opcode, on all architectures.
```
Want to make sure we don't lose this detail, but if GetSoftwareBreakpointPCOffset handles it then this is fine.

https://github.com/llvm/llvm-project/pull/108072


More information about the lldb-commits mailing list