From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59705 invoked by alias); 25 Oct 2017 14:15:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 59662 invoked by uid 89); 25 Oct 2017 14:15:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*Ad:D*cisco.com X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail.rt-rk.com Received: from mx2.rt-rk.com (HELO mail.rt-rk.com) (89.216.37.149) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Oct 2017 14:15:41 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id C96671A49AE; Wed, 25 Oct 2017 16:15:38 +0200 (CEST) Received: from djole.domain.local (djole.domain.local [10.10.13.94]) by mail.rt-rk.com (Postfix) with ESMTPSA id 7972C1A226D; Wed, 25 Oct 2017 16:15:38 +0200 (CEST) From: Djordje Todorovic 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 Subject: [PATCH 2/3] BFD: Extract PID from MIPS core dump file Date: Wed, 25 Oct 2017 14:15:00 -0000 Message-Id: <1508940933-13857-2-git-send-email-djordje.todorovic@rt-rk.com> In-Reply-To: <1508940933-13857-1-git-send-email-djordje.todorovic@rt-rk.com> References: <1508940933-13857-1-git-send-email-djordje.todorovic@rt-rk.com> X-SW-Source: 2017-10/txt/msg00768.txt.bz2 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