From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7685 invoked by alias); 17 Oct 2017 13:50:03 -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 7567 invoked by uid 89); 17 Oct 2017 13:50:03 -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= 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; Tue, 17 Oct 2017 13:50:01 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 804531A4667; Tue, 17 Oct 2017 15:49:58 +0200 (CEST) Received: from djole.domain.local (unknown [10.10.13.94]) by mail.rt-rk.com (Postfix) with ESMTPSA id 68AF21A2062; Tue, 17 Oct 2017 15:49:58 +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, Djordje Todorovic Subject: [PATCH 2/3] BFD: Extract PID from MIPS core dump file Date: Tue, 17 Oct 2017 13:50:00 -0000 Message-Id: <1508248194-26950-2-git-send-email-djordje.todorovic@rt-rk.com> In-Reply-To: <1508248194-26950-1-git-send-email-djordje.todorovic@rt-rk.com> References: <1508248194-26950-1-git-send-email-djordje.todorovic@rt-rk.com> X-SW-Source: 2017-10/txt/msg00518.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 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