This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] BFD: Extract PID from MIPS core dump file


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c9ec0e8945d057979a361e3545d42b3f15adf04a

commit c9ec0e8945d057979a361e3545d42b3f15adf04a
Author: Djordje Todorovic <djordje.todorovic@rt-rk.com>
Date:   Wed Nov 8 21:19:05 2017 +0000

    BFD: Extract PID from MIPS core dump file
    
    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.

Diff:
---
 bfd/ChangeLog     | 6 ++++++
 bfd/elf32-mips.c  | 2 ++
 bfd/elf64-mips.c  | 2 ++
 bfd/elfn32-mips.c | 2 ++
 4 files changed, 12 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b977944..8e61929 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
 2017-11-08  Djordje Todorovic  <djordje.todorovic@rt-rk.com>
 
+	* 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.
+
+2017-11-08  Djordje Todorovic  <djordje.todorovic@rt-rk.com>
+
 	* elf32-mips.c (elf32_mips_write_core_note): New function.
 	(elf_backend_write_core_note): New macro.
 	* elf64-mips.c (elf64_mips_write_core_note): New function.
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 3b48103..ec4e7d3 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 af0c01c..291a8a9 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 8e5efa5..8de1ff4 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]