[patch] Fix BSD build regression on core file's PID

Jan Kratochvil jan.kratochvil@redhat.com
Wed May 11 21:57:00 GMT 2011


Hi,

my checked-in patch
	[patch] Implement core file's PID for s390* and ppc*
	http://sourceware.org/ml/binutils/2011-04/msg00272.html
=
	commit 3248de0b35901423585ea213f7d5985fe5146b38
	Author: Jan Kratochvil <jan.kratochvil@redhat.com>
	Date:   Tue May 10 06:13:05 2011 +0000
	bfd/
	* elf.c (elfcore_grok_psinfo): Initialize CORE_PID for both native and
	32bit psinfo.
	* elf32-ppc.c (ppc_elf_grok_psinfo): Initialize core_pid.
	* elf64-ppc.c (ppc64_elf_grok_psinfo): Likewise.

was reported by Andreas Tobler as breaking BSD build.

I made a straightforward implementation - or maybe BSD has psinfo.pr_who to
use instead?  I admit I haven't installed BSD for this patch.


Sorry,
Jan


bfd/
2011-05-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* config.in: Regenerated.
	* configure: Regenerated.
	* configure.in: New tests for HAVE_PRPSINFO_T_PR_PID,
	HAVE_PRPSINFO32_T_PR_PID, HAVE_PSINFO_T_PR_PID and
	HAVE_PSINFO32_T_PR_PID.
	* elf.c (HAVE_PRPSINFO32_T, HAVE_PSINFO32_T): Reindent the blocks.
	(HAVE_ELFCORE_PSINFO_T_PR_PID, HAVE_ELFCORE_PSINFO32_T_PR_PID): Set
	them if appropriate.
	(elfcore_grok_psinfo): Protect reading psinfo.pr_pid by
	HAVE_ELFCORE_PSINFO_T_PR_PID and HAVE_ELFCORE_PSINFO32_T_PR_PID.
	* hosts/x86-64linux.h (HAVE_PRPSINFO32_T_PR_PID): New redefinition.

--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -488,9 +488,13 @@ changequote([,])dnl
     BFD_HAVE_SYS_PROCFS_TYPE(pxstatus_t)
     BFD_HAVE_SYS_PROCFS_TYPE(pstatus32_t)
     BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
+    BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prpsinfo_t, pr_pid)
     BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo32_t)
+    BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prpsinfo32_t, pr_pid)
     BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
+    BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(psinfo_t, pr_pid)
     BFD_HAVE_SYS_PROCFS_TYPE(psinfo32_t)
+    BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(psinfo32_t, pr_pid)
     BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
     BFD_HAVE_SYS_PROCFS_TYPE(lwpxstatus_t)
     BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7952,16 +7952,28 @@ elfcore_grok_s390_prefix (bfd *abfd, Elf_Internal_Note *note)
 
 #if defined (HAVE_PRPSINFO_T)
 typedef prpsinfo_t   elfcore_psinfo_t;
-#if defined (HAVE_PRPSINFO32_T)		/* Sparc64 cross Sparc32 */
+# ifdef HAVE_PRPSINFO_T_PR_PID
+#  define HAVE_ELFCORE_PSINFO_T_PR_PID 1
+# endif /* HAVE_PRPSINFO_T_PR_PID */
+# if defined (HAVE_PRPSINFO32_T)		/* Sparc64 cross Sparc32 */
 typedef prpsinfo32_t elfcore_psinfo32_t;
-#endif
+#  ifdef HAVE_PRPSINFO32_T_PR_PID
+#   define HAVE_ELFCORE_PSINFO32_T_PR_PID 1
+#  endif /* HAVE_PRPSINFO32_T_PR_PID */
+# endif
 #endif
 
 #if defined (HAVE_PSINFO_T)
 typedef psinfo_t   elfcore_psinfo_t;
-#if defined (HAVE_PSINFO32_T)		/* Sparc64 cross Sparc32 */
+# ifdef HAVE_PSINFO_T_PR_PID
+#  define HAVE_ELFCORE_PSINFO_T_PR_PID 1
+# endif /* HAVE_PSINFO_T_PR_PID */
+# if defined (HAVE_PSINFO32_T)		/* Sparc64 cross Sparc32 */
 typedef psinfo32_t elfcore_psinfo32_t;
-#endif
+#  ifdef HAVE_PSINFO32_T_PR_PID
+#   define HAVE_ELFCORE_PSINFO32_T_PR_PID 1
+#  endif /* HAVE_PSINFO32_T_PR_PID */
+# endif
 #endif
 
 /* return a malloc'ed copy of a string at START which is at
@@ -8000,7 +8012,9 @@ elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 
       memcpy (&psinfo, note->descdata, sizeof (psinfo));
 
+#ifdef HAVE_ELFCORE_PSINFO_T_PR_PID
       elf_tdata (abfd)->core_pid = psinfo.pr_pid;
+#endif
       elf_tdata (abfd)->core_program
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
 				sizeof (psinfo.pr_fname));
@@ -8017,7 +8031,9 @@ elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 
       memcpy (&psinfo, note->descdata, sizeof (psinfo));
 
+#ifdef HAVE_ELFCORE_PSINFO32_T_PR_PID
       elf_tdata (abfd)->core_pid = psinfo.pr_pid;
+#endif
       elf_tdata (abfd)->core_program
 	= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
 				sizeof (psinfo.pr_fname));
--- a/bfd/hosts/x86-64linux.h
+++ b/bfd/hosts/x86-64linux.h
@@ -41,6 +41,8 @@ typedef unsigned int uint32_t;
 
 #undef HAVE_PRPSINFO32_T
 #define HAVE_PRPSINFO32_T
+#undef HAVE_PRPSINFO32_T_PR_PID
+#define HAVE_PRPSINFO32_T_PR_PID
 
 #undef HAVE_PRSTATUS32_T
 #define HAVE_PRSTATUS32_T



More information about the Binutils mailing list