Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Use correct note types for register storage in 32-b...



details:   https://anonhg.NetBSD.org/src/rev/3ddb9f8d1a50
branches:  trunk
changeset: 1014988:3ddb9f8d1a50
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Oct 10 00:10:06 2020 +0000

description:
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}.

diffstat:

 sys/kern/core_elf32.c |  26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 6812ed930422 -r 3ddb9f8d1a50 sys/kern/core_elf32.c
--- a/sys/kern/core_elf32.c     Sat Oct 10 00:03:52 2020 +0000
+++ b/sys/kern/core_elf32.c     Sat Oct 10 00:10:06 2020 +0000
@@ -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 @@
 
 #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 @@
        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 @@
        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



Home | Main Index | Thread Index | Old Index