Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA/Patch Solaris /proc configury
@ 2002-02-01  1:53 rbrown64
  2002-02-01  9:39 ` Michael Snyder
  0 siblings, 1 reply; 2+ messages in thread
From: rbrown64 @ 2002-02-01  1:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: msnyder

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 <sys/procfs.h>
instead of <procfs.h> 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 <sys/procfs.h> where gdb/procfs.h holds
#if defined(HAVE_PROCFS_H)
#include <procfs.h>
#elif defined(HAVE_SYS_PROCFS_H)
#include <sys/procfs.h>
#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 <procfs.h> 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   <rbrown64@csc.com.au>

     * 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 <sys/procfs.h>],
+#ifdef HAVE_PROCFS_H
+#include <procfs.h>
+#else
+#include <sys/procfs.h>
+#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 <sys/procfs.h>],
+#ifdef HAVE_PROCFS_H
+#include <procfs.h>
+#else
+#include <sys/procfs.h>
+#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 <sys/procfs.h>
-  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 <sys/procfs.h>
+      [AC_TRY_RUN([
+#ifdef HAVE_PROCFS_H
+#include <procfs.h>
+#else
+#include <sys/procfs.h>
+#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 <unistd.h>
 #include <sys/types.h>
+#ifdef HAVE_PROCFS_H
+#include <procfs.h>
+#else
 #include <sys/procfs.h>
+#endif
 ], [
     int dummy;;
     dummy = ioctl(0, PIOCSET, &dummy);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFA/Patch Solaris /proc configury
  2002-02-01  1:53 RFA/Patch Solaris /proc configury rbrown64
@ 2002-02-01  9:39 ` Michael Snyder
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Snyder @ 2002-02-01  9:39 UTC (permalink / raw)
  To: rbrown64; +Cc: gdb-patches

rbrown64@csc.com.au wrote:
> 
> 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?

Hi Rodney, 

Is there a reason for making this change?
Doesn't everything work the way it is?
What do we gain?

Thanks,
Michael  


> 
> If applied it will break Solaris 2.[6-8]. Including <sys/procfs.h>
> instead of <procfs.h> 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 <sys/procfs.h> where gdb/procfs.h holds
> #if defined(HAVE_PROCFS_H)
> #include <procfs.h>
> #elif defined(HAVE_SYS_PROCFS_H)
> #include <sys/procfs.h>
> #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 <procfs.h> 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   <rbrown64@csc.com.au>
> 
>      * 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 <sys/procfs.h>],
> +#ifdef HAVE_PROCFS_H
> +#include <procfs.h>
> +#else
> +#include <sys/procfs.h>
> +#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 <sys/procfs.h>],
> +#ifdef HAVE_PROCFS_H
> +#include <procfs.h>
> +#else
> +#include <sys/procfs.h>
> +#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 <sys/procfs.h>
> -  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 <sys/procfs.h>
> +      [AC_TRY_RUN([
> +#ifdef HAVE_PROCFS_H
> +#include <procfs.h>
> +#else
> +#include <sys/procfs.h>
> +#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 <unistd.h>
>  #include <sys/types.h>
> +#ifdef HAVE_PROCFS_H
> +#include <procfs.h>
> +#else
>  #include <sys/procfs.h>
> +#endif
>  ], [
>      int dummy;;
>      dummy = ioctl(0, PIOCSET, &dummy);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-01 17:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-01  1:53 RFA/Patch Solaris /proc configury rbrown64
2002-02-01  9:39 ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox