From 37f58dce035aab53cedc36c2bd250b3432848265 Mon Sep 17 00:00:00 2001 From: Felix Lee Date: Wed, 14 Oct 1998 01:15:01 +0000 Subject: [PATCH] * sol-thread.c (ps_pstop, etc): simple test for proc_service.h version didn't work for sol2.6; pushed it to autoconf. * configure.in (gdb_cv_proc_service_is_old): new test. * acconfig.h (PROC_SERVICE_IS_OLD): new define. * configure, config.in: regenerate. --- gdb/ChangeLog | 8 ++++ gdb/acconfig.h | 4 ++ gdb/config.in | 4 ++ gdb/configure | 100 +++++++++++++++++++++++++++++++++-------------- gdb/configure.in | 15 +++++++ gdb/sol-thread.c | 44 ++++++++++++--------- 6 files changed, 126 insertions(+), 49 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 09c6be5ebdf..f97a8cf0cc8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +Tue Oct 13 18:56:51 1998 Felix Lee + + * sol-thread.c (ps_pstop, etc): simple test for proc_service.h + version didn't work for sol2.6; pushed it to autoconf. + * configure.in (gdb_cv_proc_service_is_old): new test. + * acconfig.h (PROC_SERVICE_IS_OLD): new define. + * configure, config.in: regenerate. + 1998-10-13 Jason Molenda (jsm@bugshack.cygnus.com) * blockframe.c (find_pc_sect_partial_function): Add braces to avoid diff --git a/gdb/acconfig.h b/gdb/acconfig.h index 5b9a92432d3..565e6929164 100644 --- a/gdb/acconfig.h +++ b/gdb/acconfig.h @@ -63,3 +63,7 @@ /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES + +/* Define if on solaris uses int instead of + size_t, and assorted other type changes. */ +#undef PROC_SERVICE_IS_OLD diff --git a/gdb/config.in b/gdb/config.in index 7b9b0b06890..933c2874ca0 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -120,6 +120,10 @@ /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES +/* Define if on solaris uses int instead of + size_t, and assorted other type changes. */ +#undef PROC_SERVICE_IS_OLD + /* Define if you have the __argz_count function. */ #undef HAVE___ARGZ_COUNT diff --git a/gdb/configure b/gdb/configure index 5ce95b70d79..da22ec95b41 100755 --- a/gdb/configure +++ b/gdb/configure @@ -4462,6 +4462,46 @@ rm -f conftest* CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic" fi fi + # Sun randomly tweaked the prototypes in + # at one point. + echo $ac_n "checking if is old""... $ac_c" 1>&6 +echo "configure:4469: checking if is old" >&5 + if eval "test \"`echo '$''{'gdb_cv_proc_service_is_old'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < + ps_err_e ps_pdwrite + (struct ps_prochandle*, psaddr_t, const void*, size_t); + +int main() { + +; return 0; } +EOF +if { (eval echo configure:4486: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + gdb_cv_proc_service_is_old=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gdb_cv_proc_service_is_old=yes +fi +rm -f conftest* + +fi + + echo "$ac_t""$gdb_cv_proc_service_is_old" 1>&6 + if test $gdb_cv_proc_service_is_old = yes; then + cat >> confdefs.h <<\EOF +#define PROC_SERVICE_IS_OLD 1 +EOF + + fi else echo "$ac_t""no" 1>&6 fi @@ -4763,12 +4803,12 @@ fi # In the cygwin32 environment, we need some additional flags. echo $ac_n "checking for cygwin32""... $ac_c" 1>&6 -echo "configure:4767: checking for cygwin32" >&5 +echo "configure:4807: checking for cygwin32" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:4831: checking for Tcl configuration" >&5 +echo "configure:4871: checking for Tcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4935,7 +4975,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:4939: checking for Tk configuration" >&5 +echo "configure:4979: checking for Tk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5031,7 +5071,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:5035: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:5075: checking for Tcl private headers. dir=${configdir}" >&5 # Check whether --with-tclinclude or --without-tclinclude was given. if test "${with_tclinclude+set}" = set; then withval="$with_tclinclude" @@ -5097,17 +5137,17 @@ fi if test x"${ac_cv_c_tclh}" = x ; then ac_safe=`echo "tclInt.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tclInt.h""... $ac_c" 1>&6 -echo "configure:5101: checking for tclInt.h" >&5 +echo "configure:5141: checking for tclInt.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5151: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5167,7 +5207,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:5171: checking for Tk private headers" >&5 +echo "configure:5211: checking for Tk private headers" >&5 # Check whether --with-tkinclude or --without-tkinclude was given. if test "${with_tkinclude+set}" = set; then withval="$with_tkinclude" @@ -5233,17 +5273,17 @@ fi if test x"${ac_cv_c_tkh}" = x ; then ac_safe=`echo "tk.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for tk.h""... $ac_c" 1>&6 -echo "configure:5237: checking for tk.h" >&5 +echo "configure:5277: checking for tk.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5289,7 +5329,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:5293: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:5333: checking for Itcl private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itclh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ; do if test -f $i/src/itcl.h ; then @@ -5312,7 +5352,7 @@ fi echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:5316: checking for Tix private headers. srcdir=${srcdir}" >&5 +echo "configure:5356: checking for Tix private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_tixh}" = x ; then for i in ${srcdir}/../tix ${srcdir}/../../tix ${srcdir}/../../../tix ; do if test -f $i/generic/tix.h ; then @@ -5406,7 +5446,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:5410: checking for X" >&5 +echo "configure:5450: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -5468,12 +5508,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5477: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5542,14 +5582,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -5670,7 +5710,7 @@ fi # end-sanitize-sky echo $ac_n "checking for wctype in -lw""... $ac_c" 1>&6 -echo "configure:5674: checking for wctype in -lw" >&5 +echo "configure:5714: checking for wctype in -lw" >&5 ac_lib_var=`echo w'_'wctype | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5678,7 +5718,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lw $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5853,7 +5893,7 @@ links="${links} nm.h" fi # start-sanitize-gdbtk echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:5857: checking whether ln -s works" >&5 +echo "configure:5897: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5888,19 +5928,19 @@ fi echo $ac_n "checking for Cygwin32 environment""... $ac_c" 1>&6 -echo "configure:5892: checking for Cygwin32 environment" >&5 +echo "configure:5932: checking for Cygwin32 environment" >&5 if eval "test \"`echo '$''{'am_cv_cygwin32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_cygwin32=yes else @@ -5917,19 +5957,19 @@ echo "$ac_t""$am_cv_cygwin32" 1>&6 CYGWIN32= test "$am_cv_cygwin32" = yes && CYGWIN32=yes echo $ac_n "checking for Mingw32 environment""... $ac_c" 1>&6 -echo "configure:5921: checking for Mingw32 environment" >&5 +echo "configure:5961: checking for Mingw32 environment" >&5 if eval "test \"`echo '$''{'am_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5973: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_mingw32=yes else @@ -5948,7 +5988,7 @@ test "$am_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:5952: checking for executable suffix" >&5 +echo "configure:5992: checking for executable suffix" >&5 if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else diff --git a/gdb/configure.in b/gdb/configure.in index 0ccc4bc802b..4c5272d4212 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -248,6 +248,21 @@ if test ${build} = ${host} -a ${host} = ${target} ; then CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic" fi fi + # Sun randomly tweaked the prototypes in + # at one point. + AC_MSG_CHECKING(if is old) + AC_CACHE_VAL(gdb_cv_proc_service_is_old,[ + AC_TRY_COMPILE([ + #include + ps_err_e ps_pdwrite + (struct ps_prochandle*, psaddr_t, const void*, size_t); + ],, gdb_cv_proc_service_is_old=no, + gdb_cv_proc_service_is_old=yes) + ]) + AC_MSG_RESULT($gdb_cv_proc_service_is_old) + if test $gdb_cv_proc_service_is_old = yes; then + AC_DEFINE(PROC_SERVICE_IS_OLD) + fi else AC_MSG_RESULT(no) fi diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index 58b0814d7e7..ca20bdef888 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -956,28 +956,34 @@ sol_thread_stop () /* These routines implement the lower half of the thread_db interface. Ie: the ps_* routines. */ -/* Old versions of proc_service.h (1.3 94/10/27) have - prototypes that look like - (const struct ps_prochandle *, ...) - while newer versions use - (struct ps_prochandle *, ...) - and other such minor variations. - - Someday, we might need to discover this in configure.in, - but the #ifdef below seems to be sufficient for now. */ - -#ifdef PS_OBJ_EXEC -typedef struct ps_prochandle* gdb_ps_prochandle_t; -typedef void* gdb_ps_read_buf_t; -typedef const void* gdb_ps_write_buf_t; -typedef size_t gdb_ps_size_t; -#else -typedef const struct ps_prochandle* gdb_ps_prochandle_t; -typedef char* gdb_ps_read_buf_t; -typedef char* gdb_ps_write_buf_t; +/* Various versions of have slightly + different function prototypes. In particular, we have + + NEWER OLDER + struct ps_prochandle * const struct ps_prochandle * + void* char* + const void* char* + int size_t + + Which one you have depends on solaris version and what + patches you've applied. On the theory that there are + only two major variants, we have configure check the + prototype of ps_pdwrite (), and use that info to make + appropriate typedefs here. */ + +#ifdef PROC_SERVICE_IS_OLD +typedef const struct ps_prochandle * gdb_ps_prochandle_t; +typedef char * gdb_ps_read_buf_t; +typedef char * gdb_ps_write_buf_t; typedef int gdb_ps_size_t; +#else +typedef struct ps_prochandle * gdb_ps_prochandle_t; +typedef void * gdb_ps_read_buf_t; +typedef const void * gdb_ps_write_buf_t; +typedef size_t gdb_ps_size_t; #endif + /* The next four routines are called by thread_db to tell us to stop and stop a particular process or lwp. Since GDB ensures that these are all stopped by the time we call anything in thread_db, these routines need to do -- 2.30.2