This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 2/3] BFD: Extract PID from MIPS core dump file
- From: Djordje Todorovic <djordje dot todorovic at rt-rk dot com>
- To: macro at imgtec dot com
- Cc: binutils at sourceware dot org, gdb-patches at sourceware dot org, asowda at cisco dot com, petar dot jovanovic at rt-rk dot com, nemanja dot popov at rt-rk dot com, nikola dot prica at rt-rk dot com, Djordje Todorovic <djordje dot todorovic at rt-rk dot com>
- Date: Tue, 17 Oct 2017 15:49:53 +0200
- Subject: [PATCH 2/3] BFD: Extract PID from MIPS core dump file
- Authentication-results: sourceware.org; auth=none
- References: <1508248194-26950-1-git-send-email-djordje.todorovic@rt-rk.com>
On MIPS o32, n32 and n64 platforms, PID information was not
correctly propagated from core dump file to internal GDB
structures. This patch fixes that behavior.
GDB needs correct PID in order to fetch value of TLS variable
from core file.
bfd/ChangeLog:
* elf32-mips.c (elf32_mips_grok_psinfo): Extract core->pid.
* elf64-mips.c (elf64_mips_grok_psinfo): Likewise.
* elfn32-mips.c (elf32_mips_grok_psinfo): Likewise.
---
bfd/elf32-mips.c | 2 ++
bfd/elf64-mips.c | 2 ++
bfd/elfn32-mips.c | 2 ++
3 files changed, 6 insertions(+)
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 2ee15e9..86c5e43 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -2353,6 +2353,8 @@ elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
return FALSE;
case 128: /* Linux/MIPS elf_prpsinfo */
+ elf_tdata (abfd)->core->pid
+ = bfd_get_32 (abfd, note->descdata + 16);
elf_tdata (abfd)->core->program
= _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
elf_tdata (abfd)->core->command
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index f3997bd..0227a0f 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -4228,6 +4228,8 @@ elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
return FALSE;
case 136: /* Linux/MIPS - N64 kernel elf_prpsinfo */
+ elf_tdata (abfd)->core->pid
+ = bfd_get_32 (abfd, note->descdata + 24);
elf_tdata (abfd)->core->program
= _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
elf_tdata (abfd)->core->command
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index d9d2020..cb7e26c 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -3560,6 +3560,8 @@ elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
return FALSE;
case 128: /* Linux/MIPS elf_prpsinfo */
+ elf_tdata (abfd)->core->pid
+ = bfd_get_32 (abfd, note->descdata + 16);
elf_tdata (abfd)->core->program
= _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
elf_tdata (abfd)->core->command
--
2.7.4