aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386bsd-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/i386bsd-nat.c')
-rw-r--r--gdb/i386bsd-nat.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/gdb/i386bsd-nat.c b/gdb/i386bsd-nat.c
index ad5a301..a941d5b 100644
--- a/gdb/i386bsd-nat.c
+++ b/gdb/i386bsd-nat.c
@@ -382,19 +382,39 @@ kernel_u_size (void)
return (sizeof (struct user));
}
-/* See i386bsd-tdep.c. */
-extern int i386bsd_sigcontext_pc_offset;
-
void
_initialize_i386bsd_nat (void)
{
+ int sc_pc_offset;
+
/* To support the recognition of signal handlers, i386bsd-tdep.c
hardcodes some constants. Inclusion of this file means that we
are compiling a native debugger, which means that we can use the
system header files and sysctl(3) to get at the relevant
information. */
+#if defined (__FreeBSD_version) && __FreeBSD_version >= 400011
+ extern int i386fbsd4_sc_pc_offset;
+#define SC_PC_OFFSET i386fbsd4_sc_pc_offset
+#elif defined (NetBSD) || defined (__NetBSD_Version__)
+ extern int i386nbsd_sc_pc_offset;
+#define SC_PC_OFFSET i386nbsd_sc_pc_offset
+#else
+ extern int i386bsd_sc_pc_offset;
+#define SC_PC_OFFSET i386bsd_sc_pc_offset
+#endif
+
/* Override the default value for the offset of the program counter
in the sigcontext structure. */
- i386bsd_sigcontext_pc_offset = offsetof (struct sigcontext, sc_pc);
+ sc_pc_offset = offsetof (struct sigcontext, sc_pc);
+
+ if (SC_PC_OFFSET != sc_pc_offset)
+ {
+ warning ("\
+offsetof (struct sigcontext, sc_pc) yields %d instead of %d.\n\
+Please report this to <bug-gdb@gnu.org>.",
+ sc_pc_offset, SC_PC_OFFSET);
+ }
+
+ SC_PC_OFFSET = sc_pc_offset;
}