Use gdbarch_long_bit to determine layout of FreeBSD siginfo_t.
authorJohn Baldwin <jhb@FreeBSD.org>
Mon, 9 Oct 2017 16:54:42 +0000 (09:54 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Mon, 9 Oct 2017 16:54:42 +0000 (09:54 -0700)
FreeBSD architectures are either ILP32 or LP64 resulting in two
different layouts for siginfo_t.  Previously, the 'bits_per_word'
member of bfd_arch_info was used to determine the layout to use for a
given FreeBSD architecture.  However, mipsn32 architectures inherit
from a 64-bit mips architecture where bits_per_word is 64.  As a
result, $_siginfo was not properly extracted from FreeBSD/mipsn32 core
dumps.  Fix this by using gdbarch_long_bit instead of 'bits_per_word'
to determine if a FreeBSD architecture is ILP32 or LP64.

gdb/ChangeLog:

* fbsd-nat.c (fbsd_siginfo_size): Use gdbarch_long_bit.
(fbsd_convert_siginfo): Likewise.
* fbsd-tdep.c (fbsd_core_xfer_siginfo): Likewise.

gdb/ChangeLog
gdb/fbsd-nat.c
gdb/fbsd-tdep.c

index 7c8c6e4fe5b05d8cb0a2bddead4025068f6b459e..b04da8bd443d490036dbbd77d4ccdf231a5872fb 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-09  John Baldwin  <jhb@FreeBSD.org>
+
+       * fbsd-nat.c (fbsd_siginfo_size): Use gdbarch_long_bit.
+       (fbsd_convert_siginfo): Likewise.
+       * fbsd-tdep.c (fbsd_core_xfer_siginfo): Likewise.
+
 2017-10-09  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * configure.ac (try_guile_versions): Remove guile-2.2.
index 5ad0dda5b433dec171d889dd09567d5d2c9a86a9..265175a769478b0b184ba916f20710540971442d 100644 (file)
@@ -279,7 +279,7 @@ fbsd_siginfo_size ()
   struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
 
   /* Is the inferior 32-bit?  If so, use the 32-bit siginfo size.  */
-  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
+  if (gdbarch_long_bit (gdbarch) == 32)
     return sizeof (struct siginfo32);
 #endif
   return sizeof (siginfo_t);
@@ -296,7 +296,7 @@ fbsd_convert_siginfo (siginfo_t *si)
   struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
 
   /* Is the inferior 32-bit?  If not, nothing to do.  */
-  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word != 32)
+  if (gdbarch_long_bit (gdbarch) != 32)
     return;
 
   struct siginfo32 si32;
index fa4cd912ef32e401ae74ab54c310b89384246b8c..fa70f7c20beb85db2be31664c6426a08e903989c 100644 (file)
@@ -143,7 +143,7 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
 {
   size_t siginfo_size;
 
-  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
+  if (gdbarch_long_bit (gdbarch) == 32)
     siginfo_size = SIZE32_SIGINFO_T;
   else
     siginfo_size = SIZE64_SIGINFO_T;
@@ -168,7 +168,7 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
     len = siginfo_size - offset;
 
   ULONGEST siginfo_offset;
-  if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
+  if (gdbarch_long_bit (gdbarch) == 32)
     siginfo_offset = LWPINFO_OFFSET + LWPINFO32_PL_SIGINFO;
   else
     siginfo_offset = LWPINFO_OFFSET + LWPINFO64_PL_SIGINFO;
This page took 0.033402 seconds and 4 git commands to generate.