svn commit: r283910 - in stable/10: sys/compat/freebsd32 sys/ia64/include sys/mips/include sys/powerpc/include sys/sparc64/include sys/sys sys/x86/include usr.bin/gcore

John Baldwin jhb at FreeBSD.org
Tue Jun 2 14:54:56 UTC 2015


Author: jhb
Date: Tue Jun  2 14:54:53 2015
New Revision: 283910
URL: https://svnweb.freebsd.org/changeset/base/283910

Log:
  MFC 281266:
  Move the 32-bit compatible procfs types from freebsd32.h to <sys/procfs.h>
  and export them to userland.
  - Define __HAVE_REG32 on platforms that define a reg32 structure and check
    for this in <sys/procfs.h> to control when to export prstatus32, etc.
  - Add prstatus32_t and prpsinfo32_t typedefs for the 32-bit structures.
    libbfd looks for these types, and having them fixes 'gcore' in gdb of a
    32-bit process on a 64-bit platform.
  - Use the structure definitions from <sys/procfs.h> in gcore's elf32 core
    dump code instead of duplicating the definitions.

Modified:
  stable/10/sys/compat/freebsd32/freebsd32.h
  stable/10/sys/ia64/include/reg.h
  stable/10/sys/mips/include/reg.h
  stable/10/sys/powerpc/include/reg.h
  stable/10/sys/sparc64/include/reg.h
  stable/10/sys/sys/procfs.h
  stable/10/sys/x86/include/reg.h
  stable/10/usr.bin/gcore/elf32core.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/freebsd32/freebsd32.h
==============================================================================
--- stable/10/sys/compat/freebsd32/freebsd32.h	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/sys/compat/freebsd32/freebsd32.h	Tue Jun  2 14:54:53 2015	(r283910)
@@ -243,32 +243,6 @@ struct i386_ldt_args32 {
 	uint32_t num;
 };
 
