Move gdbserver to top level

Message ID 87d0bf45up.fsf@tromey.com
State New
Headers show
Series
  • Move gdbserver to top level
Related show

Commit Message

Tom Tromey Jan. 19, 2020, 7:13 p.m.
Here's the next patch in the ongoing effort to move gdbserver to the top
level.

I've edited this patch before sending to ensure it won't be too large to
be accepted by the list.  In particular, I used "git show" to create the
patch (this seems to handle moves better than "git send-email"), and I
removed the generated files.

Tom

commit 72fd760c0e9a5dbf39fce4a15bad368e525c6d7f
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Dec 15 07:37:06 2019 -0700

    Move gdbserver to top level
    
    This patch moves gdbserver to the top level.
    
    This patch is as close to a pure move as possible -- gdbserver still
    builds its own variant of gnulib and gdbsupport.  Changing this will
    be done in a separate patch.
    
    Tested by the buildbot.
    
    ChangeLog
    2020-01-19  Tom Tromey  <tom@tromey.com>
    
            * src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
            * gdbserver: New directory, moved from gdb/gdbserver.
            * configure.ac (host_tools): Add gdbserver.
            Only build gdbserver on certain systems.
            * Makefile.in, configure: Rebuild.
            * Makefile.def (host_modules, dependencies): Add gdbserver.
            * MAINTAINERS: Add gdbserver.
    
    gdb/ChangeLog
    2020-01-19  Tom Tromey  <tom@tromey.com>
    
            * gdbserver: Move to top level.
            * configure.tgt (build_gdbserver): Remove.
            * configure.ac: Remove --enable-gdbserver.
            * configure: Rebuild.
            * Makefile.in (distclean): Don't mention gdbserver.
    
    Change-Id: I826b7565b54604711dc7a11edea0499cd51ff39e

Comments

Tom Tromey Jan. 23, 2020, 9:55 p.m. | #1
>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:


Simon> Top-level configure.ac says that configs:
Simon> - or1k*-*-linux*
Simon> - score-*-*
Simon> should build gdbserver, but I don't think they have a gdbserver port (despite
Simon> them having build_gdbserver=yes prior to this patch), do they?

Nope.  I've removed these.

Simon> When autoconf-ing gdbserver, I get:
Simon> gdbserver$ autoconf
Simon> /usr/bin/m4:acinclude.m4:20: cannot open `../../config/lib-ld.m4': No such file or directory
Simon> /usr/bin/m4:acinclude.m4:21: cannot open `../../config/lib-prefix.m4': No such file or directory
Simon> /usr/bin/m4:acinclude.m4:22: cannot open `../../config/lib-link.m4': No such file or directory
Simon> autom4te: /usr/bin/m4 failed with exit status: 1
Simon> I presume these paths need to be updated?

Thanks, I made this change.

I think I will wait a little while longer before pushing.

Tom
Fangrui Song via Gdb-patches Jan. 24, 2020, 2:22 p.m. | #2
Am Donnerstag, 23. Januar 2020, 22:55:20 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> I think I will wait a little while longer before pushing.


make install-strip doesn't work in gdbserver (it worked before indirectly
when called from within gdb).

I made it work again with these changes:

From a3cc5583ca738daa3fdb5805d0c7ab0734d28f41 Mon Sep 17 00:00:00 2001
From: Hannes Domani <ssbssa@yahoo.de>

Date: Fri, 24 Jan 2020 15:03:14 +0100
Subject: [PATCH] gdbserver install-strip

---
 gdbserver/Makefile.in  | 10 ++++++++++
 gdbserver/configure.ac |  1 +
 2 files changed, 11 insertions(+)

diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index 902d54cfe5..4f9196227c 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -45,11 +45,14 @@ htmldir = $(prefix)/html
 includedir = @includedir@
 CONFIG_SRC_SUBDIR = @CONFIG_SRC_SUBDIR@
 
+install_sh = @install_sh@
+
 SHELL = @SHELL@
 EXEEXT = @EXEEXT@
 
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 RANLIB = @RANLIB@
 
@@ -58,6 +61,7 @@ CXX = @CXX@
 CXX_DIALECT = @CXX_DIALECT@
 AR = @AR@
 AR_FLAGS = rc
+STRIP = @STRIP@
 
 # Dependency tracking information.
 DEPMODE = @CCDEPMODE@
@@ -394,6 +398,12 @@ install-only:
     # in libiberty.
     @$(MAKE) $(FLAGS_TO_PASS) DO=install "DODIRS=$(SUBDIRS)" subdir_do
 
+install-strip:
+    $(MAKE) $(FLAGS_TO_PASS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+      install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+      `test -z '$(STRIP)' || \
+        echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install-only
+
 uninstall: force
     n=`echo gdbserver | sed '$(program_transform_name)'`; \
     if [ x$$n = x ]; then n=gdbserver; else true; fi; \
diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac
index 24b832b90e..b7ed8050fc 100644
--- a/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -27,6 +27,7 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_GNU_SOURCE
 AC_SYS_LARGEFILE
+AM_PROG_INSTALL_STRIP
 
 AC_CANONICAL_SYSTEM
 
--
2.15.1.windows.2
Tom Tromey Jan. 24, 2020, 3:06 p.m. | #3
>>>>> "Hannes" == Hannes Domani via gdb-patches <gdb-patches@sourceware.org> writes:


Hannes> Am Donnerstag, 23. Januar 2020, 22:55:20 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
>> I think I will wait a little while longer before pushing.


Hannes> make install-strip doesn't work in gdbserver (it worked before indirectly
Hannes> when called from within gdb).

Thanks.  I'll pull this in.

Maybe when the move is complete, and when gdbserver is not building its
own copies of the libraries, I'll switch gdbserver to use Automake.
This would provide a lot of these things for free.

Tom
Pedro Alves Jan. 24, 2020, 3:23 p.m. | #4
On 1/19/20 7:13 PM, Tom Tromey wrote:
>  

> +# Only allow gdbserver on some systems.

> +build_gdbserver=

> +case "$host" in

> +aarch64*-*-linux*)

> +	# Target: AArch64 linux

> +	build_gdbserver=yes

> +	;;

> +

> +arm*-wince-pe | arm*-*-mingw32ce*)

> +	# Target: ARM based machine running Windows CE (win32)

> +	build_gdbserver=yes

> +	;;

> +arm*-*-linux*)

> +	# Target: ARM based machine running GNU/Linux

> +	build_gdbserver=yes

> +	;;

> +bfin-*-*linux*)

> +	# Target: Blackfin Linux

> +	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"

> +	build_gdbserver=yes

> +	;;

> +i[34567]86-*-nto*)

> +	# Target: Intel 386 running qnx6.

> +	build_gdbserver=yes

> +	;;

> +i[34567]86-*-linux*)

> +	# Target: Intel 386 running GNU/Linux

> +	build_gdbserver=yes

> +	;;

> +i[34567]86-*-cygwin*)

> +	# Target: Intel 386 running win32

> +	build_gdbserver=yes

> +	;;

> +i[34567]86-*-mingw32*)

> +	# Target: Intel 386 running win32

> +	build_gdbserver=yes

> +	;;

> +ia64-*-linux*)

> +	# Target: Intel IA-64 running GNU/Linux

> +	build_gdbserver=yes

> +	;;

> +m32r*-*-linux*)

> +	# Target: Renesas M32R running GNU/Linux

> +	build_gdbserver=yes

> +	;;

> +m68*-*-linux*)

> +	# Target: Motorola m68k with a.out and ELF

> +	build_gdbserver=yes

> +	;;

> +mips*-*-linux*)

> +	# Target: Linux/MIPS

> +	build_gdbserver=yes

> +	;;

> +or1k*-*-linux*)

> +	# Target: OpenCores OpenRISC 1000 32-bit running Linux

> +	build_gdbserver=yes

> +	;;

> +

> +powerpc*-*-linux*)

> +	# Target: PowerPC running Linux

> +	build_gdbserver=yes

> +	;;

> +s390*-*-linux*)

> +	# Target: S390 running Linux

> +	build_gdbserver=yes

> +	;;

> +score-*-*)

> +	# Target: S+core embedded system

> +	build_gdbserver=yes

> +	;;

> +sh*-*-linux*)

> +	# Target: GNU/Linux Super-H

> +	build_gdbserver=yes

> +	;;

> +sparc-*-linux*)

> +	# Target: GNU/Linux SPARC

> +	build_gdbserver=yes

> +	;;

> +sparc64-*-linux*)

> +	# Target: GNU/Linux UltraSPARC

> +	build_gdbserver=yes

> +	;;

> +tilegx-*-linux*)

> +	# Target: TILE-Gx

> +	build_gdbserver=yes

> +	;;

> +x86_64-*-linux*)

> +	# Target: GNU/Linux x86-64

> +	build_gdbserver=yes

> +	;;

> +x86_64-*-mingw* | x86_64-*-cygwin*)

> +        # Target: MingW/amd64

> +	build_gdbserver=yes

> +        ;;

> +xtensa*-*-*linux*)

> +	# Target: GNU/Linux Xtensa

> +	build_gdbserver=yes

> +	;;

> +esac

> +

> +if test "x$build_gdbserver" = x; then

> +  noconfigdirs="$noconfigdirs gdbserver"

> +fi


This should really be done by sourcing a file in gdbserver/
If we do that, then the info about whether a system supports
gdbserver is contained under gdbserver/, and does not
require syncing with gcc whenever is changes.

See the section starting at:

  # Disable libatomic on unsupported systems.

Thanks,
Pedro Alves
Tom Tromey Jan. 24, 2020, 3:49 p.m. | #5
Hannes> make install-strip doesn't work in gdbserver (it worked before indirectly
Hannes> when called from within gdb).

Tom> Thanks.  I'll pull this in.

Actually, it seems like this could go in now.
Would you mind arranging that?

Tom
Fangrui Song via Gdb-patches Jan. 24, 2020, 3:57 p.m. | #6
Am Freitag, 24. Januar 2020, 16:49:26 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> Hannes> make install-strip doesn't work in gdbserver (it worked before indirectly

> Hannes> when called from within gdb).

>

> Tom> Thanks.  I'll pull this in.

>

> Actually, it seems like this could go in now.

> Would you mind arranging that?


I'm not sure what you mean.

Pushing your patch?
Tom Tromey Jan. 24, 2020, 4:24 p.m. | #7
>>>>> "Hannes" == Hannes Domani via gdb-patches <gdb-patches@sourceware.org> writes:


Hannes> Am Freitag, 24. Januar 2020, 16:49:26 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
Hannes> make install-strip doesn't work in gdbserver (it worked before indirectly
Hannes> when called from within gdb).
>> 

Tom> Thanks.  I'll pull this in.
>> 

>> Actually, it seems like this could go in now.

>> Would you mind arranging that?


Hannes> I'm not sure what you mean.

Hannes> Pushing your patch?

Applying your "make install-strip" gdbserver to trunk.

Tom
Fangrui Song via Gdb-patches Jan. 24, 2020, 4:28 p.m. | #8
Am Freitag, 24. Januar 2020, 17:24:34 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> >>>>> "Hannes" == Hannes Domani via gdb-patches <gdb-patches@sourceware.org> writes:

>

> Hannes> Am Freitag, 24. Januar 2020, 16:49:26 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> Hannes> make install-strip doesn't work in gdbserver (it worked before indirectly

> Hannes> when called from within gdb).

> >>

> Tom> Thanks.  I'll pull this in.

> >>

> >> Actually, it seems like this could go in now.

> >> Would you mind arranging that?

>

> Hannes> I'm not sure what you mean.

>

> Hannes> Pushing your patch?

>

> Applying your "make install-strip" gdbserver to trunk.


Oooh, yes, that makes a lot more sense.

Ok, I will do that.


Regards
Hannes Domani
Fangrui Song via Gdb-patches Jan. 24, 2020, 6:25 p.m. | #9
Am Freitag, 24. Januar 2020, 17:28:57 MEZ hat Hannes Domani via gdb-patches <gdb-patches@sourceware.org> Folgendes geschrieben:

> Am Freitag, 24. Januar 2020, 17:24:34 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

>

> > >>>>> "Hannes" == Hannes Domani via gdb-patches <gdb-patches@sourceware.org> writes:

> >

> > Hannes> Am Freitag, 24. Januar 2020, 16:49:26 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> > Hannes> make install-strip doesn't work in gdbserver (it worked before indirectly

> > Hannes> when called from within gdb).

> > >>

> > Tom> Thanks.  I'll pull this in.

> > >>

> > >> Actually, it seems like this could go in now.

> > >> Would you mind arranging that?

> >

> > Hannes> I'm not sure what you mean.

> >

> > Hannes> Pushing your patch?

> >

> > Applying your "make install-strip" gdbserver to trunk.

>

> Oooh, yes, that makes a lot more sense.

>

> Ok, I will do that.


I've pushed this now.


Regards
Hannes Domani
Tom Tromey Jan. 24, 2020, 10:54 p.m. | #10
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:


Pedro> This should really be done by sourcing a file in gdbserver/
Pedro> If we do that, then the info about whether a system supports
Pedro> gdbserver is contained under gdbserver/, and does not
Pedro> require syncing with gcc whenever is changes.

Good idea, I've made this change.  Here's an updated patch.

As before, I've removed the generated files.

If you want to test it, it is in submit/move-gdbserver-to-top on my
github.

Tom

commit e955b27d1badb4c36f2823b3363c5828b7889003
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Dec 15 07:37:06 2019 -0700

    Move gdbserver to top level
    
    This patch moves gdbserver to the top level.
    
    This patch is as close to a pure move as possible -- gdbserver still
    builds its own variant of gnulib and gdbsupport.  Changing this will
    be done in a separate patch.
    
    Note that, per Simon's review comment, this patch changes the tree so
    that gdbserver is not built for or1k or score.  This makes sense,
    because there is apparently not actually a gdbserver port here.
    
    This version of the patch also splits out some configury into a new
    file, gdbserver/configure.host, so that the top-level configure script
    can simply rely on it in order to decide whether gdbserver should be
    built.
    
    Tested by the buildbot.
    
    ChangeLog
    2020-01-24  Tom Tromey  <tom@tromey.com>
    
            * src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
            * gdbserver: New directory, moved from gdb/gdbserver.
            * configure.ac (host_tools): Add gdbserver.
            Only build gdbserver on certain systems.
            * Makefile.in, configure: Rebuild.
            * Makefile.def (host_modules, dependencies): Add gdbserver.
            * MAINTAINERS: Add gdbserver.
    
    gdb/ChangeLog
    2020-01-24  Tom Tromey  <tom@tromey.com>
    
            * gdbserver: Move to top level.
            * configure.tgt (build_gdbserver): Remove.
            * configure.ac: Remove --enable-gdbserver.
            * configure: Rebuild.
            * Makefile.in (distclean): Don't mention gdbserver.
    
    Change-Id: I826b7565b54604711dc7a11edea0499cd51ff39e

diff --git a/ChangeLog b/ChangeLog
index 582d1f27704..a67383d867b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-24  Tom Tromey  <tom@tromey.com>
+
+	* src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
+	* gdbserver: New directory, moved from gdb/gdbserver.
+	* configure.ac (host_tools): Add gdbserver.
+	Only build gdbserver on certain systems.
+	* Makefile.in, configure: Rebuild.
+	* Makefile.def (host_modules, dependencies): Add gdbserver.
+	* MAINTAINERS: Add gdbserver.
+
 2020-01-19  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* remote-sim.c (gdbsim_target::wait): Return
diff --git a/MAINTAINERS b/MAINTAINERS
index 805f2e3ac43..5b8a4efbdf6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -41,7 +41,7 @@ config.guess; config.sub; readline/support/config.{sub,guess}
 depcomp; mkinstalldirs
         Send bug reports and patches to bug-automake@gnu.org.
 
-gdb/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
+gdb/; gdbserver/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
 	GDB: http://www.gnu.org/software/gdb/
 	Patches to gdb-patches@sourceware.org.
 	See also gdb/MAINTAINERS and sim/MAINTAINERS.
diff --git a/Makefile.def b/Makefile.def
index 253eb45ef14..de35083d81e 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -114,6 +114,7 @@ host_modules= { module= zlib; no_install=true; no_check=true;
 	        extra_configure_flags='@extra_host_zlib_configure_flags@';};
 host_modules= { module= gnulib; };
 host_modules= { module= gdbsupport; };
+host_modules= { module= gdbserver; };
 host_modules= { module= gdb; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
@@ -409,6 +410,12 @@ dependencies = { module=all-gdb; on=all-libdecnumber; };
 dependencies = { module=all-gdb; on=all-libtermcap; };
 dependencies = { module=all-gdb; on=all-libctf; };
 
+// Host modules specific to gdbserver.
+dependencies = { module=configure-gdbserver; on=all-intl; };
+// Depend on all-libiconv so that configure checks for iconv
+// functions will work.
+dependencies = { module=configure-gdbserver; on=all-libiconv; };
+
 dependencies = { module=configure-libgui; on=configure-tcl; };
 dependencies = { module=configure-libgui; on=configure-tk; };
 dependencies = { module=all-libgui; on=all-tcl; };
diff --git a/configure.ac b/configure.ac
index 4bd869a63a9..40669228e3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 #   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
-#   2014, 2015, 2016, 2019 Free Software Foundation, Inc.
+#   2014, 2015, 2016, 2019, 2020 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -140,7 +140,7 @@ host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
 # If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
+host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
 
 # these libraries are built for the target environment, and are built after
 # the host libraries and the host tools (which may be a cross compiler)
@@ -782,6 +782,20 @@ case "${target}" in
     ;;
 esac
 
+# Only allow gdbserver on some systems.
+if test -d ${srcdir}/gdbserver; then
+    if test x$enable_gdbserver = x; then
+        AC_MSG_CHECKING([for gdbserver support])
+	. ${srcdir}/gdbserver/configure.host
+	if test x$build_gdbserver = xyes; then
+	    AC_MSG_RESULT([yes])
+	else
+            noconfigdirs="$noconfigdirs gdbserver"
+	    AC_MSG_RESULT([no])
+        fi
+    fi
+fi
+
 # Disable libgo for some systems where it is known to not work.
 # For testing, you can easily override this with --enable-libgo.
 if test x$enable_libgo = x; then
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 16d16ef6dca..18193a9c18e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-24  Tom Tromey  <tom@tromey.com>
+
+	* gdbserver: Move to top level.
+	* configure.tgt (build_gdbserver): Remove.
+	* configure.ac: Remove --enable-gdbserver.
+	* configure: Rebuild.
+	* Makefile.in (distclean): Don't mention gdbserver.
+
 2020-01-24  Pedro Alves  <palves@redhat.com>
 
 	PR gdb/25410
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 45d1586e85e..49fff371337 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1898,13 +1898,8 @@ clean mostlyclean: $(CONFIG_CLEAN)
 # I believe this is wrong; the makefile standards for distclean just
 # describe removing files; the only sort of "re-create a distribution"
 # functionality described is if the distributed files are unmodified.
-# NB: While GDBSERVER might be configured on native systems, it isn't
-# always included in SUBDIRS.  Remove the gdbserver files explicitly.
 distclean: clean
 	@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do
-	rm -f gdbserver/config.status gdbserver/config.log
-	rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h
-	rm -f gdbserver/Makefile gdbserver/config.cache
 	rm -f nm.h config.status config.h stamp-h b jit-reader.h
 	rm -f gdb-gdb.py gdb-gdb.gdb
 	rm -f y.output yacc.acts yacc.tmp y.tab.h
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 0ca169101b3..335971fdf66 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -254,7 +254,6 @@ AC_SUBST(HAVE_NATIVE_GCORE_TARGET)
 # For other settings, only the main target counts.
 gdb_sim=
 gdb_osabi=
-build_gdbserver=
 targ=$target; . ${srcdir}/configure.tgt
 
 # Fetch the default architecture and default target vector from BFD.
@@ -2001,33 +2000,6 @@ if test x"${gdb_osabi}" != x ; then
 		       [Define to the default OS ABI for this configuration.])
 fi
 
-AC_ARG_ENABLE(gdbserver,
-AS_HELP_STRING([--enable-gdbserver],
-               [automatically build gdbserver (yes/no/auto, default is auto)]),
-[case "${enableval}" in
-  yes| no|auto) ;;
-  *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbserver option) ;;
-esac],[enable_gdbserver=auto])
-
-# We only build gdbserver automatically in a native configuration, and
-# only if the user did not explicitly disable its build.
-if test "$gdb_native" = "yes" -a "$enable_gdbserver" != "no"; then
-  AC_MSG_CHECKING(whether gdbserver is supported on this host)
-  if test "x$build_gdbserver" = xyes; then
-    AC_MSG_RESULT(yes)
-    AC_CONFIG_SUBDIRS(gdbserver)
-    gdbserver_build_enabled=yes
-  else
-    AC_MSG_RESULT(no)
-  fi
-fi
-
-# If the user explicitly request the gdbserver to be built, verify that
-# we were in fact able to enable it.
-if test "$enable_gdbserver" = "yes" -a "$gdbserver_build_enabled" != "yes"; then
-  AC_MSG_ERROR(Automatic gdbserver build is not supported for this configuration)
-fi
-
 # Check for babeltrace and babeltrace-ctf
 AC_ARG_WITH(babeltrace,
   AC_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index ab4c098c0da..755187dca65 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -5,7 +5,6 @@
 #  gdb_target_obs	target-specific object files to use
 #  gdb_sim		simulator library for target
 #  gdb_osabi		default OS ABI to use with target
-#  build_gdbserver	set to "yes" if gdbserver supports target
 #  gdb_have_gcore	set to "true"/"false" if this target can run gcore
 
 # NOTE: Every file added to a gdb_target_obs variable for any target here
@@ -129,7 +128,6 @@ aarch64*-*-linux*)
 			arm-tdep.o arm-linux-tdep.o \
 			glibc-tdep.o linux-tdep.o solib-svr4.o \
 			symfile-mem.o linux-record.o"
-	build_gdbserver=yes
 	;;
 
 alpha*-*-linux*)
@@ -162,13 +160,11 @@ arc*-*-elf32)
 arm*-wince-pe | arm*-*-mingw32ce*)
 	# Target: ARM based machine running Windows CE (win32)
 	gdb_target_obs="arm-wince-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 arm*-*-linux*)
 	# Target: ARM based machine running GNU/Linux
 	gdb_target_obs="arch/arm-linux.o arm-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
-	build_gdbserver=yes
 	;;
 arm*-*-freebsd*)
 	# Target: FreeBSD/arm
@@ -202,7 +198,6 @@ bfin-*-*linux*)
 	# Target: Blackfin Linux
 	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"
 	gdb_sim=../sim/bfin/libsim.a
-	build_gdbserver=yes
 	;;
 bfin-*-*)
 	# Target: Blackfin processor
@@ -285,7 +280,6 @@ i[34567]86-*-nto*)
 	# Target: Intel 386 running qnx6.
 	gdb_target_obs="solib-svr4.o \
 			i386-nto-tdep.o nto-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-solaris2* | x86_64-*-solaris2*)
 	# Target: Solaris x86_64
@@ -303,7 +297,6 @@ i[34567]86-*-linux*)
 	    # Target: GNU/Linux x86-64
 	    gdb_target_obs="amd64-linux-tdep.o ${gdb_target_obs}"
 	fi
-	build_gdbserver=yes
 	;;
 i[34567]86-*-gnu*)
 	# Target: Intel 386 running the GNU Hurd
@@ -312,12 +305,10 @@ i[34567]86-*-gnu*)
 i[34567]86-*-cygwin*)
 	# Target: Intel 386 running win32
 	gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-mingw32*)
 	# Target: Intel 386 running win32
 	gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-go32* | i[34567]86-*-msdosdjgpp*)
 	# Target: i386 running DJGPP/go32.
@@ -328,7 +319,6 @@ ia64-*-linux*)
 	# Target: Intel IA-64 running GNU/Linux
 	gdb_target_obs="ia64-linux-tdep.o linux-tdep.o \
 			solib-svr4.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 ia64-*-*vms*)
 	# Target: Intel IA-64 running OpenVMS
@@ -359,7 +349,6 @@ m32r*-*-linux*)
 			glibc-tdep.o solib-svr4.o symfile-mem.o \
 			linux-tdep.o"
 	gdb_sim=../sim/m32r/libsim.a
-	build_gdbserver=yes
 	;;
 m32r*-*-*)
 	# Target: Renesas m32r processor
@@ -382,7 +371,6 @@ m68*-*-linux*)
 	# Target: Motorola m68k with a.out and ELF
 	gdb_target_obs="m68k-tdep.o m68k-linux-tdep.o solib-svr4.o \
 			linux-tdep.o glibc-tdep.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
 	# Target: NetBSD/m68k
@@ -416,7 +404,6 @@ mips*-*-linux*)
 	gdb_target_obs="mips-tdep.o mips-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o"
 	gdb_sim=../sim/mips/libsim.a
-	build_gdbserver=yes
 	;;
 mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
 	# Target: MIPS running NetBSD
@@ -480,7 +467,6 @@ or1k*-*-linux*)
 	gdb_target_obs="or1k-tdep.o or1k-linux-tdep.o solib-svr4.o \
 			symfile-mem.o glibc-tdep.o linux-tdep.o"
 	gdb_sim=../sim/or1k/libsim.a
-	build_gdbserver=yes
 	;;
 
 or1k-*-* | or1knd-*-*)
@@ -522,7 +508,6 @@ powerpc*-*-linux*)
 			linux-record.o \
 			arch/ppc-linux-common.o"
 	gdb_sim=../sim/ppc/libsim.a
-	build_gdbserver=yes
 	;;
 powerpc-*-lynx*178)
 	# Target: PowerPC running Lynx178.
@@ -541,7 +526,6 @@ s390*-*-linux*)
 	# Target: S390 running Linux
 	gdb_target_obs="s390-linux-tdep.o s390-tdep.o solib-svr4.o \
 			linux-tdep.o linux-record.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 
 riscv*-*-freebsd*)
@@ -575,7 +559,6 @@ rx-*-elf)
 score-*-*)
 	# Target: S+core embedded system
 	gdb_target_obs="score-tdep.o"
-	build_gdbserver=yes
 	;;
 
 sh*-*-linux*)
@@ -584,7 +567,6 @@ sh*-*-linux*)
 			solib-svr4.o symfile-mem.o \
 			glibc-tdep.o linux-tdep.o"
 	gdb_sim=../sim/sh/libsim.a
-	build_gdbserver=yes
 	;;
 sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
 	# Target: NetBSD/sh
@@ -612,7 +594,6 @@ sparc-*-linux*)
 	    gdb_target_obs="sparc64-tdep.o sparc64-sol2-tdep.o \
 			    sparc64-linux-tdep.o ${gdb_target_obs}"
 	fi
-	build_gdbserver=yes
 	;;
 sparc64-*-linux*)
 	# Target: GNU/Linux UltraSPARC
@@ -620,7 +601,6 @@ sparc64-*-linux*)
 			sparc64-linux-tdep.o sparc-tdep.o sparc-sol2-tdep.o \
 			sparc-linux-tdep.o solib-svr4.o linux-tdep.o \
 			ravenscar-thread.o sparc-ravenscar-thread.o"
-	build_gdbserver=yes
 	;;
 sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
 	# Target: FreeBSD/sparc64
@@ -689,7 +669,6 @@ tilegx-*-linux*)
 	# Target: TILE-Gx
 	gdb_target_obs="tilegx-tdep.o tilegx-linux-tdep.o solib-svr4.o \
 			symfile-mem.o glibc-tdep.o linux-tdep.o"
-	build_gdbserver=yes
 	;;
 
 xstormy16-*-*)
@@ -742,7 +721,6 @@ x86_64-*-linux*)
 	gdb_target_obs="amd64-linux-tdep.o ${i386_tobjs}  \
 			i386-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
-	build_gdbserver=yes
 	;;
 x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
 	# Target: FreeBSD/amd64
