Module Name: src Committed By: rin Date: Sat Oct 10 00:10:06 UTC 2020
Modified Files: src/sys/kern: core_elf32.c Log Message: Use correct note types for register storage in 32-bit core files for architecture on which 64- and 32-bit ABIs use different values for PT_GET{,FP}REGS, i.e., aarch64{,eb}. Now, 32-bit GDB works fine for core files generated by aarch64{,eb} kernel. Should be no functional changes for ports other than aarch64{,eb}. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/kern/core_elf32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/core_elf32.c diff -u src/sys/kern/core_elf32.c:1.64 src/sys/kern/core_elf32.c:1.65 --- src/sys/kern/core_elf32.c:1.64 Sat May 30 16:12:56 2020 +++ src/sys/kern/core_elf32.c Sat Oct 10 00:10:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: core_elf32.c,v 1.64 2020/05/30 16:12:56 thorpej Exp $ */ +/* $NetBSD: core_elf32.c,v 1.65 2020/10/10 00:10:06 rin Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.64 2020/05/30 16:12:56 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.65 2020/10/10 00:10:06 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -65,6 +65,10 @@ __KERNEL_RCSID(1, "$NetBSD: core_elf32.c #include <uvm/uvm_extern.h> +#ifdef COMPAT_NETBSD32 +#include <machine/netbsd32_machdep.h> +#endif + struct writesegs_state { Elf_Phdr *psections; proc_t *p; @@ -510,8 +514,13 @@ ELFNAMEEND(coredump_note)(struct lwp *l, if (error) goto out; - ELFNAMEEND(coredump_savenote)(ns, PT_GETREGS, d->name, &d->intreg, - sizeof(d->intreg)); + ELFNAMEEND(coredump_savenote)(ns, +#if ELFSIZE == 32 && defined(PT32_GETREGS) + PT32_GETREGS, +#else + PT_GETREGS, +#endif + d->name, &d->intreg, sizeof(d->intreg)); #ifdef PT_GETFPREGS freglen = sizeof(d->freg); @@ -519,8 +528,13 @@ ELFNAMEEND(coredump_note)(struct lwp *l, if (error) goto out; - ELFNAMEEND(coredump_savenote)(ns, PT_GETFPREGS, d->name, &d->freg, - freglen); + ELFNAMEEND(coredump_savenote)(ns, +# if ELFSIZE == 32 && defined(PT32_GETFPREGS) + PT32_GETFPREGS, +# else + PT_GETFPREGS, +# endif + d->name, &d->freg, freglen); #endif #ifdef COREDUMP_MACHDEP_LWP_NOTES