This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[committed v7 2/3] BFD: Extract PID from MIPS core dump file
- From: "Maciej W. Rozycki" <macro at mips dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Djordje Todorovic <djordje dot todorovic at rt-rk dot com>, <binutils at sourceware dot org>, <gdb-patches at sourceware dot org>, "nemanja dot popov at rt-rk dot com" <nemanja dot popov at rt-rk dot com>, <petar dot jovanovic at rt-rk dot com>, "Ananthakrishna Sowda (asowda)" <asowda at cisco dot com>, Nikola Prica <nikola dot prica at rt-rk dot com>
- Date: Wed, 8 Nov 2017 21:23:25 +0000
- Subject: [committed v7 2/3] BFD: Extract PID from MIPS core dump file
- Authentication-results: sourceware.org; auth=none
- References: <74618d56-fa31-4cfe-329f-6a9078bac92b@rt-rk.com> <alpine.DEB.2.00.1710171449200.3886@tp.orcam.me.uk> <724f0bc9-6744-a915-d19d-77db7e9ce514@rt-rk.com> <alpine.DEB.2.00.1710252126220.3886@tp.orcam.me.uk> <64ad38a4-b8ae-912e-45d6-7048135ada2e@rt-rk.com> <alpine.DEB.2.00.1710301253210.3886@tp.orcam.me.uk> <alpine.DEB.2.00.1710301403000.3886@tp.orcam.me.uk> <8475f0b7-969d-3c27-27f2-a4944e58e954@rt-rk.com> <alpine.DEB.2.00.1711072131070.10088@tp.orcam.me.uk> <c32edd07-9381-f654-8748-fb59aa3745ca@redhat.com> <alpine.DEB.2.00.1711081950430.10088@tp.orcam.me.uk>
From: Djordje Todorovic <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.
A correct PID is needed by `libthread_db' library supplied with
glibc repository revisions before commit c579f48edba8 ("Remove
cached PID/TID in clone") or released versions before 2.25 for
GDB 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(+)
Index: binutils/bfd/elf32-mips.c
===================================================================
--- binutils.orig/bfd/elf32-mips.c 2017-11-08 21:05:36.456371632 +0000
+++ binutils/bfd/elf32-mips.c 2017-11-08 21:05:37.530049782 +0000
@@ -2353,6 +2353,8 @@ elf32_mips_grok_psinfo (bfd *abfd, Elf_I
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
Index: binutils/bfd/elf64-mips.c
===================================================================
--- binutils.orig/bfd/elf64-mips.c 2017-11-08 21:05:36.474538851 +0000
+++ binutils/bfd/elf64-mips.c 2017-11-08 21:05:37.538147336 +0000
@@ -4228,6 +4228,8 @@ elf64_mips_grok_psinfo (bfd *abfd, Elf_I
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
Index: binutils/bfd/elfn32-mips.c
===================================================================
--- binutils.orig/bfd/elfn32-mips.c 2017-11-08 21:05:36.489887759 +0000
+++ binutils/bfd/elfn32-mips.c 2017-11-08 21:05:37.562322680 +0000
@@ -3562,6 +3562,8 @@ elf32_mips_grok_psinfo (bfd *abfd, Elf_I
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