@@ -754,7 +732,6 @@ x86_64-*-mingw* | x86_64-*-cygwin*)
 	gdb_target_obs="amd64-windows-tdep.o \
                         ${i386_tobjs} i386-cygwin-tdep.o \
                         windows-tdep.o"
-	build_gdbserver=yes
         ;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
 	# Target: NetBSD/amd64
@@ -772,7 +749,6 @@ x86_64-*-rtems*)
 xtensa*-*-*linux*)
 	# Target: GNU/Linux Xtensa
 	gdb_target_obs="xtensa-linux-tdep.o symfile-mem.o linux-tdep.o"
-	build_gdbserver=yes
 	;;
 
 esac
diff --git a/gdb/gdbserver/.gitignore b/gdbserver/.gitignore
similarity index 100%
rename from gdb/gdbserver/.gitignore
rename to gdbserver/.gitignore
diff --git a/gdb/gdbserver/ChangeLog b/gdbserver/ChangeLog
similarity index 99%
rename from gdb/gdbserver/ChangeLog
rename to gdbserver/ChangeLog
index aeb9cb6c778..186d96f7ef9 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,17 @@
+2020-01-24  Tom Tromey  <tom@tromey.com>
+
+	* configure.host: New file.
+	* configure.ac: Update paths.
+	* configure: Rebuild.
+	* acinclude.m4: Update paths.
+	* Makefile.in: Update include paths.
+	(depcomp, INCLUDE_DIR, INCGNU, INCSUPPORT, INCLUDE_CFLAGS)
+	(SFILES, XML_DIR, n, $(GNULIB_BUILDDIR)/Makefile, config.status)
+	(version-generated.c, stamp-xml, regdat_sh, arch/%-ipa.o)
+	(gdbsupport/%-ipa.o, %-ipa.o, arch/%.o, gdbsupport/%.o, %.o)
+	(%-generated.c): Update paths.
+	* Move entire directory from ../gdb/gdbserver.
+
 2020-01-24  Hannes Domani  <ssbssa@yahoo.de>
 
 	* Makefile.in (install-strip): New target.
diff --git a/gdb/gdbserver/Makefile.in b/gdbserver/Makefile.in
similarity index 85%
rename from gdb/gdbserver/Makefile.in
rename to gdbserver/Makefile.in
index 3922b5231c4..60a52d3412b 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -66,7 +66,7 @@ STRIP = @STRIP@
 # Dependency tracking information.
 DEPMODE = @CCDEPMODE@
 DEPDIR = @DEPDIR@
-depcomp = $(SHELL) $(srcdir)/../../depcomp
+depcomp = $(SHELL) $(srcdir)/../depcomp
 
 # Directory containing source files.  Don't clean up the spacing,
 # this exact string is matched for by the "configure" script.
@@ -75,7 +75,7 @@ abs_top_srcdir = @abs_top_srcdir@
 abs_srcdir = @abs_srcdir@
 VPATH = @srcdir@
 
-include $(srcdir)/../silent-rules.mk
+include $(srcdir)/../gdb/silent-rules.mk
 
 # Note that these are overridden by GNU make-specific code below if
 # GNU make is used.  The overrides implement dependency tracking.
@@ -94,7 +94,7 @@ POSTCOMPILE = @true
 CC_LD = $(CXX) $(CXX_DIALECT)
 
 # Where is the "include" directory?  Traditionally ../include or ./include
-INCLUDE_DIR = ${srcdir}/../../include
+INCLUDE_DIR = ${srcdir}/../include
 INCLUDE_DEP = $$(INCLUDE_DIR)
 
 LIBIBERTY_BUILDDIR = build-libiberty-gdbserver
@@ -107,26 +107,26 @@ ustinc = @ustinc@
 # gnulib
 GNULIB_BUILDDIR = build-gnulib-gdbserver
 LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
-INCGNU = -I$(srcdir)/../../gnulib/import -I$(GNULIB_BUILDDIR)/import
+INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
 
 # Generated headers in the gnulib directory.  These must be listed
 # so that they are generated before other files are compiled.
 GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 
-INCSUPPORT = -I$(srcdir)/../.. -I../..
+INCSUPPORT = -I$(srcdir)/.. -I..
 
 # All the includes used for CFLAGS and for lint.
 # -I. for config files.
 # -I${srcdir} for our headers.
-# -I$(srcdir)/../regformats for regdef.h.
+# -I$(srcdir)/../gdb/regformats for regdef.h.
 #
 # We do not include ../target or ../nat in here because headers
 # in those directories should be included with the subdirectory.
 # e.g.: "target/wait.h".
 #
 INCLUDE_CFLAGS = -I. -I${srcdir} \
-	-I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
-	$(INCGNU) $(INCSUPPORT)
+	-I$(srcdir)/../gdb/regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
+	-I$(srcdir)/../gdb $(INCGNU) $(INCSUPPORT)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
 # from the config/ directory.
@@ -202,46 +202,46 @@ SFILES = \
 	$(srcdir)/win32-low.c \
 	$(srcdir)/wincecompat.c \
 	$(srcdir)/x86-low.c \
-	$(srcdir)/../alloc.c \
-	$(srcdir)/../arch/arm.c \
-	$(srcdir)/../arch/arm-get-next-pcs.c \
-	$(srcdir)/../arch/arm-linux.c \
-	$(srcdir)/../arch/ppc-linux-common.c \
-	$(srcdir)/../../gdbsupport/btrace-common.c \
-	$(srcdir)/../../gdbsupport/buffer.c \
-	$(srcdir)/../../gdbsupport/cleanups.c \
-	$(srcdir)/../../gdbsupport/common-debug.c \
-	$(srcdir)/../../gdbsupport/common-exceptions.c \
-	$(srcdir)/../../gdbsupport/common-inferior.c \
-	$(srcdir)/../../gdbsupport/common-regcache.c \
-	$(srcdir)/../../gdbsupport/common-utils.c \
-	$(srcdir)/../../gdbsupport/errors.c \
-	$(srcdir)/../../gdbsupport/environ.c \
-	$(srcdir)/../../gdbsupport/fileio.c \
-	$(srcdir)/../../gdbsupport/filestuff.c \
-	$(srcdir)/../../gdbsupport/job-control.c \
-	$(srcdir)/../../gdbsupport/gdb-dlfcn.c \
-	$(srcdir)/../../gdbsupport/gdb_tilde_expand.c \
-	$(srcdir)/../../gdbsupport/gdb_vecs.c \
-	$(srcdir)/../../gdbsupport/gdb_wait.c \
-	$(srcdir)/../../gdbsupport/netstuff.c \
-	$(srcdir)/../../gdbsupport/new-op.c \
-	$(srcdir)/../../gdbsupport/pathstuff.c \
-	$(srcdir)/../../gdbsupport/print-utils.c \
-	$(srcdir)/../../gdbsupport/ptid.c \
-	$(srcdir)/../../gdbsupport/rsp-low.c \
-	$(srcdir)/../../gdbsupport/safe-strerror.c \
-	$(srcdir)/../../gdbsupport/tdesc.c \
-	$(srcdir)/../../gdbsupport/xml-utils.c \
-	$(srcdir)/../nat/aarch64-sve-linux-ptrace.c \
-	$(srcdir)/../nat/linux-btrace.c \
-	$(srcdir)/../nat/linux-namespaces.c \
-	$(srcdir)/../nat/linux-osdata.c \
-	$(srcdir)/../nat/linux-personality.c \
-	$(srcdir)/../nat/mips-linux-watch.c \
-	$(srcdir)/../nat/ppc-linux.c \
-	$(srcdir)/../nat/fork-inferior.c \
-	$(srcdir)/../target/waitstatus.c
+	$(srcdir)/../gdb/alloc.c \
+	$(srcdir)/../gdb/arch/arm.c \
+	$(srcdir)/../gdb/arch/arm-get-next-pcs.c \
+	$(srcdir)/../gdb/arch/arm-linux.c \
+	$(srcdir)/../gdb/arch/ppc-linux-common.c \
+	$(srcdir)/../gdbsupport/btrace-common.c \
+	$(srcdir)/../gdbsupport/buffer.c \
+	$(srcdir)/../gdbsupport/cleanups.c \
+	$(srcdir)/../gdbsupport/common-debug.c \
+	$(srcdir)/../gdbsupport/common-exceptions.c \
+	$(srcdir)/../gdbsupport/common-inferior.c \
+	$(srcdir)/../gdbsupport/common-regcache.c \
+	$(srcdir)/../gdbsupport/common-utils.c \
+	$(srcdir)/../gdbsupport/errors.c \
+	$(srcdir)/../gdbsupport/environ.c \
+	$(srcdir)/../gdbsupport/fileio.c \
+	$(srcdir)/../gdbsupport/filestuff.c \
+	$(srcdir)/../gdbsupport/job-control.c \
+	$(srcdir)/../gdbsupport/gdb-dlfcn.c \
+	$(srcdir)/../gdbsupport/gdb_tilde_expand.c \
+	$(srcdir)/../gdbsupport/gdb_vecs.c \
+	$(srcdir)/../gdbsupport/gdb_wait.c \
+	$(srcdir)/../gdbsupport/netstuff.c \
+	$(srcdir)/../gdbsupport/new-op.c \
+	$(srcdir)/../gdbsupport/pathstuff.c \
+	$(srcdir)/../gdbsupport/print-utils.c \
+	$(srcdir)/../gdbsupport/ptid.c \
+	$(srcdir)/../gdbsupport/rsp-low.c \
+	$(srcdir)/../gdbsupport/safe-strerror.c \
+	$(srcdir)/../gdbsupport/tdesc.c \
+	$(srcdir)/../gdbsupport/xml-utils.c \
+	$(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
+	$(srcdir)/../gdb/nat/linux-btrace.c \
+	$(srcdir)/../gdb/nat/linux-namespaces.c \
+	$(srcdir)/../gdb/nat/linux-osdata.c \
+	$(srcdir)/../gdb/nat/linux-personality.c \
+	$(srcdir)/../gdb/nat/mips-linux-watch.c \
+	$(srcdir)/../gdb/nat/ppc-linux.c \
+	$(srcdir)/../gdb/nat/fork-inferior.c \
+	$(srcdir)/../gdb/target/waitstatus.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
 
@@ -322,7 +322,7 @@ XM_CLIBS = @LIBS@
 CDEPS = $(srcdir)/proc-service.list
 
 # XML files to compile in to gdbserver, if any.
-XML_DIR = $(srcdir)/../features
+XML_DIR = $(srcdir)/../gdb/features
 XML_FILES = @srv_xmlfiles@
 XML_BUILTIN = @srv_xmlbuiltin@
 
@@ -388,10 +388,10 @@ install-only:
 	n=`echo gdbserver | sed '$(program_transform_name)'`; \
 	if [ x$$n = x ]; then n=gdbserver; else true; fi; \
 	if [ x"$(IPA_DEPFILES)" != x ]; then \
-		$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir); \
+		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(libdir); \
 		$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
 	fi; \
-	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \
 	$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
 	# Note that we run install and not install-only, as the latter
 	# is not part of GNU standards and in particular not provided
@@ -522,14 +522,14 @@ stamp-h: config.in config.status
 Makefile: Makefile.in config.status
 	$(SHELL) ./config.status $@
 
-$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../../gnulib/Makefile.in config.status
+$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../gnulib/Makefile.in config.status
 	  @cd $(GNULIB_BUILDDIR); CONFIG_FILES="Makefile" \
 	  CONFIG_COMMANDS="depfiles" \
 	  CONFIG_HEADERS= \
 	  CONFIG_LINKS= \
 	  $(SHELL) config.status
 
-config.status: configure configure.srv $(srcdir)/../../bfd/development.sh
+config.status: configure configure.srv $(srcdir)/../bfd/development.sh
 	$(SHELL) ./config.status --recheck
 
 # automatic rebuilding in automake-generated Makefiles requires
@@ -541,8 +541,8 @@ am--refresh:
 
 force:
 
-version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../../gdbsupport/create-version.sh
-	$(ECHO_GEN) $(SHELL) $(srcdir)/../../gdbsupport/create-version.sh $(srcdir)/.. \
+version-generated.c: Makefile $(srcdir)/../gdb/version.in $(srcdir)/../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
+	$(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/../gdb \
 		$(host_alias) $(target_alias) $@
 
 xml-builtin-generated.c: stamp-xml; @true
@@ -550,7 +550,7 @@ stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
 	$(SILENCE) rm -f xml-builtin.tmp
 	$(ECHO_GEN_XML_BUILTIN_GENERATED) $(SHELL) $(XML_DIR)/feature_to_c.sh \
 		xml-builtin.tmp $(XML_FILES)
-	$(SILENCE) $(SHELL) $(srcdir)/../../move-if-change xml-builtin.tmp xml-builtin-generated.c
+	$(SILENCE) $(SHELL) $(srcdir)/../move-if-change xml-builtin.tmp xml-builtin-generated.c
 	$(SILENCE) echo stamp > stamp-xml
 
 .PRECIOUS: xml-builtin.c
@@ -566,7 +566,7 @@ stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
 # will remove them.
 MAKEOVERRIDES =
 
-regdat_sh = $(srcdir)/../regformats/regdat.sh
+regdat_sh = $(srcdir)/../gdb/regformats/regdat.sh
 
 UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
 
@@ -596,11 +596,11 @@ ax.o: ax.c
 
 # Rules for objects that go in the in-process agent.
 
-arch/%-ipa.o: ../arch/%.c
+arch/%-ipa.o: ../gdb/arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%-ipa.o: ../../gdbsupport/%.c
+gdbsupport/%-ipa.o: ../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -612,7 +612,7 @@ gdbsupport/%-ipa.o: ../../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-%-ipa.o: ../%.c
+%-ipa.o: ../gdb/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -629,11 +629,11 @@ gdbsupport/%-ipa.o: ../../gdbsupport/%.c
 
 # Rules for objects that go in the gdbserver binary.
 
-arch/%.o: ../arch/%.c
+arch/%.o: ../gdb/arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%.o: ../../gdbsupport/%.c
+gdbsupport/%.o: ../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -645,28 +645,28 @@ gdbsupport/%.o: ../../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-nat/%.o: ../nat/%.c
+nat/%.o: ../gdb/nat/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-target/%.o: ../target/%.c
+target/%.o: ../gdb/target/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ../%.c
+%.o: ../gdb/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
 # Rules for register format descriptions.  Suffix destination files with
 # -generated to identify and clean them easily.
 
-%-generated.c: ../regformats/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
-%-generated.c: ../regformats/arm/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/arm/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
-%-generated.c: ../regformats/rs6000/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
 #
@@ -711,7 +711,7 @@ all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
 -include $(all_deps_files)
 
 # Disable implicit make rules.
-include $(srcdir)/../disable-implicit-rules.mk
+include $(srcdir)/../gdb/disable-implicit-rules.mk
 
 # Do not delete intermediate files (e.g. *-generated.c).
 .SECONDARY:
diff --git a/gdb/gdbserver/README b/gdbserver/README
similarity index 100%
rename from gdb/gdbserver/README
rename to gdbserver/README
diff --git a/gdb/gdbserver/acinclude.m4 b/gdbserver/acinclude.m4
similarity index 63%
rename from gdb/gdbserver/acinclude.m4
rename to gdbserver/acinclude.m4
index eba3a131315..5a284515c82 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdbserver/acinclude.m4
@@ -1,42 +1,42 @@
 dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE.
-m4_include(../../bfd/bfd.m4)
+m4_include(../bfd/bfd.m4)
 
-m4_include(../acx_configure_dir.m4)
+m4_include(../gdb/acx_configure_dir.m4)
 
 # This gets AM_GDB_WARNINGS.
-m4_include(../warning.m4)
+m4_include(../gdb/warning.m4)
 
 dnl This gets autoconf bugfixes
-m4_include(../../config/override.m4)
+m4_include(../config/override.m4)
 
 dnl For ACX_PKGVERSION and ACX_BUGURL.
-m4_include(../../config/acx.m4)
+m4_include(../config/acx.m4)
 
-m4_include(../../config/depstand.m4)
-m4_include(../../config/lead-dot.m4)
+m4_include(../config/depstand.m4)
+m4_include(../config/lead-dot.m4)
 
 dnl Needed for common.m4
 dnl For AC_LIB_HAVE_LINKFLAGS.
-m4_include(../../config/lib-ld.m4)
-m4_include(../../config/lib-prefix.m4)
-m4_include(../../config/lib-link.m4)
+m4_include(../config/lib-ld.m4)
+m4_include(../config/lib-prefix.m4)
+m4_include(../config/lib-link.m4)
 dnl codeset.m4 is needed for common.m4, but not for
 dnl anything else in gdbserver.
-m4_include(../../config/codeset.m4)
-m4_include(../../gdbsupport/common.m4)
+m4_include(../config/codeset.m4)
+m4_include(../gdbsupport/common.m4)
 
 dnl For libiberty_INIT.
-m4_include(../libiberty.m4)
+m4_include(../gdb/libiberty.m4)
 
 dnl For GDB_AC_PTRACE.
-m4_include(../ptrace.m4)
+m4_include(../gdb/ptrace.m4)
 
-m4_include(../ax_cxx_compile_stdcxx.m4)
+m4_include(../gdb/ax_cxx_compile_stdcxx.m4)
 
 dnl For GDB_AC_SELFTEST.
-m4_include(../selftest.m4)
+m4_include(../gdb/selftest.m4)
 
-m4_include([../../config/ax_pthread.m4])
+m4_include([../config/ax_pthread.m4])
 
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
diff --git a/gdb/gdbserver/aclocal.m4 b/gdbserver/aclocal.m4
similarity index 100%
rename from gdb/gdbserver/aclocal.m4
rename to gdbserver/aclocal.m4
diff --git a/gdb/gdbserver/ax.c b/gdbserver/ax.c
similarity index 100%
rename from gdb/gdbserver/ax.c
rename to gdbserver/ax.c
diff --git a/gdb/gdbserver/ax.h b/gdbserver/ax.h
similarity index 100%
rename from gdb/gdbserver/ax.h
rename to gdbserver/ax.h
diff --git a/gdb/gdbserver/config.in b/gdbserver/config.in
similarity index 100%
rename from gdb/gdbserver/config.in
rename to gdbserver/config.in
diff --git a/gdb/gdbserver/configure b/gdbserver/configure
similarity index 99%
rename from gdb/gdbserver/configure
rename to gdbserver/configure
diff --git a/gdb/gdbserver/configure.ac b/gdbserver/configure.ac
similarity index 98%
rename from gdb/gdbserver/configure.ac
rename to gdbserver/configure.ac
index 03b36dc699a..285a297a1c6 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -44,7 +44,7 @@ AX_CXX_COMPILE_STDCXX(11, , mandatory)
 AC_HEADER_STDC
 
 # Set the 'development' global.
-. $srcdir/../../bfd/development.sh
+. $srcdir/../bfd/development.sh
 
 GDB_AC_SELFTEST([
   srv_selftest_objs="gdbsupport/selftest.o"
@@ -80,10 +80,10 @@ fi
 # gdbserver/.  We need to build gnulib under some other directory not
 # "gnulib", to avoid the problem of both GDB and GDBserver wanting to
 # build it in the same directory, when building in the source dir.
-ACX_CONFIGURE_DIR(["../../gnulib"], ["build-gnulib-gdbserver"],
+ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"],
                   ["$gnulib_extra_configure_args"])
 
-ACX_CONFIGURE_DIR(["../../libiberty"], ["build-libiberty-gdbserver"])
+ACX_CONFIGURE_DIR(["../libiberty"], ["build-libiberty-gdbserver"])
 
 AC_CHECK_HEADERS(termios.h sys/reg.h string.h dnl
 		 sys/procfs.h linux/elf.h dnl
diff --git a/gdbserver/configure.host b/gdbserver/configure.host
new file mode 100644
index 00000000000..86d3a80148d
--- /dev/null
+++ b/gdbserver/configure.host
@@ -0,0 +1,111 @@
+# Configure helper for gdbserver
+# Copyright (C) 2000-2020 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Source this to determine whether gdbserver can be built for a given
+# host.  This will set the variable "build_gdbserver".  The variable
+# "host" must be set before sourcing.
+
+build_gdbserver=
+case "$host" in
+aarch64*-*-linux*)
+	# Target: AArch64 linux
+	build_gdbserver=yes
+	;;
+
+arm*-wince-pe | arm*-*-mingw32ce*)
+	# Target: ARM based machine running Windows CE (win32)
+	build_gdbserver=yes
+	;;
+arm*-*-linux*)
+	# Target: ARM based machine running GNU/Linux
+	build_gdbserver=yes
+	;;
+bfin-*-*linux*)
+	# Target: Blackfin Linux
+	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"
+	build_gdbserver=yes
+	;;
+i[34567]86-*-nto*)
+	# Target: Intel 386 running qnx6.
+	build_gdbserver=yes
+	;;
+i[34567]86-*-linux*)
+	# Target: Intel 386 running GNU/Linux
+	build_gdbserver=yes
+	;;
+i[34567]86-*-cygwin*)
+	# Target: Intel 386 running win32
+	build_gdbserver=yes
+	;;
+i[34567]86-*-mingw32*)
+	# Target: Intel 386 running win32
+	build_gdbserver=yes
+	;;
+ia64-*-linux*)
+	# Target: Intel IA-64 running GNU/Linux
+	build_gdbserver=yes
+	;;
+m32r*-*-linux*)
+	# Target: Renesas M32R running GNU/Linux
+	build_gdbserver=yes
+	;;
+m68*-*-linux*)
+	# Target: Motorola m68k with a.out and ELF
+	build_gdbserver=yes
+	;;
+mips*-*-linux*)
+	# Target: Linux/MIPS
+	build_gdbserver=yes
+	;;
+powerpc*-*-linux*)
+	# Target: PowerPC running Linux
+	build_gdbserver=yes
+	;;
+s390*-*-linux*)
+	# Target: S390 running Linux
+	build_gdbserver=yes
+	;;
+sh*-*-linux*)
+	# Target: GNU/Linux Super-H
+	build_gdbserver=yes
+	;;
+sparc-*-linux*)
+	# Target: GNU/Linux SPARC
+	build_gdbserver=yes
+	;;
+sparc64-*-linux*)
+	# Target: GNU/Linux UltraSPARC
+	build_gdbserver=yes
+	;;
+tilegx-*-linux*)
+	# Target: TILE-Gx
+	build_gdbserver=yes
+	;;
+x86_64-*-linux*)
+	# Target: GNU/Linux x86-64
+	build_gdbserver=yes
+	;;
+x86_64-*-mingw* | x86_64-*-cygwin*)
+        # Target: MingW/amd64
+	build_gdbserver=yes
+        ;;
+xtensa*-*-*linux*)
+	# Target: GNU/Linux Xtensa
+	build_gdbserver=yes
+	;;
+esac
diff --git a/gdb/gdbserver/configure.srv b/gdbserver/configure.srv
similarity index 100%
rename from gdb/gdbserver/configure.srv
rename to gdbserver/configure.srv
diff --git a/gdb/gdbserver/debug.c b/gdbserver/debug.c
similarity index 100%
rename from gdb/gdbserver/debug.c
rename to gdbserver/debug.c
diff --git a/gdb/gdbserver/debug.h b/gdbserver/debug.h
similarity index 100%
rename from gdb/gdbserver/debug.h
rename to gdbserver/debug.h
diff --git a/gdb/gdbserver/dll.c b/gdbserver/dll.c
similarity index 100%
rename from gdb/gdbserver/dll.c
rename to gdbserver/dll.c
diff --git a/gdb/gdbserver/dll.h b/gdbserver/dll.h
similarity index 100%
rename from gdb/gdbserver/dll.h
rename to gdbserver/dll.h
diff --git a/gdb/gdbserver/event-loop.c b/gdbserver/event-loop.c
similarity index 100%
rename from gdb/gdbserver/event-loop.c
rename to gdbserver/event-loop.c
diff --git a/gdb/gdbserver/event-loop.h b/gdbserver/event-loop.h
similarity index 100%
rename from gdb/gdbserver/event-loop.h
rename to gdbserver/event-loop.h
diff --git a/gdb/gdbserver/fork-child.c b/gdbserver/fork-child.c
similarity index 100%
rename from gdb/gdbserver/fork-child.c
rename to gdbserver/fork-child.c
diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdbserver/gdb_proc_service.h
similarity index 100%
rename from gdb/gdbserver/gdb_proc_service.h
rename to gdbserver/gdb_proc_service.h
diff --git a/gdb/gdbserver/gdbreplay.c b/gdbserver/gdbreplay.c
similarity index 100%
rename from gdb/gdbserver/gdbreplay.c
rename to gdbserver/gdbreplay.c
diff --git a/gdb/gdbserver/gdbthread.h b/gdbserver/gdbthread.h
similarity index 100%
rename from gdb/gdbserver/gdbthread.h
rename to gdbserver/gdbthread.h
diff --git a/gdb/gdbserver/hostio-errno.c b/gdbserver/hostio-errno.c
similarity index 100%
rename from gdb/gdbserver/hostio-errno.c
rename to gdbserver/hostio-errno.c
diff --git a/gdb/gdbserver/hostio.c b/gdbserver/hostio.c
similarity index 100%
rename from gdb/gdbserver/hostio.c
rename to gdbserver/hostio.c
diff --git a/gdb/gdbserver/hostio.h b/gdbserver/hostio.h
similarity index 100%
rename from gdb/gdbserver/hostio.h
rename to gdbserver/hostio.h
diff --git a/gdb/gdbserver/i387-fp.c b/gdbserver/i387-fp.c
similarity index 100%
rename from gdb/gdbserver/i387-fp.c
rename to gdbserver/i387-fp.c
diff --git a/gdb/gdbserver/i387-fp.h b/gdbserver/i387-fp.h
similarity index 100%
rename from gdb/gdbserver/i387-fp.h
rename to gdbserver/i387-fp.h
diff --git a/gdb/gdbserver/inferiors.c b/gdbserver/inferiors.c
similarity index 100%
rename from gdb/gdbserver/inferiors.c
rename to gdbserver/inferiors.c
diff --git a/gdb/gdbserver/inferiors.h b/gdbserver/inferiors.h
similarity index 100%
rename from gdb/gdbserver/inferiors.h
rename to gdbserver/inferiors.h
diff --git a/gdb/gdbserver/linux-aarch32-low.c b/gdbserver/linux-aarch32-low.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-low.c
rename to gdbserver/linux-aarch32-low.c
diff --git a/gdb/gdbserver/linux-aarch32-low.h b/gdbserver/linux-aarch32-low.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-low.h
rename to gdbserver/linux-aarch32-low.h
diff --git a/gdb/gdbserver/linux-aarch32-tdesc.c b/gdbserver/linux-aarch32-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-tdesc.c
rename to gdbserver/linux-aarch32-tdesc.c
diff --git a/gdb/gdbserver/linux-aarch32-tdesc.h b/gdbserver/linux-aarch32-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-tdesc.h
rename to gdbserver/linux-aarch32-tdesc.h
diff --git a/gdb/gdbserver/linux-aarch64-ipa.c b/gdbserver/linux-aarch64-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-ipa.c
rename to gdbserver/linux-aarch64-ipa.c
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdbserver/linux-aarch64-low.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-low.c
rename to gdbserver/linux-aarch64-low.c
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.c b/gdbserver/linux-aarch64-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-tdesc.c
rename to gdbserver/linux-aarch64-tdesc.c
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdbserver/linux-aarch64-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-tdesc.h
rename to gdbserver/linux-aarch64-tdesc.h
diff --git a/gdb/gdbserver/linux-amd64-ipa.c b/gdbserver/linux-amd64-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-amd64-ipa.c
rename to gdbserver/linux-amd64-ipa.c
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdbserver/linux-arm-low.c
similarity index 100%
rename from gdb/gdbserver/linux-arm-low.c
rename to gdbserver/linux-arm-low.c
diff --git a/gdb/gdbserver/linux-arm-tdesc.c b/gdbserver/linux-arm-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-arm-tdesc.c
rename to gdbserver/linux-arm-tdesc.c
diff --git a/gdb/gdbserver/linux-arm-tdesc.h b/gdbserver/linux-arm-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-arm-tdesc.h
rename to gdbserver/linux-arm-tdesc.h
diff --git a/gdb/gdbserver/linux-bfin-low.c b/gdbserver/linux-bfin-low.c
similarity index 100%
rename from gdb/gdbserver/linux-bfin-low.c
rename to gdbserver/linux-bfin-low.c
diff --git a/gdb/gdbserver/linux-cris-low.c b/gdbserver/linux-cris-low.c
similarity index 100%
rename from gdb/gdbserver/linux-cris-low.c
rename to gdbserver/linux-cris-low.c
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdbserver/linux-crisv32-low.c
similarity index 100%
rename from gdb/gdbserver/linux-crisv32-low.c
rename to gdbserver/linux-crisv32-low.c
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdbserver/linux-i386-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-i386-ipa.c
rename to gdbserver/linux-i386-ipa.c
diff --git a/gdb/gdbserver/linux-ia64-low.c b/gdbserver/linux-ia64-low.c
similarity index 100%
rename from gdb/gdbserver/linux-ia64-low.c
rename to gdbserver/linux-ia64-low.c
diff --git a/gdb/gdbserver/linux-low.c b/gdbserver/linux-low.c
similarity index 100%
rename from gdb/gdbserver/linux-low.c
rename to gdbserver/linux-low.c
diff --git a/gdb/gdbserver/linux-low.h b/gdbserver/linux-low.h
similarity index 100%
rename from gdb/gdbserver/linux-low.h
rename to gdbserver/linux-low.h
diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdbserver/linux-m32r-low.c
similarity index 100%
rename from gdb/gdbserver/linux-m32r-low.c
rename to gdbserver/linux-m32r-low.c
diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdbserver/linux-m68k-low.c
similarity index 100%
rename from gdb/gdbserver/linux-m68k-low.c
rename to gdbserver/linux-m68k-low.c
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdbserver/linux-mips-low.c
similarity index 100%
rename from gdb/gdbserver/linux-mips-low.c
rename to gdbserver/linux-mips-low.c
diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdbserver/linux-nios2-low.c
similarity index 100%
rename from gdb/gdbserver/linux-nios2-low.c
rename to gdbserver/linux-nios2-low.c
diff --git a/gdb/gdbserver/linux-ppc-ipa.c b/gdbserver/linux-ppc-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-ppc-ipa.c
rename to gdbserver/linux-ppc-ipa.c
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdbserver/linux-ppc-low.c
similarity index 100%
rename from gdb/gdbserver/linux-ppc-low.c
rename to gdbserver/linux-ppc-low.c
diff --git a/gdb/gdbserver/linux-ppc-tdesc-init.h b/gdbserver/linux-ppc-tdesc-init.h
similarity index 100%
rename from gdb/gdbserver/linux-ppc-tdesc-init.h
rename to gdbserver/linux-ppc-tdesc-init.h
diff --git a/gdb/gdbserver/linux-s390-ipa.c b/gdbserver/linux-s390-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-s390-ipa.c
rename to gdbserver/linux-s390-ipa.c
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdbserver/linux-s390-low.c
similarity index 100%
rename from gdb/gdbserver/linux-s390-low.c
rename to gdbserver/linux-s390-low.c
diff --git a/gdb/gdbserver/linux-s390-tdesc.h b/gdbserver/linux-s390-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-s390-tdesc.h
rename to gdbserver/linux-s390-tdesc.h
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdbserver/linux-sh-low.c
similarity index 100%
rename from gdb/gdbserver/linux-sh-low.c
rename to gdbserver/linux-sh-low.c
diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdbserver/linux-sparc-low.c
similarity index 100%
rename from gdb/gdbserver/linux-sparc-low.c
rename to gdbserver/linux-sparc-low.c
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdbserver/linux-tic6x-low.c
similarity index 100%
rename from gdb/gdbserver/linux-tic6x-low.c
rename to gdbserver/linux-tic6x-low.c
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdbserver/linux-tile-low.c
similarity index 100%
rename from gdb/gdbserver/linux-tile-low.c
rename to gdbserver/linux-tile-low.c
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdbserver/linux-x86-low.c
similarity index 100%
rename from gdb/gdbserver/linux-x86-low.c
rename to gdbserver/linux-x86-low.c
diff --git a/gdb/gdbserver/linux-x86-tdesc.c b/gdbserver/linux-x86-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-x86-tdesc.c
rename to gdbserver/linux-x86-tdesc.c
diff --git a/gdb/gdbserver/linux-x86-tdesc.h b/gdbserver/linux-x86-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-x86-tdesc.h
rename to gdbserver/linux-x86-tdesc.h
diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdbserver/linux-xtensa-low.c
similarity index 100%
rename from gdb/gdbserver/linux-xtensa-low.c
rename to gdbserver/linux-xtensa-low.c
diff --git a/gdb/gdbserver/lynx-i386-low.c b/gdbserver/lynx-i386-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-i386-low.c
rename to gdbserver/lynx-i386-low.c
diff --git a/gdb/gdbserver/lynx-low.c b/gdbserver/lynx-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-low.c
rename to gdbserver/lynx-low.c
diff --git a/gdb/gdbserver/lynx-low.h b/gdbserver/lynx-low.h
similarity index 100%
rename from gdb/gdbserver/lynx-low.h
rename to gdbserver/lynx-low.h
diff --git a/gdb/gdbserver/lynx-ppc-low.c b/gdbserver/lynx-ppc-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-ppc-low.c
rename to gdbserver/lynx-ppc-low.c
diff --git a/gdb/gdbserver/mem-break.c b/gdbserver/mem-break.c
similarity index 100%
rename from gdb/gdbserver/mem-break.c
rename to gdbserver/mem-break.c
diff --git a/gdb/gdbserver/mem-break.h b/gdbserver/mem-break.h
similarity index 100%
rename from gdb/gdbserver/mem-break.h
rename to gdbserver/mem-break.h
diff --git a/gdb/gdbserver/notif.c b/gdbserver/notif.c
similarity index 100%
rename from gdb/gdbserver/notif.c
rename to gdbserver/notif.c
diff --git a/gdb/gdbserver/notif.h b/gdbserver/notif.h
similarity index 100%
rename from gdb/gdbserver/notif.h
rename to gdbserver/notif.h
diff --git a/gdb/gdbserver/nto-low.c b/gdbserver/nto-low.c
similarity index 100%
rename from gdb/gdbserver/nto-low.c
rename to gdbserver/nto-low.c
diff --git a/gdb/gdbserver/nto-low.h b/gdbserver/nto-low.h
similarity index 100%
rename from gdb/gdbserver/nto-low.h
rename to gdbserver/nto-low.h
diff --git a/gdb/gdbserver/nto-x86-low.c b/gdbserver/nto-x86-low.c
similarity index 100%
rename from gdb/gdbserver/nto-x86-low.c
rename to gdbserver/nto-x86-low.c
diff --git a/gdb/gdbserver/proc-service.c b/gdbserver/proc-service.c
similarity index 100%
rename from gdb/gdbserver/proc-service.c
rename to gdbserver/proc-service.c
diff --git a/gdb/gdbserver/proc-service.list b/gdbserver/proc-service.list
similarity index 100%
rename from gdb/gdbserver/proc-service.list
rename to gdbserver/proc-service.list
diff --git a/gdb/gdbserver/regcache.c b/gdbserver/regcache.c
similarity index 100%
rename from gdb/gdbserver/regcache.c
rename to gdbserver/regcache.c
diff --git a/gdb/gdbserver/regcache.h b/gdbserver/regcache.h
similarity index 100%
rename from gdb/gdbserver/regcache.h
rename to gdbserver/regcache.h
diff --git a/gdb/gdbserver/remote-utils.c b/gdbserver/remote-utils.c
similarity index 100%
rename from gdb/gdbserver/remote-utils.c
rename to gdbserver/remote-utils.c
diff --git a/gdb/gdbserver/remote-utils.h b/gdbserver/remote-utils.h
similarity index 100%
rename from gdb/gdbserver/remote-utils.h
rename to gdbserver/remote-utils.h
diff --git a/gdb/gdbserver/server.c b/gdbserver/server.c
similarity index 100%
rename from gdb/gdbserver/server.c
rename to gdbserver/server.c
diff --git a/gdb/gdbserver/server.h b/gdbserver/server.h
similarity index 100%
rename from gdb/gdbserver/server.h
rename to gdbserver/server.h
diff --git a/gdb/gdbserver/symbol.c b/gdbserver/symbol.c
similarity index 100%
rename from gdb/gdbserver/symbol.c
rename to gdbserver/symbol.c
diff --git a/gdb/gdbserver/target.c b/gdbserver/target.c
similarity index 100%
rename from gdb/gdbserver/target.c
rename to gdbserver/target.c
diff --git a/gdb/gdbserver/target.h b/gdbserver/target.h
similarity index 100%
rename from gdb/gdbserver/target.h
rename to gdbserver/target.h
diff --git a/gdb/gdbserver/tdesc.c b/gdbserver/tdesc.c
similarity index 100%
rename from gdb/gdbserver/tdesc.c
rename to gdbserver/tdesc.c
diff --git a/gdb/gdbserver/tdesc.h b/gdbserver/tdesc.h
similarity index 100%
rename from gdb/gdbserver/tdesc.h
rename to gdbserver/tdesc.h
diff --git a/gdb/gdbserver/thread-db.c b/gdbserver/thread-db.c
similarity index 100%
rename from gdb/gdbserver/thread-db.c
rename to gdbserver/thread-db.c
diff --git a/gdb/gdbserver/tracepoint.c b/gdbserver/tracepoint.c
similarity index 100%
rename from gdb/gdbserver/tracepoint.c
rename to gdbserver/tracepoint.c
diff --git a/gdb/gdbserver/tracepoint.h b/gdbserver/tracepoint.h
similarity index 100%
rename from gdb/gdbserver/tracepoint.h
rename to gdbserver/tracepoint.h
diff --git a/gdb/gdbserver/utils.c b/gdbserver/utils.c
similarity index 100%
rename from gdb/gdbserver/utils.c
rename to gdbserver/utils.c
diff --git a/gdb/gdbserver/utils.h b/gdbserver/utils.h
similarity index 100%
rename from gdb/gdbserver/utils.h
rename to gdbserver/utils.h
diff --git a/gdb/gdbserver/win32-arm-low.c b/gdbserver/win32-arm-low.c
similarity index 100%
rename from gdb/gdbserver/win32-arm-low.c
rename to gdbserver/win32-arm-low.c
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdbserver/win32-i386-low.c
similarity index 100%
rename from gdb/gdbserver/win32-i386-low.c
rename to gdbserver/win32-i386-low.c
diff --git a/gdb/gdbserver/win32-low.c b/gdbserver/win32-low.c
similarity index 100%
rename from gdb/gdbserver/win32-low.c
rename to gdbserver/win32-low.c
diff --git a/gdb/gdbserver/win32-low.h b/gdbserver/win32-low.h
similarity index 100%
rename from gdb/gdbserver/win32-low.h
rename to gdbserver/win32-low.h
diff --git a/gdb/gdbserver/wincecompat.c b/gdbserver/wincecompat.c
similarity index 100%
rename from gdb/gdbserver/wincecompat.c
rename to gdbserver/wincecompat.c
diff --git a/gdb/gdbserver/wincecompat.h b/gdbserver/wincecompat.h
similarity index 100%
rename from gdb/gdbserver/wincecompat.h
rename to gdbserver/wincecompat.h
diff --git a/gdb/gdbserver/x86-low.c b/gdbserver/x86-low.c
similarity index 100%
rename from gdb/gdbserver/x86-low.c
rename to gdbserver/x86-low.c
diff --git a/gdb/gdbserver/x86-low.h b/gdbserver/x86-low.h
similarity index 100%
rename from gdb/gdbserver/x86-low.h
rename to gdbserver/x86-low.h
diff --git a/gdb/gdbserver/x86-tdesc.h b/gdbserver/x86-tdesc.h
similarity index 100%
rename from gdb/gdbserver/x86-tdesc.h
rename to gdbserver/x86-tdesc.h
diff --git a/gdb/gdbserver/xtensa-xtregs.c b/gdbserver/xtensa-xtregs.c
similarity index 100%
rename from gdb/gdbserver/xtensa-xtregs.c
rename to gdbserver/xtensa-xtregs.c
diff --git a/src-release.sh b/src-release.sh
index 92e92ac5d77..95f79c5bd7d 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-#   Copyright (C) 1990-2019 Free Software Foundation
+#   Copyright (C) 1990-2020 Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -315,7 +315,7 @@ gas_release()
     tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
 }
 
-GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport"
+GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport gdbserver"
 gdb_release()
 {
     compressors=$1
Pedro Alves Jan. 25, 2020, 4:50 p.m. | #11
On 1/24/20 10:54 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

> 

> Pedro> This should really be done by sourcing a file in gdbserver/

> Pedro> If we do that, then the info about whether a system supports

> Pedro> gdbserver is contained under gdbserver/, and does not

> Pedro> require syncing with gcc whenever is changes.

> 

> Good idea, I've made this change.  Here's an updated patch.

> 

> As before, I've removed the generated files.

> 

> If you want to test it, it is in submit/move-gdbserver-to-top on my

> github.


Thanks!  I poked at it a bit.  I think this looks good, though I
have a comment on the dependencies below.

I think this should have a NEWS entry, given that it affects
people building standalone gdbserver today.  Do you have
documentation changes queued?

>  2020-01-19  Simon Marchi  <simon.marchi@polymtl.ca>

>  

>  	* remote-sim.c (gdbsim_target::wait): Return

> diff --git a/MAINTAINERS b/MAINTAINERS

> index 805f2e3ac43..5b8a4efbdf6 100644

> --- a/MAINTAINERS

> +++ b/MAINTAINERS

> @@ -41,7 +41,7 @@ config.guess; config.sub; readline/support/config.{sub,guess}

>  depcomp; mkinstalldirs

>          Send bug reports and patches to bug-automake@gnu.org.

>  

> -gdb/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/

> +gdb/; gdbserver/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/

>  	GDB: http://www.gnu.org/software/gdb/

>  	Patches to gdb-patches@sourceware.org.

>  	See also gdb/MAINTAINERS and sim/MAINTAINERS.

> diff --git a/Makefile.def b/Makefile.def

> index 253eb45ef14..de35083d81e 100644

> --- a/Makefile.def

> +++ b/Makefile.def

> @@ -114,6 +114,7 @@ host_modules= { module= zlib; no_install=true; no_check=true;

>  	        extra_configure_flags='@extra_host_zlib_configure_flags@';};

>  host_modules= { module= gnulib; };

>  host_modules= { module= gdbsupport; };

> +host_modules= { module= gdbserver; };

>  host_modules= { module= gdb; };

>  host_modules= { module= expect; };

>  host_modules= { module= guile; };

> @@ -409,6 +410,12 @@ dependencies = { module=all-gdb; on=all-libdecnumber; };

>  dependencies = { module=all-gdb; on=all-libtermcap; };

>  dependencies = { module=all-gdb; on=all-libctf; };

>  

> +// Host modules specific to gdbserver.

> +dependencies = { module=configure-gdbserver; on=all-intl; };


This surprised me, as I don't think gdbserver actually depends on
intl currently?  Might still be a good idea to actually enable it,
but I was surprised from an "as pure as possible" perspective.

> +// Depend on all-libiconv so that configure checks for iconv

> +// functions will work.

> +dependencies = { module=configure-gdbserver; on=all-libiconv; };

> +


Likewise curious.  Can you clarify where the configure checks
come from?

Locally I removed the intl and iconv dependencies and the
resulting gdbserver (w/ make all-gdbserver) was identical byte
for byte for me.

Thanks,
Pedro Alves
Tom Tromey Jan. 26, 2020, 3:41 p.m. | #12
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:


Pedro> I think this should have a NEWS entry, given that it affects
Pedro> people building standalone gdbserver today.  Do you have
Pedro> documentation changes queued?

Nope, I've added those now.

>> +// Host modules specific to gdbserver.

>> +dependencies = { module=configure-gdbserver; on=all-intl; };


Pedro> This surprised me, as I don't think gdbserver actually depends on
Pedro> intl currently?  Might still be a good idea to actually enable it,
Pedro> but I was surprised from an "as pure as possible" perspective.

I don't recall (I wrote this patch originally in May of last year), but
maybe I just copied gdb's dependencies.  Anyway, I've dropped them now.

Tom

commit 4c5c9a7a0b64c98f60c2ab79ad705d14ea568d0f
Author: Tom Tromey <tom@tromey.com>
Date:   Sun Dec 15 07:37:06 2019 -0700

    Move gdbserver to top level
    
    This patch moves gdbserver to the top level.
    
    This patch is as close to a pure move as possible -- gdbserver still
    builds its own variant of gnulib and gdbsupport.  Changing this will
    be done in a separate patch.
    
    [v2] Note that, per Simon's review comment, this patch changes the
    tree so that gdbserver is not built for or1k or score.  This makes
    sense, because there is apparently not actually a gdbserver port here.
    
    [v3] This version of the patch also splits out some configury into a
    new file, gdbserver/configure.host, so that the top-level configure
    script can simply rely on it in order to decide whether gdbserver
    should be built.
    
    [v4] This version adds documentation and removes some unnecessary
    top-level dependencies.
    
    Tested by the buildbot.
    
    ChangeLog
    2020-01-26  Tom Tromey  <tom@tromey.com>
    
            * src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
            * gdbserver: New directory, moved from gdb/gdbserver.
            * configure.ac (host_tools): Add gdbserver.
            Only build gdbserver on certain systems.
            * Makefile.in, configure: Rebuild.
            * Makefile.def (host_modules, dependencies): Add gdbserver.
            * MAINTAINERS: Add gdbserver.
    
    gdb/ChangeLog
    2020-01-26  Tom Tromey  <tom@tromey.com>
    
            * README: Update gdbserver documentation.
            * gdbserver: Move to top level.
            * configure.tgt (build_gdbserver): Remove.
            * configure.ac: Remove --enable-gdbserver.
            * configure: Rebuild.
            * Makefile.in (distclean): Don't mention gdbserver.
    
    Change-Id: I826b7565b54604711dc7a11edea0499cd51ff39e

diff --git a/ChangeLog b/ChangeLog
index 582d1f27704..e9e7cc85a3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-01-26  Tom Tromey  <tom@tromey.com>
+
+	* src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
+	* gdbserver: New directory, moved from gdb/gdbserver.
+	* configure.ac (host_tools): Add gdbserver.
+	Only build gdbserver on certain systems.
+	* Makefile.in, configure: Rebuild.
+	* Makefile.def (host_modules, dependencies): Add gdbserver.
+	* MAINTAINERS: Add gdbserver.
+
 2020-01-19  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* remote-sim.c (gdbsim_target::wait): Return
diff --git a/MAINTAINERS b/MAINTAINERS
index 805f2e3ac43..5b8a4efbdf6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -41,7 +41,7 @@ config.guess; config.sub; readline/support/config.{sub,guess}
 depcomp; mkinstalldirs
         Send bug reports and patches to bug-automake@gnu.org.
 
-gdb/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
+gdb/; gdbserver/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
 	GDB: http://www.gnu.org/software/gdb/
 	Patches to gdb-patches@sourceware.org.
 	See also gdb/MAINTAINERS and sim/MAINTAINERS.
diff --git a/Makefile.def b/Makefile.def
index 253eb45ef14..72cb133a09a 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -114,6 +114,7 @@ host_modules= { module= zlib; no_install=true; no_check=true;
 	        extra_configure_flags='@extra_host_zlib_configure_flags@';};
 host_modules= { module= gnulib; };
 host_modules= { module= gdbsupport; };
+host_modules= { module= gdbserver; };
 host_modules= { module= gdb; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
diff --git a/configure.ac b/configure.ac
index 4bd869a63a9..40669228e3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 #   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
-#   2014, 2015, 2016, 2019 Free Software Foundation, Inc.
+#   2014, 2015, 2016, 2019, 2020 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -140,7 +140,7 @@ host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
 # If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
+host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
 
 # these libraries are built for the target environment, and are built after
 # the host libraries and the host tools (which may be a cross compiler)
@@ -782,6 +782,20 @@ case "${target}" in
     ;;
 esac
 
+# Only allow gdbserver on some systems.
+if test -d ${srcdir}/gdbserver; then
+    if test x$enable_gdbserver = x; then
+        AC_MSG_CHECKING([for gdbserver support])
+	. ${srcdir}/gdbserver/configure.host
+	if test x$build_gdbserver = xyes; then
+	    AC_MSG_RESULT([yes])
+	else
+            noconfigdirs="$noconfigdirs gdbserver"
+	    AC_MSG_RESULT([no])
+        fi
+    fi
+fi
+
 # Disable libgo for some systems where it is known to not work.
 # For testing, you can easily override this with --enable-libgo.
 if test x$enable_libgo = x; then
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b3aa3e03106..cfdf099fed7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-26  Tom Tromey  <tom@tromey.com>
+
+	* README: Update gdbserver documentation.
+	* gdbserver: Move to top level.
+	* configure.tgt (build_gdbserver): Remove.
+	* configure.ac: Remove --enable-gdbserver.
+	* configure: Rebuild.
+	* Makefile.in (distclean): Don't mention gdbserver.
+
 2020-01-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
 	* NEWS: Mention the new option and the set/show commands.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 45d1586e85e..49fff371337 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1898,13 +1898,8 @@ clean mostlyclean: $(CONFIG_CLEAN)
 # I believe this is wrong; the makefile standards for distclean just
 # describe removing files; the only sort of "re-create a distribution"
 # functionality described is if the distributed files are unmodified.
-# NB: While GDBSERVER might be configured on native systems, it isn't
-# always included in SUBDIRS.  Remove the gdbserver files explicitly.
 distclean: clean
 	@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do
-	rm -f gdbserver/config.status gdbserver/config.log
-	rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h
-	rm -f gdbserver/Makefile gdbserver/config.cache
 	rm -f nm.h config.status config.h stamp-h b jit-reader.h
 	rm -f gdb-gdb.py gdb-gdb.gdb
 	rm -f y.output yacc.acts yacc.tmp y.tab.h
diff --git a/gdb/README b/gdb/README
index be7fdcb65d8..3895758ece5 100644
--- a/gdb/README
+++ b/gdb/README
@@ -583,12 +583,11 @@ of remote stubs to be used with remote.c.  They are designed to run
 standalone on an m68k, i386, or SPARC cpu and communicate properly
 with the remote.c stub over a serial line.
 
-   The directory gdb/gdbserver/ contains `gdbserver', a program that
+   The directory gdbserver/ contains `gdbserver', a program that
 allows remote debugging for Unix applications.  GDBserver is only
-supported for some native configurations, including Sun 3, Sun 4, and
-Linux.
+supported for some native configurations.
 
-   The file gdb/gdbserver/README includes further notes on GDBserver; in
+   The file gdbserver/README includes further notes on GDBserver; in
 particular, it explains how to build GDBserver for cross-debugging
 (where GDBserver runs on the target machine, which is of a different
 architecture than the host machine running GDB).
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 0ca169101b3..335971fdf66 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -254,7 +254,6 @@ AC_SUBST(HAVE_NATIVE_GCORE_TARGET)
 # For other settings, only the main target counts.
 gdb_sim=
 gdb_osabi=
-build_gdbserver=
 targ=$target; . ${srcdir}/configure.tgt
 
 # Fetch the default architecture and default target vector from BFD.
@@ -2001,33 +2000,6 @@ if test x"${gdb_osabi}" != x ; then
 		       [Define to the default OS ABI for this configuration.])
 fi
 
-AC_ARG_ENABLE(gdbserver,
-AS_HELP_STRING([--enable-gdbserver],
-               [automatically build gdbserver (yes/no/auto, default is auto)]),
-[case "${enableval}" in
-  yes| no|auto) ;;
-  *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbserver option) ;;
-esac],[enable_gdbserver=auto])
-
-# We only build gdbserver automatically in a native configuration, and
-# only if the user did not explicitly disable its build.
-if test "$gdb_native" = "yes" -a "$enable_gdbserver" != "no"; then
-  AC_MSG_CHECKING(whether gdbserver is supported on this host)
-  if test "x$build_gdbserver" = xyes; then
-    AC_MSG_RESULT(yes)
-    AC_CONFIG_SUBDIRS(gdbserver)
-    gdbserver_build_enabled=yes
-  else
-    AC_MSG_RESULT(no)
-  fi
-fi
-
-# If the user explicitly request the gdbserver to be built, verify that
-# we were in fact able to enable it.
-if test "$enable_gdbserver" = "yes" -a "$gdbserver_build_enabled" != "yes"; then
-  AC_MSG_ERROR(Automatic gdbserver build is not supported for this configuration)
-fi
-
 # Check for babeltrace and babeltrace-ctf
 AC_ARG_WITH(babeltrace,
   AC_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index ab4c098c0da..755187dca65 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -5,7 +5,6 @@
 #  gdb_target_obs	target-specific object files to use
 #  gdb_sim		simulator library for target
 #  gdb_osabi		default OS ABI to use with target
-#  build_gdbserver	set to "yes" if gdbserver supports target
 #  gdb_have_gcore	set to "true"/"false" if this target can run gcore
 
 # NOTE: Every file added to a gdb_target_obs variable for any target here
@@ -129,7 +128,6 @@ aarch64*-*-linux*)
 			arm-tdep.o arm-linux-tdep.o \
 			glibc-tdep.o linux-tdep.o solib-svr4.o \
 			symfile-mem.o linux-record.o"
-	build_gdbserver=yes
 	;;
 
 alpha*-*-linux*)
@@ -162,13 +160,11 @@ arc*-*-elf32)
 arm*-wince-pe | arm*-*-mingw32ce*)
 	# Target: ARM based machine running Windows CE (win32)
 	gdb_target_obs="arm-wince-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 arm*-*-linux*)
 	# Target: ARM based machine running GNU/Linux
 	gdb_target_obs="arch/arm-linux.o arm-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
-	build_gdbserver=yes
 	;;
 arm*-*-freebsd*)
 	# Target: FreeBSD/arm
@@ -202,7 +198,6 @@ bfin-*-*linux*)
 	# Target: Blackfin Linux
 	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"
 	gdb_sim=../sim/bfin/libsim.a
-	build_gdbserver=yes
 	;;
 bfin-*-*)
 	# Target: Blackfin processor
@@ -285,7 +280,6 @@ i[34567]86-*-nto*)
 	# Target: Intel 386 running qnx6.
 	gdb_target_obs="solib-svr4.o \
 			i386-nto-tdep.o nto-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-solaris2* | x86_64-*-solaris2*)
 	# Target: Solaris x86_64
@@ -303,7 +297,6 @@ i[34567]86-*-linux*)
 	    # Target: GNU/Linux x86-64
 	    gdb_target_obs="amd64-linux-tdep.o ${gdb_target_obs}"
 	fi
-	build_gdbserver=yes
 	;;
 i[34567]86-*-gnu*)
 	# Target: Intel 386 running the GNU Hurd
@@ -312,12 +305,10 @@ i[34567]86-*-gnu*)
 i[34567]86-*-cygwin*)
 	# Target: Intel 386 running win32
 	gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-mingw32*)
 	# Target: Intel 386 running win32
 	gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-go32* | i[34567]86-*-msdosdjgpp*)
 	# Target: i386 running DJGPP/go32.
@@ -328,7 +319,6 @@ ia64-*-linux*)
 	# Target: Intel IA-64 running GNU/Linux
 	gdb_target_obs="ia64-linux-tdep.o linux-tdep.o \
 			solib-svr4.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 ia64-*-*vms*)
 	# Target: Intel IA-64 running OpenVMS
@@ -359,7 +349,6 @@ m32r*-*-linux*)
 			glibc-tdep.o solib-svr4.o symfile-mem.o \
 			linux-tdep.o"
 	gdb_sim=../sim/m32r/libsim.a
-	build_gdbserver=yes
 	;;
 m32r*-*-*)
 	# Target: Renesas m32r processor
