]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Move software breakpoint recognition code into x86-windows-nat.c
authorHannes Domani <ssbssa@yahoo.de>
Fri, 23 Jan 2026 19:07:04 +0000 (20:07 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Fri, 23 Jan 2026 19:07:04 +0000 (20:07 +0100)
Approved-By: Tom Tromey <tom@tromey.com>
Reviewed-By: Christina Schimpe <christina.schimpe@intel.com>
gdb/windows-nat.c
gdb/windows-nat.h
gdb/x86-windows-nat.c

index a8698c15c883cc2908049859ee4d7302d043e034..3d1a75d1cc8da13388648b782fd72645bfd098c0 100644 (file)
@@ -1146,10 +1146,7 @@ windows_nat_target::get_windows_debug_event
                    thread_id, windows_process->desired_stop_thread_id);
 
       if (current_event->dwDebugEventCode == EXCEPTION_DEBUG_EVENT
-         && ((current_event->u.Exception.ExceptionRecord.ExceptionCode
-              == EXCEPTION_BREAKPOINT)
-             || (current_event->u.Exception.ExceptionRecord.ExceptionCode
-                 == STATUS_WX86_BREAKPOINT))
+         && is_sw_breakpoint (&current_event->u.Exception.ExceptionRecord)
          && windows_process->windows_initialization_done)
        {
          ptid_t ptid = ptid_t (current_event->dwProcessId, thread_id, 0);
@@ -1200,10 +1197,8 @@ windows_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
                  th->stopped_at_software_breakpoint = false;
                  if (windows_process->current_event.dwDebugEventCode
                      == EXCEPTION_DEBUG_EVENT
-                     && ((windows_process->current_event.u.Exception.ExceptionRecord.ExceptionCode
-                          == EXCEPTION_BREAKPOINT)
-                         || (windows_process->current_event.u.Exception.ExceptionRecord.ExceptionCode
-                             == STATUS_WX86_BREAKPOINT))
+                     && is_sw_breakpoint (&windows_process->current_event
+                                          .u.Exception.ExceptionRecord)
                      && windows_process->windows_initialization_done)
                    {
                      th->stopped_at_software_breakpoint = true;
index 537264a9231f2914a14a8d6bc4ae8e9192abc2b2..8263729554bee267350c313b5a083129f751c649 100644 (file)
@@ -215,6 +215,9 @@ protected:
   virtual void store_one_register (const struct regcache *regcache,
                                   windows_thread_info *th, int r) = 0;
 
+  /* Determine if ER contains a software-breakpoint.  */
+  virtual bool is_sw_breakpoint (const EXCEPTION_RECORD *er) const = 0;
+
 private:
 
   windows_thread_info *add_thread (ptid_t ptid, HANDLE h, void *tlb,
index 4e38181c55cba143e659e975b811ed5a22cc2bc8..f883080969468c3fb1410124926a9283fb990531 100644 (file)
@@ -65,6 +65,8 @@ struct x86_windows_nat_target final : public x86_nat_target<windows_nat_target>
                           windows_thread_info *th, int r) override;
   void store_one_register (const struct regcache *regcache,
                           windows_thread_info *th, int r) override;
+
+  bool is_sw_breakpoint (const EXCEPTION_RECORD *er) const override;
 };
 
 /* The current process.  */
@@ -280,6 +282,15 @@ x86_windows_nat_target::store_one_register (const struct regcache *regcache,
     regcache->raw_collect (r, context_ptr + x86_windows_process.mappings[r]);
 }
 
+/* See windows-nat.h.  */
+
+bool
+x86_windows_nat_target::is_sw_breakpoint (const EXCEPTION_RECORD *er) const
+{
+  return (er->ExceptionCode == EXCEPTION_BREAKPOINT
+         || er->ExceptionCode == STATUS_WX86_BREAKPOINT);
+}
+
 /* Hardware watchpoint support, adapted from go32-nat.c code.  */
 
 /* Pass the address ADDR to the inferior in the I'th debug register.