[binutils-gdb] gdb+gdbserver: Fix build for aarch64-windows

Hannes Domani via Gdb-cvs <[email protected]> Fri, 26 Jun 2026 15:03:11 +0000 (GMT)
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a1523d51594417aa0c84ada7a85e8666f13ef1e9

commit a1523d51594417aa0c84ada7a85e8666f13ef1e9
Author: Hannes Domani <[email protected]>
Date:   Tue Jun 23 18:25:09 2026 +0200

    gdb+gdbserver: Fix build for aarch64-windows
    
    Some time ago siginfo_re was made per-thread state, but
    not every use location was adjusted, giving this error:
    
    ../../gdb/aarch64-windows-nat.c:139:31: error: no member named 'siginfo_er' in 'aarch64_windows_per_inferior'
      139 |   if (aarch64_windows_process.siginfo_er.ExceptionCode != EXCEPTION_BREAKPOINT
          |       ~~~~~~~~~~~~~~~~~~~~~~~ ^
    
    Fix by looking up the exception-record of the current thread.
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/aarch64-windows-nat.c      | 13 +++++++++----
 gdbserver/win32-aarch64-low.cc | 13 +++++++++----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/gdb/aarch64-windows-nat.c b/gdb/aarch64-windows-nat.c
index 29a6c95d485..b0d5f66884b 100644
--- a/gdb/aarch64-windows-nat.c
+++ b/gdb/aarch64-windows-nat.c
@@ -136,12 +136,17 @@ const int aarch64_mappings[] =
 std::vector<CORE_ADDR>
 aarch64_windows_nat_target::stopped_data_addresses ()
 {
-  if (aarch64_windows_process.siginfo_er.ExceptionCode != EXCEPTION_BREAKPOINT
-      || aarch64_windows_process.siginfo_er.NumberParameters != 2)
+  windows_thread_info *th = aarch64_windows_process.find_thread (inferior_ptid);
+  if (th == nullptr
+      || th->last_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
     return {};
 
-  const CORE_ADDR addr_trap
-    = (CORE_ADDR) aarch64_windows_process.siginfo_er.ExceptionInformation[1];
+  EXCEPTION_RECORD &er = th->last_event.u.Exception.ExceptionRecord;
+  if (er.ExceptionCode != EXCEPTION_BREAKPOINT
+      || er.NumberParameters != 2)
+    return {};
+
+  const CORE_ADDR addr_trap = (CORE_ADDR) er.ExceptionInformation[1];
 
   struct aarch64_debug_reg_state *state
     = aarch64_get_debug_reg_state (inferior_ptid.pid ());
diff --git a/gdbserver/win32-aarch64-low.cc b/gdbserver/win32-aarch64-low.cc
index 17f64906df4..5a7b72155db 100644
--- a/gdbserver/win32-aarch64-low.cc
+++ b/gdbserver/win32-aarch64-low.cc
@@ -133,12 +133,17 @@ aarch64_remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
 static std::vector<CORE_ADDR>
 aarch64_stopped_data_addresses ()
 {
-  if (windows_process.siginfo_er.ExceptionCode != EXCEPTION_BREAKPOINT ||
-      windows_process.siginfo_er.NumberParameters != 2)
+  windows_thread_info *th = windows_process.find_thread (current_thread->id);
+  if (th == nullptr
+      || th->last_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
     return {};
 
-  const CORE_ADDR addr_trap
-    = (CORE_ADDR) windows_process.siginfo_er.ExceptionInformation[1];
+  EXCEPTION_RECORD &er = th->last_event.u.Exception.ExceptionRecord;
+  if (er.ExceptionCode != EXCEPTION_BREAKPOINT ||
+      er.NumberParameters != 2)
+    return {};
+
+  const CORE_ADDR addr_trap = (CORE_ADDR) er.ExceptionInformation[1];
 
   return aarch64_stopped_data_addresses (&debug_reg_state, addr_trap);
 }