@@ -382,7 +371,6 @@ m68*-*-linux*)
 	# Target: Motorola m68k with a.out and ELF
 	gdb_target_obs="m68k-tdep.o m68k-linux-tdep.o solib-svr4.o \
 			linux-tdep.o glibc-tdep.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
 	# Target: NetBSD/m68k
@@ -416,7 +404,6 @@ mips*-*-linux*)
 	gdb_target_obs="mips-tdep.o mips-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o"
 	gdb_sim=../sim/mips/libsim.a
-	build_gdbserver=yes
 	;;
 mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
 	# Target: MIPS running NetBSD
@@ -480,7 +467,6 @@ or1k*-*-linux*)
 	gdb_target_obs="or1k-tdep.o or1k-linux-tdep.o solib-svr4.o \
 			symfile-mem.o glibc-tdep.o linux-tdep.o"
 	gdb_sim=../sim/or1k/libsim.a
-	build_gdbserver=yes
 	;;
 
 or1k-*-* | or1knd-*-*)
@@ -522,7 +508,6 @@ powerpc*-*-linux*)
 			linux-record.o \
 			arch/ppc-linux-common.o"
 	gdb_sim=../sim/ppc/libsim.a
-	build_gdbserver=yes
 	;;
 powerpc-*-lynx*178)
 	# Target: PowerPC running Lynx178.
@@ -541,7 +526,6 @@ s390*-*-linux*)
 	# Target: S390 running Linux
 	gdb_target_obs="s390-linux-tdep.o s390-tdep.o solib-svr4.o \
 			linux-tdep.o linux-record.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 
 riscv*-*-freebsd*)
@@ -575,7 +559,6 @@ rx-*-elf)
 score-*-*)
 	# Target: S+core embedded system
 	gdb_target_obs="score-tdep.o"
-	build_gdbserver=yes
 	;;
 
 sh*-*-linux*)
@@ -584,7 +567,6 @@ sh*-*-linux*)
 			solib-svr4.o symfile-mem.o \
 			glibc-tdep.o linux-tdep.o"
 	gdb_sim=../sim/sh/libsim.a
-	build_gdbserver=yes
 	;;
 sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
 	# Target: NetBSD/sh
@@ -612,7 +594,6 @@ sparc-*-linux*)
 	    gdb_target_obs="sparc64-tdep.o sparc64-sol2-tdep.o \
 			    sparc64-linux-tdep.o ${gdb_target_obs}"
 	fi
-	build_gdbserver=yes
 	;;
 sparc64-*-linux*)
 	# Target: GNU/Linux UltraSPARC
@@ -620,7 +601,6 @@ sparc64-*-linux*)
 			sparc64-linux-tdep.o sparc-tdep.o sparc-sol2-tdep.o \
 			sparc-linux-tdep.o solib-svr4.o linux-tdep.o \
 			ravenscar-thread.o sparc-ravenscar-thread.o"
-	build_gdbserver=yes
 	;;
 sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
 	# Target: FreeBSD/sparc64
@@ -689,7 +669,6 @@ tilegx-*-linux*)
 	# Target: TILE-Gx
 	gdb_target_obs="tilegx-tdep.o tilegx-linux-tdep.o solib-svr4.o \
 			symfile-mem.o glibc-tdep.o linux-tdep.o"
-	build_gdbserver=yes
 	;;
 
 xstormy16-*-*)
@@ -742,7 +721,6 @@ x86_64-*-linux*)
 	gdb_target_obs="amd64-linux-tdep.o ${i386_tobjs}  \
 			i386-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
-	build_gdbserver=yes
 	;;
 x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
 	# Target: FreeBSD/amd64
@@ -754,7 +732,6 @@ x86_64-*-mingw* | x86_64-*-cygwin*)
 	gdb_target_obs="amd64-windows-tdep.o \
                         ${i386_tobjs} i386-cygwin-tdep.o \
                         windows-tdep.o"
-	build_gdbserver=yes
         ;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
 	# Target: NetBSD/amd64
@@ -772,7 +749,6 @@ x86_64-*-rtems*)
 xtensa*-*-*linux*)
 	# Target: GNU/Linux Xtensa
 	gdb_target_obs="xtensa-linux-tdep.o symfile-mem.o linux-tdep.o"
-	build_gdbserver=yes
 	;;
 
 esac
diff --git a/gdb/gdbserver/.gitignore b/gdbserver/.gitignore
similarity index 100%
rename from gdb/gdbserver/.gitignore
rename to gdbserver/.gitignore
diff --git a/gdb/gdbserver/ChangeLog b/gdbserver/ChangeLog
similarity index 99%
rename from gdb/gdbserver/ChangeLog
rename to gdbserver/ChangeLog
index aeb9cb6c778..857e17cd187 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,18 @@
+2020-01-26  Tom Tromey  <tom@tromey.com>
+
+	* README: Update build documentation.
+	* configure.host: New file.
+	* configure.ac: Update paths.
+	* configure: Rebuild.
+	* acinclude.m4: Update paths.
+	* Makefile.in: Update include paths.
+	(depcomp, INCLUDE_DIR, INCGNU, INCSUPPORT, INCLUDE_CFLAGS)
+	(SFILES, XML_DIR, n, $(GNULIB_BUILDDIR)/Makefile, config.status)
+	(version-generated.c, stamp-xml, regdat_sh, arch/%-ipa.o)
+	(gdbsupport/%-ipa.o, %-ipa.o, arch/%.o, gdbsupport/%.o, %.o)
+	(%-generated.c): Update paths.
+	* Move entire directory from ../gdb/gdbserver.
+
 2020-01-24  Hannes Domani  <ssbssa@yahoo.de>
 
 	* Makefile.in (install-strip): New target.
diff --git a/gdb/gdbserver/Makefile.in b/gdbserver/Makefile.in
similarity index 85%
rename from gdb/gdbserver/Makefile.in
rename to gdbserver/Makefile.in
index 3922b5231c4..60a52d3412b 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -66,7 +66,7 @@ STRIP = @STRIP@
 # Dependency tracking information.
 DEPMODE = @CCDEPMODE@
 DEPDIR = @DEPDIR@
-depcomp = $(SHELL) $(srcdir)/../../depcomp
+depcomp = $(SHELL) $(srcdir)/../depcomp
 
 # Directory containing source files.  Don't clean up the spacing,
 # this exact string is matched for by the "configure" script.
@@ -75,7 +75,7 @@ abs_top_srcdir = @abs_top_srcdir@
 abs_srcdir = @abs_srcdir@
 VPATH = @srcdir@
 
-include $(srcdir)/../silent-rules.mk
+include $(srcdir)/../gdb/silent-rules.mk
 
 # Note that these are overridden by GNU make-specific code below if
 # GNU make is used.  The overrides implement dependency tracking.
@@ -94,7 +94,7 @@ POSTCOMPILE = @true
 CC_LD = $(CXX) $(CXX_DIALECT)
 
 # Where is the "include" directory?  Traditionally ../include or ./include
-INCLUDE_DIR = ${srcdir}/../../include
+INCLUDE_DIR = ${srcdir}/../include
 INCLUDE_DEP = $$(INCLUDE_DIR)
 
 LIBIBERTY_BUILDDIR = build-libiberty-gdbserver
@@ -107,26 +107,26 @@ ustinc = @ustinc@
 # gnulib
 GNULIB_BUILDDIR = build-gnulib-gdbserver
 LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
-INCGNU = -I$(srcdir)/../../gnulib/import -I$(GNULIB_BUILDDIR)/import
+INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
 
 # Generated headers in the gnulib directory.  These must be listed
 # so that they are generated before other files are compiled.
 GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 
-INCSUPPORT = -I$(srcdir)/../.. -I../..
+INCSUPPORT = -I$(srcdir)/.. -I..
 
 # All the includes used for CFLAGS and for lint.
 # -I. for config files.
 # -I${srcdir} for our headers.
-# -I$(srcdir)/../regformats for regdef.h.
+# -I$(srcdir)/../gdb/regformats for regdef.h.
 #
 # We do not include ../target or ../nat in here because headers
 # in those directories should be included with the subdirectory.
 # e.g.: "target/wait.h".
 #
 INCLUDE_CFLAGS = -I. -I${srcdir} \
-	-I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
-	$(INCGNU) $(INCSUPPORT)
+	-I$(srcdir)/../gdb/regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
+	-I$(srcdir)/../gdb $(INCGNU) $(INCSUPPORT)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
 # from the config/ directory.
@@ -202,46 +202,46 @@ SFILES = \
 	$(srcdir)/win32-low.c \
 	$(srcdir)/wincecompat.c \
 	$(srcdir)/x86-low.c \
-	$(srcdir)/../alloc.c \
-	$(srcdir)/../arch/arm.c \
-	$(srcdir)/../arch/arm-get-next-pcs.c \
-	$(srcdir)/../arch/arm-linux.c \
-	$(srcdir)/../arch/ppc-linux-common.c \
-	$(srcdir)/../../gdbsupport/btrace-common.c \
-	$(srcdir)/../../gdbsupport/buffer.c \
-	$(srcdir)/../../gdbsupport/cleanups.c \
-	$(srcdir)/../../gdbsupport/common-debug.c \
-	$(srcdir)/../../gdbsupport/common-exceptions.c \
-	$(srcdir)/../../gdbsupport/common-inferior.c \
-	$(srcdir)/../../gdbsupport/common-regcache.c \
-	$(srcdir)/../../gdbsupport/common-utils.c \
-	$(srcdir)/../../gdbsupport/errors.c \
-	$(srcdir)/../../gdbsupport/environ.c \
-	$(srcdir)/../../gdbsupport/fileio.c \
-	$(srcdir)/../../gdbsupport/filestuff.c \
-	$(srcdir)/../../gdbsupport/job-control.c \
-	$(srcdir)/../../gdbsupport/gdb-dlfcn.c \
-	$(srcdir)/../../gdbsupport/gdb_tilde_expand.c \
-	$(srcdir)/../../gdbsupport/gdb_vecs.c \
-	$(srcdir)/../../gdbsupport/gdb_wait.c \
-	$(srcdir)/../../gdbsupport/netstuff.c \
-	$(srcdir)/../../gdbsupport/new-op.c \
-	$(srcdir)/../../gdbsupport/pathstuff.c \
-	$(srcdir)/../../gdbsupport/print-utils.c \
-	$(srcdir)/../../gdbsupport/ptid.c \
-	$(srcdir)/../../gdbsupport/rsp-low.c \
-	$(srcdir)/../../gdbsupport/safe-strerror.c \
-	$(srcdir)/../../gdbsupport/tdesc.c \
-	$(srcdir)/../../gdbsupport/xml-utils.c \
-	$(srcdir)/../nat/aarch64-sve-linux-ptrace.c \
-	$(srcdir)/../nat/linux-btrace.c \
-	$(srcdir)/../nat/linux-namespaces.c \
-	$(srcdir)/../nat/linux-osdata.c \
-	$(srcdir)/../nat/linux-personality.c \
-	$(srcdir)/../nat/mips-linux-watch.c \
-	$(srcdir)/../nat/ppc-linux.c \
-	$(srcdir)/../nat/fork-inferior.c \
-	$(srcdir)/../target/waitstatus.c
+	$(srcdir)/../gdb/alloc.c \
+	$(srcdir)/../gdb/arch/arm.c \
+	$(srcdir)/../gdb/arch/arm-get-next-pcs.c \
+	$(srcdir)/../gdb/arch/arm-linux.c \
+	$(srcdir)/../gdb/arch/ppc-linux-common.c \
+	$(srcdir)/../gdbsupport/btrace-common.c \
+	$(srcdir)/../gdbsupport/buffer.c \
+	$(srcdir)/../gdbsupport/cleanups.c \
+	$(srcdir)/../gdbsupport/common-debug.c \
+	$(srcdir)/../gdbsupport/common-exceptions.c \
+	$(srcdir)/../gdbsupport/common-inferior.c \
+	$(srcdir)/../gdbsupport/common-regcache.c \
+	$(srcdir)/../gdbsupport/common-utils.c \
+	$(srcdir)/../gdbsupport/errors.c \
+	$(srcdir)/../gdbsupport/environ.c \
+	$(srcdir)/../gdbsupport/fileio.c \
+	$(srcdir)/../gdbsupport/filestuff.c \
+	$(srcdir)/../gdbsupport/job-control.c \
+	$(srcdir)/../gdbsupport/gdb-dlfcn.c \
+	$(srcdir)/../gdbsupport/gdb_tilde_expand.c \
+	$(srcdir)/../gdbsupport/gdb_vecs.c \
+	$(srcdir)/../gdbsupport/gdb_wait.c \
+	$(srcdir)/../gdbsupport/netstuff.c \
+	$(srcdir)/../gdbsupport/new-op.c \
+	$(srcdir)/../gdbsupport/pathstuff.c \
+	$(srcdir)/../gdbsupport/print-utils.c \
+	$(srcdir)/../gdbsupport/ptid.c \
+	$(srcdir)/../gdbsupport/rsp-low.c \
+	$(srcdir)/../gdbsupport/safe-strerror.c \
+	$(srcdir)/../gdbsupport/tdesc.c \
+	$(srcdir)/../gdbsupport/xml-utils.c \
+	$(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
+	$(srcdir)/../gdb/nat/linux-btrace.c \
+	$(srcdir)/../gdb/nat/linux-namespaces.c \
+	$(srcdir)/../gdb/nat/linux-osdata.c \
+	$(srcdir)/../gdb/nat/linux-personality.c \
+	$(srcdir)/../gdb/nat/mips-linux-watch.c \
+	$(srcdir)/../gdb/nat/ppc-linux.c \
+	$(srcdir)/../gdb/nat/fork-inferior.c \
+	$(srcdir)/../gdb/target/waitstatus.c
 
 DEPFILES = @GDBSERVER_DEPFILES@
 
@@ -322,7 +322,7 @@ XM_CLIBS = @LIBS@
 CDEPS = $(srcdir)/proc-service.list
 
 # XML files to compile in to gdbserver, if any.
-XML_DIR = $(srcdir)/../features
+XML_DIR = $(srcdir)/../gdb/features
 XML_FILES = @srv_xmlfiles@
 XML_BUILTIN = @srv_xmlbuiltin@
 
@@ -388,10 +388,10 @@ install-only:
 	n=`echo gdbserver | sed '$(program_transform_name)'`; \
 	if [ x$$n = x ]; then n=gdbserver; else true; fi; \
 	if [ x"$(IPA_DEPFILES)" != x ]; then \
-		$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir); \
+		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(libdir); \
 		$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
 	fi; \
-	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \
 	$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
 	# Note that we run install and not install-only, as the latter
 	# is not part of GNU standards and in particular not provided
@@ -522,14 +522,14 @@ stamp-h: config.in config.status
 Makefile: Makefile.in config.status
 	$(SHELL) ./config.status $@
 
-$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../../gnulib/Makefile.in config.status
+$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../gnulib/Makefile.in config.status
 	  @cd $(GNULIB_BUILDDIR); CONFIG_FILES="Makefile" \
 	  CONFIG_COMMANDS="depfiles" \
 	  CONFIG_HEADERS= \
 	  CONFIG_LINKS= \
 	  $(SHELL) config.status
 
-config.status: configure configure.srv $(srcdir)/../../bfd/development.sh
+config.status: configure configure.srv $(srcdir)/../bfd/development.sh
 	$(SHELL) ./config.status --recheck
 
 # automatic rebuilding in automake-generated Makefiles requires
@@ -541,8 +541,8 @@ am--refresh:
 
 force:
 
