[Lldb-commits] [lldb] [NFC][lldb][windows] break down NativeProcessWindows::OnDebugException (PR #200832)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 08:13:59 PDT 2026


================
@@ -471,152 +471,157 @@ void NativeProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) {
 }
 
 ExceptionResult
-NativeProcessWindows::OnDebugException(bool first_chance,
-                                       const ExceptionRecord &record) {
+NativeProcessWindows::HandleSingleStepException(const ExceptionRecord &record) {
   Log *log = GetLog(WindowsLog::Exception);
-  llvm::sys::ScopedLock lock(m_mutex);
+  uint32_t wp_id = LLDB_INVALID_INDEX32;
+#ifndef __aarch64__
+  if (NativeThreadWindows *thread = GetThreadByID(record.GetThreadID())) {
+    NativeRegisterContextWindows &reg_ctx = thread->GetRegisterContext();
+    Status error =
+        reg_ctx.GetWatchpointHitIndex(wp_id, record.GetExceptionAddress());
+    if (error.Fail())
+      LLDB_LOG(log,
+               "received error while checking for watchpoint hits, pid = "
+               "{0}, error = {1}",
+               thread->GetID(), error);
+    if (wp_id != LLDB_INVALID_INDEX32) {
+      addr_t wp_addr = reg_ctx.GetWatchpointAddress(wp_id);
+      addr_t wp_hit_addr = reg_ctx.GetWatchpointHitAddress(wp_id);
+      std::string desc =
+          formatv("{0} {1} {2}", wp_addr, wp_id, wp_hit_addr).str();
+      StopThread(record.GetThreadID(), StopReason::eStopReasonWatchpoint, desc);
+    }
+  }
+#endif
+  if (wp_id == LLDB_INVALID_INDEX32)
----------------
Nerixyz wrote:

These lines were swapped before like this:
```suggestion
  if (wp_id == LLDB_INVALID_INDEX32)
#endif
```

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


More information about the lldb-commits mailing list