From: Hannes Domani Date: Mon, 26 Jan 2026 18:34:16 +0000 (+0100) Subject: gdbserver: Move software breakpoint recognition code into win32-i386-low.cc X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbf0e9445f211d4fb1e525c5a0c5455656c68ee1;p=thirdparty%2Fbinutils-gdb.git gdbserver: Move software breakpoint recognition code into win32-i386-low.cc Approved-By: Tom Tromey --- diff --git a/gdbserver/win32-i386-low.cc b/gdbserver/win32-i386-low.cc index 7e88d16fdd9..15addd9175d 100644 --- a/gdbserver/win32-i386-low.cc +++ b/gdbserver/win32-i386-low.cc @@ -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, }; diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 6c0a7e16ac9..ceee69db223 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -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; diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h index a8109b7caf0..0259105ba11 100644 --- a/gdbserver/win32-low.h +++ b/gdbserver/win32-low.h @@ -84,6 +84,9 @@ struct win32_target_ops int size, struct raw_breakpoint *bp); int (*stopped_by_watchpoint) (void); std::vector (*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;