]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver: Move software breakpoint recognition code into win32-i386-low.cc
authorHannes Domani <ssbssa@yahoo.de>
Mon, 26 Jan 2026 18:34:16 +0000 (19:34 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Mon, 26 Jan 2026 18:34:16 +0000 (19:34 +0100)
Approved-By: Tom Tromey <tom@tromey.com>
gdbserver/win32-i386-low.cc
gdbserver/win32-low.cc
gdbserver/win32-low.h

index 7e88d16fdd9805f31a886c5080e8e2860a04474f..15addd9175df8dbabb1d5e42d0cea0d014329d7a 100644 (file)
@@ -632,6 +632,15 @@ i386_win32_set_pc (struct regcache *regcache, CORE_ADDR pc)
     }
 }
 
+/* Implement win32_target_ops "is_sw_breakpoint" method.  */
+
+static bool
+i386_is_sw_breakpoint (const EXCEPTION_RECORD *er)
+{
+  return (er->ExceptionCode == EXCEPTION_BREAKPOINT
+         || er->ExceptionCode == STATUS_WX86_BREAKPOINT);
+}
+
 struct win32_target_ops the_low_target = {
   i386_arch_setup,
   i386_win32_num_regs,
@@ -652,4 +661,5 @@ struct win32_target_ops the_low_target = {
   i386_remove_point,
   x86_stopped_by_watchpoint,
   x86_stopped_data_addresses,
+  i386_is_sw_breakpoint,
 };
index 6c0a7e16ac9162ca720e702586b47ad416be1f7c..ceee69db22303fcf77b04a8fe49757ca2aee16a5 100644 (file)
@@ -937,10 +937,8 @@ maybe_adjust_pc ()
   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))
+      && (*the_low_target.is_sw_breakpoint) (&windows_process.current_event
+                                            .u.Exception.ExceptionRecord)
       && windows_process.child_initialization_done)
     {
       th->stopped_at_software_breakpoint = true;
index a8109b7caf094607677dfe910f621071c25fb18f..0259105ba11acd6ce9ea369bf0201270fb667c9c 100644 (file)
@@ -84,6 +84,9 @@ struct win32_target_ops
                       int size, struct raw_breakpoint *bp);
   int (*stopped_by_watchpoint) (void);
   std::vector<CORE_ADDR> (*stopped_data_addresses) ();
+
+  /* Determine if ER contains a software-breakpoint.  */
+  bool (*is_sw_breakpoint) (const EXCEPTION_RECORD *er);
 };
 
 extern struct win32_target_ops the_low_target;