This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Fully disentangle gdb and gdbserver
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Sun, 24 Feb 2002 20:55:29 -0500
- Subject: Re: [RFA] Fully disentangle gdb and gdbserver
- References: <20020224204935.A2247@nevyn.them.org>
On Sun, Feb 24, 2002 at 08:49:35PM -0500, Daniel Jacobowitz wrote:
> We were already moving in the direction of separating GDB and gdbserver's
> build processes, so I finished the job. This patch adds a simplified
> "terminal.h" to gdbserver, and a configure.srv which substitutes for the
> makefile fragments in config/. After this patch, gdbserver is completely
> self-contained, with the exception of the regformats/ directory.
>
> I think this is the right way to go. I've no objection to adding further
> common code later, as long as we have clearly fixed and documented
> interfaces between that common code and gdb/gdbserver.
>
>
> [Forthcoming from me tonight after this patch, probably:
> - host vs. target signal numbering
> - ptrace (PTRACE_GET*REGS) support, which will bring in
> x86-64, i386 floating-point registers, and S-390 ports
> of gdbserver, bringing us back to all the potentially working
> targets from before I started.
> - Warning cleanup, and then turning on warnings in the gdbserver
> directory.
> These along with my pending MI testsuite patch actually make gdbserver
> start to look good...]
>
> OK to commit this?
A) Forgot the patch.
B) Ignore the creeping "Linux" in the invisible patch on the previous
message, I've changed it to GNU/Linux in this more visible copy :)
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
2002-02-24 Daniel Jacobowitz <drow@mvista.com>
* gdbserver/configure.srv: New file.
* gdbserver/configure.in: Use configure.srv instead
of the host/target makefile fragments. Set GDBSERVER_DEPFILES
from it.
* gdbserver/configure: Regenerated.
* gdbserver/terminal.h: New file.
* gdbserver/Makefile.in: Update for configure changes. Remove
more unneeded include paths.
Index: terminal.h
===================================================================
RCS file: N/A
diff -u /dev/null terminal.h
--- /dev/null Wed Dec 31 19:00:00 1969
+++ terminal.h Sun Feb 24 18:34:15 2002
@@ -0,0 +1,51 @@
+/* Terminal interface definitions for the GDB remote server.
+ Copyright 2002, 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 2 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#if !defined (TERMINAL_H)
+#define TERMINAL_H 1
+
+/* Autoconf will have defined HAVE_TERMIOS_H, HAVE_TERMIO_H,
+ and HAVE_SGTTY_H for us as appropriate. */
+
+#if defined(HAVE_TERMIOS_H)
+#define HAVE_TERMIOS
+#include <termios.h>
+#else /* ! HAVE_TERMIOS_H */
+#if defined(HAVE_TERMIO_H)
+#define HAVE_TERMIO
+#include <termio.h>
+
+#undef TIOCGETP
+#define TIOCGETP TCGETA
+#undef TIOCSETN
+#define TIOCSETN TCSETA
+#undef TIOCSETP
+#define TIOCSETP TCSETAF
+#define TERMINAL struct termio
+#else /* ! HAVE_TERMIO_H; default to SGTTY. */
+#define HAVE_SGTTY
+#include <fcntl.h>
+#include <sgtty.h>
+#include <sys/ioctl.h>
+#define TERMINAL struct sgttyb
+#endif
+#endif
+
+#endif /* !defined (TERMINAL_H) */
Index: configure.srv
===================================================================
RCS file: N/A
diff -u /dev/null configure.srv
--- /dev/null Wed Dec 31 19:00:00 1969
+++ configure.srv Sun Feb 24 20:37:46 2002
@@ -0,0 +1,41 @@
+# Mappings from configuration triplets to gdbserver build options.
+# This is invoked from the autoconf-generated configure script, to
+# produce the appropriate Makefile substitutions.
+
+# This file sets the following shell variables:
+# srv_regobj The register protocol appropriate for this target.
+# srv_tgtobj Any other target-specific modules appropriate
+# for this target.
+#
+# In addition, on GNU/Linux the following shell variables will be set:
+# srv_linux_regsets Set to "yes" if ptrace(PTRACE_GETREGS) and friends
+# may be available on this platform; unset otherwise.
+
+# Input is taken from the "${target}" variable.
+
+case "${target}" in
+ arm*-*-linux*) srv_regobj=reg-arm.o
+ srv_tgtobj="linux-low.o linux-arm-low.o"
+ ;;
+ i[3456]86-*-linux*) srv_regobj=reg-i386.o
+ srv_tgtobj="linux-low.o linux-i386-low.o"
+ ;;
+ ia64-*-linux*) srv_regobj=reg-ia64.o
+ srv_tgtobj="linux-low.o linux-ia64-low.o"
+ ;;
+ m68*-*-linux*) srv_regobj=reg-m68k.o
+ srv_tgtobj="linux-low.o linux-m68k-low.o"
+ ;;
+ mips*-*-linux*) srv_regobj=reg-mips.o
+ srv_tgtobj="linux-low.o linux-mips-low.o"
+ ;;
+ powerpc*-*-linux*) srv_regobj=reg-ppc.o
+ srv_tgtobj="linux-low.o linux-ppc-low.o"
+ ;;
+ sh*-*-linux*) srv_regobj=reg-sh.o
+ srv_tgtobj="linux-low.o linux-sh-low.o"
+ ;;
+ *) echo "Error: target not supported by gdbserver."
+ exit 1
+ ;;
+esac
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/Makefile.in,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile.in
--- Makefile.in 2002/02/19 23:48:14 1.7
+++ Makefile.in 2002/02/25 01:38:44
@@ -81,12 +81,9 @@ READLINE_DEP = $$(READLINE_DIR)
# All the includes used for CFLAGS and for lint.
# -I. for config files.
-# -I.. for gdb's config files (especially config.h)
-# -I${srcdir} possibly for regex.h also.
-# -I${srcdir}/config for more generic config files.
-# -I$(srcdir)/../regformats for regdef.h
-INCLUDE_CFLAGS = -I. -I.. -I${srcdir} -I${srcdir}/.. \
- -I$(srcdir)/../regformats
+# -I${srcdir} for our headers.
+# -I$(srcdir)/../regformats for regdef.h.
+INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats
# M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
# from the config/ directory.
@@ -111,11 +108,6 @@ DIST=gdb
LINT=/usr/5bin/lint
LINTFLAGS= $(BFD_CFLAGS)
-# Host and target-dependent makefile fragments come in here.
-@host_makefile_frag@
-@target_makefile_frag@
-# End of host and target-dependent makefile fragments
-
# All source files that go into linking GDB remote server.
SFILES = $(srcdir)/low-hppabsd.c $(srcdir)/low-linux.c $(srcdir)/low-lynx.c \
@@ -123,12 +115,12 @@ SFILES = $(srcdir)/low-hppabsd.c $(srcdi
$(srcdir)/low-sun3.c $(srcdir)/utils.c $(srcdir)/server.c \
$(srcdir)/remote-utils.c
-DEPFILES = $(GDBSERVER_DEPFILES)
+DEPFILES = @GDBSERVER_DEPFILES@
-SOURCES = $(SFILES) $(ALLDEPFILES)
+SOURCES = $(SFILES)
TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
-OBS = utils.o $(GDBSERVER_DEPFILES) server.o remote-utils.o regcache.o
+OBS = utils.o $(DEPFILES) server.o remote-utils.o regcache.o
# Prevent Sun make from putting in the machine type. Setting
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
@@ -203,7 +195,7 @@ maintainer-clean realclean: clean
STAGESTUFF=${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} init.c init.o version.c gdb
-Makefile: Makefile.in config.status @frags@
+Makefile: Makefile.in config.status
$(SHELL) ./config.status
config.status: configure
@@ -236,7 +228,7 @@ regcache_h = $(srcdir)/regcache.h
server_h = $(srcdir)/server.h $(regcache_h)
server.o: server.c $(server_h)
-remote-utils.o: remote-utils.c $(server_h)
+remote-utils.o: remote-utils.c terminal.h $(server_h)
utils.o: utils.c $(server_h)
regcache.o: regcache.c $(server_h) $(regdef_h)
Index: configure
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure,v
retrieving revision 1.4
diff -u -p -r1.4 configure
--- configure 2002/02/20 16:46:36 1.4
+++ configure 2002/02/25 01:38:45
@@ -1146,41 +1146,12 @@ fi
done
-. ${srcdir}/../configure.host
+. ${srcdir}/configure.srv
-. ${srcdir}/../configure.tgt
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj"
-frags=
-host_makefile_frag=${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh
-if test ! -f ${host_makefile_frag}; then
- { echo "configure: error: "*** GDB remote does not support host ${host}"" 1>&2; exit 1; }
-fi
-frags="$frags $host_makefile_frag"
-
-target_makefile_frag=${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt
-if test ! -f ${target_makefile_frag}; then
- { echo "configure: error: "*** GDB remote does not support target ${target}"" 1>&2; exit 1; }
-fi
-frags="$frags $target_makefile_frag"
-
-
-
-hostfile=`sed -n '
-s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
-' ${host_makefile_frag}`
-
-targetfile=`sed -n '
-s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
-' ${target_makefile_frag}`
-
-if test "${target}" = "${host}"; then
-nativefile=`sed -n '
-s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
-' ${host_makefile_frag}`
-fi
-
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@@ -1334,11 +1305,7 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CPP@%$CPP%g
-/@host_makefile_frag@/r $host_makefile_frag
-s%@host_makefile_frag@%%g
-/@target_makefile_frag@/r $target_makefile_frag
-s%@target_makefile_frag@%%g
-s%@frags@%$frags%g
+s%@GDBSERVER_DEPFILES@%$GDBSERVER_DEPFILES%g
CEOF
EOF
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.in,v
retrieving revision 1.5
diff -u -p -r1.5 configure.in
--- configure.in 2002/02/20 16:46:36 1.5
+++ configure.in 2002/02/25 01:38:45
@@ -32,41 +32,10 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h)
-. ${srcdir}/../configure.host
+. ${srcdir}/configure.srv
-. ${srcdir}/../configure.tgt
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj"
-frags=
-host_makefile_frag=${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh
-if test ! -f ${host_makefile_frag}; then
- AC_MSG_ERROR("*** GDB remote does not support host ${host}")
-fi
-frags="$frags $host_makefile_frag"
-
-target_makefile_frag=${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt
-if test ! -f ${target_makefile_frag}; then
- AC_MSG_ERROR("*** GDB remote does not support target ${target}")
-fi
-frags="$frags $target_makefile_frag"
-
-AC_SUBST_FILE(host_makefile_frag)
-AC_SUBST_FILE(target_makefile_frag)
-AC_SUBST(frags)
-
-changequote(,)dnl
-hostfile=`sed -n '
-s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
-' ${host_makefile_frag}`
-
-targetfile=`sed -n '
-s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
-' ${target_makefile_frag}`
-
-if test "${target}" = "${host}"; then
-nativefile=`sed -n '
-s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
-' ${host_makefile_frag}`
-fi
-changequote([,])dnl
+AC_SUBST(GDBSERVER_DEPFILES)
AC_OUTPUT(Makefile)