This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB 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, palves at redhat dot com, Djordje Todorovic <djordje dot todorovic at rt-rk dot com>
- Date: Wed, 25 Oct 2017 16:15:32 +0200
- Subject: [PATCH 2/3] BFD: Extract PID from MIPS core dump file
- Authentication-results: sourceware.org; auth=none
- References: <1508940933-13857-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 69c6061..de204bc 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 69f365b..6a1b71f 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 790baee..3e34eef 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -3562,6 +3562,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