From owner-svn-src-head@FreeBSD.ORG Wed Apr 8 16:30:48 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E952F299; Wed, 8 Apr 2015 16:30:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9E9C27D; Wed, 8 Apr 2015 16:30:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t38GUmkg003519; Wed, 8 Apr 2015 16:30:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t38GUk8a003504; Wed, 8 Apr 2015 16:30:46 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201504081630.t38GUk8a003504@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 8 Apr 2015 16:30:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281266 - in head: sys/compat/freebsd32 sys/mips/include sys/powerpc/include sys/sparc64/include sys/sys sys/x86/include usr.bin/gcore X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2015 16:30:49 -0000 Author: jhb Date: Wed Apr 8 16:30:45 2015 New Revision: 281266 URL: https://svnweb.freebsd.org/changeset/base/281266 Log: Move the 32-bit compatible procfs types from freebsd32.h to and export them to userland. - Define __HAVE_REG32 on platforms that define a reg32 structure and check for this in 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 in gcore's elf32 core dump code instead of duplicating the definitions. Differential Revision: https://reviews.freebsd.org/D2142 Reviewed by: kib, nathanw (powerpc bits) MFC after: 1 week Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/mips/include/reg.h head/sys/powerpc/include/reg.h head/sys/sparc64/include/reg.h head/sys/sys/procfs.h head/sys/x86/include/reg.h head/usr.bin/gcore/elf32core.c Modified: head/sys/compat/freebsd32/freebsd32.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32.h Wed Apr 8 11:59:00 2015 (r281265) +++ head/sys/compat/freebsd32/freebsd32.h Wed Apr 8 16:30:45 2015 (r281266) @@ -243,32 +243,6 @@ struct i386_ldt_args32 { uint32_t num; }; -/* - * Alternative layouts for - */ -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: head/sys/mips/include/reg.h ============================================================================== --- head/sys/mips/include/reg.h Wed Apr 8 11:59:00 2015 (r281265) +++ head/sys/mips/include/reg.h Wed Apr 8 16:30:45 2015 (r281266) @@ -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: head/sys/powerpc/include/reg.h ============================================================================== --- head/sys/powerpc/include/reg.h Wed Apr 8 11:59:00 2015 (r281265) +++ head/sys/powerpc/include/reg.h Wed Apr 8 16:30:45 2015 (r281266) @@ -39,7 +39,7 @@ struct dbreg { unsigned int junk; }; -#ifdef COMPAT_FREEBSD32 +#ifdef __LP64__ /* Must match struct trapframe */ struct reg32 { int32_t fixreg[32]; @@ -61,6 +61,8 @@ struct vmxreg32 { struct dbreg32 { struct dbreg data; }; + +#define __HAVE_REG32 #endif #ifdef _KERNEL Modified: head/sys/sparc64/include/reg.h ============================================================================== --- head/sys/sparc64/include/reg.h Wed Apr 8 11:59:00 2015 (r281265) +++ head/sys/sparc64/include/reg.h Wed Apr 8 16:30:45 2015 (r281266) @@ -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: head/sys/sys/procfs.h ============================================================================== --- head/sys/sys/procfs.h Wed Apr 8 11:59:00 2015 (r281265) +++ head/sys/sys/procfs.h Wed Apr 8 16:30:45 2015 (r281266) @@ -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: head/sys/x86/include/reg.h ============================================================================== --- head/sys/x86/include/reg.h Wed Apr 8 11:59:00 2015 (r281265) +++ head/sys/x86/include/reg.h Wed Apr 8 16:30:45 2015 (r281266) @@ -91,6 +91,7 @@ #define __fpreg64 fpreg #define __dbreg32 dbreg32 #define __dbreg64 dbreg +#define __HAVE_REG32 #endif /* Modified: head/usr.bin/gcore/elf32core.c ============================================================================== --- head/usr.bin/gcore/elf32core.c Wed Apr 8 11:59:00 2015 (r281265) +++ head/usr.bin/gcore/elf32core.c Wed Apr 8 16:30:45 2015 (r281266) @@ -8,24 +8,6 @@ #include -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"