-version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../../gdbsupport/create-version.sh
-	$(ECHO_GEN) $(SHELL) $(srcdir)/../../gdbsupport/create-version.sh $(srcdir)/.. \
+version-generated.c: Makefile $(srcdir)/../gdb/version.in $(srcdir)/../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
+	$(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/../gdb \
 		$(host_alias) $(target_alias) $@
 
 xml-builtin-generated.c: stamp-xml; @true
@@ -550,7 +550,7 @@ stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
 	$(SILENCE) rm -f xml-builtin.tmp
 	$(ECHO_GEN_XML_BUILTIN_GENERATED) $(SHELL) $(XML_DIR)/feature_to_c.sh \
 		xml-builtin.tmp $(XML_FILES)
-	$(SILENCE) $(SHELL) $(srcdir)/../../move-if-change xml-builtin.tmp xml-builtin-generated.c
+	$(SILENCE) $(SHELL) $(srcdir)/../move-if-change xml-builtin.tmp xml-builtin-generated.c
 	$(SILENCE) echo stamp > stamp-xml
 
 .PRECIOUS: xml-builtin.c
@@ -566,7 +566,7 @@ stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
 # will remove them.
 MAKEOVERRIDES =
 
-regdat_sh = $(srcdir)/../regformats/regdat.sh
+regdat_sh = $(srcdir)/../gdb/regformats/regdat.sh
 
 UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
 
@@ -596,11 +596,11 @@ ax.o: ax.c
 
 # Rules for objects that go in the in-process agent.
 
-arch/%-ipa.o: ../arch/%.c
+arch/%-ipa.o: ../gdb/arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%-ipa.o: ../../gdbsupport/%.c
+gdbsupport/%-ipa.o: ../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -612,7 +612,7 @@ gdbsupport/%-ipa.o: ../../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-%-ipa.o: ../%.c
+%-ipa.o: ../gdb/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -629,11 +629,11 @@ gdbsupport/%-ipa.o: ../../gdbsupport/%.c
 
 # Rules for objects that go in the gdbserver binary.
 
-arch/%.o: ../arch/%.c
+arch/%.o: ../gdb/arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%.o: ../../gdbsupport/%.c
+gdbsupport/%.o: ../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -645,28 +645,28 @@ gdbsupport/%.o: ../../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-nat/%.o: ../nat/%.c
+nat/%.o: ../gdb/nat/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-target/%.o: ../target/%.c
+target/%.o: ../gdb/target/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ../%.c
+%.o: ../gdb/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
 # Rules for register format descriptions.  Suffix destination files with
 # -generated to identify and clean them easily.
 
-%-generated.c: ../regformats/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
-%-generated.c: ../regformats/arm/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/arm/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
-%-generated.c: ../regformats/rs6000/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
 #
@@ -711,7 +711,7 @@ all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
 -include $(all_deps_files)
 
 # Disable implicit make rules.
-include $(srcdir)/../disable-implicit-rules.mk
+include $(srcdir)/../gdb/disable-implicit-rules.mk
 
 # Do not delete intermediate files (e.g. *-generated.c).
 .SECONDARY:
diff --git a/gdb/gdbserver/README b/gdbserver/README
similarity index 89%
rename from gdb/gdbserver/README
rename to gdbserver/README
index 52a876b24e8..6b8be9669ef 100644
--- a/gdb/gdbserver/README
+++ b/gdbserver/README
@@ -100,27 +100,24 @@ The supported targets as of November 2006 are:
 	spu*-*-*
 	x86_64-*-linux*
 
-Configuring GDBserver you should specify the same machine for host and
-target (which are the machine that GDBserver is going to run on.  This
-is not the same as the machine that GDB is going to run on; building
-GDBserver automatically as part of building a whole tree of tools does
-not currently work if cross-compilation is involved (we don't get the
-right CC in the Makefile, to start with)).
-
-Building GDBserver for your target is very straightforward.  If you build
-GDB natively on a target which GDBserver supports, it will be built
+Building GDBserver for your host is very straightforward.  If you build
+GDB natively on a host which GDBserver supports, it will be built
 automatically when you build GDB.  You can also build just GDBserver:
 
 	% mkdir obj
 	% cd obj
-	% path-to-gdbserver-sources/configure
+	% path-to-toplevel-sources/configure --disable-gdb
 	% make
 
+(If you have a combined binutils+gdb tree, you may want to also
+disable other directories when configuring, e.g., binutils, gas, gold,
+gprof, and ld.)
+
 If you prefer to cross-compile to your target, then you can also build
 GDBserver that way.  In a Bourne shell, for example:
 
 	% export CC=your-cross-compiler
-	% path-to-gdbserver-sources/configure your-target-name
+	% path-to-topevel-sources/configure your-target-name --disable-gdb
 	% make
 
 Using GDBreplay:
diff --git a/gdb/gdbserver/acinclude.m4 b/gdbserver/acinclude.m4
similarity index 63%
rename from gdb/gdbserver/acinclude.m4
rename to gdbserver/acinclude.m4
index eba3a131315..5a284515c82 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdbserver/acinclude.m4
@@ -1,42 +1,42 @@
 dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE.
-m4_include(../../bfd/bfd.m4)
+m4_include(../bfd/bfd.m4)
 
-m4_include(../acx_configure_dir.m4)
+m4_include(../gdb/acx_configure_dir.m4)
 
 # This gets AM_GDB_WARNINGS.
-m4_include(../warning.m4)
+m4_include(../gdb/warning.m4)
 
 dnl This gets autoconf bugfixes
-m4_include(../../config/override.m4)
+m4_include(../config/override.m4)
 
 dnl For ACX_PKGVERSION and ACX_BUGURL.
-m4_include(../../config/acx.m4)
+m4_include(../config/acx.m4)
 
-m4_include(../../config/depstand.m4)
-m4_include(../../config/lead-dot.m4)
+m4_include(../config/depstand.m4)
+m4_include(../config/lead-dot.m4)
 
 dnl Needed for common.m4
 dnl For AC_LIB_HAVE_LINKFLAGS.
-m4_include(../../config/lib-ld.m4)
-m4_include(../../config/lib-prefix.m4)
-m4_include(../../config/lib-link.m4)
+m4_include(../config/lib-ld.m4)
+m4_include(../config/lib-prefix.m4)
+m4_include(../config/lib-link.m4)
 dnl codeset.m4 is needed for common.m4, but not for
 dnl anything else in gdbserver.
-m4_include(../../config/codeset.m4)
-m4_include(../../gdbsupport/common.m4)
+m4_include(../config/codeset.m4)
+m4_include(../gdbsupport/common.m4)
 
 dnl For libiberty_INIT.
-m4_include(../libiberty.m4)
+m4_include(../gdb/libiberty.m4)
 
 dnl For GDB_AC_PTRACE.
-m4_include(../ptrace.m4)
+m4_include(../gdb/ptrace.m4)
 
-m4_include(../ax_cxx_compile_stdcxx.m4)
+m4_include(../gdb/ax_cxx_compile_stdcxx.m4)
 
 dnl For GDB_AC_SELFTEST.
-m4_include(../selftest.m4)
+m4_include(../gdb/selftest.m4)
 
-m4_include([../../config/ax_pthread.m4])
+m4_include([../config/ax_pthread.m4])
 
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
diff --git a/gdb/gdbserver/aclocal.m4 b/gdbserver/aclocal.m4
similarity index 100%
rename from gdb/gdbserver/aclocal.m4
rename to gdbserver/aclocal.m4
diff --git a/gdb/gdbserver/ax.c b/gdbserver/ax.c
similarity index 100%
rename from gdb/gdbserver/ax.c
rename to gdbserver/ax.c
diff --git a/gdb/gdbserver/ax.h b/gdbserver/ax.h
similarity index 100%
rename from gdb/gdbserver/ax.h
rename to gdbserver/ax.h
diff --git a/gdb/gdbserver/config.in b/gdbserver/config.in
similarity index 100%
rename from gdb/gdbserver/config.in
rename to gdbserver/config.in
diff --git a/gdb/gdbserver/configure b/gdbserver/configure
similarity index 99%
rename from gdb/gdbserver/configure
rename to gdbserver/configure
diff --git a/gdb/gdbserver/configure.ac b/gdbserver/configure.ac
similarity index 98%
rename from gdb/gdbserver/configure.ac
rename to gdbserver/configure.ac
index 03b36dc699a..285a297a1c6 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -44,7 +44,7 @@ AX_CXX_COMPILE_STDCXX(11, , mandatory)
 AC_HEADER_STDC
 
 # Set the 'development' global.
-. $srcdir/../../bfd/development.sh
+. $srcdir/../bfd/development.sh
 
 GDB_AC_SELFTEST([
   srv_selftest_objs="gdbsupport/selftest.o"
@@ -80,10 +80,10 @@ fi
 # gdbserver/.  We need to build gnulib under some other directory not
 # "gnulib", to avoid the problem of both GDB and GDBserver wanting to
 # build it in the same directory, when building in the source dir.
-ACX_CONFIGURE_DIR(["../../gnulib"], ["build-gnulib-gdbserver"],
+ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"],
                   ["$gnulib_extra_configure_args"])
 
-ACX_CONFIGURE_DIR(["../../libiberty"], ["build-libiberty-gdbserver"])
+ACX_CONFIGURE_DIR(["../libiberty"], ["build-libiberty-gdbserver"])
 
 AC_CHECK_HEADERS(termios.h sys/reg.h string.h dnl
 		 sys/procfs.h linux/elf.h dnl
diff --git a/gdbserver/configure.host b/gdbserver/configure.host
new file mode 100644
index 00000000000..86d3a80148d
--- /dev/null
+++ b/gdbserver/configure.host
@@ -0,0 +1,111 @@
+# Configure helper for gdbserver
+# Copyright (C) 2000-2020 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Source this to determine whether gdbserver can be built for a given
+# host.  This will set the variable "build_gdbserver".  The variable
+# "host" must be set before sourcing.
+
+build_gdbserver=
+case "$host" in
+aarch64*-*-linux*)
+	# Target: AArch64 linux
+	build_gdbserver=yes
+	;;
+
+arm*-wince-pe | arm*-*-mingw32ce*)
+	# Target: ARM based machine running Windows CE (win32)
+	build_gdbserver=yes
+	;;
+arm*-*-linux*)
+	# Target: ARM based machine running GNU/Linux
+	build_gdbserver=yes
+	;;
+bfin-*-*linux*)
+	# Target: Blackfin Linux
+	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"
+	build_gdbserver=yes
+	;;
+i[34567]86-*-nto*)
+	# Target: Intel 386 running qnx6.
+	build_gdbserver=yes
+	;;
+i[34567]86-*-linux*)
+	# Target: Intel 386 running GNU/Linux
+	build_gdbserver=yes
+	;;
+i[34567]86-*-cygwin*)
+	# Target: Intel 386 running win32
+	build_gdbserver=yes
+	;;
+i[34567]86-*-mingw32*)
+	# Target: Intel 386 running win32
+	build_gdbserver=yes
+	;;
+ia64-*-linux*)
+	# Target: Intel IA-64 running GNU/Linux
+	build_gdbserver=yes
+	;;
+m32r*-*-linux*)
+	# Target: Renesas M32R running GNU/Linux
+	build_gdbserver=yes
+	;;
+m68*-*-linux*)
+	# Target: Motorola m68k with a.out and ELF
+	build_gdbserver=yes
+	;;
+mips*-*-linux*)
+	# Target: Linux/MIPS
+	build_gdbserver=yes
+	;;
+powerpc*-*-linux*)
+	# Target: PowerPC running Linux
+	build_gdbserver=yes
+	;;
+s390*-*-linux*)
+	# Target: S390 running Linux
+	build_gdbserver=yes
+	;;
+sh*-*-linux*)
+	# Target: GNU/Linux Super-H
+	build_gdbserver=yes
+	;;
+sparc-*-linux*)
+	# Target: GNU/Linux SPARC
+	build_gdbserver=yes
+	;;
+sparc64-*-linux*)
+	# Target: GNU/Linux UltraSPARC
+	build_gdbserver=yes
+	;;
+tilegx-*-linux*)
+	# Target: TILE-Gx
+	build_gdbserver=yes
+	;;
+x86_64-*-linux*)
+	# Target: GNU/Linux x86-64
+	build_gdbserver=yes
+	;;
+x86_64-*-mingw* | x86_64-*-cygwin*)
+        # Target: MingW/amd64
+	build_gdbserver=yes
+        ;;
+xtensa*-*-*linux*)
+	# Target: GNU/Linux Xtensa
+	build_gdbserver=yes
+	;;
+esac
diff --git a/gdb/gdbserver/configure.srv b/gdbserver/configure.srv
similarity index 100%
rename from gdb/gdbserver/configure.srv
rename to gdbserver/configure.srv
diff --git a/gdb/gdbserver/debug.c b/gdbserver/debug.c
similarity index 100%
rename from gdb/gdbserver/debug.c
rename to gdbserver/debug.c
diff --git a/gdb/gdbserver/debug.h b/gdbserver/debug.h
similarity index 100%
rename from gdb/gdbserver/debug.h
rename to gdbserver/debug.h
diff --git a/gdb/gdbserver/dll.c b/gdbserver/dll.c
similarity index 100%
rename from gdb/gdbserver/dll.c
rename to gdbserver/dll.c
diff --git a/gdb/gdbserver/dll.h b/gdbserver/dll.h
similarity index 100%
rename from gdb/gdbserver/dll.h
rename to gdbserver/dll.h
diff --git a/gdb/gdbserver/event-loop.c b/gdbserver/event-loop.c
similarity index 100%
rename from gdb/gdbserver/event-loop.c
rename to gdbserver/event-loop.c
diff --git a/gdb/gdbserver/event-loop.h b/gdbserver/event-loop.h
similarity index 100%
rename from gdb/gdbserver/event-loop.h
rename to gdbserver/event-loop.h
diff --git a/gdb/gdbserver/fork-child.c b/gdbserver/fork-child.c
similarity index 100%
rename from gdb/gdbserver/fork-child.c
rename to gdbserver/fork-child.c
diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdbserver/gdb_proc_service.h
similarity index 100%
rename from gdb/gdbserver/gdb_proc_service.h
rename to gdbserver/gdb_proc_service.h
diff --git a/gdb/gdbserver/gdbreplay.c b/gdbserver/gdbreplay.c
similarity index 100%
rename from gdb/gdbserver/gdbreplay.c
rename to gdbserver/gdbreplay.c
diff --git a/gdb/gdbserver/gdbthread.h b/gdbserver/gdbthread.h
similarity index 100%
rename from gdb/gdbserver/gdbthread.h
rename to gdbserver/gdbthread.h
diff --git a/gdb/gdbserver/hostio-errno.c b/gdbserver/hostio-errno.c
similarity index 100%
rename from gdb/gdbserver/hostio-errno.c
rename to gdbserver/hostio-errno.c
diff --git a/gdb/gdbserver/hostio.c b/gdbserver/hostio.c
similarity index 100%
rename from gdb/gdbserver/hostio.c
rename to gdbserver/hostio.c
diff --git a/gdb/gdbserver/hostio.h b/gdbserver/hostio.h
similarity index 100%
rename from gdb/gdbserver/hostio.h
rename to gdbserver/hostio.h
diff --git a/gdb/gdbserver/i387-fp.c b/gdbserver/i387-fp.c
similarity index 100%
rename from gdb/gdbserver/i387-fp.c
rename to gdbserver/i387-fp.c
diff --git a/gdb/gdbserver/i387-fp.h b/gdbserver/i387-fp.h
similarity index 100%
rename from gdb/gdbserver/i387-fp.h
rename to gdbserver/i387-fp.h
diff --git a/gdb/gdbserver/inferiors.c b/gdbserver/inferiors.c
similarity index 100%
rename from gdb/gdbserver/inferiors.c
rename to gdbserver/inferiors.c
diff --git a/gdb/gdbserver/inferiors.h b/gdbserver/inferiors.h
similarity index 100%
rename from gdb/gdbserver/inferiors.h
rename to gdbserver/inferiors.h
diff --git a/gdb/gdbserver/linux-aarch32-low.c b/gdbserver/linux-aarch32-low.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-low.c
rename to gdbserver/linux-aarch32-low.c
diff --git a/gdb/gdbserver/linux-aarch32-low.h b/gdbserver/linux-aarch32-low.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-low.h
rename to gdbserver/linux-aarch32-low.h
diff --git a/gdb/gdbserver/linux-aarch32-tdesc.c b/gdbserver/linux-aarch32-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-tdesc.c
rename to gdbserver/linux-aarch32-tdesc.c
diff --git a/gdb/gdbserver/linux-aarch32-tdesc.h b/gdbserver/linux-aarch32-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-tdesc.h
rename to gdbserver/linux-aarch32-tdesc.h
diff --git a/gdb/gdbserver/linux-aarch64-ipa.c b/gdbserver/linux-aarch64-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-ipa.c
rename to gdbserver/linux-aarch64-ipa.c
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdbserver/linux-aarch64-low.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-low.c
rename to gdbserver/linux-aarch64-low.c
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.c b/gdbserver/linux-aarch64-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-tdesc.c
rename to gdbserver/linux-aarch64-tdesc.c
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdbserver/linux-aarch64-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-tdesc.h
rename to gdbserver/linux-aarch64-tdesc.h
diff --git a/gdb/gdbserver/linux-amd64-ipa.c b/gdbserver/linux-amd64-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-amd64-ipa.c
rename to gdbserver/linux-amd64-ipa.c
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdbserver/linux-arm-low.c
similarity index 100%
rename from gdb/gdbserver/linux-arm-low.c
rename to gdbserver/linux-arm-low.c
diff --git a/gdb/gdbserver/linux-arm-tdesc.c b/gdbserver/linux-arm-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-arm-tdesc.c
rename to gdbserver/linux-arm-tdesc.c
diff --git a/gdb/gdbserver/linux-arm-tdesc.h b/gdbserver/linux-arm-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-arm-tdesc.h
rename to gdbserver/linux-arm-tdesc.h
diff --git a/gdb/gdbserver/linux-bfin-low.c b/gdbserver/linux-bfin-low.c
similarity index 100%
rename from gdb/gdbserver/linux-bfin-low.c
rename to gdbserver/linux-bfin-low.c
diff --git a/gdb/gdbserver/linux-cris-low.c b/gdbserver/linux-cris-low.c
similarity index 100%
rename from gdb/gdbserver/linux-cris-low.c
rename to gdbserver/linux-cris-low.c
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdbserver/linux-crisv32-low.c
similarity index 100%
rename from gdb/gdbserver/linux-crisv32-low.c
rename to gdbserver/linux-crisv32-low.c
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdbserver/linux-i386-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-i386-ipa.c
rename to gdbserver/linux-i386-ipa.c
diff --git a/gdb/gdbserver/linux-ia64-low.c b/gdbserver/linux-ia64-low.c
similarity index 100%
rename from gdb/gdbserver/linux-ia64-low.c
rename to gdbserver/linux-ia64-low.c
diff --git a/gdb/gdbserver/linux-low.c b/gdbserver/linux-low.c
similarity index 100%
rename from gdb/gdbserver/linux-low.c
rename to gdbserver/linux-low.c
diff --git a/gdb/gdbserver/linux-low.h b/gdbserver/linux-low.h
similarity index 100%
rename from gdb/gdbserver/linux-low.h
rename to gdbserver/linux-low.h
diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdbserver/linux-m32r-low.c
similarity index 100%
rename from gdb/gdbserver/linux-m32r-low.c
rename to gdbserver/linux-m32r-low.c
diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdbserver/linux-m68k-low.c
similarity index 100%
rename from gdb/gdbserver/linux-m68k-low.c
rename to gdbserver/linux-m68k-low.c
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdbserver/linux-mips-low.c
similarity index 100%
rename from gdb/gdbserver/linux-mips-low.c
rename to gdbserver/linux-mips-low.c
diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdbserver/linux-nios2-low.c
similarity index 100%
rename from gdb/gdbserver/linux-nios2-low.c
rename to gdbserver/linux-nios2-low.c
diff --git a/gdb/gdbserver/linux-ppc-ipa.c b/gdbserver/linux-ppc-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-ppc-ipa.c
rename to gdbserver/linux-ppc-ipa.c
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdbserver/linux-ppc-low.c
similarity index 100%
rename from gdb/gdbserver/linux-ppc-low.c
rename to gdbserver/linux-ppc-low.c
diff --git a/gdb/gdbserver/linux-ppc-tdesc-init.h b/gdbserver/linux-ppc-tdesc-init.h
similarity index 100%
rename from gdb/gdbserver/linux-ppc-tdesc-init.h
rename to gdbserver/linux-ppc-tdesc-init.h
diff --git a/gdb/gdbserver/linux-s390-ipa.c b/gdbserver/linux-s390-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-s390-ipa.c
rename to gdbserver/linux-s390-ipa.c
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdbserver/linux-s390-low.c
similarity index 100%
rename from gdb/gdbserver/linux-s390-low.c
rename to gdbserver/linux-s390-low.c
diff --git a/gdb/gdbserver/linux-s390-tdesc.h b/gdbserver/linux-s390-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-s390-tdesc.h
rename to gdbserver/linux-s390-tdesc.h
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdbserver/linux-sh-low.c
similarity index 100%
rename from gdb/gdbserver/linux-sh-low.c
rename to gdbserver/linux-sh-low.c
diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdbserver/linux-sparc-low.c
similarity index 100%
rename from gdb/gdbserver/linux-sparc-low.c
rename to gdbserver/linux-sparc-low.c
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdbserver/linux-tic6x-low.c
similarity index 100%
rename from gdb/gdbserver/linux-tic6x-low.c
rename to gdbserver/linux-tic6x-low.c
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdbserver/linux-tile-low.c
similarity index 100%
rename from gdb/gdbserver/linux-tile-low.c
rename to gdbserver/linux-tile-low.c
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdbserver/linux-x86-low.c
similarity index 100%
rename from gdb/gdbserver/linux-x86-low.c
rename to gdbserver/linux-x86-low.c
diff --git a/gdb/gdbserver/linux-x86-tdesc.c b/gdbserver/linux-x86-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-x86-tdesc.c
rename to gdbserver/linux-x86-tdesc.c
diff --git a/gdb/gdbserver/linux-x86-tdesc.h b/gdbserver/linux-x86-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-x86-tdesc.h
rename to gdbserver/linux-x86-tdesc.h
diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdbserver/linux-xtensa-low.c
similarity index 100%
rename from gdb/gdbserver/linux-xtensa-low.c
rename to gdbserver/linux-xtensa-low.c
diff --git a/gdb/gdbserver/lynx-i386-low.c b/gdbserver/lynx-i386-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-i386-low.c
rename to gdbserver/lynx-i386-low.c
diff --git a/gdb/gdbserver/lynx-low.c b/gdbserver/lynx-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-low.c
rename to gdbserver/lynx-low.c
diff --git a/gdb/gdbserver/lynx-low.h b/gdbserver/lynx-low.h
similarity index 100%
rename from gdb/gdbserver/lynx-low.h
rename to gdbserver/lynx-low.h
diff --git a/gdb/gdbserver/lynx-ppc-low.c b/gdbserver/lynx-ppc-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-ppc-low.c
rename to gdbserver/lynx-ppc-low.c
diff --git a/gdb/gdbserver/mem-break.c b/gdbserver/mem-break.c
similarity index 100%
rename from gdb/gdbserver/mem-break.c
rename to gdbserver/mem-break.c
diff --git a/gdb/gdbserver/mem-break.h b/gdbserver/mem-break.h
similarity index 100%
rename from gdb/gdbserver/mem-break.h
rename to gdbserver/mem-break.h
diff --git a/gdb/gdbserver/notif.c b/gdbserver/notif.c
similarity index 100%
rename from gdb/gdbserver/notif.c
rename to gdbserver/notif.c
diff --git a/gdb/gdbserver/notif.h b/gdbserver/notif.h
similarity index 100%
rename from gdb/gdbserver/notif.h
rename to gdbserver/notif.h
diff --git a/gdb/gdbserver/nto-low.c b/gdbserver/nto-low.c
similarity index 100%
rename from gdb/gdbserver/nto-low.c
rename to gdbserver/nto-low.c
diff --git a/gdb/gdbserver/nto-low.h b/gdbserver/nto-low.h
similarity index 100%
rename from gdb/gdbserver/nto-low.h
rename to gdbserver/nto-low.h
diff --git a/gdb/gdbserver/nto-x86-low.c b/gdbserver/nto-x86-low.c
similarity index 100%
rename from gdb/gdbserver/nto-x86-low.c
rename to gdbserver/nto-x86-low.c
diff --git a/gdb/gdbserver/proc-service.c b/gdbserver/proc-service.c
similarity index 100%
rename from gdb/gdbserver/proc-service.c
rename to gdbserver/proc-service.c
diff --git a/gdb/gdbserver/proc-service.list b/gdbserver/proc-service.list
similarity index 100%
rename from gdb/gdbserver/proc-service.list
rename to gdbserver/proc-service.list
diff --git a/gdb/gdbserver/regcache.c b/gdbserver/regcache.c
similarity index 100%
rename from gdb/gdbserver/regcache.c
rename to gdbserver/regcache.c
diff --git a/gdb/gdbserver/regcache.h b/gdbserver/regcache.h
similarity index 100%
rename from gdb/gdbserver/regcache.h
rename to gdbserver/regcache.h
diff --git a/gdb/gdbserver/remote-utils.c b/gdbserver/remote-utils.c
similarity index 100%
rename from gdb/gdbserver/remote-utils.c
rename to gdbserver/remote-utils.c
diff --git a/gdb/gdbserver/remote-utils.h b/gdbserver/remote-utils.h
similarity index 100%
rename from gdb/gdbserver/remote-utils.h
rename to gdbserver/remote-utils.h
diff --git a/gdb/gdbserver/server.c b/gdbserver/server.c
similarity index 100%
rename from gdb/gdbserver/server.c
rename to gdbserver/server.c
diff --git a/gdb/gdbserver/server.h b/gdbserver/server.h
similarity index 100%
rename from gdb/gdbserver/server.h
rename to gdbserver/server.h
diff --git a/gdb/gdbserver/symbol.c b/gdbserver/symbol.c
similarity index 100%
rename from gdb/gdbserver/symbol.c
rename to gdbserver/symbol.c
diff --git a/gdb/gdbserver/target.c b/gdbserver/target.c
similarity index 100%
rename from gdb/gdbserver/target.c
rename to gdbserver/target.c
diff --git a/gdb/gdbserver/target.h b/gdbserver/target.h
similarity index 100%
rename from gdb/gdbserver/target.h
rename to gdbserver/target.h
diff --git a/gdb/gdbserver/tdesc.c b/gdbserver/tdesc.c
similarity index 100%
rename from gdb/gdbserver/tdesc.c
rename to gdbserver/tdesc.c
diff --git a/gdb/gdbserver/tdesc.h b/gdbserver/tdesc.h
similarity index 100%
rename from gdb/gdbserver/tdesc.h
rename to gdbserver/tdesc.h
diff --git a/gdb/gdbserver/thread-db.c b/gdbserver/thread-db.c
similarity index 100%
rename from gdb/gdbserver/thread-db.c
rename to gdbserver/thread-db.c
diff --git a/gdb/gdbserver/tracepoint.c b/gdbserver/tracepoint.c
similarity index 100%
rename from gdb/gdbserver/tracepoint.c
rename to gdbserver/tracepoint.c
diff --git a/gdb/gdbserver/tracepoint.h b/gdbserver/tracepoint.h
similarity index 100%
rename from gdb/gdbserver/tracepoint.h
rename to gdbserver/tracepoint.h
diff --git a/gdb/gdbserver/utils.c b/gdbserver/utils.c
similarity index 100%
rename from gdb/gdbserver/utils.c
rename to gdbserver/utils.c
diff --git a/gdb/gdbserver/utils.h b/gdbserver/utils.h
similarity index 100%
rename from gdb/gdbserver/utils.h
rename to gdbserver/utils.h
diff --git a/gdb/gdbserver/win32-arm-low.c b/gdbserver/win32-arm-low.c
similarity index 100%
rename from gdb/gdbserver/win32-arm-low.c
rename to gdbserver/win32-arm-low.c
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdbserver/win32-i386-low.c
similarity index 100%
rename from gdb/gdbserver/win32-i386-low.c
rename to gdbserver/win32-i386-low.c
diff --git a/gdb/gdbserver/win32-low.c b/gdbserver/win32-low.c
similarity index 100%
rename from gdb/gdbserver/win32-low.c
rename to gdbserver/win32-low.c
diff --git a/gdb/gdbserver/win32-low.h b/gdbserver/win32-low.h
similarity index 100%
rename from gdb/gdbserver/win32-low.h
rename to gdbserver/win32-low.h
diff --git a/gdb/gdbserver/wincecompat.c b/gdbserver/wincecompat.c
similarity index 100%
rename from gdb/gdbserver/wincecompat.c
rename to gdbserver/wincecompat.c
diff --git a/gdb/gdbserver/wincecompat.h b/gdbserver/wincecompat.h
similarity index 100%
rename from gdb/gdbserver/wincecompat.h
rename to gdbserver/wincecompat.h
diff --git a/gdb/gdbserver/x86-low.c b/gdbserver/x86-low.c
similarity index 100%
rename from gdb/gdbserver/x86-low.c
rename to gdbserver/x86-low.c
diff --git a/gdb/gdbserver/x86-low.h b/gdbserver/x86-low.h
similarity index 100%
rename from gdb/gdbserver/x86-low.h
rename to gdbserver/x86-low.h
diff --git a/gdb/gdbserver/x86-tdesc.h b/gdbserver/x86-tdesc.h
similarity index 100%
rename from gdb/gdbserver/x86-tdesc.h
rename to gdbserver/x86-tdesc.h
diff --git a/gdb/gdbserver/xtensa-xtregs.c b/gdbserver/xtensa-xtregs.c
similarity index 100%
rename from gdb/gdbserver/xtensa-xtregs.c
rename to gdbserver/xtensa-xtregs.c
diff --git a/src-release.sh b/src-release.sh
index 92e92ac5d77..95f79c5bd7d 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-#   Copyright (C) 1990-2019 Free Software Foundation
+#   Copyright (C) 1990-2020 Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -315,7 +315,7 @@ gas_release()
     tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
 }
 
-GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport"
+GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport gdbserver"
 gdb_release()
 {
     compressors=$1
Pedro Alves Jan. 27, 2020, 1:41 p.m. | #13
On 1/26/20 3:41 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

> 

> Pedro> I think this should have a NEWS entry, given that it affects

> Pedro> people building standalone gdbserver today.  Do you have

> Pedro> documentation changes queued?

> 

> Nope, I've added those now.

> 

>>> +// Host modules specific to gdbserver.

>>> +dependencies = { module=configure-gdbserver; on=all-intl; };

> 

> Pedro> This surprised me, as I don't think gdbserver actually depends on

> Pedro> intl currently?  Might still be a good idea to actually enable it,

> Pedro> but I was surprised from an "as pure as possible" perspective.

> 

> I don't recall (I wrote this patch originally in May of last year), but

> maybe I just copied gdb's dependencies.  Anyway, I've dropped them now.


Thanks.

> 

> Tom

> 

> commit 4c5c9a7a0b64c98f60c2ab79ad705d14ea568d0f

> Author: Tom Tromey <tom@tromey.com>

> Date:   Sun Dec 15 07:37:06 2019 -0700

> 

>     Move gdbserver to top level

>     

>     This patch moves gdbserver to the top level.

>     

>     This patch is as close to a pure move as possible -- gdbserver still

>     builds its own variant of gnulib and gdbsupport.  Changing this will

>     be done in a separate patch.

>     

>     [v2] Note that, per Simon's review comment, this patch changes the

>     tree so that gdbserver is not built for or1k or score.  This makes

>     sense, because there is apparently not actually a gdbserver port here.

>     

>     [v3] This version of the patch also splits out some configury into a

>     new file, gdbserver/configure.host, so that the top-level configure

>     script can simply rely on it in order to decide whether gdbserver

>     should be built.

>     

>     [v4] This version adds documentation and removes some unnecessary

>     top-level dependencies.


Thanks.

> +# Only allow gdbserver on some systems.

> +if test -d ${srcdir}/gdbserver; then

> +    if test x$enable_gdbserver = x; then

> +        AC_MSG_CHECKING([for gdbserver support])

> +	. ${srcdir}/gdbserver/configure.host

> +	if test x$build_gdbserver = xyes; then

> +	    AC_MSG_RESULT([yes])

> +	else

> +            noconfigdirs="$noconfigdirs gdbserver"

> +	    AC_MSG_RESULT([no])

> +        fi

> +    fi

> +fi


Some tabs vs spaces mixup above.  (But see below.)

> --- a/gdb/gdbserver/README

> +++ b/gdbserver/README

> @@ -100,27 +100,24 @@ The supported targets as of November 2006 are:

>  	spu*-*-*

>  	x86_64-*-linux*

>  

> -Configuring GDBserver you should specify the same machine for host and

> -target (which are the machine that GDBserver is going to run on.  This

> -is not the same as the machine that GDB is going to run on; building

> -GDBserver automatically as part of building a whole tree of tools does

> -not currently work if cross-compilation is involved (we don't get the

> -right CC in the Makefile, to start with)).

> -

> -Building GDBserver for your target is very straightforward.  If you build

> -GDB natively on a target which GDBserver supports, it will be built

> +Building GDBserver for your host is very straightforward.  If you build

> +GDB natively on a host which GDBserver supports, it will be built

>  automatically when you build GDB.  You can also build just GDBserver:

>  

>  	% mkdir obj

>  	% cd obj

> -	% path-to-gdbserver-sources/configure

> +	% path-to-toplevel-sources/configure --disable-gdb

>  	% make

>  

> +(If you have a combined binutils+gdb tree, you may want to also

> +disable other directories when configuring, e.g., binutils, gas, gold,

> +gprof, and ld.)

> +


On a git checkout, configuring with:

 configure \
 --disable-binutils \
 --disable-ld \
 --disable-gas \
 --disable-gprof \
 --disable-gold \
 --disable-gdb

and compiling with '$ make', still builds a number of top level directories
other than gdbserver.  We end up with this in the top level Makefile.in:

 SUBDIRS =  intl libiberty opcodes bfd readline zlib libdecnumber libctf sim gdbserver etc

So to build just gdbserver, you'd need to add a --disable-foo for each of those above
in addition to the ones already indicated, something like:

 configure \
 --disable-binutils \
 --disable-ld \
 --disable-gas \
 --disable-gprof \
 --disable-gold \
 --disable-gdb \
 --disable-intl \
 --disable-libiberty \
 --disable-opcodes \
 --disable-bfd \
 --disable-readline \
 --disable-zlib \
 --disable-libdecnumber \
 --disable-libctf \
 --disable-sim \
 --disable-etc


I guess it's the intended design for top level to build readline, bfd,
etc.  by default even if no application is being built that depends
on them.  I don't know.

People may trip on this if they try to build gdbserver for a port for which
one of those top level dirs doesn't build, like bfd.  powerpc-lynxos is 
I think one such case, but there are probably others in the non-glibc space,
and also off tree.

However, a configure command, followed by "make all-gdbserver" builds only
gdbserver and its required dependencies (which are none at the moment).

So I'm thinking that it might be better to document "make all-gdbserver" instead
of the --disable approach.  Or at least, mention it as alternative.  WDYT?


>  If you prefer to cross-compile to your target, then you can also build

>  GDBserver that way.  In a Bourne shell, for example:

>  

>  	% export CC=your-cross-compiler

> -	% path-to-gdbserver-sources/configure your-target-name

> +	% path-to-topevel-sources/configure your-target-name --disable-gdb

>  	% make

>  

>  Using GDBreplay:


> index 00000000000..86d3a80148d

> --- /dev/null

> +++ b/gdbserver/configure.host


I noticed something about this file that made me look a bit more
and I have a couple questions, including a patch.

I noticed that several directories already contain a file named
configure.host, including gdb:

 $ find . -name configure.host
 ./gdb/configure.host
 ./ld/configure.host
 ./gdbserver/configure.host
 ./bfd/configure.host

And in gdb's ld's and bfd's case, this file is sourced
by the respective directory's configure script, not by
the top level script.  If we wanted to migrate gdb's top
configure bits to source a new file from gdb/ to determine
whether gdb is supported, like gdbserver, we wouldn't
be able to call the new "do we support gdb on this host"
configure snippet file gdb/configure.host, since that
file already exists with a different purpose.  Likewise
for ld and bfd.  So, with that in mind, should we name
gdbserver's new configure.host file to something else?

However, looking at how libatomic, liboffloadmic, etc.
handle this at the top level, I see that the top level
sources a file that is also sourced by their respective
configures.  I.e., the file sourced served a dual purpose.
From the top level, the file is sourced in subshell, which
avoids variable polluting the top level.  This has the advantage
that you only have to write support for a port once in one file,
instead of in two places.

The equivalent for gdbserver would be the patch below,
which seems to work well.  Was there a reason you didn't follow
libatomic's (etc.) model?

From 0a8e011249c5d887886b1e06d5b3b774bd6f9d10 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>

Date: Mon, 27 Jan 2020 12:53:10 +0000
Subject: [PATCH] UNSUPPORTED

---
 configure                |  18 ++++----
 configure.ac             |  16 ++++---
 gdbserver/configure.host | 111 -----------------------------------------------
 gdbserver/configure.srv  |  12 +++--
 4 files changed, 27 insertions(+), 130 deletions(-)
 delete mode 100644 gdbserver/configure.host

diff --git a/configure b/configure
index c31220e8e75..8a3e7026f0b 100755
--- a/configure
+++ b/configure
@@ -3541,17 +3541,19 @@ esac
 # Only allow gdbserver on some systems.
 if test -d ${srcdir}/gdbserver; then
     if test x$enable_gdbserver = x; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdbserver support" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdbserver support" >&5
 $as_echo_n "checking for gdbserver support... " >&6; }
-	. ${srcdir}/gdbserver/configure.host
-	if test x$build_gdbserver = xyes; then
-	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	else
-            noconfigdirs="$noconfigdirs gdbserver"
+	if (srcdir=${srcdir}/gdbserver; \
+		. ${srcdir}/configure.srv; \
+		test -n "$UNSUPPORTED")
+	then
 	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-        fi
+	    noconfigdirs="$noconfigdirs gdbserver"
+	else
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	fi
     fi
 fi
 
diff --git a/configure.ac b/configure.ac
index 40669228e3c..35a9c1867d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -785,14 +785,16 @@ esac
 # Only allow gdbserver on some systems.
 if test -d ${srcdir}/gdbserver; then
     if test x$enable_gdbserver = x; then
-        AC_MSG_CHECKING([for gdbserver support])
-	. ${srcdir}/gdbserver/configure.host
-	if test x$build_gdbserver = xyes; then
-	    AC_MSG_RESULT([yes])
-	else
-            noconfigdirs="$noconfigdirs gdbserver"
+	AC_MSG_CHECKING([for gdbserver support])
+	if (srcdir=${srcdir}/gdbserver; \
+		. ${srcdir}/configure.srv; \
+		test -n "$UNSUPPORTED")
+	then
 	    AC_MSG_RESULT([no])
-        fi
+	    noconfigdirs="$noconfigdirs gdbserver"
+	else
+	    AC_MSG_RESULT([yes])
+	fi
     fi
 fi
 
