link gdbserver against libiberty

This builds a libiberty just for gdbserver and arranges for gdbserver
to use it.  I've tripped across the lack of libiberty in gdbserver at
least once, and I have seen other threads where it would have been
useful.

2014-06-12  Tom Tromey  <tromey@redhat.com>

	* debug.c (debug_printf): Remove HAVE_GETTIMEOFDAY checks.
	* server.c (monitor_show_help): Remove HAVE_GETTIMEOFDAY check.
	(parse_debug_format_options): Likewise.
	(gdbserver_usage): Likewise.
	* Makefile.in (LIBIBERTY_BUILDDIR, LIBIBERTY): New variables.
	(SUBDIRS, REQUIRED_SUBDIRS): Add libiberty.
	(gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Depend on and link
	against libiberty.
	($(LIBGNU)): Depend on libiberty.
	(all-lib): Recurse into all subdirs.
	(install-only): Invoke "install" target in subdirs.
	(vasprintf.o, vsnprintf.o, safe-ctype.o, lbasename.o): Remove
	targets.
	* configure: Rebuild.
	* configure.ac: Add ACX_CONFIGURE_DIR for libiberty.  Don't check
	for vasprintf, vsnprintf, or gettimeofday.
	* configure.srv: Don't add safe-ctype.o or lbasename.o to
	srv_tgtobj.
This commit is contained in:
Tom Tromey 2014-01-19 14:33:37 -07:00
parent f9579b9902
commit 0b04e52316
7 changed files with 140 additions and 43 deletions

View file

@ -1,3 +1,24 @@
2014-06-12 Tom Tromey <tromey@redhat.com>
* debug.c (debug_printf): Remove HAVE_GETTIMEOFDAY checks.
* server.c (monitor_show_help): Remove HAVE_GETTIMEOFDAY check.
(parse_debug_format_options): Likewise.
(gdbserver_usage): Likewise.
* Makefile.in (LIBIBERTY_BUILDDIR, LIBIBERTY): New variables.
(SUBDIRS, REQUIRED_SUBDIRS): Add libiberty.
(gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Depend on and link
against libiberty.
($(LIBGNU)): Depend on libiberty.
(all-lib): Recurse into all subdirs.
(install-only): Invoke "install" target in subdirs.
(vasprintf.o, vsnprintf.o, safe-ctype.o, lbasename.o): Remove
targets.
* configure: Rebuild.
* configure.ac: Add ACX_CONFIGURE_DIR for libiberty. Don't check
for vasprintf, vsnprintf, or gettimeofday.
* configure.srv: Don't add safe-ctype.o or lbasename.o to
srv_tgtobj.
2014-06-05 Joel Brobecker <brobecker@adacore.com>
* development.sh: Delete.

View file

@ -83,6 +83,9 @@ CC-LD=${CC}
INCLUDE_DIR = ${srcdir}/../../include
INCLUDE_DEP = $$(INCLUDE_DIR)
LIBIBERTY_BUILDDIR = build-libiberty-gdbserver
LIBIBERTY = $(LIBIBERTY_BUILDDIR)/libiberty.a
# Where is ust? These will be empty if ust was not available.
ustlibs = @ustlibs@
ustinc = @ustinc@
@ -191,14 +194,14 @@ XML_BUILTIN = @srv_xmlbuiltin@
IPA_DEPFILES = @IPA_DEPFILES@
extra_libraries = @extra_libraries@
SUBDIRS = $(GNULIB_BUILDDIR)
SUBDIRS = $(GNULIB_BUILDDIR) $(LIBIBERTY_BUILDDIR)
CLEANDIRS = $(SUBDIRS)
# List of subdirectories in the build tree that must exist.
# This is used to force build failures in existing trees when
# a new directory is added.
# The format here is for the `case' shell command.
REQUIRED_SUBDIRS = $(GNULIB_BUILDDIR)
REQUIRED_SUBDIRS = $(GNULIB_BUILDDIR) | $(LIBIBERTY_BUILDDIR)
FLAGS_TO_PASS = \
"prefix=$(prefix)" \
@ -259,7 +262,10 @@ install-only:
fi; \
$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
$(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
# Note that we run install and not install-only, as the latter
# is not part of GNU standards and in particular not provided
# in libiberty.
@$(MAKE) $(FLAGS_TO_PASS) DO=install "DODIRS=$(SUBDIRS)" subdir_do
uninstall: force
n=`echo gdbserver | sed '$(program_transform_name)'`; \
@ -277,20 +283,20 @@ install-html:
clean-info: force
@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(LIBGNU)
gdbserver$(EXEEXT): $(OBS) ${ADD_DEPS} ${CDEPS} $(LIBGNU) $(LIBIBERTY)
rm -f gdbserver$(EXEEXT)
${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbserver$(EXEEXT) $(OBS) \
$(LIBGNU) $(GDBSERVER_LIBS) $(XM_CLIBS)
$(LIBGNU) $(LIBIBERTY) $(GDBSERVER_LIBS) $(XM_CLIBS)
$(LIBGNU) $(GNULIB_H): all-lib
all-lib: $(GNULIB_BUILDDIR)/Makefile
@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=$(GNULIB_BUILDDIR) subdir_do
$(LIBGNU) $(LIBIBERTY) $(GNULIB_H): all-lib
all-lib: $(GNULIB_BUILDDIR)/Makefile $(LIBIBERTY_BUILDDIR)/Makefile
@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS="$(SUBDIRS)" subdir_do
.PHONY: all-lib
gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU)
gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) $(LIBIBERTY)
rm -f gdbreplay$(EXEEXT)
${CC-LD} $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) \
$(XM_CLIBS) $(LIBGNU)
$(XM_CLIBS) $(LIBGNU) $(LIBIBERTY)
IPA_OBJS=ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o regcache-ipa.o remote-utils-ipa.o common-utils-ipa.o tdesc-ipa.o print-utils-ipa.o rsp-low-ipa.o ${IPA_DEPFILES}
@ -549,23 +555,6 @@ linux-waitpid.o: ../nat/linux-waitpid.c
$(COMPILE) $<
$(POSTCOMPILE)
# We build vasprintf with -DHAVE_CONFIG_H because we want that unit to
# include our config.h file. Otherwise, some system headers do not get
# included, and the compiler emits a warning about implicitly defined
# functions (missing declaration).
vasprintf.o: $(srcdir)/../../libiberty/vasprintf.c
$(COMPILE) $< -DHAVE_CONFIG_H
$(POSTCOMPILE)
vsnprintf.o: $(srcdir)/../../libiberty/vsnprintf.c
$(COMPILE) $<
$(POSTCOMPILE)
safe-ctype.o: $(srcdir)/../../libiberty/safe-ctype.c
$(COMPILE) $<
$(POSTCOMPILE)
lbasename.o: $(srcdir)/../../libiberty/lbasename.c
$(COMPILE) $<
$(POSTCOMPILE)
aarch64.c : $(srcdir)/../regformats/aarch64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/aarch64.dat aarch64.c
reg-arm.c : $(srcdir)/../regformats/reg-arm.dat $(regdat_sh)

View file

@ -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`
@ -4728,7 +4825,7 @@ fi
done
for ac_func in gettimeofday pread pwrite pread64 readlink
for ac_func in pread pwrite pread64 readlink
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View file

@ -77,12 +77,14 @@ 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
sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
netinet/tcp.h arpa/inet.h)
AC_CHECK_FUNCS(gettimeofday pread pwrite pread64 readlink)
AC_CHECK_FUNCS(pread pwrite pread64 readlink)
AC_REPLACE_FUNCS(vasprintf vsnprintf)
GDB_AC_COMMON

View file

@ -77,7 +77,6 @@ case "${target}" in
;;
arm*-*-mingw32ce*) srv_regobj=reg-arm.o
srv_tgtobj="win32-low.o win32-arm-low.o"
srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o"
srv_tgtobj="${srv_tgtobj} wincecompat.o"
# hostio_last_error implementation is in win32-low.c
srv_hostio_err_objs=""
@ -101,7 +100,6 @@ case "${target}" in
;;
i[34567]86-*-cygwin*) srv_regobj="$srv_i386_regobj"
srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o"
srv_xmlfiles="$srv_i386_xmlfiles"
;;
i[34567]86-*-linux*) srv_regobj="$srv_i386_linux_regobj"
@ -128,7 +126,6 @@ case "${target}" in
i[34567]86-*-mingw32ce*)
srv_regobj="$srv_i386_regobj"
srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o"
srv_tgtobj="${srv_tgtobj} wincecompat.o"
srv_xmlfiles="$srv_i386_xmlfiles"
# hostio_last_error implementation is in win32-low.c
@ -138,7 +135,6 @@ case "${target}" in
;;
i[34567]86-*-mingw*) srv_regobj="$srv_i386_regobj"
srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o"
srv_xmlfiles="$srv_i386_xmlfiles"
srv_mingw=yes
;;
@ -330,13 +326,11 @@ case "${target}" in
;;
x86_64-*-mingw*) srv_regobj="$srv_amd64_regobj"
srv_tgtobj="i386-low.o i387-fp.o win32-low.o win32-i386-low.o"
srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o"
srv_xmlfiles="$srv_i386_xmlfiles $srv_amd64_xmlfiles"
srv_mingw=yes
;;
x86_64-*-cygwin*) srv_regobj="$srv_amd64_regobj"
srv_tgtobj="i386-low.o i387-fp.o win32-low.o win32-i386-low.o"
srv_tgtobj="${srv_tgtobj} safe-ctype.o lbasename.o"
srv_xmlfiles="$srv_i386_xmlfiles"
;;

View file

@ -36,7 +36,7 @@ void
debug_printf (const char *msg, ...)
{
va_list args;
#if defined (HAVE_GETTIMEOFDAY) && !defined (IN_PROCESS_AGENT)
#if !defined (IN_PROCESS_AGENT)
/* N.B. Not thread safe, and can't be used, as is, with IPA. */
static int new_line = 1;
@ -57,7 +57,7 @@ debug_printf (const char *msg, ...)
vfprintf (stderr, msg, args);
va_end (args);
#if defined (HAVE_GETTIMEOFDAY) && !defined (IN_PROCESS_AGENT)
#if !defined (IN_PROCESS_AGENT)
if (*msg)
new_line = msg[strlen (msg) - 1] == '\n';
#endif

View file

@ -696,9 +696,7 @@ monitor_show_help (void)
monitor_output (" set debug-format option1[,option2,...]\n");
monitor_output (" Add additional information to debugging messages\n");
monitor_output (" Options: all, none");
#ifdef HAVE_GETTIMEOFDAY
monitor_output (", timestamp");
#endif
monitor_output ("\n");
monitor_output (" exit\n");
monitor_output (" Quit GDBserver\n");
@ -974,14 +972,12 @@ parse_debug_format_options (const char *arg, int is_monitor)
if (is_monitor)
monitor_output ("All extra debug format options disabled.\n");
}
#ifdef HAVE_GETTIMEOFDAY
else if (strcmp (option, "timestamp") == 0)
{
debug_timestamp = 1;
if (is_monitor)
monitor_output ("Timestamps will be added to debug output.\n");
}
#endif
else if (*option == '\0')
{
/* An empty option, e.g., "--debug-format=foo,,bar", is ignored. */
@ -2887,9 +2883,7 @@ gdbserver_usage (FILE *stream)
" Options:\n"
" all\n"
" none\n"
#ifdef HAVE_GETTIMEOFDAY
" timestamp\n"
#endif
" --remote-debug Enable remote protocol debugging output.\n"
" --version Display version information and exit.\n"
" --wrapper WRAPPER -- Run WRAPPER to start new programs.\n"