linux-mips
[Top] [All Lists]

multi-threaded core dump

To: linux-mips@linux-mips.org
Subject: multi-threaded core dump
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 14 Mar 2005 15:58:40 +0900 (JST)
Cc: ralf@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
It seems linux-mips does not produce correct register dumps in core
file for multi-threaded programs.  This patch tries to fix it.  Could
you review it?  Thank you.


diff -ur linux-mips/arch/mips/kernel/process.c linux/arch/mips/kernel/process.c
--- linux-mips/arch/mips/kernel/process.c       2005-03-04 10:19:33.000000000 
+0900
+++ linux/arch/mips/kernel/process.c    2005-03-14 15:51:43.592837356 +0900
@@ -167,6 +167,14 @@
 #endif
 }
 
+int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs)
+{
+       struct thread_info *ti = tsk->thread_info;
+       long ksp = (unsigned long)ti + THREAD_SIZE - 32;
+       dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1);
+       return 1;
+}
+
 int dump_task_fpu (struct task_struct *t, elf_fpregset_t *fpr)
 {
        memcpy(fpr, &t->thread.fpu, sizeof(current->thread.fpu));
diff -ur linux-mips/include/asm-mips/elf.h linux/include/asm-mips/elf.h
--- linux-mips/include/asm-mips/elf.h   2005-03-04 10:19:35.000000000 +0900
+++ linux/include/asm-mips/elf.h        2005-03-14 15:52:22.000046107 +0900
@@ -225,10 +225,12 @@
 #endif /* CONFIG_MIPS64 */
 
 extern void dump_regs(elf_greg_t *, struct pt_regs *regs);
+extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
 extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
 
 #define ELF_CORE_COPY_REGS(elf_regs, regs)                     \
        dump_regs((elf_greg_t *)&(elf_regs), regs);
+#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
 #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs)                  \
        dump_task_fpu(tsk, elf_fpregs)
 
---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>