diff --git a/gdbserver/configure.host b/gdbserver/configure.host
deleted file mode 100644
index 86d3a80148d..00000000000
--- a/gdbserver/configure.host
+++ /dev/null
@@ -1,111 +0,0 @@
-# Configure helper for gdbserver
-# Copyright (C) 2000-2020 Free Software Foundation, Inc.
-#
-# This file is part of GDB.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Source this to determine whether gdbserver can be built for a given
-# host.  This will set the variable "build_gdbserver".  The variable
-# "host" must be set before sourcing.
-
-build_gdbserver=
-case "$host" in
-aarch64*-*-linux*)
-	# Target: AArch64 linux
-	build_gdbserver=yes
-	;;
-
-arm*-wince-pe | arm*-*-mingw32ce*)
-	# Target: ARM based machine running Windows CE (win32)
-	build_gdbserver=yes
-	;;
-arm*-*-linux*)
-	# Target: ARM based machine running GNU/Linux
-	build_gdbserver=yes
-	;;
-bfin-*-*linux*)
-	# Target: Blackfin Linux
-	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"
-	build_gdbserver=yes
-	;;
-i[34567]86-*-nto*)
-	# Target: Intel 386 running qnx6.
-	build_gdbserver=yes
-	;;
-i[34567]86-*-linux*)
-	# Target: Intel 386 running GNU/Linux
-	build_gdbserver=yes
-	;;
-i[34567]86-*-cygwin*)
-	# Target: Intel 386 running win32
-	build_gdbserver=yes
-	;;
-i[34567]86-*-mingw32*)
-	# Target: Intel 386 running win32
-	build_gdbserver=yes
-	;;
-ia64-*-linux*)
-	# Target: Intel IA-64 running GNU/Linux
-	build_gdbserver=yes
-	;;
-m32r*-*-linux*)
-	# Target: Renesas M32R running GNU/Linux
-	build_gdbserver=yes
-	;;
-m68*-*-linux*)
-	# Target: Motorola m68k with a.out and ELF
-	build_gdbserver=yes
-	;;
-mips*-*-linux*)
-	# Target: Linux/MIPS
-	build_gdbserver=yes
-	;;
-powerpc*-*-linux*)
-	# Target: PowerPC running Linux
-	build_gdbserver=yes
-	;;
-s390*-*-linux*)
-	# Target: S390 running Linux
-	build_gdbserver=yes
-	;;
-sh*-*-linux*)
-	# Target: GNU/Linux Super-H
-	build_gdbserver=yes
-	;;
-sparc-*-linux*)
-	# Target: GNU/Linux SPARC
-	build_gdbserver=yes
-	;;
-sparc64-*-linux*)
-	# Target: GNU/Linux UltraSPARC
-	build_gdbserver=yes
-	;;
-tilegx-*-linux*)
-	# Target: TILE-Gx
-	build_gdbserver=yes
-	;;
-x86_64-*-linux*)
-	# Target: GNU/Linux x86-64
-	build_gdbserver=yes
-	;;
-x86_64-*-mingw* | x86_64-*-cygwin*)
-        # Target: MingW/amd64
-	build_gdbserver=yes
-        ;;
-xtensa*-*-*linux*)
-	# Target: GNU/Linux Xtensa
-	build_gdbserver=yes
-	;;
-esac
diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
index 8437c1ace06..52264be8ecd 100644
--- a/gdbserver/configure.srv
+++ b/gdbserver/configure.srv
@@ -1,6 +1,8 @@
 # Mappings from configuration triplets to gdbserver build options.
 # This is invoked from the autoconf-generated configure script, to
 # produce the appropriate Makefile substitutions.
+# It is also sourced by the top level configure script, to determine
+# whether gdbserver is supported on a given host.
 
 # This file sets the following shell variables:
 #   srv_regobj		The register protocol appropriate for this target.
@@ -12,6 +14,7 @@
 #			gdbserver in this configuration.
 #   ipa_obj		Any other target-specific modules appropriate
 #			for this target's in-process agent.
+#   UNSUPPORTED         Set to 1 if the host is unsupported.
 #
 # In addition, on GNU/Linux the following shell variables will be set:
 #   srv_linux_regsets	Set to "yes" if ptrace(PTRACE_GETREGS) and friends
@@ -30,9 +33,9 @@ ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l-
 # these files over and over again.
 srv_linux_obj="linux-low.o nat/linux-osdata.o nat/linux-procfs.o nat/linux-ptrace.o nat/linux-waitpid.o nat/linux-personality.o nat/linux-namespaces.o fork-child.o nat/fork-inferior.o"
 
-# Input is taken from the "${target}" variable.
+# Input is taken from the "${host}" variable.
 
-case "${target}" in
+case "${host}" in
   aarch64*-*-linux*)	srv_tgtobj="linux-aarch64-low.o"
 			srv_tgtobj="$srv_tgtobj nat/aarch64-linux-hw-point.o"
 			srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
@@ -395,7 +398,8 @@ case "${target}" in
 			srv_linux_regsets=yes
 			srv_linux_thread_db=yes
 			;;
-  *)			echo "Error: target not supported by gdbserver."
-			exit 1
+  *)
+			# Who are you?
+			UNSUPPORTED=1
 			;;
 esac

base-commit: 4c5c9a7a0b64c98f60c2ab79ad705d14ea568d0f
-- 
2.14.5
Tom Tromey Jan. 27, 2020, 9:28 p.m. | #14
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:


Pedro> I guess it's the intended design for top level to build readline, bfd,
Pedro> etc.  by default even if no application is being built that depends
Pedro> on them.  I don't know.

Me neither, but it seems to me that we could try to change it.  My
mental model is that there are certain top-level build targets (gdb, or
binutils) and the rest are just dependencies of those.  So, we could try
not to build these dependencies unless there's a need.

Pedro> People may trip on this if they try to build gdbserver for a port
Pedro> for which one of those top level dirs doesn't build, like bfd.
Pedro> powerpc-lynxos is I think one such case, but there are probably
Pedro> others in the non-glibc space, and also off tree.

FWIW there is a problem here I haven't solved yet.  Right now, the
top-level gdbsupport depends on BFD.  This is needed for common-types.h.

However, this introduces a conflict if we want to share the top-level
gdbsupport with gdbserver.

I'm not totally sure what to do here.  Maybe we could replicate the BFD
type-configury code?  Like, break it out into a new .m4 file for
sharing.  It's been a while though, so I forget why, but I thought I had
some reason this wouldn't work.

Pedro> So I'm thinking that it might be better to document "make
Pedro> all-gdbserver" instead of the --disable approach.  Or at least,
Pedro> mention it as alternative.  WDYT?

Makes sense, though I may take a stab at fixing the top-level instead.

Pedro> However, looking at how libatomic, liboffloadmic, etc.
Pedro> handle this at the top level, I see that the top level
Pedro> sources a file that is also sourced by their respective
Pedro> configures.  I.e., the file sourced served a dual purpose.
Pedro> From the top level, the file is sourced in subshell, which
Pedro> avoids variable polluting the top level.  This has the advantage
Pedro> that you only have to write support for a port once in one file,
Pedro> instead of in two places.

Pedro> The equivalent for gdbserver would be the patch below,
Pedro> which seems to work well.  Was there a reason you didn't follow
Pedro> libatomic's (etc.) model?

I just didn't think of it.  I like your idea better, though, because it
means not duplicating information.

Tom
Pedro Alves Jan. 28, 2020, 2:07 p.m. | #15
On 1/27/20 9:28 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

> 

> Pedro> I guess it's the intended design for top level to build readline, bfd,

> Pedro> etc.  by default even if no application is being built that depends

> Pedro> on them.  I don't know.

> 

> Me neither, but it seems to me that we could try to change it.  My

> mental model is that there are certain top-level build targets (gdb, or

> binutils) and the rest are just dependencies of those.  So, we could try

> not to build these dependencies unless there's a need.


That was my model as well.  I had never noticed it was different until
now.

> 

> Pedro> People may trip on this if they try to build gdbserver for a port

> Pedro> for which one of those top level dirs doesn't build, like bfd.

> Pedro> powerpc-lynxos is I think one such case, but there are probably

> Pedro> others in the non-glibc space, and also off tree.

> 

> FWIW there is a problem here I haven't solved yet.  Right now, the

> top-level gdbsupport depends on BFD.  This is needed for common-types.h.

> 

> However, this introduces a conflict if we want to share the top-level

> gdbsupport with gdbserver.

> 

> I'm not totally sure what to do here.  Maybe we could replicate the BFD

> type-configury code?  Like, break it out into a new .m4 file for

> sharing.  It's been a while though, so I forget why, but I thought I had

> some reason this wouldn't work.


Yeah.

For ULONGEST/LONGEST, I think we can just assume long long or uint64_t
is available nowadays instead of relying on bfd.  We have been using
long long and uint64_t in common code for quite a while and nobody
has complained.

I think the main thing is CORE_ADDR/bfd_vma.  For that, I'm not sure
either.  Sharing the type-configury with an .m4 should work, I think.

Another option is to use the gdbserver version of the types on gdb as well,
in effect assuming 64-bit CORE_ADDR even on 32-bit hosts.  There may be
some fallout in some code assuming bfd_vma == CORE_ADDR, but probably not
that much.  

I'm not sure whether that would cause a significant performance/memory
degradation on 32-bit hosts for using 64-bit CORE_ADDR, significant enough
to worry about it.  I'm inclined to think that it isn't.  That the main
motivation for the type-configury was that 32-bit compilers in the old days
didn't support 64-bit types.  It's effectively the same as configuring
with --enable-64-bit-bfd.

Thanks,
Pedro Alves
Tom Tromey Feb. 3, 2020, 9:34 p.m. | #16
Pedro> I guess it's the intended design for top level to build readline, bfd,
Pedro> etc.  by default even if no application is being built that depends
Pedro> on them.  I don't know.

[...]

Pedro> So I'm thinking that it might be better to document "make
Pedro> all-gdbserver" instead of the --disable approach.  Or at least,
Pedro> mention it as alternative.  WDYT?

Tom> Makes sense, though I may take a stab at fixing the top-level instead.

We talked about this at FOSDEM and Pedro convinced me to just go ahead
with the documentation change and the move, and consider changing the
top-level configury later.

Pedro> The equivalent for gdbserver would be the patch below,
Pedro> which seems to work well.  Was there a reason you didn't follow
Pedro> libatomic's (etc.) model?

Tom> I just didn't think of it.  I like your idea better, though, because it
Tom> means not duplicating information.

I've pulled this patch into mine.

I'm going to push it tomorrow or the day after, unless there's some
objection.

thanks,
Tom
Simon Marchi Feb. 7, 2020, 4:06 p.m. | #17
On 2020-02-03 4:34 p.m., Tom Tromey wrote:
> Pedro> I guess it's the intended design for top level to build readline, bfd,

> Pedro> etc.  by default even if no application is being built that depends

> Pedro> on them.  I don't know.

> 

> [...]

> 

> Pedro> So I'm thinking that it might be better to document "make

> Pedro> all-gdbserver" instead of the --disable approach.  Or at least,

> Pedro> mention it as alternative.  WDYT?

> 

> Tom> Makes sense, though I may take a stab at fixing the top-level instead.

> 

> We talked about this at FOSDEM and Pedro convinced me to just go ahead

> with the documentation change and the move, and consider changing the

> top-level configury later.

> 

> Pedro> The equivalent for gdbserver would be the patch below,

> Pedro> which seems to work well.  Was there a reason you didn't follow

> Pedro> libatomic's (etc.) model?

> 

> Tom> I just didn't think of it.  I like your idea better, though, because it

> Tom> means not duplicating information.

> 

> I've pulled this patch into mine.

> 

> I'm going to push it tomorrow or the day after, unless there's some

> objection.


I have no objection.  I think for a big change like that we have to expect we'll
get some things wrong that we'll need to fix afterwards, no big deal.

It was suggested (on IRC, maybe on the mailing list too) that since we have moved
the gdbsupport directory, and are moving the gdbserver directory, we should take
the opportunity to rename these source files to .cc/.cxx/.cpp.  I also have no objection
to that.

Simon
Tom de Vries Feb. 9, 2020, 1:59 p.m. | #18
On 03-02-2020 22:34, Tom Tromey wrote:
> I'm going to push it tomorrow or the day after, unless there's some

> objection.


Hi,

FYI, starting this commit, I'm running into:
...
(gdb) PASS: gdb.multi/multi-target.exp: continue: non-stop=off: set
remote-exec file in inferior 2
spawn of  --once --multi localhost:2346 failed
ERROR: tcl error sourcing
/data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp.
ERROR: Timeout waiting for gdbserver response.
    while executing
"error "Timeout waiting for gdbserver response.""
    invoked from within
"expect {
            -i $server_spawn_id
            -timeout 120
            -notransfer
            -re "Listening on" { }
            -re "Can't (bind address|listen on socket): Addr..."
    (procedure "gdbserver_start" line 120)
    invoked from within
"gdbserver_start "--multi" """
    (procedure "connect_target_extended_remote" line 2)
    invoked from within
"connect_target_extended_remote $binfile"
    (procedure "add_inferior" line 14)
    invoked from within
"add_inferior 2 "extended-remote" $binfile"
    (procedure "setup" line 25)
    invoked from within
"setup ${non-stop}"
    (procedure "test_continue" line 2)
    invoked from within
"test_continue ${non-stop}"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $body"
    invoked from within
"foreach_with_prefix non-stop {"off" "on"} {
        test_continue ${non-stop}
    }"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $body"
    invoked from within
"with_test_prefix "continue" {
    foreach_with_prefix non-stop {"off" "on"} {
        test_continue ${non-stop}
    }
}"
    (file
"/data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp"
line 425)
    invoked from within
"source
/data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source
/data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""
monitor exit
"monitor" command not supported by this target.
(gdb) testcase
/data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp
completed in 130 seconds

                === gdb Summary ===

# of expected passes            8
...

Thanks,
- Tom
Tom de Vries Feb. 9, 2020, 2:17 p.m. | #19
On 09-02-2020 14:59, Tom de Vries wrote:
> On 03-02-2020 22:34, Tom Tromey wrote:

>> I'm going to push it tomorrow or the day after, unless there's some

>> objection.

> 

> Hi,

> 

> FYI, starting this commit, I'm running into:

> ...

> (gdb) PASS: gdb.multi/multi-target.exp: continue: non-stop=off: set

> remote-exec file in inferior 2

> spawn of  --once --multi localhost:2346 failed

> ERROR: tcl error sourcing

> /data/gdb_versions/devel/src/gdb/testsuite/gdb.multi/multi-target.exp.

> ERROR: Timeout waiting for gdbserver response.


Looking at other tests that use gdbserver, I guess this is missing:
...
diff --git a/gdb/testsuite/gdb.multi/multi-target.exp
b/gdb/testsuite/gdb.multi/multi-target.exp
index 3588eb4d76..6c727b5e3b 100644
--- a/gdb/testsuite/gdb.multi/multi-target.exp
+++ b/gdb/testsuite/gdb.multi/multi-target.exp
@@ -17,6 +17,10 @@

 load_lib gdbserver-support.exp

+if { [skip_gdbserver_tests] } {
+    return 0
+}
+
 standard_testfile

 # The plain remote target can't do multiple inferiors.

...

[ It would be nice though if the gdbserver tests will work again, given
that I'm actually building gdbserver. ]

Thanks,
- Tom
Alan Modra Feb. 9, 2020, 11:05 p.m. | #20
On Mon, Feb 03, 2020 at 10:34:30PM +0100, Tom Tromey wrote:
> I'm going to push it tomorrow or the day after, unless there's some

> objection.


I'm noticing all my binutils builds have this new directory being
built.  I suppose I can just add --disable-gdbserver, but should
--disable-gdb also disable gdbserver?

-- 
Alan Modra
Australia Development Lab, IBM
Andreas Schwab Feb. 10, 2020, 9:52 a.m. | #21
Should gdbserver be disabled automatically when building with a cross
compiler?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Tom de Vries Feb. 10, 2020, 10:01 a.m. | #22
On 09-02-2020 15:17, Tom de Vries wrote:
> [ It would be nice though if the gdbserver tests will work again, given

> that I'm actually building gdbserver. ]


Hmm, I noticed that also on the buildbot (
https://sourceware.org/ml/gdb-testers/2020-q1/msg03282.html ) we no
longer run the gdb.server tests:
...
Running
/home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/abspath.exp
...
testcase
/home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/abspath.exp
completed in 0 seconds

Running
/home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
...
testcase
/home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/bkpt-other-inferior.exp
completed in 0 seconds

Running
/home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/connect-stopped-target.exp
...
testcase
/home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/connect-stopped-target.exp
completed in 0 seconds
...

Thanks,
- Tom
Pedro Alves Feb. 10, 2020, 12:02 p.m. | #23
On 2/9/20 11:05 PM, Alan Modra wrote:
> On Mon, Feb 03, 2020 at 10:34:30PM +0100, Tom Tromey wrote:

>> I'm going to push it tomorrow or the day after, unless there's some

>> objection.

> 

> I'm noticing all my binutils builds have this new directory being

> built.  I suppose I can just add --disable-gdbserver, but should

> --disable-gdb also disable gdbserver?


I don't think so.  That'd make gdbserver different from other
programs in the tree.  E.g., if you do --disable-binutils you
don't disable ld either.

See here for a somewhat related discussion:

 https://sourceware.org/ml/gdb-patches/2020-01/msg00881.html

Thanks,
Pedro Alves
Pedro Alves Feb. 10, 2020, 12:13 p.m. | #24
On 2/10/20 9:52 AM, Andreas Schwab wrote:
> Should gdbserver be disabled automatically when building with a cross

> compiler?


I'm confused.  Why would we want to do that?

Pedro Alves
Andreas Schwab Feb. 10, 2020, 1:03 p.m. | #25
On Feb 10 2020, Pedro Alves wrote:

> On 2/10/20 9:52 AM, Andreas Schwab wrote:

>> Should gdbserver be disabled automatically when building with a cross

>> compiler?

>

> I'm confused.  Why would we want to do that?


That's what happend before the move.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Andreas Schwab Feb. 10, 2020, 1:15 p.m. | #26
On Feb 10 2020, Pedro Alves wrote:

> On 2/10/20 9:52 AM, Andreas Schwab wrote:

>> Should gdbserver be disabled automatically when building with a cross

>> compiler?

>

> I'm confused.  Why would we want to do that?


Actually what I mean is, when building a cross toolchain, host !=
target.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Sergio Durigan Junior Feb. 10, 2020, 3:54 p.m. | #27
On Monday, February 10 2020, Tom de Vries wrote:

> On 09-02-2020 15:17, Tom de Vries wrote:

>> [ It would be nice though if the gdbserver tests will work again, given

>> that I'm actually building gdbserver. ]

>

> Hmm, I noticed that also on the buildbot (

> https://sourceware.org/ml/gdb-testers/2020-q1/msg03282.html ) we no

> longer run the gdb.server tests:

> ...

> Running

> /home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/abspath.exp

> ...

> testcase

> /home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/abspath.exp

> completed in 0 seconds

>

> Running

> /home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/bkpt-other-inferior.exp

> ...

> testcase

> /home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/bkpt-other-inferior.exp

> completed in 0 seconds

>

> Running

> /home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/connect-stopped-target.exp

> ...

> testcase

> /home/gdb-buildbot-2/fedora-x86-64-2/fedora-x86-64/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/connect-stopped-target.exp

> completed in 0 seconds

> ...


I wonder why...  We build GDB from scratch on every build.  Is there
anything special that needs to be done to run the gdbserver tests now?

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
Tom Tromey Feb. 12, 2020, 12:55 a.m. | #28
>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:


Sergio> I wonder why...  We build GDB from scratch on every build.  Is there
Sergio> anything special that needs to be done to run the gdbserver tests now?

No, I just neglected to update the gdb test suite to find gdbserver in
the new spot.

I will send a patch momentarily.

Tom
Sergio Durigan Junior Feb. 12, 2020, 4:46 p.m. | #29
On Tuesday, February 11 2020, Tom Tromey wrote:

>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

>

> Sergio> I wonder why...  We build GDB from scratch on every build.  Is there

> Sergio> anything special that needs to be done to run the gdbserver tests now?

>

> No, I just neglected to update the gdb test suite to find gdbserver in

> the new spot.

>

> I will send a patch momentarily.


Thanks, Tom.

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
Sergio Durigan Junior Feb. 14, 2020, 3:54 a.m. | #30
On Tuesday, February 11 2020, Tom Tromey wrote:

>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

>

> Sergio> I wonder why...  We build GDB from scratch on every build.  Is there

> Sergio> anything special that needs to be done to run the gdbserver tests now?

>

> No, I just neglected to update the gdb test suite to find gdbserver in

> the new spot.

>

> I will send a patch momentarily.


I'm attaching a patch that works OK for me here.  WDYT?

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

From 219ed0823fdc0596be2ba79358b2fd22c2d5e333 Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>

Date: Thu, 13 Feb 2020 22:51:23 -0500
Subject: [PATCH] Adjust gdb_server_prog to the new gdbserver location

This patch adjusts 'gdb_server_prog' (from
testsuite/boards/gdbserver-base.exp) to point to the new location
where gdbserver lives.  This "unbreaks" the
native{,-extended}-gdbserver boards.

gdb/testsuite/ChangeLog:
2020-02-14  Sergio Durigan Junior  <sergiodj@redhat.com>

	* boards/gdbserver-base.exp: Adjust 'gdb_server_prog'.
---
 gdb/testsuite/boards/gdbserver-base.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/boards/gdbserver-base.exp b/gdb/testsuite/boards/gdbserver-base.exp
index 4db834dd84..f27a2fdf91 100644
--- a/gdb/testsuite/boards/gdbserver-base.exp
+++ b/gdb/testsuite/boards/gdbserver-base.exp
@@ -22,7 +22,7 @@ process_multilib_options ""
 set_board_info compiler "[find_gcc]"
 
 # Test the copy of gdbserver in the build directory.
-set_board_info gdb_server_prog "[pwd]/../gdbserver/gdbserver"
+set_board_info gdb_server_prog "[pwd]/../../gdbserver/gdbserver"
 
 # gdbserver does not intercept target file operations and perform them
 # on the host.
-- 
2.21.0
Tom Tromey Feb. 14, 2020, 6:37 p.m. | #31
>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:


Sergio> I'm attaching a patch that works OK for me here.  WDYT?

This one includes that:

https://sourceware.org/ml/gdb-patches/2020-02/msg00426.html

I see that Luis responded.  I'll read that and see what's up.

Tom
Tom Tromey Feb. 14, 2020, 9:14 p.m. | #32
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:


>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> I'm attaching a patch that works OK for me here.  WDYT?

Tom> This one includes that:

Tom> https://sourceware.org/ml/gdb-patches/2020-02/msg00426.html

Tom> I see that Luis responded.  I'll read that and see what's up.

I'm going to check it in now.

Tom
Luis Machado Feb. 17, 2020, 1:58 p.m. | #33
Hi Tom,

On 2/14/20 6:14 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

> 

>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

> Sergio> I'm attaching a patch that works OK for me here.  WDYT?

> 

> Tom> This one includes that:

> 

> Tom> https://sourceware.org/ml/gdb-patches/2020-02/msg00426.html

> 

> Tom> I see that Luis responded.  I'll read that and see what's up.

> 

> I'm going to check it in now.

> 

> Tom

> 


I ran into the following this morning...

make[2]: Entering directory 
'/home/luis.machado/work/tcwg/build/binutils-gdb-master/gdbserver'
make[2]: *** No rule to make target '../gnulib/import/libgnu.a', needed 
by 'gdbserver'.  Stop.

This was with a build using a configure line containing "--disable-gdb" 
but no "--disable-gdbserver".

Should --disable-gdb also imply --disable-gdbserver? Or should we be 
able to build gdbserver without building gdb (sounds a bit more complex)?
Maciej W. Rozycki Feb. 17, 2020, 2:21 p.m. | #34
On Mon, 17 Feb 2020, Luis Machado wrote:

> Should --disable-gdb also imply --disable-gdbserver? Or should we be 

> able to build gdbserver without building gdb (sounds a bit more complex)?


 Nope, `--disable-gdb --enable-gdbserver' is typical for a cross-debug 
environment, where you want to configure and build cross-GDB with 
`--host=foo --target=bar' and `gdbserver' with `--host=bar'.  Sometimes 
your build environment may not even be capable to build native GDB with 
`--host=bar', or your target system to run it, and in any case building 
GDB takes a lot of processing time compared to `gdbserver'.  So it would 
be a waste of resources if we forced people to do that.

 I build `gdbserver' by itself routinely, although I only did the minimum 
to convert from the old layout, that is rather than calling `configure' 
from gdb/gdbserver/ I now call it from gdbserver/.  So far it has worked, 
although with the new arrangement it probably qualifies as a hack, and may 
stop working sometime.

  Maciej
Luis Machado Feb. 17, 2020, 2:29 p.m. | #35
On 2/17/20 11:21 AM, Maciej W. Rozycki wrote:
> On Mon, 17 Feb 2020, Luis Machado wrote:

> 

>> Should --disable-gdb also imply --disable-gdbserver? Or should we be

>> able to build gdbserver without building gdb (sounds a bit more complex)?

> 

>   Nope, `--disable-gdb --enable-gdbserver' is typical for a cross-debug

> environment, where you want to configure and build cross-GDB with

> `--host=foo --target=bar' and `gdbserver' with `--host=bar'.  Sometimes

> your build environment may not even be capable to build native GDB with

> `--host=bar', or your target system to run it, and in any case building

> GDB takes a lot of processing time compared to `gdbserver'.  So it would

> be a waste of resources if we forced people to do that.


Well, that is a fair point. In which case i think we have a bug in our 
hands.

> 

>   I build `gdbserver' by itself routinely, although I only did the minimum

> to convert from the old layout, that is rather than calling `configure'

> from gdb/gdbserver/ I now call it from gdbserver/.  So far it has worked,

> although with the new arrangement it probably qualifies as a hack, and may

> stop working sometime.

> 

>    Maciej

>
Luis Machado Feb. 17, 2020, 4:57 p.m. | #36
On 2/17/20 10:58 AM, Luis Machado wrote:
> Hi Tom,

> 

> On 2/14/20 6:14 PM, Tom Tromey wrote:

>>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

>>

>>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

>> Sergio> I'm attaching a patch that works OK for me here.  WDYT?

>>

>> Tom> This one includes that:

>>

>> Tom> https://sourceware.org/ml/gdb-patches/2020-02/msg00426.html

>>

>> Tom> I see that Luis responded.  I'll read that and see what's up.

>>

>> I'm going to check it in now.

>>

>> Tom

>>

> 

> I ran into the following this morning...

> 

> make[2]: Entering directory 

> '/home/luis.machado/work/tcwg/build/binutils-gdb-master/gdbserver'

> make[2]: *** No rule to make target '../gnulib/import/libgnu.a', needed 

> by 'gdbserver'.  Stop.

> 

> This was with a build using a configure line containing "--disable-gdb" 

> but no "--disable-gdbserver".

> 

> Should --disable-gdb also imply --disable-gdbserver? Or should we be 

> able to build gdbserver without building gdb (sounds a bit more complex)?


Meanwhile, thanks to Christian, i've confirmed that adding a similar 
block to configure.ac, like this one:

# gdb depends on gnulib and gdbsupport, but as nothing else does, only
# include them if gdb is built.
if echo " ${configdirs} " | grep " gdb " > /dev/null 2>&1 ; then
   # The Makefile provides the ordering, so it's enough here to add to
   # the list.
   configdirs="${configdirs} gnulib gdbsupport"
fi


... fixes the problem for gdbserver as well.
Tom Tromey Feb. 17, 2020, 4:59 p.m. | #37
>>>>> "Luis" == Luis Machado <luis.machado@linaro.org> writes:


Luis> Should --disable-gdb also imply --disable-gdbserver? Or should we be
Luis> able to build gdbserver without building gdb (sounds a bit more
Luis> complex)?

We should, it was historically supported and preserving this ability is
one of the goals of the series.

Thanks for the report.  I missed a spot in configure.ac and I will be
pushing a fix shortly.

Tom
Tankut Baris Aktemur Feb. 17, 2020, 5:27 p.m. | #38
On Monday, February 17, 2020 6:00 PM, Tom Tromey wrote:
> >>>>> "Luis" == Luis Machado <luis.machado@linaro.org> writes:

> 

> Luis> Should --disable-gdb also imply --disable-gdbserver? Or should we be

> Luis> able to build gdbserver without building gdb (sounds a bit more

> Luis> complex)?

> 

> We should, it was historically supported and preserving this ability is

> one of the goals of the series.

> 

> Thanks for the report.  I missed a spot in configure.ac and I will be

> pushing a fix shortly.

> 

> Tom


It used to be possible to build gdbserver by directly using its configure.
E.g.: path/to/gdbserver/configure, as shown here:
https://sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver

Is this not a use-case anymore?

Thanks.
-Baris


Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
Tom Tromey Feb. 17, 2020, 6:46 p.m. | #39
>>>>> ">" == Aktemur, Tankut Baris <tankut.baris.aktemur@intel.com> writes:


>> It used to be possible to build gdbserver by directly using its configure.

>> E.g.: path/to/gdbserver/configure, as shown here:

>> https://sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver


>> Is this not a use-case anymore?


It is still possible to build just gdbserver, but the approach is
different now.  The documentation was updated as part of this switch.

The new approach is to configure as usual, possibly disabling gdb as
well, and then use "make all-gdbserver".  I do it like:

    ../binutils-gdb/configure --disable-{binutils,gas,gold,gprof,ld,gdb}
    make all-gdbserver

Plain "make" can also be used, but some unnecessary libraries will still
be built -- that's why we recommend all-gdbserver.  It might be good to
also disable these libraries if no "deliverable" depends on them, but as
that's a top-level change, it requires some more thought.

Tom

Patch

diff --git a/ChangeLog b/ChangeLog
index e75c8c249c9..924fc0eae73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@ 
+2020-01-19  Tom Tromey  <tom@tromey.com>
+
+	* src-release.sh (GDB_SUPPORT_DIRS): Add gdbserver.
+	* gdbserver: New directory, moved from gdb/gdbserver.
+	* configure.ac (host_tools): Add gdbserver.
+	Only build gdbserver on certain systems.
+	* Makefile.in, configure: Rebuild.
+	* Makefile.def (host_modules, dependencies): Add gdbserver.
+	* MAINTAINERS: Add gdbserver.
+
 2020-01-18  Nick Clifton  <nickc@redhat.com>
 
 	Binutils 2.34 branch created.
diff --git a/MAINTAINERS b/MAINTAINERS
index 805f2e3ac43..5b8a4efbdf6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -41,7 +41,7 @@  config.guess; config.sub; readline/support/config.{sub,guess}
 depcomp; mkinstalldirs
         Send bug reports and patches to bug-automake@gnu.org.
 
-gdb/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
+gdb/; gdbserver/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
 	GDB: http://www.gnu.org/software/gdb/
 	Patches to gdb-patches@sourceware.org.
 	See also gdb/MAINTAINERS and sim/MAINTAINERS.
diff --git a/Makefile.def b/Makefile.def
index 253eb45ef14..de35083d81e 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -114,6 +114,7 @@  host_modules= { module= zlib; no_install=true; no_check=true;
 	        extra_configure_flags='@extra_host_zlib_configure_flags@';};
 host_modules= { module= gnulib; };
 host_modules= { module= gdbsupport; };
+host_modules= { module= gdbserver; };
 host_modules= { module= gdb; };
 host_modules= { module= expect; };
 host_modules= { module= guile; };
@@ -409,6 +410,12 @@  dependencies = { module=all-gdb; on=all-libdecnumber; };
 dependencies = { module=all-gdb; on=all-libtermcap; };
 dependencies = { module=all-gdb; on=all-libctf; };
 
+// Host modules specific to gdbserver.
+dependencies = { module=configure-gdbserver; on=all-intl; };
+// Depend on all-libiconv so that configure checks for iconv
+// functions will work.
+dependencies = { module=configure-gdbserver; on=all-libiconv; };
+
 dependencies = { module=configure-libgui; on=configure-tcl; };
 dependencies = { module=configure-libgui; on=configure-tk; };
 dependencies = { module=all-libgui; on=all-tcl; };
diff --git a/configure.ac b/configure.ac
index 4bd869a63a9..aef6ca74dcf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,7 +140,7 @@  host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr
 # binutils, gas and ld appear in that order because it makes sense to run
 # "make check" in that particular order.
 # If --enable-gold is used, "gold" may replace "ld".
-host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
+host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools"
 
 # these libraries are built for the target environment, and are built after
 # the host libraries and the host tools (which may be a cross compiler)
@@ -782,6 +782,110 @@  case "${target}" in
     ;;
 esac
 
+# Only allow gdbserver on some systems.
+build_gdbserver=
+case "$host" in
+aarch64*-*-linux*)
+	# Target: AArch64 linux
+	build_gdbserver=yes
+	;;
+
+arm*-wince-pe | arm*-*-mingw32ce*)
+	# Target: ARM based machine running Windows CE (win32)
+	build_gdbserver=yes
+	;;
+arm*-*-linux*)
+	# Target: ARM based machine running GNU/Linux
+	build_gdbserver=yes
+	;;
+bfin-*-*linux*)
+	# Target: Blackfin Linux
+	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"
+	build_gdbserver=yes
+	;;
+i[34567]86-*-nto*)
+	# Target: Intel 386 running qnx6.
+	build_gdbserver=yes
+	;;
+i[34567]86-*-linux*)
+	# Target: Intel 386 running GNU/Linux
+	build_gdbserver=yes
+	;;
+i[34567]86-*-cygwin*)
+	# Target: Intel 386 running win32
+	build_gdbserver=yes
+	;;
+i[34567]86-*-mingw32*)
+	# Target: Intel 386 running win32
+	build_gdbserver=yes
+	;;
+ia64-*-linux*)
+	# Target: Intel IA-64 running GNU/Linux
+	build_gdbserver=yes
+	;;
+m32r*-*-linux*)
+	# Target: Renesas M32R running GNU/Linux
+	build_gdbserver=yes
+	;;
+m68*-*-linux*)
+	# Target: Motorola m68k with a.out and ELF
+	build_gdbserver=yes
+	;;
+mips*-*-linux*)
+	# Target: Linux/MIPS
+	build_gdbserver=yes
+	;;
+or1k*-*-linux*)
+	# Target: OpenCores OpenRISC 1000 32-bit running Linux
+	build_gdbserver=yes
+	;;
+
+powerpc*-*-linux*)
+	# Target: PowerPC running Linux
+	build_gdbserver=yes
+	;;
+s390*-*-linux*)
+	# Target: S390 running Linux
+	build_gdbserver=yes
+	;;
+score-*-*)
+	# Target: S+core embedded system
+	build_gdbserver=yes
+	;;
+sh*-*-linux*)
+	# Target: GNU/Linux Super-H
+	build_gdbserver=yes
+	;;
+sparc-*-linux*)
+	# Target: GNU/Linux SPARC
+	build_gdbserver=yes
+	;;
+sparc64-*-linux*)
+	# Target: GNU/Linux UltraSPARC
+	build_gdbserver=yes
+	;;
+tilegx-*-linux*)
+	# Target: TILE-Gx
+	build_gdbserver=yes
+	;;
+x86_64-*-linux*)
+	# Target: GNU/Linux x86-64
+	build_gdbserver=yes
+	;;
+x86_64-*-mingw* | x86_64-*-cygwin*)
+        # Target: MingW/amd64
+	build_gdbserver=yes
+        ;;
+xtensa*-*-*linux*)
+	# Target: GNU/Linux Xtensa
+	build_gdbserver=yes
+	;;
+esac
+
+if test "x$build_gdbserver" = x; then
+  noconfigdirs="$noconfigdirs gdbserver"
+fi
+
 # Disable libgo for some systems where it is known to not work.
 # For testing, you can easily override this with --enable-libgo.
 if test x$enable_libgo = x; then
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f7798def4fb..ddc8fd467d9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@ 
+2020-01-19  Tom Tromey  <tom@tromey.com>
+
+	* gdbserver: Move to top level.
+	* configure.tgt (build_gdbserver): Remove.
+	* configure.ac: Remove --enable-gdbserver.
+	* configure: Rebuild.
+	* Makefile.in (distclean): Don't mention gdbserver.
+
 2020-01-19  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* linux-fork.c (one_fork_p): Simplify.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 45d1586e85e..49fff371337 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1898,13 +1898,8 @@  clean mostlyclean: $(CONFIG_CLEAN)
 # I believe this is wrong; the makefile standards for distclean just
 # describe removing files; the only sort of "re-create a distribution"
 # functionality described is if the distributed files are unmodified.
