This is the mail archive of the binutils@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]

[patch] Implement core file's PID for s390* and ppc*


Hi,

this is extension of the patch
	Re: [PATCH] add a bfd interface to get at a core file's PID
	http://sourceware.org/ml/binutils/2010-08/msg00200.html

which implements it for:
	ppc64-linux-gnu
	ppc32-linux-gnu
	s390x-linux-gnu
	s390-linux-gnu

The latter two drop to the native implementation, hence elfcore_grok_psinfo.

The testcase for it is:
	[patch] testcase: PR 8210 corefiles threads #2
	http://sourceware.org/ml/gdb-patches/2011-04/msg00345.html

OK to check it in?


Thanks,
Jan


bfd/
2011-04-19  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* elf.c (elfcore_grok_psinfo): Initialize CORE_PID for both native and
	32bit psoinfo.
	* elf32-ppc.c (ppc_elf_grok_psinfo): Initialize corE_pid.
	* elf64-ppc.c (ppc64_elf_grok_psinfo): Likewise.

--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8000,6 +8000,7 @@ elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 
       memcpy (&psinfo, note->descdata, sizeof (psinfo));
 
+      elf_tdata (abfd)->core_pid = psinfo.pr_pid;
       elf_tdata (abfd)->core_program
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
 				sizeof (psinfo.pr_fname));
@@ -8016,6 +8017,7 @@ elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 
       memcpy (&psinfo, note->descdata, sizeof (psinfo));
 
+      elf_tdata (abfd)->core_pid = psinfo.pr_pid;
       elf_tdata (abfd)->core_program
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
 				sizeof (psinfo.pr_fname));
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -1881,6 +1881,8 @@ ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
       return FALSE;
 
     case 128:		/* Linux/PPC 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
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -2670,6 +2670,8 @@ ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
   if (note->descsz != 136)
     return FALSE;
 
+  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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]