This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch to gdbserver


While adding support for NetBSD systems to gdbserver, I noticed that
gdbserver's configure.in had some significant errors in addition to
still being Cygnus configure.

The first problem was if ../config/${hostfile} was present, it would
be linked to xm.h instead of ../config/${gdb_host_cpu}/${hostfile}.
The same with targetfile and nativefile.

GDB used to do the same thing three or four years back, but that was
changed so processor specific headers could inherit from OS specific
headers for those OS's that supported multiple architectures (at the
time, lynxos and possibly svr4.  Now there is *bsd and linux as well).

The second problem was that the names of the host, target, and native
headers were extracted from the host and target makefile stub with awk
and assumed that the variable definitions would have whitespace follow-
ing the equals sign in the assignment.  This restriction was lifted for
GDB years ago as well, so there is a some risk that *.mh and *.mt files
that work fine with GDB won't work with gdbserver.

And by the time I fixed the above issues, it seemed trivial enough to
go the next step and convert everything to use autoconf.  The enclosed
patch contains those changes.

	--jtc

Index: Makefile.in
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/gdbserver/Makefile.in,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.in
*** Makefile.in	1998/12/03 00:05:46	1.1.1.1
--- Makefile.in	1999/04/29 19:14:01
***************
*** 1,4 ****
! #Copyright 1989, 90, 91, 92, 93, 94, 95, 96, 1997
  #Free Software Foundation, Inc.
  
  # This file is part of GDB.
--- 1,4 ----
! #Copyright 1989, 90, 91, 92, 93, 94, 95, 96, 97, 99
  #Free Software Foundation, Inc.
  
  # This file is part of GDB.
***************
*** 17,32 ****
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
! prefix = /usr/local
  
! program_transform_name =
! exec_prefix = $(prefix)
! bindir = $(exec_prefix)/bin
! libdir = $(exec_prefix)/lib
  tooldir = $(libdir)/$(target_alias)
  
! datadir = $(prefix)/share
! mandir = $(prefix)/man
  man1dir = $(mandir)/man1
  man2dir = $(mandir)/man2
  man3dir = $(mandir)/man3
--- 17,34 ----
  # along with this program; if not, write to the Free Software
  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
! prefix = @prefix@
! exec_prefix = @exec_prefix@
  
! host_alias = @host_alias@
! target_alias = @target_alias@
! program_transform_name = @program_transform_name@
! bindir = @bindir@
! libdir = @libdir@
  tooldir = $(libdir)/$(target_alias)
  
! datadir = @datadir@
! mandir = @mandir@
  man1dir = $(mandir)/man1
  man2dir = $(mandir)/man2
  man3dir = $(mandir)/man3
***************
*** 36,49 ****
  man7dir = $(mandir)/man7
  man8dir = $(mandir)/man8
  man9dir = $(mandir)/man9
! infodir = $(prefix)/info
! includedir = $(prefix)/include
  
  SHELL = /bin/sh
  
! INSTALL = `cd $(srcdir)/../..;pwd`/install-sh -c
! INSTALL_PROGRAM = $(INSTALL)
! INSTALL_DATA = $(INSTALL)
  
  AR = ar
  AR_FLAGS = qv
--- 38,51 ----
  man7dir = $(mandir)/man7
  man8dir = $(mandir)/man8
  man9dir = $(mandir)/man9
! infodir = @infodir@
! includedir = @includedir@
  
  SHELL = /bin/sh
  
! INSTALL = @INSTALL@
! INSTALL_PROGRAM = @INSTALL_PROGRAM@
! INSTALL_DATA = @INSTALL_DATA@
  
  AR = ar
  AR_FLAGS = qv
***************
*** 60,66 ****
  
  # Directory containing source files.  Don't clean up the spacing,
  # this exact string is matched for by the "configure" script.
! srcdir = .
  
  # It is also possible that you will need to add -I/usr/include/sys to the
  # CFLAGS section if your system doesn't have fcntl.h in /usr/include (which 
--- 62,68 ----
  
  # Directory containing source files.  Don't clean up the spacing,
  # this exact string is matched for by the "configure" script.
! srcdir = @srcdir@
  
  # It is also possible that you will need to add -I/usr/include/sys to the
  # CFLAGS section if your system doesn't have fcntl.h in /usr/include (which 
Index: configure.in
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/gdbserver/configure.in,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 configure.in
*** configure.in	1998/12/03 00:05:46	1.1.1.1
--- configure.in	1999/04/29 19:15:19
***************
*** 1,46 ****
! srcname="Remote GDB server"
! srctrigger=server.c
! gdb_serial_driver=../ser-unix.c
  
! # per-host:
  
