From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1936) id A7AEA3947C3D; Fri, 28 Jan 2022 19:16:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A7AEA3947C3D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: John Baldwin To: gdb-cvs@sourceware.org Subject: [binutils-gdb] FreeBSD x86: Remove fallback for detecting signal trampolines by address. X-Act-Checkin: binutils-gdb X-Git-Author: John Baldwin X-Git-Refname: refs/heads/master X-Git-Oldrev: bf84b776bda0945300f40432580156af99c000f6 X-Git-Newrev: 5046f3c8c0cf0a641f25cf0b3f6e3a6969f28dd8 Message-Id: <20220128191619.A7AEA3947C3D@sourceware.org> Date: Fri, 28 Jan 2022 19:16:19 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2022 19:16:19 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5046f3c8c0cf= 0a641f25cf0b3f6e3a6969f28dd8 commit 5046f3c8c0cf0a641f25cf0b3f6e3a6969f28dd8 Author: John Baldwin Date: Fri Jan 28 11:14:37 2022 -0800 FreeBSD x86: Remove fallback for detecting signal trampolines by addres= s. =20 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. Diff: --- gdb/amd64-fbsd-nat.c | 28 ---------------------------- gdb/amd64-fbsd-tdep.c | 6 ------ gdb/amd64-tdep.h | 2 -- gdb/i386-fbsd-nat.c | 26 -------------------------- gdb/i386-fbsd-tdep.c | 8 -------- gdb/i386-tdep.h | 2 -- 6 files changed, 72 deletions(-) diff --git a/gdb/amd64-fbsd-nat.c b/gdb/amd64-fbsd-nat.c index 376e1ff77c8..3c79a40687b 100644 --- a/gdb/amd64-fbsd-nat.c +++ b/gdb/amd64-fbsd-nat.c @@ -278,32 +278,4 @@ Please report this to ."), } =20 SC_RBP_OFFSET =3D 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. 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] =3D CTL_KERN; - mib[1] =3D KERN_PROC; - mib[2] =3D KERN_PROC_SIGTRAMP; - mib[3] =3D getpid (); - len =3D sizeof (kst); - if (sysctl (mib, 4, &kst, &len, NULL, 0) =3D=3D 0) - { - amd64fbsd_sigtramp_start_addr =3D (uintptr_t) kst.ksigtramp_start; - amd64fbsd_sigtramp_end_addr =3D (uintptr_t) kst.ksigtramp_end; - } - } -#endif } diff --git a/gdb/amd64-fbsd-tdep.c b/gdb/amd64-fbsd-tdep.c index 93edbc4f861..647d9d744a1 100644 --- a/gdb/amd64-fbsd-tdep.c +++ b/gdb/amd64-fbsd-tdep.c @@ -117,10 +117,6 @@ static int amd64fbsd_r_reg_offset[] =3D -1 /* %gs */ }; =20 -/* Location of the signal trampoline. */ -CORE_ADDR amd64fbsd_sigtramp_start_addr; -CORE_ADDR amd64fbsd_sigtramp_end_addr; - /* From . */ int amd64fbsd_sc_reg_offset[] =3D { @@ -245,8 +241,6 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gd= barch *gdbarch) amd64_target_description (X86_XSTATE_SSE_MASK, true)); =20 tdep->sigtramp_p =3D amd64fbsd_sigtramp_p; - tdep->sigtramp_start =3D amd64fbsd_sigtramp_start_addr; - tdep->sigtramp_end =3D amd64fbsd_sigtramp_end_addr; tdep->sigcontext_addr =3D amd64fbsd_sigcontext_addr; tdep->sc_reg_offset =3D amd64fbsd_sc_reg_offset; tdep->sc_num_regs =3D ARRAY_SIZE (amd64fbsd_sc_reg_offset); diff --git a/gdb/amd64-tdep.h b/gdb/amd64-tdep.h index 0ffa7422f7f..cdc1d6f6df4 100644 --- a/gdb/amd64-tdep.h +++ b/gdb/amd64-tdep.h @@ -145,8 +145,6 @@ extern int amd64nbsd_r_reg_offset[]; extern int amd64obsd_r_reg_offset[]; =20 /* 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[]; =20 #endif /* amd64-tdep.h */ diff --git a/gdb/i386-fbsd-nat.c b/gdb/i386-fbsd-nat.c index 61717c65b18..75fe5e78f20 100644 --- a/gdb/i386-fbsd-nat.c +++ b/gdb/i386-fbsd-nat.c @@ -182,30 +182,4 @@ _initialize_i386fbsd_nat () =20 /* 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. 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] =3D CTL_KERN; - mib[1] =3D KERN_PROC; - mib[2] =3D KERN_PROC_SIGTRAMP; - mib[3] =3D getpid (); - len =3D sizeof (kst); - if (sysctl (mib, 4, &kst, &len, NULL, 0) =3D=3D 0) - { - i386fbsd_sigtramp_start_addr =3D (uintptr_t) kst.ksigtramp_start; - i386fbsd_sigtramp_end_addr =3D (uintptr_t) kst.ksigtramp_end; - } - } -#endif } diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c index 8c19b447243..c3f02d1d227 100644 --- a/gdb/i386-fbsd-tdep.c +++ b/gdb/i386-fbsd-tdep.c @@ -122,10 +122,6 @@ static int i386fbsd_r_reg_offset[] =3D 2 * 4, 1 * 4, 0 * 4, 18 * 4 /* %ds, %es, %fs, %gs */ }; =20 -/* Sigtramp routine location. */ -CORE_ADDR i386fbsd_sigtramp_start_addr; -CORE_ADDR i386fbsd_sigtramp_end_addr; - /* From . */ int i386fbsd_sc_reg_offset[] =3D { @@ -292,10 +288,6 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gd= barch *gdbarch) =20 tdep->sigtramp_p =3D i386fbsd_sigtramp_p; =20 - /* FreeBSD uses a different memory layout. */ - tdep->sigtramp_start =3D i386fbsd_sigtramp_start_addr; - tdep->sigtramp_end =3D i386fbsd_sigtramp_end_addr; - /* FreeBSD has a more complete `struct sigcontext'. */ tdep->sc_reg_offset =3D i386fbsd_sc_reg_offset; tdep->sc_num_regs =3D ARRAY_SIZE (i386fbsd_sc_reg_offset); diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 58899337458..62d94da53b0 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -472,8 +472,6 @@ extern int i386_mpx_enabled (void); /* Functions and variables exported from i386-bsd-tdep.c. */ =20 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[];