From: Djordje Todorovic <djordje.todorovic@rt-rk.com>
To: macro@imgtec.com
Cc: binutils@sourceware.org, gdb-patches@sourceware.org,
asowda@cisco.com, petar.jovanovic@rt-rk.com,
nemanja.popov@rt-rk.com, nikola.prica@rt-rk.com,
palves@redhat.com,
Djordje Todorovic <djordje.todorovic@rt-rk.com>
Subject: [PATCH 2/3] BFD: Extract PID from MIPS core dump file
Date: Wed, 25 Oct 2017 14:15:00 -0000 [thread overview]
Message-ID: <1508940933-13857-2-git-send-email-djordje.todorovic@rt-rk.com> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2017-10-25 14:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 14:15 [PATCH 1/3] BFD: Write Linux core PRSTATUS note into MIPS core file Djordje Todorovic
2017-10-25 14:15 ` Djordje Todorovic [this message]
2017-10-25 14:15 ` [PATCH 3/3] Add test for fetching TLS from " Djordje Todorovic
2017-10-25 22:41 ` [PATCH 1/3] BFD: Write Linux core PRSTATUS note into MIPS " Maciej W. Rozycki
-- strict thread matches above, loose matches on Subject: below --
2017-10-17 13:50 Djordje Todorovic
2017-10-17 13:50 ` [PATCH 2/3] BFD: Extract PID from MIPS core dump file Djordje Todorovic
2017-10-18 13:36 ` Maciej W. Rozycki
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=1508940933-13857-2-git-send-email-djordje.todorovic@rt-rk.com \
--to=djordje.todorovic@rt-rk.com \
--cc=asowda@cisco.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=macro@imgtec.com \
--cc=nemanja.popov@rt-rk.com \
--cc=nikola.prica@rt-rk.com \
--cc=palves@redhat.com \
--cc=petar.jovanovic@rt-rk.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).