-# NB: While GDBSERVER might be configured on native systems, it isn't
-# always included in SUBDIRS.  Remove the gdbserver files explicitly.
 distclean: clean
 	@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(CLEANDIRS)" subdir_do
-	rm -f gdbserver/config.status gdbserver/config.log
-	rm -f gdbserver/tm.h gdbserver/xm.h gdbserver/nm.h
-	rm -f gdbserver/Makefile gdbserver/config.cache
 	rm -f nm.h config.status config.h stamp-h b jit-reader.h
 	rm -f gdb-gdb.py gdb-gdb.gdb
 	rm -f y.output yacc.acts yacc.tmp y.tab.h
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 0ca169101b3..335971fdf66 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -254,7 +254,6 @@  AC_SUBST(HAVE_NATIVE_GCORE_TARGET)
 # For other settings, only the main target counts.
 gdb_sim=
 gdb_osabi=
-build_gdbserver=
 targ=$target; . ${srcdir}/configure.tgt
 
 # Fetch the default architecture and default target vector from BFD.
@@ -2001,33 +2000,6 @@  if test x"${gdb_osabi}" != x ; then
 		       [Define to the default OS ABI for this configuration.])
 fi
 
-AC_ARG_ENABLE(gdbserver,
-AS_HELP_STRING([--enable-gdbserver],
-               [automatically build gdbserver (yes/no/auto, default is auto)]),
-[case "${enableval}" in
-  yes| no|auto) ;;
-  *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbserver option) ;;
-esac],[enable_gdbserver=auto])
-
-# We only build gdbserver automatically in a native configuration, and
-# only if the user did not explicitly disable its build.
-if test "$gdb_native" = "yes" -a "$enable_gdbserver" != "no"; then
-  AC_MSG_CHECKING(whether gdbserver is supported on this host)
-  if test "x$build_gdbserver" = xyes; then
-    AC_MSG_RESULT(yes)
-    AC_CONFIG_SUBDIRS(gdbserver)
-    gdbserver_build_enabled=yes
-  else
-    AC_MSG_RESULT(no)
-  fi
-fi
-
-# If the user explicitly request the gdbserver to be built, verify that
-# we were in fact able to enable it.
-if test "$enable_gdbserver" = "yes" -a "$gdbserver_build_enabled" != "yes"; then
-  AC_MSG_ERROR(Automatic gdbserver build is not supported for this configuration)
-fi
-
 # Check for babeltrace and babeltrace-ctf
 AC_ARG_WITH(babeltrace,
   AC_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index ab4c098c0da..755187dca65 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -5,7 +5,6 @@ 
 #  gdb_target_obs	target-specific object files to use
 #  gdb_sim		simulator library for target
 #  gdb_osabi		default OS ABI to use with target
-#  build_gdbserver	set to "yes" if gdbserver supports target
 #  gdb_have_gcore	set to "true"/"false" if this target can run gcore
 
 # NOTE: Every file added to a gdb_target_obs variable for any target here
@@ -129,7 +128,6 @@  aarch64*-*-linux*)
 			arm-tdep.o arm-linux-tdep.o \
 			glibc-tdep.o linux-tdep.o solib-svr4.o \
 			symfile-mem.o linux-record.o"
-	build_gdbserver=yes
 	;;
 
 alpha*-*-linux*)
@@ -162,13 +160,11 @@  arc*-*-elf32)
 arm*-wince-pe | arm*-*-mingw32ce*)
 	# Target: ARM based machine running Windows CE (win32)
 	gdb_target_obs="arm-wince-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 arm*-*-linux*)
 	# Target: ARM based machine running GNU/Linux
 	gdb_target_obs="arch/arm-linux.o arm-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
-	build_gdbserver=yes
 	;;
 arm*-*-freebsd*)
 	# Target: FreeBSD/arm
@@ -202,7 +198,6 @@  bfin-*-*linux*)
 	# Target: Blackfin Linux
 	gdb_target_obs="bfin-tdep.o bfin-linux-tdep.o linux-tdep.o"
 	gdb_sim=../sim/bfin/libsim.a
-	build_gdbserver=yes
 	;;
 bfin-*-*)
 	# Target: Blackfin processor
@@ -285,7 +280,6 @@  i[34567]86-*-nto*)
 	# Target: Intel 386 running qnx6.
 	gdb_target_obs="solib-svr4.o \
 			i386-nto-tdep.o nto-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-solaris2* | x86_64-*-solaris2*)
 	# Target: Solaris x86_64
@@ -303,7 +297,6 @@  i[34567]86-*-linux*)
 	    # Target: GNU/Linux x86-64
 	    gdb_target_obs="amd64-linux-tdep.o ${gdb_target_obs}"
 	fi
-	build_gdbserver=yes
 	;;
 i[34567]86-*-gnu*)
 	# Target: Intel 386 running the GNU Hurd
@@ -312,12 +305,10 @@  i[34567]86-*-gnu*)
 i[34567]86-*-cygwin*)
 	# Target: Intel 386 running win32
 	gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-mingw32*)
 	# Target: Intel 386 running win32
 	gdb_target_obs="i386-cygwin-tdep.o windows-tdep.o"
-	build_gdbserver=yes
 	;;
 i[34567]86-*-go32* | i[34567]86-*-msdosdjgpp*)
 	# Target: i386 running DJGPP/go32.
@@ -328,7 +319,6 @@  ia64-*-linux*)
 	# Target: Intel IA-64 running GNU/Linux
 	gdb_target_obs="ia64-linux-tdep.o linux-tdep.o \
 			solib-svr4.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 ia64-*-*vms*)
 	# Target: Intel IA-64 running OpenVMS
@@ -359,7 +349,6 @@  m32r*-*-linux*)
 			glibc-tdep.o solib-svr4.o symfile-mem.o \
 			linux-tdep.o"
 	gdb_sim=../sim/m32r/libsim.a
-	build_gdbserver=yes
 	;;
 m32r*-*-*)
 	# Target: Renesas m32r processor
@@ -382,7 +371,6 @@  m68*-*-linux*)
 	# Target: Motorola m68k with a.out and ELF
 	gdb_target_obs="m68k-tdep.o m68k-linux-tdep.o solib-svr4.o \
 			linux-tdep.o glibc-tdep.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
 	# Target: NetBSD/m68k
@@ -416,7 +404,6 @@  mips*-*-linux*)
 	gdb_target_obs="mips-tdep.o mips-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o"
 	gdb_sim=../sim/mips/libsim.a
-	build_gdbserver=yes
 	;;
 mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
 	# Target: MIPS running NetBSD
@@ -480,7 +467,6 @@  or1k*-*-linux*)
 	gdb_target_obs="or1k-tdep.o or1k-linux-tdep.o solib-svr4.o \
 			symfile-mem.o glibc-tdep.o linux-tdep.o"
 	gdb_sim=../sim/or1k/libsim.a
-	build_gdbserver=yes
 	;;
 
 or1k-*-* | or1knd-*-*)
@@ -522,7 +508,6 @@  powerpc*-*-linux*)
 			linux-record.o \
 			arch/ppc-linux-common.o"
 	gdb_sim=../sim/ppc/libsim.a
-	build_gdbserver=yes
 	;;
 powerpc-*-lynx*178)
 	# Target: PowerPC running Lynx178.
@@ -541,7 +526,6 @@  s390*-*-linux*)
 	# Target: S390 running Linux
 	gdb_target_obs="s390-linux-tdep.o s390-tdep.o solib-svr4.o \
 			linux-tdep.o linux-record.o symfile-mem.o"
-	build_gdbserver=yes
 	;;
 
 riscv*-*-freebsd*)
@@ -575,7 +559,6 @@  rx-*-elf)
 score-*-*)
 	# Target: S+core embedded system
 	gdb_target_obs="score-tdep.o"
-	build_gdbserver=yes
 	;;
 
 sh*-*-linux*)
@@ -584,7 +567,6 @@  sh*-*-linux*)
 			solib-svr4.o symfile-mem.o \
 			glibc-tdep.o linux-tdep.o"
 	gdb_sim=../sim/sh/libsim.a
-	build_gdbserver=yes
 	;;
 sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
 	# Target: NetBSD/sh
@@ -612,7 +594,6 @@  sparc-*-linux*)
 	    gdb_target_obs="sparc64-tdep.o sparc64-sol2-tdep.o \
 			    sparc64-linux-tdep.o ${gdb_target_obs}"
 	fi
-	build_gdbserver=yes
 	;;
 sparc64-*-linux*)
 	# Target: GNU/Linux UltraSPARC
@@ -620,7 +601,6 @@  sparc64-*-linux*)
 			sparc64-linux-tdep.o sparc-tdep.o sparc-sol2-tdep.o \
 			sparc-linux-tdep.o solib-svr4.o linux-tdep.o \
 			ravenscar-thread.o sparc-ravenscar-thread.o"
-	build_gdbserver=yes
 	;;
 sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
 	# Target: FreeBSD/sparc64
@@ -689,7 +669,6 @@  tilegx-*-linux*)
 	# Target: TILE-Gx
 	gdb_target_obs="tilegx-tdep.o tilegx-linux-tdep.o solib-svr4.o \
 			symfile-mem.o glibc-tdep.o linux-tdep.o"
-	build_gdbserver=yes
 	;;
 
 xstormy16-*-*)
@@ -742,7 +721,6 @@  x86_64-*-linux*)
 	gdb_target_obs="amd64-linux-tdep.o ${i386_tobjs}  \
 			i386-linux-tdep.o glibc-tdep.o \
 			solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o"
-	build_gdbserver=yes
 	;;
 x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
 	# Target: FreeBSD/amd64
@@ -754,7 +732,6 @@  x86_64-*-mingw* | x86_64-*-cygwin*)
 	gdb_target_obs="amd64-windows-tdep.o \
                         ${i386_tobjs} i386-cygwin-tdep.o \
                         windows-tdep.o"
-	build_gdbserver=yes
         ;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
 	# Target: NetBSD/amd64
@@ -772,7 +749,6 @@  x86_64-*-rtems*)
 xtensa*-*-*linux*)
 	# Target: GNU/Linux Xtensa
 	gdb_target_obs="xtensa-linux-tdep.o symfile-mem.o linux-tdep.o"
-	build_gdbserver=yes
 	;;
 
 esac
diff --git a/gdb/gdbserver/.gitignore b/gdbserver/.gitignore
similarity index 100%
rename from gdb/gdbserver/.gitignore
rename to gdbserver/.gitignore
diff --git a/gdb/gdbserver/ChangeLog b/gdbserver/ChangeLog
similarity index 99%
rename from gdb/gdbserver/ChangeLog
rename to gdbserver/ChangeLog
index e5c05fa4ee3..9f2a701d173 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,16 @@ 
+2020-01-19  Tom Tromey  <tom@tromey.com>
+
+	* configure.ac: Update paths.
+	* configure: Rebuild.
+	* acinclude.m4: Update paths.
+	* Makefile.in: Update include paths.
+	(depcomp, INCLUDE_DIR, INCGNU, INCSUPPORT, INCLUDE_CFLAGS)
+	(SFILES, XML_DIR, n, $(GNULIB_BUILDDIR)/Makefile, config.status)
+	(version-generated.c, stamp-xml, regdat_sh, arch/%-ipa.o)
+	(gdbsupport/%-ipa.o, %-ipa.o, arch/%.o, gdbsupport/%.o, %.o)
+	(%-generated.c): Update paths.
+	* Move entire directory from ../gdb/gdbserver.
+
 2020-01-14  Tom Tromey  <tom@tromey.com>
 
 	* configure: Rebuild.
diff --git a/gdb/gdbserver/Makefile.in b/gdbserver/Makefile.in
similarity index 87%
rename from gdb/gdbserver/Makefile.in
rename to gdbserver/Makefile.in
index 38f30a02770..902d54cfe58 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -62,7 +62,7 @@  AR_FLAGS = rc
 # Dependency tracking information.
 DEPMODE = @CCDEPMODE@
 DEPDIR = @DEPDIR@
-depcomp = $(SHELL) $(srcdir)/../../depcomp
+depcomp = $(SHELL) $(srcdir)/../depcomp
 
 # Directory containing source files.  Don't clean up the spacing,
 # this exact string is matched for by the "configure" script.
@@ -71,7 +71,7 @@  abs_top_srcdir = @abs_top_srcdir@
 abs_srcdir = @abs_srcdir@
 VPATH = @srcdir@
 
-include $(srcdir)/../silent-rules.mk
+include $(srcdir)/../gdb/silent-rules.mk
 
 # Note that these are overridden by GNU make-specific code below if
 # GNU make is used.  The overrides implement dependency tracking.
@@ -90,7 +90,7 @@  POSTCOMPILE = @true
 CC_LD = $(CXX) $(CXX_DIALECT)
 
 # Where is the "include" directory?  Traditionally ../include or ./include
-INCLUDE_DIR = ${srcdir}/../../include
+INCLUDE_DIR = ${srcdir}/../include
 INCLUDE_DEP = $$(INCLUDE_DIR)
 
 LIBIBERTY_BUILDDIR = build-libiberty-gdbserver
@@ -103,26 +103,26 @@  ustinc = @ustinc@
 # gnulib
 GNULIB_BUILDDIR = build-gnulib-gdbserver
 LIBGNU = $(GNULIB_BUILDDIR)/import/libgnu.a
-INCGNU = -I$(srcdir)/../../gnulib/import -I$(GNULIB_BUILDDIR)/import
+INCGNU = -I$(srcdir)/../gnulib/import -I$(GNULIB_BUILDDIR)/import
 
 # Generated headers in the gnulib directory.  These must be listed
 # so that they are generated before other files are compiled.
 GNULIB_H = $(GNULIB_BUILDDIR)/import/string.h @GNULIB_STDINT_H@
 
-INCSUPPORT = -I$(srcdir)/../.. -I../..
+INCSUPPORT = -I$(srcdir)/.. -I..
 
 # All the includes used for CFLAGS and for lint.
 # -I. for config files.
 # -I${srcdir} for our headers.
-# -I$(srcdir)/../regformats for regdef.h.
+# -I$(srcdir)/../gdb/regformats for regdef.h.
 #
 # We do not include ../target or ../nat in here because headers
 # in those directories should be included with the subdirectory.
 # e.g.: "target/wait.h".
 #
 INCLUDE_CFLAGS = -I. -I${srcdir} \
-	-I$(srcdir)/../regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
-	$(INCGNU) $(INCSUPPORT)
+	-I$(srcdir)/../gdb/regformats -I$(srcdir)/.. -I$(INCLUDE_DIR) \
+	-I$(srcdir)/../gdb $(INCGNU) $(INCSUPPORT)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
 # from the config/ directory.
@@ -202,33 +202,33 @@  SFILES = \
 	$(srcdir)/arch/arm-get-next-pcs.c \
 	$(srcdir)/arch/arm-linux.c \
 	$(srcdir)/arch/ppc-linux-common.c \
-	$(srcdir)/../alloc.c \
-	$(srcdir)/../../gdbsupport/btrace-common.c \
-	$(srcdir)/../../gdbsupport/buffer.c \
-	$(srcdir)/../../gdbsupport/cleanups.c \
-	$(srcdir)/../../gdbsupport/common-debug.c \
-	$(srcdir)/../../gdbsupport/common-exceptions.c \
-	$(srcdir)/../../gdbsupport/common-inferior.c \
-	$(srcdir)/../../gdbsupport/common-regcache.c \
-	$(srcdir)/../../gdbsupport/common-utils.c \
-	$(srcdir)/../../gdbsupport/errors.c \
-	$(srcdir)/../../gdbsupport/environ.c \
-	$(srcdir)/../../gdbsupport/fileio.c \
-	$(srcdir)/../../gdbsupport/filestuff.c \
-	$(srcdir)/../../gdbsupport/job-control.c \
-	$(srcdir)/../../gdbsupport/gdb-dlfcn.c \
-	$(srcdir)/../../gdbsupport/gdb_tilde_expand.c \
-	$(srcdir)/../../gdbsupport/gdb_vecs.c \
-	$(srcdir)/../../gdbsupport/gdb_wait.c \
-	$(srcdir)/../../gdbsupport/netstuff.c \
-	$(srcdir)/../../gdbsupport/new-op.c \
-	$(srcdir)/../../gdbsupport/pathstuff.c \
-	$(srcdir)/../../gdbsupport/print-utils.c \
-	$(srcdir)/../../gdbsupport/ptid.c \
-	$(srcdir)/../../gdbsupport/rsp-low.c \
-	$(srcdir)/../../gdbsupport/safe-strerror.c \
-	$(srcdir)/../../gdbsupport/tdesc.c \
-	$(srcdir)/../../gdbsupport/xml-utils.c \
+	$(srcdir)/../gdb/alloc.c \
+	$(srcdir)/../gdbsupport/btrace-common.c \
+	$(srcdir)/../gdbsupport/buffer.c \
+	$(srcdir)/../gdbsupport/cleanups.c \
+	$(srcdir)/../gdbsupport/common-debug.c \
+	$(srcdir)/../gdbsupport/common-exceptions.c \
+	$(srcdir)/../gdbsupport/common-inferior.c \
+	$(srcdir)/../gdbsupport/common-regcache.c \
+	$(srcdir)/../gdbsupport/common-utils.c \
+	$(srcdir)/../gdbsupport/errors.c \
+	$(srcdir)/../gdbsupport/environ.c \
+	$(srcdir)/../gdbsupport/fileio.c \
+	$(srcdir)/../gdbsupport/filestuff.c \
+	$(srcdir)/../gdbsupport/job-control.c \
+	$(srcdir)/../gdbsupport/gdb-dlfcn.c \
+	$(srcdir)/../gdbsupport/gdb_tilde_expand.c \
+	$(srcdir)/../gdbsupport/gdb_vecs.c \
+	$(srcdir)/../gdbsupport/gdb_wait.c \
+	$(srcdir)/../gdbsupport/netstuff.c \
+	$(srcdir)/../gdbsupport/new-op.c \
+	$(srcdir)/../gdbsupport/pathstuff.c \
+	$(srcdir)/../gdbsupport/print-utils.c \
+	$(srcdir)/../gdbsupport/ptid.c \
+	$(srcdir)/../gdbsupport/rsp-low.c \
+	$(srcdir)/../gdbsupport/safe-strerror.c \
+	$(srcdir)/../gdbsupport/tdesc.c \
+	$(srcdir)/../gdbsupport/xml-utils.c \
 	$(srcdir)/nat/aarch64-sve-linux-ptrace.c \
 	$(srcdir)/nat/linux-btrace.c \
 	$(srcdir)/nat/linux-namespaces.c \
@@ -318,7 +318,7 @@  XM_CLIBS = @LIBS@
 CDEPS = $(srcdir)/proc-service.list
 
 # XML files to compile in to gdbserver, if any.
-XML_DIR = $(srcdir)/../features
+XML_DIR = $(srcdir)/../gdb/features
 XML_FILES = @srv_xmlfiles@
 XML_BUILTIN = @srv_xmlbuiltin@
 
@@ -384,10 +384,10 @@  install-only:
 	n=`echo gdbserver | sed '$(program_transform_name)'`; \
 	if [ x$$n = x ]; then n=gdbserver; else true; fi; \
 	if [ x"$(IPA_DEPFILES)" != x ]; then \
-		$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir); \
+		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(libdir); \
 		$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
 	fi; \
-	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
+	$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir); \
 	$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
 	# Note that we run install and not install-only, as the latter
 	# is not part of GNU standards and in particular not provided
@@ -512,14 +512,14 @@  stamp-h: config.in config.status
 Makefile: Makefile.in config.status
 	$(SHELL) ./config.status $@
 
-$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../../gnulib/Makefile.in config.status
+$(GNULIB_BUILDDIR)/Makefile: $(srcdir)/../gnulib/Makefile.in config.status
 	  @cd $(GNULIB_BUILDDIR); CONFIG_FILES="Makefile" \
 	  CONFIG_COMMANDS="depfiles" \
 	  CONFIG_HEADERS= \
 	  CONFIG_LINKS= \
 	  $(SHELL) config.status
 
-config.status: configure configure.srv $(srcdir)/../../bfd/development.sh
+config.status: configure configure.srv $(srcdir)/../bfd/development.sh
 	$(SHELL) ./config.status --recheck
 
 # automatic rebuilding in automake-generated Makefiles requires
@@ -531,8 +531,8 @@  am--refresh:
 
 force:
 