! . ${srcdir}/../configure.host
! 
! echo "gdbserver/configure.in: host is $host, target is $target"
! 
! if [ ! -f ${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh ]; then
! 	echo '***' "GDB remote does not support host ${host}" 1>&2
! 	exit 1
! fi
  
! #  We really shouldn't depend on there being a space after XM_FILE= ...
! hostfile=`awk '$1 == "XM_FILE=" { print $2 }' <${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh`
  
! # per-target:
  
  . ${srcdir}/../configure.tgt
  
! echo "gdbserver/configure.in: host_cpu is $host_cpu, target_cpu is $target_cpu"
  
! if [ ! -f ${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt ]; then
! 	echo '***' "GDB remote does not support target ${target}" 1>&2
! 	exit 1
  fi
  
! if [ -z "${removing}" ] ; then
! 	cat ${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh ${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt | awk '$1 == "#msg" {
! 		print substr($0,6)}'
  fi
  
! #  We really shouldn't depend on there being a space after TM_FILE= ...
! targetfile=`awk '$1 == "TM_FILE=" { print $2 }' <${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt`
  
! if [ "${target}" = "${host}" ] ; then
! 	nativefile=`awk '$1 == "NAT_FILE=" { print $2 }' <${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh`
  fi
  
- host_makefile_frag=../config/${gdb_host_cpu}/${gdb_host}.mh
- target_makefile_frag=../config/${gdb_target_cpu}/${gdb_target}.mt
  
  # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
  # (NAT_FILE) is not set in the ?config/* file, we don't make the
--- 1,64 ----
! dnl Autoconf configure script for GDB server.
! dnl Copyright 1999 Free Software Foundation, Inc.
! dnl
! dnl This file is part of GDB.
! dnl
! dnl This program is free software; you can redistribute it and/or modify
! dnl it under the terms of the GNU General Public License as published by
! dnl the Free Software Foundation; either version 2 of the License, or
! dnl (at your option) any later version.
! dnl
! dnl This program is distributed in the hope that it will be useful,
! dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
! dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! dnl GNU General Public License for more details.
! dnl
! dnl You should have received a copy of the GNU General Public License
! dnl along with this program; if not, write to the Free Software
! dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  
! dnl Process this file with autoconf to produce a configure script.
  
! AC_INIT(server.c)
  
! AC_CANONICAL_SYSTEM
! AC_PROG_INSTALL
  
! . ${srcdir}/../configure.host
  
  . ${srcdir}/../configure.tgt
  
! host_makefile_frag=${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh
! target_makefile_frag=${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt
  
! if test ! -f ${host_makefile_frag}; then
! 	AC_MSG_ERROR("*** GDB remote does not support host ${host}")
  fi
  
! if test ! -f ${target_makefile_frag}; then
! 	AC_MSG_ERROR("*** GDB remote does not support target ${target}")
  fi
  
! 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
+ 
+ echo ${hostfile}
+ echo ${targetfile}
+ echo ${nativefile}
  
  
  # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
  # (NAT_FILE) is not set in the ?config/* file, we don't make the
***************
*** 52,100 ****
  links=
  rm -f xm.h
  rm -f ser-hardwire.c
! if [ "${hostfile}" != "" ]; then
! 	if [ -f ${srcdir}/../config/${hostfile} ]; then
! 		files="${files} ../config/${hostfile}"
! 	else
! 		files="${files} ../config/${gdb_host_cpu}/${hostfile}"
! 	fi
  	links="${links} xm.h"
- 
- #	files="${files} ${gdb_serial_driver}"
- #	links="${links} ser-hardwire.c"
  fi
  rm -f tm.h
! if [ "${targetfile}" != "" ]; then
! 	if [ -f ${srcdir}/../config/${targetfile} ]; then
! 		files="${files} ../config/${targetfile}"
! 	else
! 		files="${files} ../config/${gdb_target_cpu}/${targetfile}"
! 	fi
  	links="${links} tm.h"
  fi
  rm -f nm.h
! if [ "${nativefile}" != "" ]; then
! 	if [ -f ${srcdir}/../config/${nativefile} ]; then
! 		files="${files} ../config/${nativefile}"
! 	else
! 		files="${files} ../config/${gdb_host_cpu}/${nativefile}"
! 	fi
  	links="${links} nm.h"
  # temporary scaffolding until all hosts have the host/target/native
  # split in place.
  else
! 	files="${files} ../config/nm-empty.h"
  	links="${links} nm.h"
  fi
  
! if [ ${target_cpu} = "sparclite" ]; then
! 	configdirs="${configdirs} sparclite"
! fi
! 
! # post-target:
! 
! if [ "${nativefile}" = "" ] ; then
! 	sed -e '/^NATDEPFILES= /s//# NATDEPFILES= /' \
! 		< Makefile > Makefile.tem
! 	mv -f Makefile.tem Makefile
! fi
--- 70,94 ----
  links=
  rm -f xm.h
  rm -f ser-hardwire.c
! if test "${hostfile}" != ""; then
! 	files="${files} ${srcdir}/../config/${gdb_host_cpu}/${hostfile}"
  	links="${links} xm.h"
  fi
  rm -f tm.h
! if test "${targetfile}" != ""; then
! 	files="${files} ${srcdir}/../config/${gdb_target_cpu}/${targetfile}"
  	links="${links} tm.h"
  fi
  rm -f nm.h
! if test "${nativefile}" != ""; then
! 	files="${files} ${srcdir}/../config/${gdb_host_cpu}/${nativefile}"
  	links="${links} nm.h"
  # temporary scaffolding until all hosts have the host/target/native
  # split in place.
  else
! 	files="${files} ${srcdir}/../config/nm-empty.h"
  	links="${links} nm.h"
  fi
+ AC_LINK_FILES($files, $links)
  
! AC_OUTPUT(Makefile)


-- 
J.T. Conklin
RedBack Networks