From 47ef0da56a772d7dca43c54523303afa2d0c73eb Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Tue, 14 May 1996 07:02:56 +0000 Subject: [PATCH] * Makefile.in config.in configure configure.in config/sparc/nm-sun4sol2.h config/sparc/sun4sol2.mh config/sparc/tm-sun4sol2.h: Use autoconf to config Solaris thread and pthread support, since pre-2.5 systems don't come with libthread_db.so.1. * procfs.c (info_proc): Use int instead of id_t. Old versions of Irix don't see to define this. --- gdb/ChangeLog | 11 +++++ gdb/config.in | 3 ++ gdb/config/sparc/nm-sun4sol2.h | 4 ++ gdb/config/sparc/sun4sol2.mh | 3 +- gdb/config/sparc/tm-sun4sol2.h | 4 ++ gdb/configure | 76 ++++++++++++++++++++-------------- gdb/configure.in | 15 +++++++ gdb/procfs.c | 4 +- 8 files changed, 86 insertions(+), 34 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e74f36364d..e3a3d3ff8b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +Mon May 13 23:53:30 1996 Stu Grossman (grossman@critters.cygnus.com) + + * Makefile.in config.in configure configure.in + config/sparc/nm-sun4sol2.h config/sparc/sun4sol2.mh + config/sparc/tm-sun4sol2.h: Use autoconf to config Solaris thread + and pthread support, since pre-2.5 systems don't come with + libthread_db.so.1. + + * procfs.c (info_proc): Use int instead of id_t. Old versions of + Irix don't see to define this. + start-sanitize-gdbtk Mon May 13 13:43:25 1996 Fred Fish diff --git a/gdb/config.in b/gdb/config.in index a5c51adfd8..340c087d3e 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -88,3 +88,6 @@ /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL + +/* Define if you have the Solaris thread_db library (/usr/lib/libthread_db.so.1). */ +#undef HAVE_THREAD_DB_LIB diff --git a/gdb/config/sparc/nm-sun4sol2.h b/gdb/config/sparc/nm-sun4sol2.h index 9fb58e0aa4..c83e44db9e 100644 --- a/gdb/config/sparc/nm-sun4sol2.h +++ b/gdb/config/sparc/nm-sun4sol2.h @@ -29,6 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define PRSVADDR_BROKEN +#ifdef HAVE_THREAD_DB_LIB + #ifdef __STDC__ struct objfile; #endif @@ -36,3 +38,5 @@ struct objfile; #define target_new_objfile(OBJFILE) sol_thread_new_objfile (OBJFILE) void sol_thread_new_objfile PARAMS ((struct objfile *objfile)); + +#endif diff --git a/gdb/config/sparc/sun4sol2.mh b/gdb/config/sparc/sun4sol2.mh index 5390b5b244..b24ce9ffbd 100644 --- a/gdb/config/sparc/sun4sol2.mh +++ b/gdb/config/sparc/sun4sol2.mh @@ -5,8 +5,7 @@ XDEPFILES= ser-tcp.o XM_CLIBS= -lsocket -lnsl NAT_FILE= nm-sun4sol2.h -NATDEPFILES= corelow.o core-sol2.o solib.o procfs.o fork-child.o sol-thread.o -NAT_CLIBS= /lib/libthread_db.so.1 +NATDEPFILES= corelow.o core-sol2.o solib.o procfs.o fork-child.o # SVR4 comes standard with terminfo, and in some implementations, the # old termcap descriptions are incomplete. So ensure that we use the diff --git a/gdb/config/sparc/tm-sun4sol2.h b/gdb/config/sparc/tm-sun4sol2.h index 49afbab062..8a2a0e6af0 100644 --- a/gdb/config/sparc/tm-sun4sol2.h +++ b/gdb/config/sparc/tm-sun4sol2.h @@ -76,5 +76,9 @@ extern char *sunpro_static_transform_name PARAMS ((char *)); #define PIDGET(pid) ((pid) & 0xffff) #define TIDGET(pid) (((pid) >> 16) & 0xffff) +#ifdef HAVE_THREAD_DB_LIB + extern char *solaris_pid_to_str PARAMS ((int pid)); #define target_pid_to_str(PID) solaris_pid_to_str (PID) + +#endif diff --git a/gdb/configure b/gdb/configure index 1c3911af6d..cd53d46183 100755 --- a/gdb/configure +++ b/gdb/configure @@ -1761,6 +1761,21 @@ EOF fi + +echo $ac_n "checking for Solaris thread debugging library""... $ac_c" 1>&6 +if test -f /usr/lib/libthread_db.so.1 ; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS /usr/lib/libthread_db.so.1" + THREAD_DB_OBS=sol-thread.o + cat >> confdefs.h <<\EOF +#define HAVE_THREAD_DB_LIB 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + ENABLE_CFLAGS= ENABLE_CLIBS= ENABLE_OBS= @@ -1910,12 +1925,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:1919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1982,7 +1997,7 @@ 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; }; then +if { (eval echo configure:2009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2111,7 +2126,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2155,7 +2170,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2190,7 +2205,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2230,7 +2245,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2269,7 +2284,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2374,12 +2389,12 @@ 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:2383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2432,7 +2447,7 @@ if test "$cross_compiling" = yes; then else cat > conftest.$ac_ext < @@ -2447,7 +2462,7 @@ main() { return 0; } EOF -{ (eval echo configure:2451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then tclmajor=`cat tclmajor` tclminor=`cat tclminor` @@ -2592,13 +2607,13 @@ else ac_cv_c_tclib="-l$installedtcllibroot" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_tcllib="-l$installedtcllibroot" else @@ -2708,12 +2723,12 @@ 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:2717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2773,7 +2788,7 @@ if test "$cross_compiling" = yes; then else cat > conftest.$ac_ext < @@ -2788,7 +2803,7 @@ cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then tkmajor=`cat tkmajor` tkminor=`cat tkminor` @@ -2954,13 +2969,13 @@ else ac_cv_c_tklib="-l$installedtklibroot" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_tklib="-l$installedtklibroot" else @@ -3001,7 +3016,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:3028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3039,7 +3054,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:3066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3752,6 +3767,7 @@ s%@target_alias@%$target_alias%g s%@target_cpu@%$target_cpu%g s%@target_vendor@%$target_vendor%g s%@target_os@%$target_os%g +s%@THREAD_DB_OBS@%$THREAD_DB_OBS%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g s%@X_LIBS@%$X_LIBS%g diff --git a/gdb/configure.in b/gdb/configure.in index 3c38d8cc21..5023140ac7 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -96,6 +96,21 @@ AC_MSG_RESULT($gdb_cv_printf_has_long_double) AC_FUNC_MMAP +dnl See if thread_db is around for Solaris thread debugging. Note that we must +dnl explicitly test for version 1 of the library because version 0 (present on +dnl Solaris 2.4 or earlier) doesn't have the same API. + +AC_MSG_CHECKING(for Solaris thread debugging library) +if test -f /usr/lib/libthread_db.so.1 ; then + AC_MSG_RESULT(yes) + LIBS="$LIBS /usr/lib/libthread_db.so.1" + THREAD_DB_OBS=sol-thread.o + AC_DEFINE(HAVE_THREAD_DB_LIB) +else + AC_MSG_RESULT(no) +fi +AC_SUBST(THREAD_DB_OBS) + dnl Handle optional features that can be enabled. ENABLE_CFLAGS= ENABLE_CLIBS= diff --git a/gdb/procfs.c b/gdb/procfs.c index 7d049ff7f8..08cbb45ca6 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -3633,7 +3633,7 @@ info_proc (args, from_tty) int status = 0; int all = 0; int nlwp; - id_t *lwps; + int *lwps; old_chain = make_cleanup (null_cleanup, 0); @@ -3745,7 +3745,7 @@ No process. Start debugging a program or specify an explicit process ID."); } #else /* PIOCLWPIDS */ nlwp = 1; - lwps = alloca ((2 * nlwp + 2) * sizeof (id_t)); + lwps = alloca ((2 * nlwp + 2) * sizeof *lwps); lwps[0] = 0; #endif /* PIOCLWPIDS */