All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Andrew Sharp <andy.sharp@onstor.com>
Cc: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>
Subject: Re: gdb chokes on core from 64-bit kernel (patch)
Date: Fri, 9 Nov 2007 09:07:57 +0000	[thread overview]
Message-ID: <20071109090757.GA12469@linux-mips.org> (raw)
In-Reply-To: <20071108140322.7bf03aa9@ripper.onstor.net>

On Thu, Nov 08, 2007 at 02:03:22PM -0800, Andrew Sharp wrote:

> 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;

Looks like it's a larger change than needed.

> 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

This change breaks the native 64-bit and N32 ptrace and core dumpers.

I suggest something more minimal like the below patch.  Does that one do
the trick for you?

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

 arch/mips/kernel/ptrace32.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 76818be..44109fb 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -14,6 +14,9 @@
  * At this time Linux/MIPS64 only supports syscall tracing, even for 32-bit
  * binaries.
  */
+
+#define WANT_COMPAT_REG_H
+
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>

       reply	other threads:[~2007-11-09  9:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071108140322.7bf03aa9@ripper.onstor.net>
2007-11-09  9:07 ` Ralf Baechle [this message]
2007-11-15 19:40   ` gdb chokes on core from 64-bit kernel (patch) Andrew Sharp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071109090757.GA12469@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=andy.sharp@onstor.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.