]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
FreeBSD x86: Remove fallback for detecting signal trampolines by address.
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 28 Jan 2022 19:14:37 +0000 (11:14 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 28 Jan 2022 19:14:37 +0000 (11:14 -0800)
A few FreeBSD releases did not include the page holding the signal
code in core dumps.  As a workaround, a sysctl was used to fetch the
default location of the signal code instead.  The youngest affected
FreeBSD release is 10.1 released in November 2014 and EOLed in
December 2016.  The fallback only works for native processes and would
require a separate unwinder once the FreeBSD arches are converted to
use tramp_frame for signal frames.

gdb/amd64-fbsd-nat.c
gdb/amd64-fbsd-tdep.c
gdb/amd64-tdep.h
gdb/i386-fbsd-nat.c
gdb/i386-fbsd-tdep.c
gdb/i386-tdep.h

index 376e1ff77c86da7132582417eaaba965c9728d20..3c79a40687b9c7364d3d39f8e5e9a9dc7dfb365d 100644 (file)
@@ -278,32 +278,4 @@ Please report this to <bug-gdb@gnu.org>."),
     }
 
   SC_RBP_OFFSET = offset;
-
-#ifdef KERN_PROC_SIGTRAMP
-  /* Normally signal frames are detected via amd64fbsd_sigtramp_p.
-     However, FreeBSD 9.2 through 10.1 do not include the page holding
-     the signal code in core dumps.  These releases do provide a
-     kern.proc.sigtramp.<pid> sysctl that returns the location of the
-     signal trampoline for a running process.  We fetch the location
-     of the current (gdb) process and use this to identify signal
-     frames in core dumps from these releases.  Note that this only
-     works for core dumps of 64-bit (FreeBSD/amd64) processes and does
-     not handle core dumps of 32-bit (FreeBSD/i386) processes.  */
-  {
-    int mib[4];
-    struct kinfo_sigtramp kst;
-    size_t len;
-
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PROC;
-    mib[2] = KERN_PROC_SIGTRAMP;
-    mib[3] = getpid ();
-    len = sizeof (kst);
-    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
-      {
-       amd64fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
-       amd64fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
-      }
-  }
-#endif
 }
index 93edbc4f861dc03f8e9bce711058a92c114d9114..647d9d744a1d744853a823ea1fb69a5e9e458443 100644 (file)
@@ -117,10 +117,6 @@ static int amd64fbsd_r_reg_offset[] =
   -1                           /* %gs */
 };
 
-/* Location of the signal trampoline.  */
-CORE_ADDR amd64fbsd_sigtramp_start_addr;
-CORE_ADDR amd64fbsd_sigtramp_end_addr;
-
 /* From <machine/signal.h>.  */
 int amd64fbsd_sc_reg_offset[] =
 {
@@ -245,8 +241,6 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
                  amd64_target_description (X86_XSTATE_SSE_MASK, true));
 
   tdep->sigtramp_p = amd64fbsd_sigtramp_p;
-  tdep->sigtramp_start = amd64fbsd_sigtramp_start_addr;
-  tdep->sigtramp_end = amd64fbsd_sigtramp_end_addr;
   tdep->sigcontext_addr = amd64fbsd_sigcontext_addr;
   tdep->sc_reg_offset = amd64fbsd_sc_reg_offset;
   tdep->sc_num_regs = ARRAY_SIZE (amd64fbsd_sc_reg_offset);
index 0ffa7422f7fe260d1544c37f609d7fd9a63f8819..cdc1d6f6df4e3048cd2379e089259804a15c5608 100644 (file)
@@ -145,8 +145,6 @@ extern int amd64nbsd_r_reg_offset[];
 extern int amd64obsd_r_reg_offset[];
 
 /* Variables exported from amd64-fbsd-tdep.c.  */
-extern CORE_ADDR amd64fbsd_sigtramp_start_addr;
-extern CORE_ADDR amd64fbsd_sigtramp_end_addr;
 extern int amd64fbsd_sc_reg_offset[];
 
 #endif /* amd64-tdep.h */
index 61717c65b18c22f9014d01f5241dfb2e0c854b98..75fe5e78f203ac6a25907483de6c489f35e53e0b 100644 (file)
@@ -182,30 +182,4 @@ _initialize_i386fbsd_nat ()
 
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (i386fbsd_supply_pcb);
-
-#ifdef KERN_PROC_SIGTRAMP
-  /* Normally signal frames are detected via i386fbsd_sigtramp_p.
-     However, FreeBSD 9.2 through 10.1 do not include the page holding
-     the signal code in core dumps.  These releases do provide a
-     kern.proc.sigtramp.<pid> sysctl that returns the location of the
-     signal trampoline for a running process.  We fetch the location
-     of the current (gdb) process and use this to identify signal
-     frames in core dumps from these releases.  */
-  {
-    int mib[4];
-    struct kinfo_sigtramp kst;
-    size_t len;
-
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PROC;
-    mib[2] = KERN_PROC_SIGTRAMP;
-    mib[3] = getpid ();
-    len = sizeof (kst);
-    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
-      {
-       i386fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
-       i386fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
-      }
-  }
-#endif
 }
index 8c19b44724350f98bacc03b374afef12b29a28d7..c3f02d1d2271d4142e1fcd1ff20f87bfafaee31a 100644 (file)
@@ -122,10 +122,6 @@ static int i386fbsd_r_reg_offset[] =
   2 * 4, 1 * 4, 0 * 4, 18 * 4  /* %ds, %es, %fs, %gs */
 };
 
-/* Sigtramp routine location.  */
-CORE_ADDR i386fbsd_sigtramp_start_addr;
-CORE_ADDR i386fbsd_sigtramp_end_addr;
-
 /* From <machine/signal.h>.  */
 int i386fbsd_sc_reg_offset[] =
 {
@@ -292,10 +288,6 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   tdep->sigtramp_p = i386fbsd_sigtramp_p;
 
-  /* FreeBSD uses a different memory layout.  */
-  tdep->sigtramp_start = i386fbsd_sigtramp_start_addr;
-  tdep->sigtramp_end = i386fbsd_sigtramp_end_addr;
-
   /* FreeBSD has a more complete `struct sigcontext'.  */
   tdep->sc_reg_offset = i386fbsd_sc_reg_offset;
   tdep->sc_num_regs = ARRAY_SIZE (i386fbsd_sc_reg_offset);
index 5889933745876267c400bd5e29407b80f36b3aca..62d94da53b03a0666051a337c2dd450fcd579048 100644 (file)
@@ -472,8 +472,6 @@ extern int i386_mpx_enabled (void);
 /* Functions and variables exported from i386-bsd-tdep.c.  */
 
 extern void i386bsd_init_abi (struct gdbarch_info, struct gdbarch *);
-extern CORE_ADDR i386fbsd_sigtramp_start_addr;
-extern CORE_ADDR i386fbsd_sigtramp_end_addr;
 extern CORE_ADDR i386obsd_sigtramp_start_addr;
 extern CORE_ADDR i386obsd_sigtramp_end_addr;
 extern int i386fbsd_sc_reg_offset[];