From: Daniel Jacobowitz Date: Tue, 26 Nov 2002 01:32:22 +0000 (+0000) Subject: * acconfig.h (HAVE_PREAD64): Add. X-Git-Tag: gdb_5_3-2002-12-12-release~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50264be10cecaef85ed5557cf26dc102f48fc5a5;p=thirdparty%2Fbinutils-gdb.git * acconfig.h (HAVE_PREAD64): Add. * configure.in: Check for pread64. * config.in: Regenerated. * configure: Regenerated. * lin-lwp.c (lin_lwp_xfer_memory): Call linux_proc_xfer_memory. * linux-proc.c (linux_proc_xfer_memory): New function. * config/nm-linux.h (linux_proc_xfer_memory): Add prototype. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d110b821dfe..9791ad486dc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-11-25 Daniel Jacobowitz + + * acconfig.h (HAVE_PREAD64): Add. + * configure.in: Check for pread64. + * config.in: Regenerated. + * configure: Regenerated. + * lin-lwp.c (lin_lwp_xfer_memory): Call linux_proc_xfer_memory. + * linux-proc.c (linux_proc_xfer_memory): New function. + * config/nm-linux.h (linux_proc_xfer_memory): Add prototype. + 2002-11-25 Christopher Faylor * win32-nat.c (child_attach): Reset saw_create counter or subsequent diff --git a/gdb/acconfig.h b/gdb/acconfig.h index 619b0ae97b4..88c15e1263a 100644 --- a/gdb/acconfig.h +++ b/gdb/acconfig.h @@ -49,6 +49,9 @@ /* Define if has pr_siginfo64_t */ #undef HAVE_PR_SIGINFO64_T +/* Define if the pread64 function is available. */ +#undef HAVE_PREAD64 + /* Define if exists and defines struct link_map which has members with an ``l_'' prefix. (For Solaris, SVR4, and SVR4-like systems.) */ diff --git a/gdb/config.in b/gdb/config.in index 8c1c7bf356e..2ddfa643c11 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -1,4 +1,4 @@ -/* config.in. Generated automatically from configure.in by autoheader 2.13. */ +/* config.in. Generated automatically from configure.in by autoheader. */ /* Define if on AIX 3. System headers sometimes define this. @@ -80,6 +80,9 @@ /* Define if your struct reg has r_gs. */ #undef HAVE_STRUCT_REG_R_GS +/* Define if the pread64 function is available. */ +#undef HAVE_PREAD64 + /* Define if exists and defines struct link_map which has members with an ``l_'' prefix. (For Solaris, SVR4, and SVR4-like systems.) */ diff --git a/gdb/config/nm-linux.h b/gdb/config/nm-linux.h index a2d429214d9..114acd8b67c 100644 --- a/gdb/config/nm-linux.h +++ b/gdb/config/nm-linux.h @@ -71,4 +71,7 @@ extern void lin_thread_get_thread_signals (sigset_t *mask); /* Override child_pid_to_exec_file in 'inftarg.c'. */ #define CHILD_PID_TO_EXEC_FILE - +struct mem_attrib; +extern int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, + int write, struct mem_attrib *attrib, + struct target_ops *target); diff --git a/gdb/configure b/gdb/configure index 9befcab3d80..5f82a3f52c4 100755 --- a/gdb/configure +++ b/gdb/configure @@ -6544,6 +6544,36 @@ EOF fi +if test $host = $target; then + case $target in + *-linux*) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE" + cat > conftest.$ac_ext < +int main() { +pread64 (0, NULL, 0, 0); +; return 0; } +EOF +if { (eval echo configure:6561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ENABLE_CFLAGS="$ENABLE_CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE" + cat >> confdefs.h <<\EOF +#define HAVE_PREAD64 1 +EOF + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + CFLAGS=$save_CFLAGS + ;; + esac +fi + # Check whether --enable-gdbcli or --disable-gdbcli was given. if test "${enable_gdbcli+set}" = set; then @@ -6735,7 +6765,7 @@ WERROR_CFLAGS="" if test "x${build_warnings}" != x -a "x$GCC" = xyes then echo $ac_n "checking compiler warning flags""... $ac_c" 1>&6 -echo "configure:6739: checking compiler warning flags" >&5 +echo "configure:6769: checking compiler warning flags" >&5 # Separate out the -Werror flag as some files just cannot be # compiled with it enabled. for w in ${build_warnings}; do @@ -6745,14 +6775,14 @@ echo "configure:6739: checking compiler warning flags" >&5 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $w" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6786: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* WARN_CFLAGS="${WARN_CFLAGS} $w" else @@ -6812,12 +6842,12 @@ fi if test $want_included_regex = false; then echo $ac_n "checking for GNU regex""... $ac_c" 1>&6 -echo "configure:6816: checking for GNU regex" >&5 +echo "configure:6846: checking for GNU regex" >&5 if eval "test \"`echo '$''{'gdb_cv_have_gnu_regex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6829,7 +6859,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:6833: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gdb_cv_have_gnu_regex=yes else @@ -6858,12 +6888,12 @@ fi # In the Cygwin environment, we need some additional flags. echo $ac_n "checking for cygwin""... $ac_c" 1>&6 -echo "configure:6862: checking for cygwin" >&5 +echo "configure:6892: checking for cygwin" >&5 if eval "test \"`echo '$''{'gdb_cv_os_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 -echo "configure:6905: checking for tgetent in -lncurses" >&5 +echo "configure:6935: checking for tgetent in -lncurses" >&5 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6909,7 +6939,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6954: \"$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 @@ -6939,7 +6969,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lHcurses""... $ac_c" 1>&6 -echo "configure:6943: checking for tgetent in -lHcurses" >&5 +echo "configure:6973: checking for tgetent in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6947,7 +6977,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6992: \"$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 @@ -6977,7 +7007,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6 -echo "configure:6981: checking for tgetent in -ltermlib" >&5 +echo "configure:7011: checking for tgetent in -ltermlib" >&5 ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6985,7 +7015,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermlib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7030: \"$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 @@ -7015,7 +7045,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 -echo "configure:7019: checking for tgetent in -ltermcap" >&5 +echo "configure:7049: checking for tgetent in -ltermcap" >&5 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7023,7 +7053,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ltermcap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7068: \"$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 @@ -7053,7 +7083,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6 -echo "configure:7057: checking for tgetent in -lcurses" >&5 +echo "configure:7087: checking for tgetent in -lcurses" >&5 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7061,7 +7091,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7106: \"$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 @@ -7091,7 +7121,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for tgetent in -lterminfo""... $ac_c" 1>&6 -echo "configure:7095: checking for tgetent in -lterminfo" >&5 +echo "configure:7125: checking for tgetent in -lterminfo" >&5 ac_lib_var=`echo terminfo'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7099,7 +7129,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lterminfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7144: \"$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 @@ -7275,7 +7305,7 @@ if test "${with_tclconfig+set}" = set; then fi echo $ac_n "checking for Tcl configuration""... $ac_c" 1>&6 -echo "configure:7279: checking for Tcl configuration" >&5 +echo "configure:7309: 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 @@ -7383,7 +7413,7 @@ if test "${with_tkconfig+set}" = set; then fi echo $ac_n "checking for Tk configuration""... $ac_c" 1>&6 -echo "configure:7387: checking for Tk configuration" >&5 +echo "configure:7417: 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 @@ -7492,7 +7522,7 @@ fi no_tcl=true echo $ac_n "checking for Tcl private headers. dir=${configdir}""... $ac_c" 1>&6 -echo "configure:7496: checking for Tcl private headers. dir=${configdir}" >&5 +echo "configure:7526: 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" @@ -7558,17 +7588,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:7562: checking for tclInt.h" >&5 +echo "configure:7592: 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:7572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7602: \"$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* @@ -7628,7 +7658,7 @@ fi # no_tk=true echo $ac_n "checking for Tk private headers""... $ac_c" 1>&6 -echo "configure:7632: checking for Tk private headers" >&5 +echo "configure:7662: 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" @@ -7694,17 +7724,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:7698: checking for tk.h" >&5 +echo "configure:7728: 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:7708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7738: \"$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* @@ -7750,7 +7780,7 @@ fi echo $ac_n "checking for Itcl private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7754: checking for Itcl private headers. srcdir=${srcdir}" >&5 +echo "configure:7784: 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 ${srcdir}/../itcl/itcl; do if test -f $i/generic/itcl.h ; then @@ -7773,7 +7803,7 @@ fi echo $ac_n "checking for Itk private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7777: checking for Itk private headers. srcdir=${srcdir}" >&5 +echo "configure:7807: checking for Itk private headers. srcdir=${srcdir}" >&5 if test x"${ac_cv_c_itkh}" = x ; then for i in ${srcdir}/../itcl ${srcdir}/../../itcl ${srcdir}/../../../itcl ${srcdir}/../itcl/itk; do if test -f $i/generic/itk.h ; then @@ -7796,7 +7826,7 @@ fi echo $ac_n "checking for Tix private headers. srcdir=${srcdir}""... $ac_c" 1>&6 -echo "configure:7800: checking for Tix private headers. srcdir=${srcdir}" >&5 +echo "configure:7830: 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 @@ -7848,7 +7878,7 @@ if test "${with_itclconfig+set}" = set; then fi echo $ac_n "checking for Itcl configuration""... $ac_c" 1>&6 -echo "configure:7852: checking for Itcl configuration" >&5 +echo "configure:7882: checking for Itcl configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itclconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7951,7 +7981,7 @@ if test "${with_itkconfig+set}" = set; then fi echo $ac_n "checking for Itk configuration""... $ac_c" 1>&6 -echo "configure:7955: checking for Itk configuration" >&5 +echo "configure:7985: checking for Itk configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_itkconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8054,7 +8084,7 @@ if test "${with_tixconfig+set}" = set; then fi echo $ac_n "checking for Tix configuration""... $ac_c" 1>&6 -echo "configure:8058: checking for Tix configuration" >&5 +echo "configure:8088: checking for Tix configuration" >&5 if eval "test \"`echo '$''{'ac_cv_c_tixconfig'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8200,7 +8230,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:8204: checking for X" >&5 +echo "configure:8234: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -8262,12 +8292,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:8271: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8301: \"$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* @@ -8336,14 +8366,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:8377: \"$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. @@ -8635,7 +8665,7 @@ fi # ``gdbserver'' can only be built in a native configuration. if test x"${target}" = x"${host}"; then echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6 -echo "configure:8639: checking whether gdbserver is supported on this host" >&5 +echo "configure:8669: checking whether gdbserver is supported on this host" >&5 if test x"${build_gdbserver}" = xyes ; then configdirs="${configdirs} gdbserver" SUBDIRS="${SUBDIRS} gdbserver" @@ -8697,7 +8727,7 @@ fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:8701: checking whether ln -s works" >&5 +echo "configure:8731: 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 @@ -8721,12 +8751,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:8725: checking for Cygwin environment" >&5 +echo "configure:8755: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+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:8771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -8754,19 +8784,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:8758: checking for mingw32 environment" >&5 +echo "configure:8788: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_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:8800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -8785,7 +8815,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:8789: checking for executable suffix" >&5 +echo "configure:8819: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8795,7 +8825,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:8799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:8829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; @@ -9106,7 +9136,7 @@ cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. diff --git a/gdb/configure.in b/gdb/configure.in index edc72c3aa94..61bf5e7d757 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -600,6 +600,23 @@ if test ${build} = ${host} -a ${host} = ${target} ; then AC_SUBST(CONFIG_LDFLAGS) fi +dnl linux-proc.c wants to use pread64, which may require special CFLAGS +dnl -D_BSD_SOURCE is normally assumed but we have to specify it because of +dnl -D_XOPEN_SOURCE=500. +if test $host = $target; then + case $target in + *-linux*) + save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE" + AC_TRY_LINK([#include ], + [pread64 (0, NULL, 0, 0);], + [ENABLE_CFLAGS="$ENABLE_CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE" + AC_DEFINE(HAVE_PREAD64)], []) + CFLAGS=$save_CFLAGS + ;; + esac +fi + dnl The CLI cannot be disabled yet, but may be in the future dnl Handle CLI sub-directory configury. diff --git a/gdb/lin-lwp.c b/gdb/lin-lwp.c index cd577fbe3a0..74e5d85f73e 100644 --- a/gdb/lin-lwp.c +++ b/gdb/lin-lwp.c @@ -1383,7 +1383,9 @@ lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, if (is_lwp (inferior_ptid)) inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid)); - xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target); + xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target); + if (xfer == 0) + xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target); do_cleanups (old_chain); return xfer; diff --git a/gdb/linux-proc.c b/gdb/linux-proc.c index f76def3a3a2..2f43ae61f97 100644 --- a/gdb/linux-proc.c +++ b/gdb/linux-proc.c @@ -25,6 +25,8 @@ #include /* for elf_gregset etc. */ #include /* for struct stat */ #include /* for isdigit */ +#include /* for open, pread64 */ +#include /* for O_RDONLY */ #include "regcache.h" /* for registers_changed */ #include "gregset.h" /* for gregset */ #include "gdbcore.h" /* for get_exec_file */ @@ -33,6 +35,10 @@ #include "cli/cli-decode.h" /* for add_info */ #include "gdb_string.h" +#ifndef O_LARGEFILE +#define O_LARGEFILE 0 +#endif + /* Function: child_pid_to_exec_file * * Accepts an integer pid @@ -577,3 +583,46 @@ Specify any of the following keywords for detailed info:\n\ status -- list a different bunch of random process info.\n\ all -- list all available /proc info."); } + +int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write, + struct mem_attrib *attrib, + struct target_ops *target) +{ + int fd, ret; + char filename[64]; + + if (write) + return 0; + + /* Don't bother for one word. */ + if (len < 3 * sizeof (long)) + return 0; + + /* We could keep this file open and cache it - possibly one + per thread. That requires some juggling, but is even faster. */ + sprintf (filename, "/proc/%d/mem", PIDGET (inferior_ptid)); + fd = open (filename, O_RDONLY | O_LARGEFILE); + if (fd == -1) + return 0; + + /* If pread64 is available, use it. It's faster if the kernel + supports it (only one syscall), and it's 64-bit safe even + on 32-bit platforms (for instance, SPARC debugging a SPARC64 + application). + + We play some autoconf and CFLAGS games to get this declaration + exposed: -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE. And then + a -D_BSD_SOURCE to counteract the defaults for _XOPEN_SOURCE. */ +#ifdef HAVE_PREAD64 + if (pread64 (fd, myaddr, len, addr) != len) +#else + if (lseek (fd, addr, SEEK_SET) == -1 + || read (fd, myaddr, len) != len) +#endif + ret = 0; + else + ret = len; + + close (fd); + return ret; +}