AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:<20071108140308.35502f8c@ripper.onstor.net>
CFG:
PT:0
S:andy.sharp@onstor.com
RQ:
SSV:onstor-exch02.onstor.net
NSV:
SSH:
R:<linux-mips@linux-mips.org>,<ralf@linux-mips.org>
MAID:1
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
X-Sylpheed-End-Special-Headers: 1
Date: Thu, 8 Nov 2007 14:03:22 -0800
From: Andrew Sharp <andy.sharp@onstor.com>
To: linux-mips@linux-mips.org <linux-mips@linux-mips.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Subject: gdb chokes on core from 64-bit kernel (patch)
Message-ID: <20071108140322.7bf03aa9@ripper.onstor.net>
Organization: Onstor
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

The gdb from debian etch (6.4.90-debian) doesn't like core files
produced by 64-bit kernel it seems.  I've got this patch which seems
to do the job, but I'm unclear on what other implications it might have,
if any.



diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index 993f7ec..58533dc 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -54,9 +54,13 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
 #include <asm/processor.h>
 #include <linux/module.h>
-#include <linux/elfcore.h>
 #include <linux/compat.h>
 
+void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs);
+#undef ELF_CORE_COPY_REGS
+#define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs);
+#include <linux/elfcore.h>
+
 #define elf_prstatus elf_prstatus32
 struct elf_prstatus32
 {
@@ -109,9 +113,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct comp
        value->tv_usec = rem / NSEC_PER_USEC;
 }
 
-#undef ELF_CORE_COPY_REGS
-#define ELF_CORE_COPY_REGS(_dest,_regs) elf32_core_copy_regs(_dest,_regs);
-
 void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs)
 {
        int i;
diff --git a/include/asm-mips/reg.h b/include/asm-mips/reg.h
index 634b55d..b44b308 100644
--- a/include/asm-mips/reg.h
+++ b/include/asm-mips/reg.h
@@ -12,7 +12,7 @@
 #ifndef __ASM_MIPS_REG_H
 #define __ASM_MIPS_REG_H
 
-
+#define WANT_COMPAT_REG_H
 #if defined(CONFIG_32BIT) || defined(WANT_COMPAT_REG_H)
 
 #define EF_R0                  6
@@ -69,7 +69,7 @@
 
 #endif
 
-#ifdef CONFIG_64BIT
+#if defined(CONFIG_64BIT) && !defined(WANT_COMPAT_REG_H)
 
 #define EF_R0                   0
 #define EF_R1                   1
