From patchwork Wed Feb 19 17:06:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 38230 Received: (qmail 55610 invoked by alias); 19 Feb 2020 17:06:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 55601 invoked by uid 89); 19 Feb 2020 17:06:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=obs, silence, 2516, PACKAGE X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.68.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Feb 2020 17:06:47 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 9C452400D3745 for ; Wed, 19 Feb 2020 09:52:47 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 4So9jaFq8RP4z4So9j0TuE; Wed, 19 Feb 2020 11:06:45 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=79xocnpyKxweyfC+dT5Aa1QmintJtMZF8w9sUEEcBfU=; b=Nz2IS1PFdHVH9Os5GuLdsVnXaK ACKjNQ2FIXxTCnvYSO+FebVFifHixXsZ5v8CAVgEt1mvufVdZj+YvKm2D+UXgXSIpCGk5n8XfC1pU oYBHhPS+i1sajvB5q8iKsCJHI; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:55582 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1j4So9-000lau-I8; Wed, 19 Feb 2020 10:06:45 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Change gdbserver to use existing gdbsupport Date: Wed, 19 Feb 2020 10:06:43 -0700 Message-Id: <20200219170643.10725-1-tom@tromey.com> This changes the gdbserver build to use the gdbsupport that was built for gdb. The most notable change here is that CORE_ADDR is always a 64-bit type. This makes it so that gdb acts as if it were always built in 64-bit mode. I tested this locally, and I tried it with a few crosses using AdaCore's internal test suite (including a 32-bit build). However, I don't have a very clear idea of what code might break due to the switch from a 32- to 64-bit CORE_ADDR. ChangeLog 2020-02-19 Tom Tromey * Makefile.in: Rebuild. * Makefile.def (gdbsupport): Don't depend on bfd. (gdbserver): Depend on gdbsupport. gdbserver/ChangeLog 2020-02-19 Tom Tromey * configure: Rebuild. * configure.ac (GDBSERVER_DEPFILES): Remove srv_selftest_objs. * Makefile.in (SFILES, OBS, TAGS, GDBREPLAY_OBS): Remove gdbsupport files. (gdbsupport/%.o): Remove target. (GDBSUPPORT_BUILDDIR, GDBSUPPORT): New variables. (gdbserver$(EXEEXT), gdbreplay$(EXEEXT)): Add GDBSUPPORT. gdbsupport/ChangeLog 2020-02-19 Tom Tromey * common-types.h: Remove GDBSERVER code. (gdb_byte, CORE_ADDR, LONGEST, ULONGEST): Redefine. * common-defs.h: Remove GDBSERVER code. --- ChangeLog | 6 +++ Makefile.def | 3 +- Makefile.in | 4 +- gdbserver/ChangeLog | 10 +++++ gdbserver/Makefile.in | 86 +++++---------------------------------- gdbserver/configure | 4 +- gdbserver/configure.ac | 6 +-- gdbsupport/ChangeLog | 6 +++ gdbsupport/common-defs.h | 16 -------- gdbsupport/common-types.h | 32 +++------------ 10 files changed, 43 insertions(+), 130 deletions(-) diff --git a/Makefile.def b/Makefile.def index 2fe8204366c..52714924f46 100644 --- a/Makefile.def +++ b/Makefile.def @@ -412,6 +412,7 @@ dependencies = { module=all-gdb; on=all-libctf; }; // Host modules specific to gdbserver. dependencies = { module=configure-gdbserver; on=all-gnulib; }; +dependencies = { module=all-gdbserver; on=all-gdbsupport; }; dependencies = { module=all-gdbserver; on=all-gnulib; }; dependencies = { module=all-gdbserver; on=all-libiberty; }; @@ -421,9 +422,7 @@ dependencies = { module=all-libgui; on=all-tcl; }; dependencies = { module=all-libgui; on=all-tk; }; dependencies = { module=all-libgui; on=all-itcl; }; -dependencies = { module=configure-gdbsupport; on=configure-bfd; }; dependencies = { module=configure-gdbsupport; on=configure-gnulib; }; -dependencies = { module=all-gdbsupport; on=all-bfd; }; dependencies = { module=all-gdbsupport; on=all-gnulib; }; // Host modules specific to binutils. diff --git a/Makefile.in b/Makefile.in index be38b34e9bf..0d756545a3c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -51977,6 +51977,7 @@ all-gdb: maybe-all-build-bison all-gdb: maybe-all-sim all-gdb: maybe-all-libtermcap configure-gdbserver: maybe-all-gnulib +all-gdbserver: maybe-all-gdbsupport all-gdbserver: maybe-all-gnulib configure-libgui: maybe-configure-tcl configure-libgui: maybe-configure-tk @@ -52430,7 +52431,6 @@ configure-libcc1: stage_last configure-utils: stage_last configure-gdb: stage_last configure-gdbserver: stage_last -configure-gdbsupport: stage_last configure-gprof: stage_last configure-sid: stage_last configure-sim: stage_last @@ -52454,8 +52454,6 @@ all-gdb: maybe-all-opcodes all-gdb: maybe-all-libdecnumber all-gdb: maybe-all-libctf all-gdbserver: maybe-all-libiberty -configure-gdbsupport: maybe-configure-bfd -all-gdbsupport: maybe-all-bfd configure-gprof: maybe-configure-intl all-gprof: maybe-all-libiberty all-gprof: maybe-all-bfd diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index 1baebba0f56..0804743c9ae 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -100,6 +100,9 @@ INCLUDE_DEP = $$(INCLUDE_DIR) LIBIBERTY_BUILDDIR = ../libiberty LIBIBERTY = $(LIBIBERTY_BUILDDIR)/libiberty.a +GDBSUPPORT_BUILDDIR = ../gdbsupport +GDBSUPPORT = $(GDBSUPPORT_BUILDDIR)/libgdbsupport.a + # Where is ust? These will be empty if ust was not available. ustlibs = @ustlibs@ ustinc = @ustinc@ @@ -205,32 +208,6 @@ SFILES = \ $(srcdir)/../gdb/arch/arm-linux.c \ $(srcdir)/../gdb/arch/ppc-linux-common.c \ $(srcdir)/../gdb/arch/riscv.c \ - $(srcdir)/../gdbsupport/btrace-common.cc \ - $(srcdir)/../gdbsupport/buffer.cc \ - $(srcdir)/../gdbsupport/cleanups.cc \ - $(srcdir)/../gdbsupport/common-debug.cc \ - $(srcdir)/../gdbsupport/common-exceptions.cc \ - $(srcdir)/../gdbsupport/common-inferior.cc \ - $(srcdir)/../gdbsupport/common-regcache.cc \ - $(srcdir)/../gdbsupport/common-utils.cc \ - $(srcdir)/../gdbsupport/errors.cc \ - $(srcdir)/../gdbsupport/environ.cc \ - $(srcdir)/../gdbsupport/fileio.cc \ - $(srcdir)/../gdbsupport/filestuff.cc \ - $(srcdir)/../gdbsupport/job-control.cc \ - $(srcdir)/../gdbsupport/gdb-dlfcn.cc \ - $(srcdir)/../gdbsupport/gdb_tilde_expand.cc \ - $(srcdir)/../gdbsupport/gdb_vecs.cc \ - $(srcdir)/../gdbsupport/gdb_wait.cc \ - $(srcdir)/../gdbsupport/netstuff.cc \ - $(srcdir)/../gdbsupport/new-op.cc \ - $(srcdir)/../gdbsupport/pathstuff.cc \ - $(srcdir)/../gdbsupport/print-utils.cc \ - $(srcdir)/../gdbsupport/ptid.cc \ - $(srcdir)/../gdbsupport/rsp-low.cc \ - $(srcdir)/../gdbsupport/safe-strerror.cc \ - $(srcdir)/../gdbsupport/tdesc.cc \ - $(srcdir)/../gdbsupport/xml-utils.cc \ $(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \ $(srcdir)/../gdb/nat/linux-btrace.c \ $(srcdir)/../gdb/nat/linux-namespaces.c \ @@ -252,36 +229,6 @@ TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} OBS = \ alloc.o \ ax.o \ - gdbsupport/agent.o \ - gdbsupport/btrace-common.o \ - gdbsupport/buffer.o \ - gdbsupport/cleanups.o \ - gdbsupport/common-debug.o \ - gdbsupport/common-exceptions.o \ - gdbsupport/common-inferior.o \ - gdbsupport/job-control.o \ - gdbsupport/common-regcache.o \ - gdbsupport/common-utils.o \ - gdbsupport/errors.o \ - gdbsupport/environ.o \ - gdbsupport/fileio.o \ - gdbsupport/filestuff.o \ - gdbsupport/format.o \ - gdbsupport/gdb-dlfcn.o \ - gdbsupport/gdb_tilde_expand.o \ - gdbsupport/gdb_vecs.o \ - gdbsupport/gdb_wait.o \ - gdbsupport/netstuff.o \ - gdbsupport/new-op.o \ - gdbsupport/pathstuff.o \ - gdbsupport/print-utils.o \ - gdbsupport/ptid.o \ - gdbsupport/rsp-low.o \ - gdbsupport/safe-strerror.o \ - gdbsupport/signals.o \ - gdbsupport/signals-state-save-restore.o \ - gdbsupport/tdesc.o \ - gdbsupport/xml-utils.o \ debug.o \ dll.o \ event-loop.o \ @@ -304,14 +251,6 @@ OBS = \ $(XML_BUILTIN) GDBREPLAY_OBS = \ - gdbsupport/cleanups.o \ - gdbsupport/common-exceptions.o \ - gdbsupport/common-utils.o \ - gdbsupport/rsp-low.o \ - gdbsupport/errors.o \ - gdbsupport/netstuff.o \ - gdbsupport/print-utils.o \ - gdbsupport/safe-strerror.o \ gdbreplay.o \ utils.o \ version.o @@ -403,17 +342,19 @@ html: install-html: clean-info: -gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) +gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) \ + $(GDBSUPPORT) $(SILENCE) rm -f gdbserver$(EXEEXT) $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ - -o gdbserver$(EXEEXT) $(OBS) $(LIBGNU) $(LIBIBERTY) \ - $(GDBSERVER_LIBS) $(XM_CLIBS) + -o gdbserver$(EXEEXT) $(OBS) $(GDBSUPPORT) $(LIBGNU) \ + $(LIBIBERTY) $(GDBSERVER_LIBS) $(XM_CLIBS) -gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) +gdbreplay$(EXEEXT): $(sort $(GDBREPLAY_OBS)) $(LIBGNU) $(LIBIBERTY) \ + $(GDBSUPPORT) $(SILENCE) rm -f gdbreplay$(EXEEXT) $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ - -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) $(LIBGNU) \ - $(LIBIBERTY) + -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) $(XM_CLIBS) \ + $(GDBSUPPORT) $(LIBGNU) $(LIBIBERTY) IPA_OBJS = \ alloc-ipa.o \ @@ -449,7 +390,6 @@ TAGS: ${TAGFILES} if [ x$$i != xyzzy ]; then \ echo ${srcdir}/$$i | sed -e 's/\.o$$/\.cc/' \ -e 's,/\(arch\|nat\|target\)/,/../\1/,' \ - -e 's,/\(gdbsupport\)/,/../../\1/,'; \ fi; \ done` \ ${TAGFILES} @@ -585,10 +525,6 @@ arch/%.o: ../gdb/arch/%.c $(COMPILE) -x c++ $< $(POSTCOMPILE) -gdbsupport/%.o: ../gdbsupport/%.cc - $(COMPILE) $< - $(POSTCOMPILE) - %.o: %-generated.cc $(COMPILE) $< $(POSTCOMPILE) diff --git a/gdbserver/configure b/gdbserver/configure index 0ae464644c9..0d35ec8cb09 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -6098,8 +6098,6 @@ if $enable_unittests; then $as_echo "#define GDB_SELF_TEST 1" >>confdefs.h - srv_selftest_objs="gdbsupport/selftest.o" - fi @@ -10526,7 +10524,7 @@ $as_echo "#define USE_XML 1" >>confdefs.h done fi -GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_selftest_objs" +GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles" GDBSERVER_LIBS="$srv_libs" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports __sync_*_compare_and_swap" >&5 diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac index be2284b26c5..65155afa471 100644 --- a/gdbserver/configure.ac +++ b/gdbserver/configure.ac @@ -46,9 +46,7 @@ AC_HEADER_STDC # Set the 'development' global. . $srcdir/../bfd/development.sh -GDB_AC_SELFTEST([ - srv_selftest_objs="gdbsupport/selftest.o" -]) +GDB_AC_SELFTEST ACX_NONCANONICAL_TARGET ACX_NONCANONICAL_HOST @@ -357,7 +355,7 @@ if test "$srv_xmlfiles" != ""; then done fi -GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles $srv_selftest_objs" +GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles" GDBSERVER_LIBS="$srv_libs" dnl Check whether the target supports __sync_*_compare_and_swap. diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index a5c57de2f27..65500ce7634 100644 --- a/gdbsupport/common-defs.h +++ b/gdbsupport/common-defs.h @@ -20,20 +20,6 @@ #ifndef COMMON_COMMON_DEFS_H #define COMMON_COMMON_DEFS_H -#ifdef GDBSERVER - -#include - -#undef PACKAGE_NAME -#undef PACKAGE -#undef PACKAGE_VERSION -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME - -#include - -#else /* GDBSERVER */ - #include #undef PACKAGE_NAME @@ -44,8 +30,6 @@ #include "gnulib/config.h" -#endif /* GDBSERVER */ - /* From: https://www.gnu.org/software/gnulib/manual/html_node/stdint_002eh.html diff --git a/gdbsupport/common-types.h b/gdbsupport/common-types.h index 61099b4e25d..f5b2f3d2491 100644 --- a/gdbsupport/common-types.h +++ b/gdbsupport/common-types.h @@ -20,40 +20,18 @@ #ifndef COMMON_COMMON_TYPES_H #define COMMON_COMMON_TYPES_H -#ifdef GDBSERVER +#include /* * A byte from the program being debugged. */ typedef unsigned char gdb_byte; -typedef unsigned long long CORE_ADDR; - -typedef long long LONGEST; -typedef unsigned long long ULONGEST; - -#else /* GDBSERVER */ - -#include "bfd.h" - -/* * A byte from the program being debugged. */ -typedef bfd_byte gdb_byte; - /* * An address in the program being debugged. Host byte order. */ -typedef bfd_vma CORE_ADDR; - -/* This is to make sure that LONGEST is at least as big as CORE_ADDR. */ - -#ifdef BFD64 - -typedef BFD_HOST_64_BIT LONGEST; -typedef BFD_HOST_U_64_BIT ULONGEST; - -#else /* No BFD64 */ +typedef uint64_t CORE_ADDR; -typedef long long LONGEST; -typedef unsigned long long ULONGEST; +/* LONGEST must be at least as big as CORE_ADDR. */ -#endif /* No BFD64 */ -#endif /* GDBSERVER */ +typedef int64_t LONGEST; +typedef uint64_t ULONGEST; /* * The largest CORE_ADDR value. */ #define CORE_ADDR_MAX (~(CORE_ADDR) 0)