-/*
- * Alternative layouts for <sys/procfs.h>
- */
-struct prstatus32 {
-        int     pr_version;
-        u_int   pr_statussz;
-        u_int   pr_gregsetsz;
-        u_int   pr_fpregsetsz;
-        int     pr_osreldate;
-        int     pr_cursig;
-        pid_t   pr_pid;
-        struct reg32 pr_reg;
-};
-
-struct prpsinfo32 {
-        int     pr_version;
-        u_int   pr_psinfosz;
-        char    pr_fname[PRFNAMESZ+1];
-        char    pr_psargs[PRARGSZ+1];
-};
-
-struct thrmisc32 {
-        char    pr_tname[MAXCOMLEN+1];
-        u_int   _pad;
-};
-
 struct mq_attr32 {
 	int	mq_flags;
 	int	mq_maxmsg;

Modified: stable/10/sys/ia64/include/reg.h
==============================================================================
--- stable/10/sys/ia64/include/reg.h	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/sys/ia64/include/reg.h	Tue Jun  2 14:54:53 2015	(r283910)
@@ -81,6 +81,8 @@ struct dbreg {
 	unsigned long	dbr_inst[8];
 };
 
+#define __HAVE_REG32
+
 #ifdef _KERNEL
 struct thread;
 

Modified: stable/10/sys/mips/include/reg.h
==============================================================================
--- stable/10/sys/mips/include/reg.h	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/sys/mips/include/reg.h	Tue Jun  2 14:54:53 2015	(r283910)
@@ -70,7 +70,7 @@ struct dbreg {
 	unsigned long junk;
 };
 
-#ifdef COMPAT_FREEBSD32
+#ifdef __LP64__
 /* Must match struct trapframe */
 struct reg32 {
 	uint32_t r_regs[NUMSAVEREGS];
@@ -83,6 +83,8 @@ struct fpreg32 {
 struct dbreg32 {
 	uint32_t junk;
 };
+
+#define __HAVE_REG32
 #endif
 
 #ifdef _KERNEL

Modified: stable/10/sys/powerpc/include/reg.h
==============================================================================
--- stable/10/sys/powerpc/include/reg.h	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/sys/powerpc/include/reg.h	Tue Jun  2 14:54:53 2015	(r283910)
@@ -28,7 +28,7 @@ struct dbreg {
 	unsigned int	junk;
 };
 
-#ifdef COMPAT_FREEBSD32
+#ifdef __LP64__
 /* Must match struct trapframe */
 struct reg32 {
 	int32_t fixreg[32];
@@ -46,6 +46,8 @@ struct fpreg32 {
 struct dbreg32 {
 	struct dbreg data;
 };
+
+#define __HAVE_REG32
 #endif
 
 #ifdef _KERNEL

Modified: stable/10/sys/sparc64/include/reg.h
==============================================================================
--- stable/10/sys/sparc64/include/reg.h	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/sys/sparc64/include/reg.h	Tue Jun  2 14:54:53 2015	(r283910)
@@ -98,6 +98,12 @@ struct dbreg {
 	int dummy;
 };
 
+/*
+ * NB: sparcv8 binaries are not supported even though this header
+ * defines the relevant structures.
+ */
+#define	__HAVE_REG32
+
 #ifdef _KERNEL
 /*
  * XXX these interfaces are MI, so they should be declared in a MI place.

Modified: stable/10/sys/sys/procfs.h
==============================================================================
--- stable/10/sys/sys/procfs.h	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/sys/sys/procfs.h	Tue Jun  2 14:54:53 2015	(r283910)
@@ -89,4 +89,29 @@ typedef struct thrmisc {
 
 typedef uint64_t psaddr_t;	/* An address in the target process. */
 
+#ifdef __HAVE_REG32
+typedef struct prstatus32 {
+	int32_t	pr_version;
+	uint32_t pr_statussz;
+	uint32_t pr_gregsetsz;
+	uint32_t pr_fpregsetsz;
+	int32_t	pr_osreldate;
+	int32_t	pr_cursig;
+	int32_t	pr_pid;
+	struct reg32 pr_reg;
+} prstatus32_t;
+
+typedef struct prpsinfo32 {
+	int32_t	pr_version;
+	uint32_t pr_psinfosz;
+	char	pr_fname[PRFNAMESZ+1];
+	char	pr_psargs[PRARGSZ+1];
+} prpsinfo32_t;
+
+struct thrmisc32 {
+	char	pr_tname[MAXCOMLEN+1];
+	uint32_t _pad;
+};
+#endif /* __HAVE_REG32 */
+
 #endif /* _SYS_PROCFS_H_ */

Modified: stable/10/sys/x86/include/reg.h
==============================================================================
--- stable/10/sys/x86/include/reg.h	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/sys/x86/include/reg.h	Tue Jun  2 14:54:53 2015	(r283910)
@@ -91,6 +91,7 @@
 #define	__fpreg64	fpreg
 #define	__dbreg32	dbreg32
 #define	__dbreg64	dbreg
+#define	__HAVE_REG32
 #endif
 
 /*

Modified: stable/10/usr.bin/gcore/elf32core.c
==============================================================================
--- stable/10/usr.bin/gcore/elf32core.c	Tue Jun  2 13:07:22 2015	(r283909)
+++ stable/10/usr.bin/gcore/elf32core.c	Tue Jun  2 14:54:53 2015	(r283910)
@@ -8,24 +8,6 @@
 
 #include <sys/procfs.h>
 
-struct prpsinfo32 {
-	int	pr_version;
-	u_int	pr_psinfosz;
-	char	pr_fname[PRFNAMESZ+1];
-	char	pr_psargs[PRARGSZ+1];
-};
-
-struct prstatus32 {
-	int	pr_version;
-	u_int	pr_statussz;
-	u_int	pr_gregsetsz;
-	u_int	pr_fpregsetsz;
-	int	pr_osreldate;
-	int	pr_cursig;
-	pid_t	pr_pid;
-	struct reg32 pr_reg;
-};
-
 #define	ELFCORE_COMPAT_32	1
 #include "elfcore.c"
 


More information about the svn-src-all mailing list