From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21712 invoked by alias); 1 Feb 2002 09:53:00 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 21673 invoked from network); 1 Feb 2002 09:52:55 -0000 Received: from unknown (HELO sydmr02.au.aunz.csc.com) (20.139.1.27) by sources.redhat.com with SMTP; 1 Feb 2002 09:52:55 -0000 Received: from aus-syd11.int.csc.com.au (mailgw.int.csc.com.au [20.10.3.50] (may be forged)) by sydmr02.au.aunz.csc.com (Mirapoint) with ESMTP id AJW57549; Fri, 1 Feb 2002 20:55:35 +1100 (EST) Subject: RFA/Patch Solaris /proc configury To: gdb-patches@sources.redhat.com Cc: msnyder@redhat.com X-Mailer: Lotus Notes Release 5.0.4a July 24, 2000 Message-ID: From: rbrown64@csc.com.au Date: Fri, 01 Feb 2002 01:53:00 -0000 X-MIMETrack: Serialize by Router on AUS-SYD11/AUST/CSC(Release 5.0.4a |July 24, 2000) at 01-02-2002 20:55:28 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-SW-Source: 2002-02/txt/msg00001.txt.bz2 This patch is the beginnings of what is required to switch sparc-sun-solaris2.[6-8] to using the `new structured /proc definitions'. => pstatus_t interface. On Solaris 2.[78], pstatus_t has the pr_dmodel member which defines whether the process data model is ILP32 or LP64 - identifying 64-bit processes? If applied it will break Solaris 2.[6-8]. Including instead of without #defining _STRUCTURED_PROC=1 will expose the old prstatus_t interface. Were I not trying to keep this as a minor change (Corporate assignment), fiddling the 36 files in gdb/ to #include "procfs.h" instead of where gdb/procfs.h holds #if defined(HAVE_PROCFS_H) #include #elif defined(HAVE_SYS_PROCFS_H) #include #endif should make things build on Solaris 2.[6-8] again. It also checks for prstatus_t in gdb/configure.in. This should allow wrapping the elfcore_write_{prfpreg,prpsinfo} calls in gdb/procfs.c with #if defined(HAVE_PRSTATUS_T) || defined(HAVE_PSTATUS_T) #endif to make it possible to link on alpha*-dec-osf4* again. Though maybe it would be better to explictly check for each of the elfcore_write structures and #ifdef appropriately. Comments? Maybe a less disruptive change would be to check for pr_dmodel in pstatus_t if exists and #define _STRUCTURED_PROC=1 only if it is found, updating config.h to set _STRUCTURED_PROC and undefining HAVE_PROCFS_H. 2002-02-01 Rodney Brown * bfd/acinclude.m4(BFD_HAVE_SYS_PROCFS_TYPE): Use HAVE_PROCFS_H. (BFD_HAVE_SYS_PROCFS_TYPE_MEMBER): Likewise. * bfd/configure.in: Check procfs.h. Check pr_dmodel in pstatus_t. * gdb/configure.in: Check procfs.h. Check pr_dmodel in pstatus_t. Check prstatus_t. (gdb_cv_prfpregset_t_broken): Use HAVE_PROCFS_H. (gdb_cv_have_procfs_piocset): Use HAVE_PROCFS_H. --- bfd/acinclude.m4.orig Thu Aug 31 20:35:50 2000 +++ bfd/acinclude.m4 Fri Feb 1 20:40:06 2002 @@ -69,14 +69,18 @@ fi ])dnl -dnl Check for existence of a type $1 in sys/procfs.h +dnl Check for existence of a type $1 in procfs.h or sys/procfs.h AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE, [AC_MSG_CHECKING([for $1 in sys/procfs.h]) AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1, [AC_TRY_COMPILE([ #define _SYSCALL32 -#include ], +#ifdef HAVE_PROCFS_H +#include +#else +#include +#endif], [$1 avar], bfd_cv_have_sys_procfs_type_$1=yes, bfd_cv_have_sys_procfs_type_$1=no @@ -89,14 +93,18 @@ ]) -dnl Check for existence of member $2 in type $1 in sys/procfs.h +dnl Check for existence of member $2 in type $1 in procfs.h or sys/procfs.h AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER, [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h]) AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2, [AC_TRY_COMPILE([ #define _SYSCALL32 -#include ], +#ifdef HAVE_PROCFS_H +#include +#else +#include +#endif], [$1 avar; void* aref = (void*) &avar.$2], bfd_cv_have_sys_procfs_type_member_$1_$2=yes, bfd_cv_have_sys_procfs_type_member_$1_$2=no --- bfd/configure.in.orig Thu Jan 24 13:32:30 2002 +++ bfd/configure.in Thu Jan 31 23:27:46 2002 @@ -376,13 +376,15 @@ # ELF corefile support has several flavors, but all of # them use something called - AC_CHECK_HEADERS(sys/procfs.h) - if test "$ac_cv_header_sys_procfs_h" = yes; then + AC_CHECK_HEADERS(procfs.h sys/procfs.h) + if test "$ac_cv_header_procfs_h" = yes -o "$ac_cv_header_sys_procfs_h" = yes + then BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t) BFD_HAVE_SYS_PROCFS_TYPE(prstatus32_t) BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus_t, pr_who) BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus32_t, pr_who) BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t) + BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(pstatus_t, pr_dmodel) BFD_HAVE_SYS_PROCFS_TYPE(pxstatus_t) BFD_HAVE_SYS_PROCFS_TYPE(pstatus32_t) BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t) --- gdb/configure.in.orig Mon Jan 21 05:19:30 2002 +++ gdb/configure.in Fri Feb 1 15:36:59 2002 @@ -119,7 +119,7 @@ esac; esac AC_CHECK_HEADERS(ctype.h nlist.h link.h thread_db.h proc_service.h \ - memory.h objlist.h ptrace.h sgtty.h stddef.h stdlib.h \ + memory.h objlist.h procfs.h ptrace.h sgtty.h stddef.h stdlib.h \ string.h sys/procfs.h sys/ptrace.h sys/reg.h stdint.h \ term.h termio.h termios.h unistd.h wait.h sys/wait.h \ wchar.h wctype.h asm/debugreg.h sys/debugreg.h sys/select.h \ @@ -285,8 +285,11 @@ esac fi -if test "$ac_cv_header_sys_procfs_h" = yes; then +if test "$ac_cv_header_procfs_h" = yes -o "$ac_cv_header_sys_procfs_h" = yes +then + BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t) BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t) + BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(pstatus_t, pr_dmodel) BFD_HAVE_SYS_PROCFS_TYPE(prrun_t) BFD_HAVE_SYS_PROCFS_TYPE(gregset_t) BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t) @@ -312,7 +315,12 @@ if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then AC_MSG_CHECKING(whether prfpregset_t type is broken) AC_CACHE_VAL(gdb_cv_prfpregset_t_broken, - [AC_TRY_RUN([#include + [AC_TRY_RUN([ +#ifdef HAVE_PROCFS_H +#include +#else +#include +#endif int main () { if (sizeof (prfpregset_t) == sizeof (void *)) @@ -334,7 +342,11 @@ AC_CACHE_VAL(gdb_cv_have_procfs_piocset, [AC_TRY_COMPILE([#include #include +#ifdef HAVE_PROCFS_H +#include +#else #include +#endif ], [ int dummy;; dummy = ioctl(0, PIOCSET, &dummy);