-version-generated.c: Makefile $(srcdir)/../version.in $(srcdir)/../../bfd/version.h $(srcdir)/../../gdbsupport/create-version.sh
-	$(ECHO_GEN) $(SHELL) $(srcdir)/../../gdbsupport/create-version.sh $(srcdir)/.. \
+version-generated.c: Makefile $(srcdir)/../gdb/version.in $(srcdir)/../bfd/version.h $(srcdir)/../gdbsupport/create-version.sh
+	$(ECHO_GEN) $(SHELL) $(srcdir)/../gdbsupport/create-version.sh $(srcdir)/../gdb \
 		$(host_alias) $(target_alias) $@
 
 xml-builtin-generated.c: stamp-xml; @true
@@ -540,7 +540,7 @@  stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
 	$(SILENCE) rm -f xml-builtin.tmp
 	$(ECHO_GEN_XML_BUILTIN_GENERATED) $(SHELL) $(XML_DIR)/feature_to_c.sh \
 		xml-builtin.tmp $(XML_FILES)
-	$(SILENCE) $(SHELL) $(srcdir)/../../move-if-change xml-builtin.tmp xml-builtin-generated.c
+	$(SILENCE) $(SHELL) $(srcdir)/../move-if-change xml-builtin.tmp xml-builtin-generated.c
 	$(SILENCE) echo stamp > stamp-xml
 
 .PRECIOUS: xml-builtin.c
@@ -556,7 +556,7 @@  stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
 # will remove them.
 MAKEOVERRIDES =
 
-regdat_sh = $(srcdir)/../regformats/regdat.sh
+regdat_sh = $(srcdir)/../gdb/regformats/regdat.sh
 
 UST_CFLAGS = $(ustinc) -DCONFIG_UST_GDB_INTEGRATION
 
@@ -586,11 +586,11 @@  ax.o: ax.c
 
 # Rules for objects that go in the in-process agent.
 
-arch/%-ipa.o: ../arch/%.c
+arch/%-ipa.o: ../gdb/arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%-ipa.o: ../../gdbsupport/%.c
+gdbsupport/%-ipa.o: ../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -602,7 +602,7 @@  gdbsupport/%-ipa.o: ../../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
-%-ipa.o: ../%.c
+%-ipa.o: ../gdb/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -619,11 +619,11 @@  gdbsupport/%-ipa.o: ../../gdbsupport/%.c
 
 # Rules for objects that go in the gdbserver binary.
 
-arch/%.o: ../arch/%.c
+arch/%.o: ../gdb/arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-gdbsupport/%.o: ../../gdbsupport/%.c
+gdbsupport/%.o: ../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
@@ -635,28 +635,28 @@  gdbsupport/%.o: ../../gdbsupport/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ../nat/%.c
+%.o: ../gdb/nat/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ../target/%.c
+%.o: ../gdb/target/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
-%.o: ../%.c
+%.o: ../gdb/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)
 
 # Rules for register format descriptions.  Suffix destination files with
 # -generated to identify and clean them easily.
 
-%-generated.c: ../regformats/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
-%-generated.c: ../regformats/arm/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/arm/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
-%-generated.c: ../regformats/rs6000/%.dat $(regdat_sh)
+%-generated.c: ../gdb/regformats/rs6000/%.dat $(regdat_sh)
 	$(ECHO_REGDAT) $(SHELL) $(regdat_sh) $< $@
 
 #
@@ -701,7 +701,7 @@  all_deps_files = $(foreach dep,$(patsubst %.o,%.Po,$(all_object_files)),\
 -include $(all_deps_files)
 
 # Disable implicit make rules.
-include $(srcdir)/../disable-implicit-rules.mk
+include $(srcdir)/../gdb/disable-implicit-rules.mk
 
 # Do not delete intermediate files (e.g. *-generated.c).
 .SECONDARY:
diff --git a/gdb/gdbserver/README b/gdbserver/README
similarity index 100%
rename from gdb/gdbserver/README
rename to gdbserver/README
diff --git a/gdb/gdbserver/acinclude.m4 b/gdbserver/acinclude.m4
similarity index 70%
rename from gdb/gdbserver/acinclude.m4
rename to gdbserver/acinclude.m4
index eba3a131315..7336d1f1c31 100644
--- a/gdb/gdbserver/acinclude.m4
+++ b/gdbserver/acinclude.m4
@@ -1,19 +1,19 @@ 
 dnl gdb/gdbserver/configure.in uses BFD_HAVE_SYS_PROCFS_TYPE.
-m4_include(../../bfd/bfd.m4)
+m4_include(../bfd/bfd.m4)
 
-m4_include(../acx_configure_dir.m4)
+m4_include(../gdb/acx_configure_dir.m4)
 
 # This gets AM_GDB_WARNINGS.
-m4_include(../warning.m4)
+m4_include(../gdb/warning.m4)
 
 dnl This gets autoconf bugfixes
-m4_include(../../config/override.m4)
+m4_include(../config/override.m4)
 
 dnl For ACX_PKGVERSION and ACX_BUGURL.
-m4_include(../../config/acx.m4)
+m4_include(../config/acx.m4)
 
-m4_include(../../config/depstand.m4)
-m4_include(../../config/lead-dot.m4)
+m4_include(../config/depstand.m4)
+m4_include(../config/lead-dot.m4)
 
 dnl Needed for common.m4
 dnl For AC_LIB_HAVE_LINKFLAGS.
@@ -22,21 +22,21 @@  m4_include(../../config/lib-prefix.m4)
 m4_include(../../config/lib-link.m4)
 dnl codeset.m4 is needed for common.m4, but not for
 dnl anything else in gdbserver.
-m4_include(../../config/codeset.m4)
-m4_include(../../gdbsupport/common.m4)
+m4_include(../config/codeset.m4)
+m4_include(../gdbsupport/common.m4)
 
 dnl For libiberty_INIT.
-m4_include(../libiberty.m4)
+m4_include(../gdb/libiberty.m4)
 
 dnl For GDB_AC_PTRACE.
-m4_include(../ptrace.m4)
+m4_include(../gdb/ptrace.m4)
 
-m4_include(../ax_cxx_compile_stdcxx.m4)
+m4_include(../gdb/ax_cxx_compile_stdcxx.m4)
 
 dnl For GDB_AC_SELFTEST.
-m4_include(../selftest.m4)
+m4_include(../gdb/selftest.m4)
 
-m4_include([../../config/ax_pthread.m4])
+m4_include([../config/ax_pthread.m4])
 
 dnl Check for existence of a type $1 in libthread_db.h
 dnl Based on BFD_HAVE_SYS_PROCFS_TYPE in bfd/bfd.m4.
diff --git a/gdb/gdbserver/aclocal.m4 b/gdbserver/aclocal.m4
similarity index 100%
rename from gdb/gdbserver/aclocal.m4
rename to gdbserver/aclocal.m4
diff --git a/gdb/gdbserver/ax.c b/gdbserver/ax.c
similarity index 100%
rename from gdb/gdbserver/ax.c
rename to gdbserver/ax.c
diff --git a/gdb/gdbserver/ax.h b/gdbserver/ax.h
similarity index 100%
rename from gdb/gdbserver/ax.h
rename to gdbserver/ax.h
diff --git a/gdb/gdbserver/config.in b/gdbserver/config.in
similarity index 100%
rename from gdb/gdbserver/config.in
rename to gdbserver/config.in
diff --git a/gdb/gdbserver/configure b/gdbserver/configure
similarity index 99%
rename from gdb/gdbserver/configure
rename to gdbserver/configure
diff --git a/gdb/gdbserver/configure.ac b/gdbserver/configure.ac
similarity index 98%
rename from gdb/gdbserver/configure.ac
rename to gdbserver/configure.ac
index 969354308c7..24b832b90e8 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -43,7 +43,7 @@  AX_CXX_COMPILE_STDCXX(11, , mandatory)
 AC_HEADER_STDC
 
 # Set the 'development' global.
-. $srcdir/../../bfd/development.sh
+. $srcdir/../bfd/development.sh
 
 GDB_AC_SELFTEST([
   srv_selftest_objs="gdbsupport/selftest.o"
@@ -79,10 +79,10 @@  fi
 # gdbserver/.  We need to build gnulib under some other directory not
 # "gnulib", to avoid the problem of both GDB and GDBserver wanting to
 # build it in the same directory, when building in the source dir.
-ACX_CONFIGURE_DIR(["../../gnulib"], ["build-gnulib-gdbserver"],
+ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"],
                   ["$gnulib_extra_configure_args"])
 
-ACX_CONFIGURE_DIR(["../../libiberty"], ["build-libiberty-gdbserver"])
+ACX_CONFIGURE_DIR(["../libiberty"], ["build-libiberty-gdbserver"])
 
 AC_CHECK_HEADERS(termios.h sys/reg.h string.h dnl
 		 sys/procfs.h linux/elf.h dnl
diff --git a/gdb/gdbserver/configure.srv b/gdbserver/configure.srv
similarity index 100%
rename from gdb/gdbserver/configure.srv
rename to gdbserver/configure.srv
diff --git a/gdb/gdbserver/debug.c b/gdbserver/debug.c
similarity index 100%
rename from gdb/gdbserver/debug.c
rename to gdbserver/debug.c
diff --git a/gdb/gdbserver/debug.h b/gdbserver/debug.h
similarity index 100%
rename from gdb/gdbserver/debug.h
rename to gdbserver/debug.h
diff --git a/gdb/gdbserver/dll.c b/gdbserver/dll.c
similarity index 100%
rename from gdb/gdbserver/dll.c
rename to gdbserver/dll.c
diff --git a/gdb/gdbserver/dll.h b/gdbserver/dll.h
similarity index 100%
rename from gdb/gdbserver/dll.h
rename to gdbserver/dll.h
diff --git a/gdb/gdbserver/event-loop.c b/gdbserver/event-loop.c
similarity index 100%
rename from gdb/gdbserver/event-loop.c
rename to gdbserver/event-loop.c
diff --git a/gdb/gdbserver/event-loop.h b/gdbserver/event-loop.h
similarity index 100%
rename from gdb/gdbserver/event-loop.h
rename to gdbserver/event-loop.h
diff --git a/gdb/gdbserver/fork-child.c b/gdbserver/fork-child.c
similarity index 100%
rename from gdb/gdbserver/fork-child.c
rename to gdbserver/fork-child.c
diff --git a/gdb/gdbserver/gdb_proc_service.h b/gdbserver/gdb_proc_service.h
similarity index 100%
rename from gdb/gdbserver/gdb_proc_service.h
rename to gdbserver/gdb_proc_service.h
diff --git a/gdb/gdbserver/gdbreplay.c b/gdbserver/gdbreplay.c
similarity index 100%
rename from gdb/gdbserver/gdbreplay.c
rename to gdbserver/gdbreplay.c
diff --git a/gdb/gdbserver/gdbthread.h b/gdbserver/gdbthread.h
similarity index 100%
rename from gdb/gdbserver/gdbthread.h
rename to gdbserver/gdbthread.h
diff --git a/gdb/gdbserver/hostio-errno.c b/gdbserver/hostio-errno.c
similarity index 100%
rename from gdb/gdbserver/hostio-errno.c
rename to gdbserver/hostio-errno.c
diff --git a/gdb/gdbserver/hostio.c b/gdbserver/hostio.c
similarity index 100%
rename from gdb/gdbserver/hostio.c
rename to gdbserver/hostio.c
diff --git a/gdb/gdbserver/hostio.h b/gdbserver/hostio.h
similarity index 100%
rename from gdb/gdbserver/hostio.h
rename to gdbserver/hostio.h
diff --git a/gdb/gdbserver/i387-fp.c b/gdbserver/i387-fp.c
similarity index 100%
rename from gdb/gdbserver/i387-fp.c
rename to gdbserver/i387-fp.c
diff --git a/gdb/gdbserver/i387-fp.h b/gdbserver/i387-fp.h
similarity index 100%
rename from gdb/gdbserver/i387-fp.h
rename to gdbserver/i387-fp.h
diff --git a/gdb/gdbserver/inferiors.c b/gdbserver/inferiors.c
similarity index 100%
rename from gdb/gdbserver/inferiors.c
rename to gdbserver/inferiors.c
diff --git a/gdb/gdbserver/inferiors.h b/gdbserver/inferiors.h
similarity index 100%
rename from gdb/gdbserver/inferiors.h
rename to gdbserver/inferiors.h
diff --git a/gdb/gdbserver/linux-aarch32-low.c b/gdbserver/linux-aarch32-low.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-low.c
rename to gdbserver/linux-aarch32-low.c
diff --git a/gdb/gdbserver/linux-aarch32-low.h b/gdbserver/linux-aarch32-low.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-low.h
rename to gdbserver/linux-aarch32-low.h
diff --git a/gdb/gdbserver/linux-aarch32-tdesc.c b/gdbserver/linux-aarch32-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-tdesc.c
rename to gdbserver/linux-aarch32-tdesc.c
diff --git a/gdb/gdbserver/linux-aarch32-tdesc.h b/gdbserver/linux-aarch32-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch32-tdesc.h
rename to gdbserver/linux-aarch32-tdesc.h
diff --git a/gdb/gdbserver/linux-aarch64-ipa.c b/gdbserver/linux-aarch64-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-ipa.c
rename to gdbserver/linux-aarch64-ipa.c
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdbserver/linux-aarch64-low.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-low.c
rename to gdbserver/linux-aarch64-low.c
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.c b/gdbserver/linux-aarch64-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-tdesc.c
rename to gdbserver/linux-aarch64-tdesc.c
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdbserver/linux-aarch64-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-aarch64-tdesc.h
rename to gdbserver/linux-aarch64-tdesc.h
diff --git a/gdb/gdbserver/linux-amd64-ipa.c b/gdbserver/linux-amd64-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-amd64-ipa.c
rename to gdbserver/linux-amd64-ipa.c
diff --git a/gdb/gdbserver/linux-arm-low.c b/gdbserver/linux-arm-low.c
similarity index 100%
rename from gdb/gdbserver/linux-arm-low.c
rename to gdbserver/linux-arm-low.c
diff --git a/gdb/gdbserver/linux-arm-tdesc.c b/gdbserver/linux-arm-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-arm-tdesc.c
rename to gdbserver/linux-arm-tdesc.c
diff --git a/gdb/gdbserver/linux-arm-tdesc.h b/gdbserver/linux-arm-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-arm-tdesc.h
rename to gdbserver/linux-arm-tdesc.h
diff --git a/gdb/gdbserver/linux-bfin-low.c b/gdbserver/linux-bfin-low.c
similarity index 100%
rename from gdb/gdbserver/linux-bfin-low.c
rename to gdbserver/linux-bfin-low.c
diff --git a/gdb/gdbserver/linux-cris-low.c b/gdbserver/linux-cris-low.c
similarity index 100%
rename from gdb/gdbserver/linux-cris-low.c
rename to gdbserver/linux-cris-low.c
diff --git a/gdb/gdbserver/linux-crisv32-low.c b/gdbserver/linux-crisv32-low.c
similarity index 100%
rename from gdb/gdbserver/linux-crisv32-low.c
rename to gdbserver/linux-crisv32-low.c
diff --git a/gdb/gdbserver/linux-i386-ipa.c b/gdbserver/linux-i386-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-i386-ipa.c
rename to gdbserver/linux-i386-ipa.c
diff --git a/gdb/gdbserver/linux-ia64-low.c b/gdbserver/linux-ia64-low.c
similarity index 100%
rename from gdb/gdbserver/linux-ia64-low.c
rename to gdbserver/linux-ia64-low.c
diff --git a/gdb/gdbserver/linux-low.c b/gdbserver/linux-low.c
similarity index 100%
rename from gdb/gdbserver/linux-low.c
rename to gdbserver/linux-low.c
diff --git a/gdb/gdbserver/linux-low.h b/gdbserver/linux-low.h
similarity index 100%
rename from gdb/gdbserver/linux-low.h
rename to gdbserver/linux-low.h
diff --git a/gdb/gdbserver/linux-m32r-low.c b/gdbserver/linux-m32r-low.c
similarity index 100%
rename from gdb/gdbserver/linux-m32r-low.c
rename to gdbserver/linux-m32r-low.c
diff --git a/gdb/gdbserver/linux-m68k-low.c b/gdbserver/linux-m68k-low.c
similarity index 100%
rename from gdb/gdbserver/linux-m68k-low.c
rename to gdbserver/linux-m68k-low.c
diff --git a/gdb/gdbserver/linux-mips-low.c b/gdbserver/linux-mips-low.c
similarity index 100%
rename from gdb/gdbserver/linux-mips-low.c
rename to gdbserver/linux-mips-low.c
diff --git a/gdb/gdbserver/linux-nios2-low.c b/gdbserver/linux-nios2-low.c
similarity index 100%
rename from gdb/gdbserver/linux-nios2-low.c
rename to gdbserver/linux-nios2-low.c
diff --git a/gdb/gdbserver/linux-ppc-ipa.c b/gdbserver/linux-ppc-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-ppc-ipa.c
rename to gdbserver/linux-ppc-ipa.c
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdbserver/linux-ppc-low.c
similarity index 100%
rename from gdb/gdbserver/linux-ppc-low.c
rename to gdbserver/linux-ppc-low.c
diff --git a/gdb/gdbserver/linux-ppc-tdesc-init.h b/gdbserver/linux-ppc-tdesc-init.h
similarity index 100%
rename from gdb/gdbserver/linux-ppc-tdesc-init.h
rename to gdbserver/linux-ppc-tdesc-init.h
diff --git a/gdb/gdbserver/linux-s390-ipa.c b/gdbserver/linux-s390-ipa.c
similarity index 100%
rename from gdb/gdbserver/linux-s390-ipa.c
rename to gdbserver/linux-s390-ipa.c
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdbserver/linux-s390-low.c
similarity index 100%
rename from gdb/gdbserver/linux-s390-low.c
rename to gdbserver/linux-s390-low.c
diff --git a/gdb/gdbserver/linux-s390-tdesc.h b/gdbserver/linux-s390-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-s390-tdesc.h
rename to gdbserver/linux-s390-tdesc.h
diff --git a/gdb/gdbserver/linux-sh-low.c b/gdbserver/linux-sh-low.c
similarity index 100%
rename from gdb/gdbserver/linux-sh-low.c
rename to gdbserver/linux-sh-low.c
diff --git a/gdb/gdbserver/linux-sparc-low.c b/gdbserver/linux-sparc-low.c
similarity index 100%
rename from gdb/gdbserver/linux-sparc-low.c
rename to gdbserver/linux-sparc-low.c
diff --git a/gdb/gdbserver/linux-tic6x-low.c b/gdbserver/linux-tic6x-low.c
similarity index 100%
rename from gdb/gdbserver/linux-tic6x-low.c
rename to gdbserver/linux-tic6x-low.c
diff --git a/gdb/gdbserver/linux-tile-low.c b/gdbserver/linux-tile-low.c
similarity index 100%
rename from gdb/gdbserver/linux-tile-low.c
rename to gdbserver/linux-tile-low.c
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdbserver/linux-x86-low.c
similarity index 100%
rename from gdb/gdbserver/linux-x86-low.c
rename to gdbserver/linux-x86-low.c
diff --git a/gdb/gdbserver/linux-x86-tdesc.c b/gdbserver/linux-x86-tdesc.c
similarity index 100%
rename from gdb/gdbserver/linux-x86-tdesc.c
rename to gdbserver/linux-x86-tdesc.c
diff --git a/gdb/gdbserver/linux-x86-tdesc.h b/gdbserver/linux-x86-tdesc.h
similarity index 100%
rename from gdb/gdbserver/linux-x86-tdesc.h
rename to gdbserver/linux-x86-tdesc.h
diff --git a/gdb/gdbserver/linux-xtensa-low.c b/gdbserver/linux-xtensa-low.c
similarity index 100%
rename from gdb/gdbserver/linux-xtensa-low.c
rename to gdbserver/linux-xtensa-low.c
diff --git a/gdb/gdbserver/lynx-i386-low.c b/gdbserver/lynx-i386-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-i386-low.c
rename to gdbserver/lynx-i386-low.c
diff --git a/gdb/gdbserver/lynx-low.c b/gdbserver/lynx-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-low.c
rename to gdbserver/lynx-low.c
diff --git a/gdb/gdbserver/lynx-low.h b/gdbserver/lynx-low.h
similarity index 100%
rename from gdb/gdbserver/lynx-low.h
rename to gdbserver/lynx-low.h
diff --git a/gdb/gdbserver/lynx-ppc-low.c b/gdbserver/lynx-ppc-low.c
similarity index 100%
rename from gdb/gdbserver/lynx-ppc-low.c
rename to gdbserver/lynx-ppc-low.c
diff --git a/gdb/gdbserver/mem-break.c b/gdbserver/mem-break.c
similarity index 100%
rename from gdb/gdbserver/mem-break.c
rename to gdbserver/mem-break.c
diff --git a/gdb/gdbserver/mem-break.h b/gdbserver/mem-break.h
similarity index 100%
rename from gdb/gdbserver/mem-break.h
rename to gdbserver/mem-break.h
diff --git a/gdb/gdbserver/notif.c b/gdbserver/notif.c
similarity index 100%
rename from gdb/gdbserver/notif.c
rename to gdbserver/notif.c
diff --git a/gdb/gdbserver/notif.h b/gdbserver/notif.h
similarity index 100%
rename from gdb/gdbserver/notif.h
rename to gdbserver/notif.h
diff --git a/gdb/gdbserver/nto-low.c b/gdbserver/nto-low.c
similarity index 100%
rename from gdb/gdbserver/nto-low.c
rename to gdbserver/nto-low.c
diff --git a/gdb/gdbserver/nto-low.h b/gdbserver/nto-low.h
similarity index 100%
rename from gdb/gdbserver/nto-low.h
rename to gdbserver/nto-low.h
diff --git a/gdb/gdbserver/nto-x86-low.c b/gdbserver/nto-x86-low.c
similarity index 100%
rename from gdb/gdbserver/nto-x86-low.c
rename to gdbserver/nto-x86-low.c
diff --git a/gdb/gdbserver/proc-service.c b/gdbserver/proc-service.c
similarity index 100%
rename from gdb/gdbserver/proc-service.c
rename to gdbserver/proc-service.c
diff --git a/gdb/gdbserver/proc-service.list b/gdbserver/proc-service.list
similarity index 100%
rename from gdb/gdbserver/proc-service.list
rename to gdbserver/proc-service.list
diff --git a/gdb/gdbserver/regcache.c b/gdbserver/regcache.c
similarity index 100%
rename from gdb/gdbserver/regcache.c
rename to gdbserver/regcache.c
diff --git a/gdb/gdbserver/regcache.h b/gdbserver/regcache.h
similarity index 100%
rename from gdb/gdbserver/regcache.h
rename to gdbserver/regcache.h
diff --git a/gdb/gdbserver/remote-utils.c b/gdbserver/remote-utils.c
similarity index 100%
rename from gdb/gdbserver/remote-utils.c
rename to gdbserver/remote-utils.c
diff --git a/gdb/gdbserver/remote-utils.h b/gdbserver/remote-utils.h
similarity index 100%
rename from gdb/gdbserver/remote-utils.h
rename to gdbserver/remote-utils.h
diff --git a/gdb/gdbserver/server.c b/gdbserver/server.c
similarity index 100%
rename from gdb/gdbserver/server.c
rename to gdbserver/server.c
diff --git a/gdb/gdbserver/server.h b/gdbserver/server.h
similarity index 100%
rename from gdb/gdbserver/server.h
rename to gdbserver/server.h
diff --git a/gdb/gdbserver/symbol.c b/gdbserver/symbol.c
similarity index 100%
rename from gdb/gdbserver/symbol.c
rename to gdbserver/symbol.c
diff --git a/gdb/gdbserver/target.c b/gdbserver/target.c
similarity index 100%
rename from gdb/gdbserver/target.c
rename to gdbserver/target.c
diff --git a/gdb/gdbserver/target.h b/gdbserver/target.h
similarity index 100%
rename from gdb/gdbserver/target.h
rename to gdbserver/target.h
diff --git a/gdb/gdbserver/tdesc.c b/gdbserver/tdesc.c
similarity index 100%
rename from gdb/gdbserver/tdesc.c
rename to gdbserver/tdesc.c
diff --git a/gdb/gdbserver/tdesc.h b/gdbserver/tdesc.h
similarity index 100%
rename from gdb/gdbserver/tdesc.h
rename to gdbserver/tdesc.h
diff --git a/gdb/gdbserver/thread-db.c b/gdbserver/thread-db.c
similarity index 100%
rename from gdb/gdbserver/thread-db.c
rename to gdbserver/thread-db.c
diff --git a/gdb/gdbserver/tracepoint.c b/gdbserver/tracepoint.c
similarity index 100%
rename from gdb/gdbserver/tracepoint.c
rename to gdbserver/tracepoint.c
diff --git a/gdb/gdbserver/tracepoint.h b/gdbserver/tracepoint.h
similarity index 100%
rename from gdb/gdbserver/tracepoint.h
rename to gdbserver/tracepoint.h
diff --git a/gdb/gdbserver/utils.c b/gdbserver/utils.c
similarity index 100%
rename from gdb/gdbserver/utils.c
rename to gdbserver/utils.c
diff --git a/gdb/gdbserver/utils.h b/gdbserver/utils.h
similarity index 100%
rename from gdb/gdbserver/utils.h
rename to gdbserver/utils.h
diff --git a/gdb/gdbserver/win32-arm-low.c b/gdbserver/win32-arm-low.c
similarity index 100%
rename from gdb/gdbserver/win32-arm-low.c
rename to gdbserver/win32-arm-low.c
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdbserver/win32-i386-low.c
similarity index 100%
rename from gdb/gdbserver/win32-i386-low.c
rename to gdbserver/win32-i386-low.c
diff --git a/gdb/gdbserver/win32-low.c b/gdbserver/win32-low.c
similarity index 100%
rename from gdb/gdbserver/win32-low.c
rename to gdbserver/win32-low.c
diff --git a/gdb/gdbserver/win32-low.h b/gdbserver/win32-low.h
similarity index 100%
rename from gdb/gdbserver/win32-low.h
rename to gdbserver/win32-low.h
diff --git a/gdb/gdbserver/wincecompat.c b/gdbserver/wincecompat.c
similarity index 100%
rename from gdb/gdbserver/wincecompat.c
rename to gdbserver/wincecompat.c
diff --git a/gdb/gdbserver/wincecompat.h b/gdbserver/wincecompat.h
similarity index 100%
rename from gdb/gdbserver/wincecompat.h
rename to gdbserver/wincecompat.h
diff --git a/gdb/gdbserver/x86-low.c b/gdbserver/x86-low.c
similarity index 100%
rename from gdb/gdbserver/x86-low.c
rename to gdbserver/x86-low.c
diff --git a/gdb/gdbserver/x86-low.h b/gdbserver/x86-low.h
similarity index 100%
rename from gdb/gdbserver/x86-low.h
rename to gdbserver/x86-low.h
diff --git a/gdb/gdbserver/x86-tdesc.h b/gdbserver/x86-tdesc.h
similarity index 100%
rename from gdb/gdbserver/x86-tdesc.h
rename to gdbserver/x86-tdesc.h
diff --git a/gdb/gdbserver/xtensa-xtregs.c b/gdbserver/xtensa-xtregs.c
similarity index 100%
rename from gdb/gdbserver/xtensa-xtregs.c
rename to gdbserver/xtensa-xtregs.c
diff --git a/src-release.sh b/src-release.sh
index 92e92ac5d77..95f79c5bd7d 100755
--- a/src-release.sh
+++ b/src-release.sh
@@ -1,5 +1,5 @@ 
 #!/usr/bin/env bash
-#   Copyright (C) 1990-2019 Free Software Foundation
+#   Copyright (C) 1990-2020 Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -315,7 +315,7 @@  gas_release()
     tar_compress $package $tool "$GAS_SUPPORT_DIRS" "$compressors"
 }
 
-GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport"
+GDB_SUPPORT_DIRS="bfd include libiberty libctf opcodes readline sim intl libdecnumber cpu zlib contrib gnulib gdbsupport gdbserver"
 gdb_release()
 {
     compressors=$1