Re: [RFA] nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing

Pedro Alves
2013-12-13T10:06:50Z

On 12/12/2013 10:06 PM, Tom Tromey wrote:
>>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:
>
> Joel> which is good enough for our purposes. But for the second issue,
> Joel> I only had a handful of bad options for our current situation:
> Joel> 1. Import the module from gnulib; but that's never an innocent
> Joel> change, and also the documentation says that it does not work
> Joel> for Windows paths;
> Joel> 2. Import the libiberty module by hand, which itself depends on
> Joel> their safe-ctype.h module.
> Joel> 3. Write a quick ad hoc function that implements basename.
>
> Now that we are on git and can move stuff around without much hassle, I
> think it's a good time for someone to tackle rearranging the tree a bit
> so that this artificial "gdbserver cannot use libiberty" restriction can
> be lifted.

Not speaking for or against the plan, but I don't recall that the current
restriction was based on directory structure. With ACX_CONFIGURE_DIR, we
can build libiberty within gdbserver's build dir, like we do gnulib (see below),
so it seems that's a non-issue (even if that was is not the cleanest).
Rather, the main issue was that libiberty won't build out of the box on some
of the gdbserver targets, like Windows CE and Lynx, IIRC. CE is probably
already broken for a while, so it's fine with me to not have it
block such a change.

---
gdb/gdbserver/configure | 97 ++++++++++++++++++++++++++++++++++++++++++++++
gdb/gdbserver/configure.ac | 2 +
2 files changed, 99 insertions(+)

diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index fac7fb3..9c49ae2 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -4714,6 +4714,103 @@ $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cach
cd "$ac_popdir"

+
+ in_src="../../libiberty"
+ in_build="build-libiberty-gdbserver"
+
+ # Remove --cache-file, --srcdir, and --disable-option-checking arguments
+ # so they do not pile up.
+ ac_sub_configure_args=
+ ac_prev=
+ eval "set x $ac_configure_args"
+ shift
+ for ac_arg
+ do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case $ac_arg in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
+ | --c=*)
+ ;;
+ --config-cache | -C)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ ;;
+ --disable-option-checking)
+ ;;
+ *)
+ case $ac_arg in
+ *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append ac_sub_configure_args " '$ac_arg'" ;;
+ esac
+ done
+
+ # Always prepend --prefix to ensure using the same prefix
+ # in subdir configurations.
+ ac_arg="--prefix=$prefix"
+ case $ac_arg in
+ *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
+
+ # Pass --silent
+ if test "$silent" = yes; then
+ ac_sub_configure_args="--silent $ac_sub_configure_args"
+ fi
+
+ # Always prepend --disable-option-checking to silence warnings, since
+ # different subdirs can have different --enable and --with options.
+ ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args"
+
+ ac_popdir=`pwd`
+ ac_dir=$in_build
+
+ ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
+ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5
+ $as_echo "$ac_msg" >&6
+ as_dir="$ac_dir"; as_fn_mkdir_p
+
+ case $srcdir in
+ [\\/]* | ?:[\\/]* )
+ ac_srcdir=$srcdir/$in_src ;;
+ *) # Relative name.
+ ac_srcdir=../$srcdir/$in_src ;;
+ esac
+
+ cd "$ac_dir"
+
+ ac_sub_configure=$ac_srcdir/configure
+
+ # Make the cache file name correct relative to the subdirectory.
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
+ *) # Relative name.
+ ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
+$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
+ # The eval makes quoting arguments work.
+ eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
+ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
+ as_fn_error "$ac_sub_configure failed for $ac_dir" "$LINENO" 5
+
+ cd "$ac_popdir"
+
+
for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h linux/elf.h errno.h fcntl.h signal.h sys/file.h malloc.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 1c61843..5b39acc 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -77,6 +77,8 @@ AC_PROG_MAKE_SET
# build it in the same directory, when building in the source dir.
ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"])

+ACX_CONFIGURE_DIR(["../../libiberty"], ["build-libiberty-gdbserver"])
+
AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
proc_service.h sys/procfs.h linux/elf.h dnl
errno.h fcntl.h signal.h sys/file.h malloc.h dnl
--
1.7.11.7