mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-28 22:40:24 +00:00
These changes abolish M4 preprocessing for the GDB manual.
Formatting these files now depends on the recently designed Texinfo conditionals: to format successfully, you must use very recent versions (not yet distributed by FSF) of texinfo.tex and makeinfo.c. The new Texinfo commands are @set, @clear, @ifset, @ifclear, and @value. Recent texinfo-2 Beta distributions contained partial implementations. texi2roff does not yet support these commands. There are miscellaneous clean-ups to Makefile.in as well.
This commit is contained in:
parent
42b5c73927
commit
18fae2a8db
@ -21,24 +21,7 @@ srcdir = .
|
||||
|
||||
prefix = /usr/local
|
||||
|
||||
exec_prefix = $(prefix)
|
||||
bindir = $(exec_prefix)/bin
|
||||
libdir = $(exec_prefix)/lib
|
||||
|
||||
datadir = $(prefix)/lib
|
||||
mandir = $(prefix)/man
|
||||
man1dir = $(mandir)/man1
|
||||
man2dir = $(mandir)/man2
|
||||
man3dir = $(mandir)/man3
|
||||
man4dir = $(mandir)/man4
|
||||
man5dir = $(mandir)/man5
|
||||
man6dir = $(mandir)/man6
|
||||
man7dir = $(mandir)/man7
|
||||
man8dir = $(mandir)/man8
|
||||
man9dir = $(mandir)/man9
|
||||
infodir = $(prefix)/info
|
||||
includedir = $(prefix)/include
|
||||
docdir = $(datadir)/doc
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
@ -46,21 +29,11 @@ INSTALL = install -c
|
||||
INSTALL_PROGRAM = $(INSTALL)
|
||||
INSTALL_DATA = $(INSTALL)
|
||||
|
||||
AR = ar
|
||||
AR_FLAGS = qv
|
||||
BISON = bison
|
||||
RANLIB = ranlib
|
||||
|
||||
# main GDB source directory
|
||||
gdbdir = ..
|
||||
|
||||
# Documentation (gdb.dvi) needs either GNU m4 or SysV m4;
|
||||
# Berkeley/Sun don't have quite enough.
|
||||
#M4=/usr/5bin/m4
|
||||
M4=m4
|
||||
gdbdir = $(srcdir)/..
|
||||
|
||||
# where to find texinfo; GDB dist should include a recent one
|
||||
TEXIDIR=$(srcdir)/${gdbdir}/../texinfo
|
||||
TEXIDIR=${gdbdir}/../texinfo
|
||||
|
||||
# where to find makeinfo, preferably one designed for texinfo-2
|
||||
MAKEINFO=makeinfo
|
||||
@ -68,17 +41,25 @@ MAKEINFO=makeinfo
|
||||
# where to find texi2roff, ditto
|
||||
TEXI2ROFF=texi2roff
|
||||
|
||||
# Where is the source dir for the READLINE library? Traditionally in .. or .
|
||||
# (For the binary library built from it, we use ${READLINE_DIR}${subdir}.)
|
||||
READLINE_DIR = $(srcdir)/${gdbdir}/../readline
|
||||
# Where is the source dir for the READLINE library doc?
|
||||
# Traditionally readline is in .. or .
|
||||
READLINE_DIR = ${gdbdir}/../readline/doc
|
||||
|
||||
SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$$TEXINPUTS
|
||||
|
||||
# Don Knuth's TeX formatter
|
||||
TEX = tex
|
||||
|
||||
# auxiliary program for sorting Texinfo indices
|
||||
TEXINDEX = texindex
|
||||
|
||||
# Main GDB manual's source files
|
||||
SFILES_DOCDIR = \
|
||||
$(srcdir)/gdb.texinfo $(srcdir)/pretex.m4 $(srcdir)/none.m4 \
|
||||
$(srcdir)/all.m4 gdbinv-m.m4 gdbinv-s.m4 gdbVN.m4
|
||||
SFILES_INCLUDED = $(srcdir)/gdb-config.texi $(srcdir)/gdbinv-s.texi
|
||||
|
||||
# Which version of GDB manual? default includes everything
|
||||
CONFIG=all
|
||||
SFILES_LOCAL = $(srcdir)/gdb.texinfo GDBvn.texi $(SFILES_INCLUDED)
|
||||
|
||||
SFILES_DOC = $(SFILES_LOCAL) \
|
||||
$(READLINE_DIR)/rluser.texinfo $(READLINE_DIR)/inc-hist.texi
|
||||
|
||||
#### Host, target, and site specific Makefile fragments come in here.
|
||||
###
|
||||
@ -87,8 +68,6 @@ all install:
|
||||
|
||||
info: gdb.info gdbint.info stabs.info
|
||||
all-doc: gdb.info gdb.dvi refcard.dvi gdb-internals gdbint.dvi
|
||||
clean-info:
|
||||
-rm -f *.info*
|
||||
|
||||
install-info: info
|
||||
-parent=`echo $(infodir)|sed -e 's@/[^/]*$$@@'`; \
|
||||
@ -98,7 +77,7 @@ install-info: info
|
||||
$(INSTALL_DATA) $$i $(infodir)/$$i ; \
|
||||
done
|
||||
|
||||
STAGESTUFF = *.info* gdb-all.texi gdbVN.m4
|
||||
STAGESTUFF = *.info* gdb-all.texi GDBvn.texi
|
||||
|
||||
# Copy the object files from a particular stage into a subdirectory.
|
||||
stage1: force
|
||||
@ -130,82 +109,76 @@ de-stage3: force
|
||||
-(cd stage3 ; mv -f * ..)
|
||||
-rmdir stage3
|
||||
|
||||
clean:
|
||||
rm -f gdb.dvi rluser.texinfo inc-hist.texi gdb-all* gdb.info* gdbVN.m4
|
||||
rm -f gdb-internals gdbint.?? gdbint.??? gdbint.info
|
||||
rm -f refcard.ps refcard.dvi refcard.log *~
|
||||
clean-info:
|
||||
rm -f gdb.info* gdbint.info* stabs.info*
|
||||
|
||||
clean-dvi:
|
||||
rm -f gdb.dvi refcard.dvi gdbint.dvi stabs.dvi psref.dvi
|
||||
|
||||
mostlyclean: clean-info clean-dvi
|
||||
rm -f gdb.?? gdb.??? gdb.mm gdb.ms gdb.me
|
||||
rm -f links2roff
|
||||
rm -f refcard.ps lrefcard.ps refcard.log psref.* *~
|
||||
rm -f gdbint.?? gdbint.??? stabs.?? stabs.???
|
||||
|
||||
clean: mostlyclean
|
||||
rm -f GDBvn.texi rluser.texinfo inc-hist.texi
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.status
|
||||
|
||||
realclean: distclean
|
||||
|
||||
|
||||
# GDB QUICK REFERENCE (TeX dvi file, CM fonts)
|
||||
refcard.dvi : $(srcdir)/refcard.tex
|
||||
TEXINPUTS=$(srcdir):.:$$TEXINPUTS tex refcard.tex; rm -f refcard.log
|
||||
$(SET_TEXINPUTS) $(TEX) refcard.tex; rm -f refcard.log
|
||||
rm -f rcfonts.tex
|
||||
|
||||
# GDB QUICK REFERENCE (PostScript output, common PS fonts)
|
||||
refcard.ps : $(srcdir)/refcard.tex $(srcdir)/psrc.sed
|
||||
sed -f $(srcdir)/psrc.sed $(srcdir)/refcard.tex >psref.tex
|
||||
TEXINPUTS=$(srcdir):.:$$TEXINPUTS tex psref.tex
|
||||
$(SET_TEXINPUTS) $(TEX) psref.tex
|
||||
dvips -t landscape psref -o; mv psref.ps refcard.ps
|
||||
rm -f psref.dvi psref.log
|
||||
|
||||
# GDB QUICK REFERENCE (PostScript output, common PS fonts w/long names)
|
||||
lrefcard.ps : $(srcdir)/refcard.tex $(srcdir)/lpsrc.sed
|
||||
sed -f $(srcdir)/lpsrc.sed $(srcdir)/refcard.tex >psref.tex
|
||||
TEXINPUTS=$(srcdir):.:$$TEXINPUTS tex psref.tex
|
||||
$(SET_TEXINPUTS) $(TEX) psref.tex
|
||||
dvips -t landscape psref -o; mv psref.ps lrefcard.ps
|
||||
rm -f psref.dvi psref.log
|
||||
|
||||
# "Readline" appendices. Get them here so both TeX and texi2roff can find.
|
||||
rluser.texinfo: ${READLINE_DIR}/doc/rluser.texinfo
|
||||
ln -s ${READLINE_DIR}/doc/rluser.texinfo . || \
|
||||
ln ${READLINE_DIR}/doc/rluser.texinfo . || \
|
||||
cp ${READLINE_DIR}/doc/rluser.texinfo .
|
||||
|
||||
inc-hist.texi: ${READLINE_DIR}/doc/inc-hist.texi
|
||||
ln -s ${READLINE_DIR}/doc/inc-hist.texi . || \
|
||||
ln ${READLINE_DIR}/doc/inc-hist.texi . || \
|
||||
cp ${READLINE_DIR}/doc/inc-hist.texi .
|
||||
|
||||
# File to record current GDB version number (copied from main dir Makefile.in)
|
||||
gdbVN.m4 : $(srcdir)/${gdbdir}/Makefile.in
|
||||
echo "_define__(<_GDB_VN__>,`sed <$(srcdir)/../Makefile.in -n 's/VERSION = //p'`)" > ./gdbVN.m4
|
||||
GDBvn.texi : ${gdbdir}/Makefile.in
|
||||
echo "@set GDBVN `sed <$(srcdir)/../Makefile.in -n 's/VERSION = //p'`" > ./GDBvn.texi
|
||||
|
||||
# GDB MANUAL: texinfo source, created by preprocessing w/m4
|
||||
# If you want other configs in the makefile, add or modify instructions for
|
||||
# building source here, then change CONFIG (that way you get info, dvi,
|
||||
# roff targets automatically for your config).
|
||||
# Be sure to not create a bad gdb-all.texi if ${M4} is missing or aborts...
|
||||
# The nonsense with gdbVN.m4 is to get this to run with both Sun and GNU make.
|
||||
# Note that we can *generate* gdbVN.m4, but since we distribute one in the
|
||||
# GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
|
||||
# If your texinfo or makeinfo don't support these, get a new texinfo release
|
||||
#
|
||||
# The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
|
||||
# Note that we can *generate* GDBvn.texi, but since we distribute one in the
|
||||
# source directory for the benefit of people who *don't* use this makefile,
|
||||
# VPATH will often tell make not to bother building it, because the one
|
||||
# in the srcdir is up to date. (if not, then make should build one here).
|
||||
|
||||
gdb-all.texi: ${SFILES_DOCDIR}
|
||||
if [ ! -f ./gdbVN.m4 ]; then \
|
||||
ln -s $(srcdir)/gdbVN.m4 . || \
|
||||
ln $(srcdir)/gdbVN.m4 . || \
|
||||
cp $(srcdir)/gdbVN.m4 . ; else true; fi
|
||||
rm -f foobus.texinfo
|
||||
${M4} $(srcdir)/pretex.m4 $(srcdir)/none.m4 $(srcdir)/all.m4 \
|
||||
gdbVN.m4 $(srcdir)/gdb.texinfo >foobus.texinfo
|
||||
rm -f gdb-all.texi
|
||||
mv foobus.texinfo ./gdb-all.texi
|
||||
|
||||
# GDB MANUAL: TeX dvi file
|
||||
gdb.dvi : gdb-${CONFIG}.texi rluser.texinfo inc-hist.texi
|
||||
TEXINPUTS=${TEXIDIR}:.:$(srcdir):$$TEXINPUTS tex gdb-${CONFIG}.texi
|
||||
TEXINPUTS=${TEXIDIR}:.:$(srcdir):$$TEXINPUTS tex gdb-${CONFIG}.texi
|
||||
texindex gdb-${CONFIG}.??
|
||||
TEXINPUTS=${TEXIDIR}:.:$(srcdir):$$TEXINPUTS tex gdb-${CONFIG}.texi
|
||||
mv gdb-${CONFIG}.dvi ./gdb.dvi
|
||||
rm -f gdb-${CONFIG}.?? gdb-${CONFIG}.???
|
||||
gdb.dvi: ${SFILES_DOC}
|
||||
if [ ! -f ./GDBvn.texi ]; then \
|
||||
ln -s $(srcdir)/GDBvn.texi . || \
|
||||
ln $(srcdir)/GDBvn.texi . || \
|
||||
cp $(srcdir)/GDBvn.texi . ; else true; fi
|
||||
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
|
||||
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
|
||||
$(TEXINDEX) gdb.??
|
||||
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
|
||||
rm -f gdb.?? gdb.log gdb.aux gdb.toc gdb.??s
|
||||
|
||||
# GDB MANUAL: info file
|
||||
# We're using texinfo2, and older makeinfo's may not be able to
|
||||
# cope with all the markup. In the meantime, we distribute the info
|
||||
# files
|
||||
gdb.info: gdb-${CONFIG}.texi
|
||||
$(MAKEINFO) -o ./gdb.info gdb-${CONFIG}.texi
|
||||
# cope with all the markup.
|
||||
gdb.info: ${SFILES_DOC}
|
||||
$(MAKEINFO) -I ${READLINE_DIR} -I $(srcdir) -o ./gdb.info gdb.texinfo
|
||||
|
||||
# GDB MANUAL: roff translations
|
||||
# Try to use a recent texi2roff. v2 was put on prep in jan91.
|
||||
@ -218,16 +191,65 @@ gdb.info: gdb-${CONFIG}.texi
|
||||
# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
|
||||
# + @alphaenumerate is ridiculously new, turned into @enumerate
|
||||
|
||||
# texi2roff doesn't have a notion of include dirs, so we have to fake
|
||||
# it out for gdb manual's include files---but only if not configured
|
||||
# in main sourcedir.
|
||||
links2roff: $(SFILES_INCLUDED)
|
||||
if [ ! -f gdb-config.texi ]; then \
|
||||
ln -s $(SFILES_INCLUDED) . || \
|
||||
ln $(SFILES_INCLUDED) . || \
|
||||
cp $(SFILES_INCLUDED) . ; \
|
||||
fi
|
||||
touch links2roff
|
||||
|
||||
# "Readline" appendices. Get them also due to lack of includes,
|
||||
# regardless of whether or not configuring in main sourcedir.
|
||||
# @ftable removed due to bug in texi2roff-2; if your texi2roff
|
||||
# is newer, try just ln or cp
|
||||
rluser.texinfo: ${READLINE_DIR}/rluser.texinfo
|
||||
sed -e 's/^@ftable/@table/g' \
|
||||
-e 's/^@end ftable/@end table/g' \
|
||||
${READLINE_DIR}/rluser.texinfo > ./rluser.texinfo
|
||||
|
||||
inc-hist.texi: ${READLINE_DIR}/inc-hist.texi
|
||||
ln -s ${READLINE_DIR}/inc-hist.texi . || \
|
||||
ln ${READLINE_DIR}/inc-hist.texi . || \
|
||||
cp ${READLINE_DIR}/inc-hist.texi .
|
||||
|
||||
# gdb manual suitable for [gtn]roff -me
|
||||
gdb.me: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
-e '/^@c /d' \
|
||||
-e 's/{.*,,/{/' \
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
$(srcdir)/gdb.texinfo | \
|
||||
$(TEXI2ROFF) -me | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>gdb.me
|
||||
|
||||
# gdb manual suitable for [gtn]roff -ms
|
||||
gdb.ms: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
-e '/^@c /d' \
|
||||
-e 's/{.*,,/{/' \
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
$(srcdir)/gdb.texinfo | \
|
||||
$(TEXI2ROFF) -ms | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>gdb.ms
|
||||
|
||||
# gdb manual suitable for [tn]roff -mm
|
||||
# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
|
||||
# try leaving them in
|
||||
# ditto special treatment of @ftable in rluser.texinfo
|
||||
gdb.mm: gdb-${CONFIG}.texi ${READLINE_DIR}/doc/rluser.texinfo inc-hist.texi
|
||||
rm -f ./rluser.texinfo
|
||||
sed -e 's/^@ftable/@table/g' \
|
||||
-e 's/^@end ftable/@end table/g' \
|
||||
${READLINE_DIR}/doc/rluser.texinfo > ./rluser.texinfo
|
||||
gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
@ -237,57 +259,16 @@ gdb.mm: gdb-${CONFIG}.texi ${READLINE_DIR}/doc/rluser.texinfo inc-hist.texi
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
gdb-${CONFIG}.texi | \
|
||||
$(srcdir)/gdb.texinfo | \
|
||||
$(TEXI2ROFF) -mm | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>gdb.mm
|
||||
rm ./rluser.texinfo
|
||||
|
||||
# gdb manual suitable for [gtn]roff -me
|
||||
gdb.me: gdb-${CONFIG}.texi ${READLINE_DIR}/doc/rluser.texinfo inc-hist.texi
|
||||
rm -f ./rluser.texinfo
|
||||
sed -e 's/^@ftable/@table/g' \
|
||||
-e 's/^@end ftable/@end table/g' \
|
||||
${READLINE_DIR}/doc/rluser.texinfo > ./rluser.texinfo
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
-e '/^@c /d' \
|
||||
-e 's/{.*,,/{/' \
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
gdb-${CONFIG}.texi | \
|
||||
$(TEXI2ROFF) -me | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>gdb.me
|
||||
rm ./rluser.texinfo
|
||||
|
||||
# gdb manual suitable for [gtn]roff -ms
|
||||
gdb.ms: gdb-${CONFIG}.texi ${READLINE_DIR}/doc/rluser.texinfo inc-hist.texi
|
||||
rm -f ./rluser.texinfo
|
||||
sed -e 's/^@ftable/@table/g' \
|
||||
-e 's/^@end ftable/@end table/g' \
|
||||
${READLINE_DIR}/doc/rluser.texinfo > ./rluser.texinfo
|
||||
sed -e '/\\input texinfo/d' \
|
||||
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
|
||||
-e '/^@ifinfo/,/^@end ifinfo/d' \
|
||||
-e '/^@c /d' \
|
||||
-e 's/{.*,,/{/' \
|
||||
-e 's/@ / /g' \
|
||||
-e 's/^@alphaenumerate/@enumerate/g' \
|
||||
-e 's/^@end alphaenumerate/@end enumerate/g' \
|
||||
gdb-${CONFIG}.texi | \
|
||||
$(TEXI2ROFF) -ms | \
|
||||
sed -e 's/---/\\(em/g' \
|
||||
>gdb.ms
|
||||
rm ./rluser.texinfo
|
||||
|
||||
# GDB INTERNALS MANUAL: TeX dvi file
|
||||
gdbint.dvi : gdbint.texinfo
|
||||
TEXINPUTS=${TEXIDIR}:.:$(srcdir):$$TEXINPUTS tex gdbint.texinfo
|
||||
texindex gdbint.??
|
||||
TEXINPUTS=${TEXIDIR}:.:$(srcdir):$$TEXINPUTS tex gdbint.texinfo
|
||||
$(SET_TEXINPUTS) $(TEX) gdbint.texinfo
|
||||
$(TEXINDEX) gdbint.??
|
||||
$(SET_TEXINPUTS) $(TEX) gdbint.texinfo
|
||||
rm -f gdbint.?? gdbint.aux gdbint.cps gdbint.fns gdbint.kys \
|
||||
gdbint.log gdbint.pgs gdbint.toc gdbint.tps gdbint.vrs
|
||||
|
||||
@ -302,9 +283,9 @@ stabs.info: stabs.texinfo
|
||||
|
||||
# STABS DOCUMENTATION: TeX dvi file
|
||||
stabs.dvi : stabs.texinfo
|
||||
TEXINPUTS=${TEXIDIR}:.:$(srcdir):$$TEXINPUTS tex stabs.texinfo
|
||||
texindex stabs.??
|
||||
TEXINPUTS=${TEXIDIR}:.:$(srcdir):$$TEXINPUTS tex stabs.texinfo
|
||||
$(SET_TEXINPUTS) $(TEX) stabs.texinfo
|
||||
$(TEXINDEX) stabs.??
|
||||
$(SET_TEXINPUTS) $(TEX) stabs.texinfo
|
||||
rm -f stabs.?? stabs.aux stabs.cps stabs.fns stabs.kys \
|
||||
stabs.log stabs.pgs stabs.toc stabs.tps stabs.vrs
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_ALL_ARCH__>,<1>)
|
||||
_define__(<_GENERIC__>,<1>) In case none.m4 changes its mind abt default
|
||||
|
||||
_define__(<_AOUT__>,<1>)
|
||||
_define__(<_BOUT__>,<1>)
|
||||
_define__(<_COFF__>,<1>)
|
||||
_define__(<_ELF__>,<1>)
|
||||
|
||||
_define__(<_REMOTESTUB__>,<1>)
|
||||
_define__(<_AMD29K__>,<1>)
|
||||
_define__(<_H8__>,<1>)
|
||||
_define__(<_I80386__>,<1>)
|
||||
_define__(<_I960__>,<1>)
|
||||
_define__(<_M680X0__>,<1>)
|
||||
_define__(<_SPARC__>,<1>)
|
||||
_define__(<_ST2000__>,<1>)
|
||||
_define__(<_VAX__>,<1>)
|
||||
_define__(<_VXWORKS__>,<1>)
|
||||
_define__(<_Z8000__>,<1>)
|
||||
|
||||
_divert__<>
|
@ -1,5 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_AMD29K__>,<1>)
|
||||
_define__(<_HOST__>,<AMD 29K>)
|
||||
_define__(<_MACH_DEP__>,<AMD29K Dependent>
|
||||
_divert__<>
|
@ -1,16 +1,7 @@
|
||||
srcname="GDB doc"
|
||||
srctrigger=gdb.texinfo
|
||||
# per-host:
|
||||
|
||||
case "${host_os}" in
|
||||
|
||||
sysv4* )
|
||||
host_makefile_frag=config/mh-sysv4
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# per-target:
|
||||
|
||||
files="gdbinv-m.m4.in gdbinv-s.m4.in"
|
||||
links="gdbinv-m.m4 gdbinv-s.m4"
|
||||
files=""
|
||||
links=""
|
||||
|
101
gdb/doc/gdb-config.texi
Normal file
101
gdb/doc/gdb-config.texi
Normal file
@ -0,0 +1,101 @@
|
||||
@c GDB MANUAL configuration file.
|
||||
@c Copyright (c) 1993 Free Software Foundation, Inc.
|
||||
@c
|
||||
@c NOTE: While the GDB manual is configurable (by changing these
|
||||
@c switches), its configuration is ***NOT*** automatically tied in to
|
||||
@c source configuration---because the authors expect that, save in
|
||||
@c unusual cases, the most inclusive form of the manual is appropriate
|
||||
@c no matter how the program itself is configured.
|
||||
@c
|
||||
@c The only automatically-varying variable is the GDB version number,
|
||||
@c which the Makefile rewrites based on the VERSION variable from
|
||||
@c `../Makefile.in'.
|
||||
@c
|
||||
@c GDB version number is recorded in the variable GDBVN
|
||||
@include GDBvn.texi
|
||||
@c
|
||||
@c ----------------------------------------------------------------------
|
||||
@c PLATFORM FLAGS:
|
||||
@set GENERIC
|
||||
@c
|
||||
@c Hitachi H8/300 target:
|
||||
@set Hviii
|
||||
@c Hitachi H8/300 target ONLY:
|
||||
@clear HviiiEXCLUSIVE
|
||||
@c
|
||||
@c SPARC target:
|
||||
@set SPARC
|
||||
@c
|
||||
@c AMD 29000 target:
|
||||
@set AMDxxixK
|
||||
@c
|
||||
@c Intel 960 target:
|
||||
@set Icmlx
|
||||
@c
|
||||
@c Tandem ST2000 (phone switch) target:
|
||||
@set STmm
|
||||
@c
|
||||
@c Zilog 8000 target:
|
||||
@set ZviiiK
|
||||
@c
|
||||
@c Lucid "Energize" environment:
|
||||
@clear LUCID
|
||||
@c
|
||||
@c Wind River Systems VxWorks environment:
|
||||
@set VXWORKS
|
||||
@c
|
||||
@c ----------------------------------------------------------------------
|
||||
@c DOC FEATURE FLAGS:
|
||||
@c
|
||||
@c Include change-from-old?
|
||||
@set NOVEL
|
||||
@c
|
||||
@c Bare-board target?
|
||||
@clear BARETARGET
|
||||
@c
|
||||
@c Restrict languages discussed to C?
|
||||
@clear CONLY
|
||||
@c
|
||||
@c Specifically for host machine running DOS?
|
||||
@clear DOSHOST
|
||||
@c
|
||||
@c Is manual stand-alone, or part of an agglomeration, with overall GPL?
|
||||
@clear AGGLOMERATION
|
||||
@c
|
||||
@c Remote serial line settings of interest?
|
||||
@set SERIAL
|
||||
@c
|
||||
@c Discuss features requiring Posix or similar OS environment?
|
||||
@set POSIX
|
||||
@c
|
||||
@c Discuss remote serial debugging stub?
|
||||
@set REMOTESTUB
|
||||
@c
|
||||
@c Refrain from discussing how to configure sw and format doc?
|
||||
@clear PRECONFIGURED
|
||||
@c
|
||||
@c Refrain from referring to unfree publications?
|
||||
@set FSFDOC
|
||||
@c
|
||||
@c ----------------------------------------------------------------------
|
||||
@c STRINGS:
|
||||
@c
|
||||
@c Name of GDB program. Used also for (gdb) prompt string.
|
||||
@set GDBP gdb
|
||||
@c
|
||||
@c Name of GDB product. Used in running text.
|
||||
@set GDBN GDB
|
||||
@c
|
||||
@c Name of GDB initialization file.
|
||||
@set GDBINIT .gdbinit
|
||||
@c
|
||||
@c Name of host. Should not be used in generic configs, but generic
|
||||
@c value may catch some flubs.
|
||||
@set HOST machine specific
|
||||
@c
|
||||
@c Name of GCC product
|
||||
@set NGCC GCC
|
||||
@c
|
||||
@c Name of GCC program
|
||||
@set GCC gcc
|
||||
|
2693
gdb/doc/gdb.texinfo
2693
gdb/doc/gdb.texinfo
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
||||
_dnl__ -*- Texinfo -*-
|
||||
_dnl__ Copyright (c) 1991 Free Software Foundation, Inc.
|
||||
_dnl__ This file is part of the source for the GDB manual.
|
||||
_dnl__ M4 FRAGMENT: $Id$
|
||||
_if__(_REMOTESTUB__)
|
||||
* Remote Serial:: _GDBN__ remote serial protocol
|
||||
_fi__(_REMOTESTUB__)
|
||||
_if__(_I960__)
|
||||
* i960-Nindy Remote:: _GDBN__ with a remote i960 (Nindy)
|
||||
_fi__(_I960__)
|
||||
_if__(_AMD29K__)
|
||||
* EB29K Remote:: _GDBN__ with a remote EB29K
|
||||
_fi__(_AMD29K__)
|
||||
_if__(_VXWORKS__)
|
||||
* VxWorks Remote:: _GDBN__ and VxWorks
|
||||
_fi__(_VXWORKS__)
|
||||
_if__(_ST2000__)
|
||||
* ST2000 Remote:: _GDBN__ with a Tandem ST2000
|
||||
_fi__(_ST2000__)
|
||||
_if__(_H8__)
|
||||
* Hitachi H8/300 Remote:: _GDBN__ and the Hitachi H8/300
|
||||
_fi__(_H8__)
|
||||
_if__(_Z8000__)
|
||||
* Z8000 Simulator:: _GDBN__ and its Zilog Z8000 Simulator
|
||||
_fi__(_Z8000__)
|
@ -1,989 +0,0 @@
|
||||
_dnl__ -*- Texinfo -*-
|
||||
_dnl__ Copyright (c) 1990 1991 1992 Free Software Foundation, Inc.
|
||||
_dnl__ This file is part of the source for the GDB manual.
|
||||
_dnl__ M4 FRAGMENT $Id$
|
||||
_dnl__ This text diverted to "Remote Debugging" section in general case;
|
||||
_dnl__ however, if we're doing a manual specifically for one of these, it
|
||||
_dnl__ belongs up front (in "Getting In and Out" chapter).
|
||||
_if__(_REMOTESTUB__)
|
||||
@node Remote Serial
|
||||
@subsection The _GDBN__ remote serial protocol
|
||||
|
||||
@cindex remote serial debugging, overview
|
||||
To debug a program running on another machine (the debugging
|
||||
@dfn{target} machine), you must first arrange for all the usual
|
||||
prerequisites for the program to run by itself. For example, for a C
|
||||
program, you need
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
A startup routine to set up the C runtime environment; these usually
|
||||
have a name like @file{crt0}. The startup routine may be supplied by
|
||||
your hardware supplier, or you may have to write your own.
|
||||
|
||||
@item
|
||||
You probably need a C subroutine library to support your program's
|
||||
subroutine calls, notably managing input and output.
|
||||
|
||||
@item
|
||||
A way of getting your program to the other machine---for example, a
|
||||
download program. These are often supplied by the hardware
|
||||
manufacturer, but you may have to write your own from hardware
|
||||
documentation.
|
||||
@end enumerate
|
||||
|
||||
The next step is to arrange for your program to use a serial port to
|
||||
communicate with the machine where _GDBN__ is running (the @dfn{host}
|
||||
machine). In general terms, the scheme looks like this:
|
||||
|
||||
@table @emph
|
||||
@item On the host,
|
||||
_GDBN__ already understands how to use this protocol; when everything
|
||||
else is set up, you can simply use the @samp{target remote} command
|
||||
(@pxref{Targets,,Specifying a Debugging Target}).
|
||||
|
||||
@item On the target,
|
||||
you must link with your program a few special-purpose subroutines that
|
||||
implement the _GDBN__ remote serial protocol. The file containing these
|
||||
subroutines is called a @dfn{debugging stub}.
|
||||
@end table
|
||||
|
||||
The debugging stub is specific to the architecture of the remote
|
||||
machine; for example, use @file{sparc-stub.c} to debug programs on
|
||||
@sc{sparc} boards.
|
||||
|
||||
@cindex remote serial stub list
|
||||
These working remote stubs are distributed with _GDBN__:
|
||||
|
||||
@c FIXME! verify these...
|
||||
@table @code
|
||||
@item sparc-stub.c
|
||||
@kindex sparc-stub.c
|
||||
For @sc{sparc} architectures.
|
||||
|
||||
@item m68k-stub.c
|
||||
@kindex m68-stub.c
|
||||
For Motorola 680x0 architectures.
|
||||
|
||||
@item i386-stub.c
|
||||
@kindex i36-stub.c
|
||||
For Intel 386 and compatible architectures.
|
||||
@end table
|
||||
|
||||
The @file{README} file in the _GDBN__ distribution may list other
|
||||
recently added stubs.
|
||||
|
||||
@menu
|
||||
* stub contents:: What the stub can do for you
|
||||
* bootstrapping:: What you must do for the stub
|
||||
* debug session:: Putting it all together
|
||||
* protocol:: Outline of the communication protocol
|
||||
@end menu
|
||||
|
||||
@node stub contents
|
||||
@subsubsection What the stub can do for you
|
||||
|
||||
@cindex remote serial stub
|
||||
The debugging stub for your architecture supplies these three
|
||||
subroutines:
|
||||
|
||||
@table @code
|
||||
@item set_debug_traps
|
||||
@kindex set_debug_traps
|
||||
@cindex remote serial stub, initialization
|
||||
This routine arranges to transfer control to @code{handle_exception}
|
||||
when your program stops. You must call this subroutine explicitly near
|
||||
the beginning of your program.
|
||||
|
||||
@item handle_exception
|
||||
@kindex handle_exception
|
||||
@cindex remote serial stub, main routine
|
||||
This is the central workhorse, but your program never calls it
|
||||
explicitly---the setup code arranges for @code{handle_exception} to
|
||||
run when a trap is triggered.
|
||||
|
||||
@code{handle_exception} takes control when your program stops during
|
||||
execution (for example, on a breakpoint), and mediates communications
|
||||
with _GDBN__ on the host machine. This is where the communications
|
||||
protocol is implemented; @code{handle_exception} acts as the _GDBN__
|
||||
representative on the target machine; it begins by sending summary
|
||||
information on the state of your program, then continues to execute,
|
||||
retrieving and transmitting any information _GDBN__ needs, until you
|
||||
execute a _GDBN__ command that makes your program resume; at that point,
|
||||
@code{handle_exception} returns control to your own code on the target
|
||||
machine.
|
||||
|
||||
@item breakpoint
|
||||
@cindex @code{breakpoint} subroutine, remote
|
||||
Use this auxiliary subroutine to make your program contain a
|
||||
breakpoint. Depending on the particular situation, this may be the only
|
||||
way for _GDBN__ to get control. For instance, if your target
|
||||
machine has some sort of interrupt button, you won't need to call this;
|
||||
pressing the interrupt button will transfer control to
|
||||
@code{handle_exception}---in efect, to _GDBN__. On some machines,
|
||||
simply receiving characters on the serial port may also trigger a trap;
|
||||
again, in that situation, you don't need to call @code{breakpoint} from
|
||||
your own program---simply running @samp{target remote} from the host
|
||||
_GDBN__ session will get control.
|
||||
|
||||
Call @code{breakpoint} if none of these is true, or if you simply want
|
||||
to make certain your program stops at a predetermined point for the
|
||||
start of your debugging session.
|
||||
@end table
|
||||
|
||||
@node bootstrapping
|
||||
@subsubsection What you must do for the stub
|
||||
|
||||
@cindex remote stub, support routines
|
||||
The debugging stubs that come with _GDBN__ are set up for a particular
|
||||
chip architecture, but they have no information about the rest of your
|
||||
debugging target machine. To allow the stub to work, you must supply
|
||||
these special low-level subroutines:
|
||||
|
||||
@table @code
|
||||
@item int getDebugChar()
|
||||
@kindex getDebugChar
|
||||
Write this subroutine to read a single character from the serial port.
|
||||
It may be identical to @code{getchar} for your target system; a
|
||||
different name is used to allow you to distinguish the two if you wish.
|
||||
|
||||
@item void putDebugChar(int)
|
||||
@kindex putDebugChar
|
||||
Write this subroutine to write a single character to the serial port.
|
||||
It may be identical to @code{putchar} for your target system; a
|
||||
different name is used to allow you to distinguish the two if you wish.
|
||||
|
||||
@item void flush_i_cache()
|
||||
@kindex flush_i_cache
|
||||
Write this subroutine to flush the instruction cache, if any, on your
|
||||
target machine. If there is no instruction cache, this subroutine may
|
||||
be a no-op.
|
||||
|
||||
On target machines that have instruction caches, _GDBN__ requires this
|
||||
function to make certain that the state of your program is stable.
|
||||
@end table
|
||||
|
||||
@noindent
|
||||
You must also make sure this library routine is available:
|
||||
|
||||
@table @code
|
||||
@item void *memset(void *, int, int)
|
||||
@kindex memset
|
||||
This is the standard library function @code{memset} that sets an area of
|
||||
memory to a known value. If you have one of the free versions of
|
||||
@code{libc.a}, @code{memset} can be found there; otherwise, you must
|
||||
either obtain it from your hardware manufacturer, or write your own.
|
||||
@end table
|
||||
|
||||
If you do not use the GNU C compiler, you may need other standard
|
||||
library subroutines as well; this will vary from one stub to another,
|
||||
but in general the stubs are likely to use any of the common library
|
||||
subroutines which @code{gcc} generates as inline code.
|
||||
|
||||
|
||||
@node debug session
|
||||
@subsubsection Putting it all together
|
||||
|
||||
@cindex remote serial debugging summary
|
||||
In summary, when your program is ready to debug, you must follow these
|
||||
steps.
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Make sure you have the supporting low-level routines:
|
||||
@code{getDebugChar}, @code{putDebugChar}, @code{flush_i_cache},
|
||||
@code{memset}.
|
||||
|
||||
@item
|
||||
Insert these lines near the top of your program:
|
||||
|
||||
@example
|
||||
set_debug_traps();
|
||||
breakpoint();
|
||||
@end example
|
||||
|
||||
@item
|
||||
Compile and link together: your program, the _GDBN__ debugging stub for
|
||||
your target architecture, and the supporting subroutines.
|
||||
|
||||
@item
|
||||
Make sure you have a serial connection between your target machine and
|
||||
the _GDBN__ host, and identify the serial port used for this on the host.
|
||||
|
||||
@item
|
||||
Download your program to your target machine (or get it there by
|
||||
whatever means the manufacturer provides), and start it.
|
||||
|
||||
@item
|
||||
To start remote debugging, run _GDBN__ on the host machine, and specify
|
||||
as an executable file the program that is running in the remote machine.
|
||||
This tells _GDBN__ how to find your program's symbols and the contents
|
||||
of its pure text.
|
||||
|
||||
Then establish communication using the @code{target remote} command.
|
||||
Its argument is the name of the device you're using to control the
|
||||
target machine. For example:
|
||||
|
||||
@example
|
||||
target remote /dev/ttyb
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
if the serial line is connected to the device named @file{/dev/ttyb}.
|
||||
@ignore
|
||||
@c this is from the old text, but it doesn't seem to make sense now that I've
|
||||
@c seen an example... pesch 4sep1992
|
||||
This will stop the remote machine if it is not already stopped.
|
||||
@end ignore
|
||||
|
||||
@end enumerate
|
||||
|
||||
Now you can use all the usual commands to examine and change data and to
|
||||
step and continue the remote program.
|
||||
|
||||
To resume the remote program and stop debugging it, use the @code{detach}
|
||||
command.
|
||||
|
||||
@node protocol
|
||||
@subsubsection Outline of the communication protocol
|
||||
|
||||
@cindex debugging stub, example
|
||||
@cindex remote stub, example
|
||||
@cindex stub example, remote debugging
|
||||
The stub files provided with _GDBN__ implement the target side of the
|
||||
communication protocol, and the _GDBN__ side is implemented in the
|
||||
_GDBN__ source file @file{remote.c}. Normally, you can simply allow
|
||||
these subroutines to communicate, and ignore the details. (If you're
|
||||
implementing your own stub file, you can still ignore the details: start
|
||||
with one of the existing stub files. @file{sparc-stub.c} is the best
|
||||
organized, and therefore the easiest to read.)
|
||||
|
||||
However, there may be occasions when you need to know something about
|
||||
the protocol---for example, if there is only one serial port to your
|
||||
target machine, you might want your program to do something special if
|
||||
it recognizes a packet meant for _GDBN__.
|
||||
|
||||
@cindex protocol, _GDBN__ remote serial
|
||||
@cindex serial protocol, _GDBN__ remote
|
||||
@cindex remote serial protocol
|
||||
All _GDBN__ commands and responses (other than acknowledgements, which
|
||||
are single characters) are sent as a packet which includes a
|
||||
checksum. A packet is introduced with the character @samp{$}, and ends
|
||||
with the character @samp{#} followed by a two-digit checksum:
|
||||
|
||||
@example
|
||||
$@var{packet info}#@var{checksum}
|
||||
@end example
|
||||
|
||||
@cindex checksum, for _GDBN__ remote
|
||||
@noindent
|
||||
@var{checksum} is computed as the modulo 256 sum of the @var{packet
|
||||
info} characters.
|
||||
|
||||
When either the host or the target machine receives a packet, the first
|
||||
response expected is an acknowledgement: a single character, either
|
||||
@samp{+} (to indicate the package was received correctly) or @samp{-}
|
||||
(to request retransmission).
|
||||
|
||||
The host (_GDBN__) sends commands, and the target (the debugging stub
|
||||
incorporated in your program) sends data in response. The target also
|
||||
sends data when your program stops.
|
||||
|
||||
Command packets are distinguished by their first character, which
|
||||
identifies the kind of command.
|
||||
|
||||
These are the commands currently supported:
|
||||
|
||||
@table @code
|
||||
@item g
|
||||
Requests the values of CPU registers.
|
||||
|
||||
@item G
|
||||
Sets the values of CPU registers.
|
||||
|
||||
@item m@var{addr},@var{count}
|
||||
Read @var{count} bytes at location @var{addr}.
|
||||
|
||||
@item M@var{addr},@var{count}:@dots{}
|
||||
Write @var{count} bytes at location @var{addr}.
|
||||
|
||||
@item c
|
||||
@itemx c@var{addr}
|
||||
Resume execution at the current address (or at @var{addr} if supplied).
|
||||
|
||||
@item s
|
||||
@itemx s@var{addr}
|
||||
Step the target program for one instruction, from either the current
|
||||
program counter or from @var{addr} if supplied.
|
||||
|
||||
@item k
|
||||
Kill the target program.
|
||||
|
||||
@item ?
|
||||
Report the most recent signal. To allow you to take advantage of the
|
||||
_GDBN__ signal handling commands, one of the functions of the debugging
|
||||
stub is to report CPU traps as the corresponding POSIX signal values.
|
||||
@end table
|
||||
|
||||
@kindex set remotedebug
|
||||
@kindex show remotedebug
|
||||
@cindex packets, reporting on stdout
|
||||
@cindex serial connections, debugging
|
||||
If you have trouble with the serial connection, you can use the command
|
||||
@code{set remotedebug}. This makes _GDBN__ report on all packets sent
|
||||
back and forth across the serial line to the remote machine. The
|
||||
packet-debugging information is printed on the _GDBN__ standard output
|
||||
stream. @code{set remotedebug off} turns it off, and @code{show
|
||||
remotedebug} will show you its current state.
|
||||
_fi__(_REMOTESTUB__)
|
||||
|
||||
_if__(_I960__)
|
||||
@node i960-Nindy Remote
|
||||
@subsection _GDBN__ with a Remote i960 (Nindy)
|
||||
|
||||
@cindex Nindy
|
||||
@cindex i960
|
||||
@dfn{Nindy} is a ROM Monitor program for Intel 960 target systems. When
|
||||
_GDBN__ is configured to control a remote Intel 960 using Nindy, you can
|
||||
tell _GDBN__ how to connect to the 960 in several ways:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Through command line options specifying serial port, version of the
|
||||
Nindy protocol, and communications speed;
|
||||
|
||||
@item
|
||||
By responding to a prompt on startup;
|
||||
|
||||
@item
|
||||
By using the @code{target} command at any point during your _GDBN__
|
||||
session. @xref{Target Commands, ,Commands for Managing Targets}.
|
||||
|
||||
@end itemize
|
||||
|
||||
@menu
|
||||
* Nindy Startup:: Startup with Nindy
|
||||
* Nindy Options:: Options for Nindy
|
||||
* Nindy reset:: Nindy Reset Command
|
||||
@end menu
|
||||
|
||||
@node Nindy Startup
|
||||
@subsubsection Startup with Nindy
|
||||
|
||||
If you simply start @code{_GDBP__} without using any command-line
|
||||
options, you are prompted for what serial port to use, @emph{before} you
|
||||
reach the ordinary _GDBN__ prompt:
|
||||
|
||||
@example
|
||||
Attach /dev/ttyNN -- specify NN, or "quit" to quit:
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Respond to the prompt with whatever suffix (after @samp{/dev/tty})
|
||||
identifies the serial port you want to use. You can, if you choose,
|
||||
simply start up with no Nindy connection by responding to the prompt
|
||||
with an empty line. If you do this, and later wish to attach to Nindy,
|
||||
use @code{target} (@pxref{Target Commands, ,Commands for Managing Targets}).
|
||||
|
||||
@node Nindy Options
|
||||
@subsubsection Options for Nindy
|
||||
|
||||
These are the startup options for beginning your _GDBN__ session with a
|
||||
Nindy-960 board attached:
|
||||
|
||||
@table @code
|
||||
@item -r @var{port}
|
||||
Specify the serial port name of a serial interface to be used to connect
|
||||
to the target system. This option is only available when _GDBN__ is
|
||||
configured for the Intel 960 target architecture. You may specify
|
||||
@var{port} as any of: a full pathname (e.g. @samp{-r /dev/ttya}), a
|
||||
device name in @file{/dev} (e.g. @samp{-r ttya}), or simply the unique
|
||||
suffix for a specific @code{tty} (e.g. @samp{-r a}).
|
||||
|
||||
@item -O
|
||||
(An uppercase letter ``O'', not a zero.) Specify that _GDBN__ should use
|
||||
the ``old'' Nindy monitor protocol to connect to the target system.
|
||||
This option is only available when _GDBN__ is configured for the Intel 960
|
||||
target architecture.
|
||||
|
||||
@quotation
|
||||
@emph{Warning:} if you specify @samp{-O}, but are actually trying to
|
||||
connect to a target system that expects the newer protocol, the connection
|
||||
will fail, appearing to be a speed mismatch. _GDBN__ will repeatedly
|
||||
attempt to reconnect at several different line speeds. You can abort
|
||||
this process with an interrupt.
|
||||
@end quotation
|
||||
|
||||
@item -brk
|
||||
Specify that _GDBN__ should first send a @code{BREAK} signal to the target
|
||||
system, in an attempt to reset it, before connecting to a Nindy target.
|
||||
|
||||
@quotation
|
||||
@emph{Warning:} Many target systems do not have the hardware that this
|
||||
requires; it only works with a few boards.
|
||||
@end quotation
|
||||
@end table
|
||||
|
||||
The standard @samp{-b} option controls the line speed used on the serial
|
||||
port.
|
||||
|
||||
@c @group
|
||||
@node Nindy reset
|
||||
@subsubsection Nindy Reset Command
|
||||
|
||||
@table @code
|
||||
@item reset
|
||||
@kindex reset
|
||||
For a Nindy target, this command sends a ``break'' to the remote target
|
||||
system; this is only useful if the target has been equipped with a
|
||||
circuit to perform a hard reset (or some other interesting action) when
|
||||
a break is detected.
|
||||
@end table
|
||||
@c @end group
|
||||
_fi__(_I960__)
|
||||
|
||||
_if__(_AMD29K__)
|
||||
@node EB29K Remote
|
||||
@subsection _GDBN__ with a Remote EB29K
|
||||
|
||||
@cindex EB29K board
|
||||
@cindex running 29K programs
|
||||
|
||||
To use _GDBN__ from a Unix system to run programs on AMD's EB29K
|
||||
board in a PC, you must first connect a serial cable between the PC
|
||||
and a serial port on the Unix system. In the following, we assume
|
||||
you've hooked the cable between the PC's @file{COM1} port and
|
||||
@file{/dev/ttya} on the Unix system.
|
||||
|
||||
@menu
|
||||
* Comms (EB29K):: Communications Setup
|
||||
* _GDBP__-EB29K:: EB29K cross-debugging
|
||||
* Remote Log:: Remote Log
|
||||
@end menu
|
||||
|
||||
@node Comms (EB29K)
|
||||
@subsubsection Communications Setup
|
||||
|
||||
The next step is to set up the PC's port, by doing something like the
|
||||
following in DOS on the PC:
|
||||
|
||||
_0__@example
|
||||
C:\> MODE com1:9600,n,8,1,none
|
||||
_1__@end example
|
||||
|
||||
@noindent
|
||||
This example---run on an MS DOS 4.0 system---sets the PC port to 9600
|
||||
bps, no parity, eight data bits, one stop bit, and no ``retry'' action;
|
||||
you must match the communications parameters when establishing the Unix
|
||||
end of the connection as well.
|
||||
@c FIXME: Who knows what this "no retry action" crud from the DOS manual may
|
||||
@c mean? It's optional; leave it out? ---pesch@cygnus.com, 25feb91
|
||||
|
||||
To give control of the PC to the Unix side of the serial line, type
|
||||
the following at the DOS console:
|
||||
|
||||
_0__@example
|
||||
C:\> CTTY com1
|
||||
_1__@end example
|
||||
|
||||
@noindent
|
||||
(Later, if you wish to return control to the DOS console, you can use
|
||||
the command @code{CTTY con}---but you must send it over the device that
|
||||
had control, in our example over the @file{COM1} serial line).
|
||||
|
||||
From the Unix host, use a communications program such as @code{tip} or
|
||||
@code{cu} to communicate with the PC; for example,
|
||||
|
||||
@example
|
||||
cu -s 9600 -l /dev/ttya
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The @code{cu} options shown specify, respectively, the linespeed and the
|
||||
serial port to use. If you use @code{tip} instead, your command line
|
||||
may look something like the following:
|
||||
|
||||
@example
|
||||
tip -9600 /dev/ttya
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Your system may define a different name where our example uses
|
||||
@file{/dev/ttya} as the argument to @code{tip}. The communications
|
||||
parameters, including which port to use, are associated with the
|
||||
@code{tip} argument in the ``remote'' descriptions file---normally the
|
||||
system table @file{/etc/remote}.
|
||||
@c FIXME: What if anything needs doing to match the "n,8,1,none" part of
|
||||
@c the DOS side's comms setup? cu can support -o (odd
|
||||
@c parity), -e (even parity)---apparently no settings for no parity or
|
||||
@c for character size. Taken from stty maybe...? John points out tip
|
||||
@c can set these as internal variables, eg ~s parity=none; man stty
|
||||
@c suggests that it *might* work to stty these options with stdin or
|
||||
@c stdout redirected... ---pesch@cygnus.com, 25feb91
|
||||
|
||||
@kindex EBMON
|
||||
Using the @code{tip} or @code{cu} connection, change the DOS working
|
||||
directory to the directory containing a copy of your 29K program, then
|
||||
start the PC program @code{EBMON} (an EB29K control program supplied
|
||||
with your board by AMD). You should see an initial display from
|
||||
@code{EBMON} similar to the one that follows, ending with the
|
||||
@code{EBMON} prompt @samp{#}---
|
||||
|
||||
_0__@example
|
||||
C:\> G:
|
||||
|
||||
G:\> CD \usr\joe\work29k
|
||||
|
||||
G:\USR\JOE\WORK29K> EBMON
|
||||
Am29000 PC Coprocessor Board Monitor, version 3.0-18
|
||||
Copyright 1990 Advanced Micro Devices, Inc.
|
||||
Written by Gibbons and Associates, Inc.
|
||||
|
||||
Enter '?' or 'H' for help
|
||||
|
||||
PC Coprocessor Type = EB29K
|
||||
I/O Base = 0x208
|
||||
Memory Base = 0xd0000
|
||||
|
||||
Data Memory Size = 2048KB
|
||||
Available I-RAM Range = 0x8000 to 0x1fffff
|
||||
Available D-RAM Range = 0x80002000 to 0x801fffff
|
||||
|
||||
PageSize = 0x400
|
||||
Register Stack Size = 0x800
|
||||
Memory Stack Size = 0x1800
|
||||
|
||||
CPU PRL = 0x3
|
||||
Am29027 Available = No
|
||||
Byte Write Available = Yes
|
||||
|
||||
# ~.
|
||||
_1__@end example
|
||||
|
||||
Then exit the @code{cu} or @code{tip} program (done in the example by
|
||||
typing @code{~.} at the @code{EBMON} prompt). @code{EBMON} will keep
|
||||
running, ready for _GDBN__ to take over.
|
||||
|
||||
For this example, we've assumed what is probably the most convenient
|
||||
way to make sure the same 29K program is on both the PC and the Unix
|
||||
system: a PC/NFS connection that establishes ``drive @code{G:}'' on the
|
||||
PC as a file system on the Unix host. If you do not have PC/NFS or
|
||||
something similar connecting the two systems, you must arrange some
|
||||
other way---perhaps floppy-disk transfer---of getting the 29K program
|
||||
from the Unix system to the PC; _GDBN__ will @emph{not} download it over the
|
||||
serial line.
|
||||
|
||||
@node _GDBP__-EB29K
|
||||
@subsubsection EB29K cross-debugging
|
||||
|
||||
Finally, @code{cd} to the directory containing an image of your 29K
|
||||
program on the Unix system, and start _GDBN__---specifying as argument the
|
||||
name of your 29K program:
|
||||
|
||||
@example
|
||||
cd /usr/joe/work29k
|
||||
_GDBP__ myfoo
|
||||
@end example
|
||||
|
||||
Now you can use the @code{target} command:
|
||||
|
||||
@example
|
||||
target amd-eb /dev/ttya 9600 MYFOO
|
||||
@c FIXME: test above 'target amd-eb' as spelled, with caps! caps are meant to
|
||||
@c emphasize that this is the name as seen by DOS (since I think DOS is
|
||||
@c single-minded about case of letters). ---pesch@cygnus.com, 25feb91
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
In this example, we've assumed your program is in a file called
|
||||
@file{myfoo}. Note that the filename given as the last argument to
|
||||
@code{target amd-eb} should be the name of the program as it appears to DOS.
|
||||
In our example this is simply @code{MYFOO}, but in general it can include
|
||||
a DOS path, and depending on your transfer mechanism may not resemble
|
||||
the name on the Unix side.
|
||||
|
||||
At this point, you can set any breakpoints you wish; when you are ready
|
||||
to see your program run on the 29K board, use the _GDBN__ command
|
||||
@code{run}.
|
||||
|
||||
To stop debugging the remote program, use the _GDBN__ @code{detach}
|
||||
command.
|
||||
|
||||
To return control of the PC to its console, use @code{tip} or @code{cu}
|
||||
once again, after your _GDBN__ session has concluded, to attach to
|
||||
@code{EBMON}. You can then type the command @code{q} to shut down
|
||||
@code{EBMON}, returning control to the DOS command-line interpreter.
|
||||
Type @code{CTTY con} to return command input to the main DOS console,
|
||||
and type @kbd{~.} to leave @code{tip} or @code{cu}.
|
||||
|
||||
@node Remote Log
|
||||
@subsubsection Remote Log
|
||||
@kindex eb.log
|
||||
@cindex log file for EB29K
|
||||
|
||||
The @code{target amd-eb} command creates a file @file{eb.log} in the
|
||||
current working directory, to help debug problems with the connection.
|
||||
@file{eb.log} records all the output from @code{EBMON}, including echoes
|
||||
of the commands sent to it. Running @samp{tail -f} on this file in
|
||||
another window often helps to understand trouble with @code{EBMON}, or
|
||||
unexpected events on the PC side of the connection.
|
||||
|
||||
_fi__(_AMD29K__)
|
||||
|
||||
_if__(_ST2000__)
|
||||
@node ST2000 Remote
|
||||
@subsection _GDBN__ with a Tandem ST2000
|
||||
|
||||
To connect your ST2000 to the host system, see the manufacturer's
|
||||
manual. Once the ST2000 is physically attached, you can run
|
||||
|
||||
@example
|
||||
target st2000 @var{dev} @var{speed}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
to establish it as your debugging environment.
|
||||
|
||||
The @code{load} and @code{attach} commands are @emph{not} defined for
|
||||
this target; you must load your program into the ST2000 as you normally
|
||||
would for standalone operation. _GDBN__ will read debugging information
|
||||
(such as symbols) from a separate, debugging version of the program
|
||||
available on your host computer.
|
||||
@c FIXME!! This is terribly vague; what little content is here is
|
||||
@c basically hearsay.
|
||||
|
||||
@cindex ST2000 auxiliary commands
|
||||
These auxiliary _GDBN__ commands are available to help you with the ST2000
|
||||
environment:
|
||||
|
||||
@table @code
|
||||
@item st2000 @var{command}
|
||||
@kindex st2000 @var{cmd}
|
||||
@cindex STDBUG commands (ST2000)
|
||||
@cindex commands to STDBUG (ST2000)
|
||||
Send a @var{command} to the STDBUG monitor. See the manufacturer's
|
||||
manual for available commands.
|
||||
|
||||
@item connect
|
||||
@cindex connect (to STDBUG)
|
||||
Connect the controlling terminal to the STDBUG command monitor. When
|
||||
you are done interacting with STDBUG, typing either of two character
|
||||
sequences will get you back to the _GDBN__ command prompt:
|
||||
@kbd{@key{RET}~.} (Return, followed by tilde and period) or
|
||||
@kbd{@key{RET}~@key{C-d}} (Return, followed by tilde and control-D).
|
||||
@end table
|
||||
_fi__(_ST2000__)
|
||||
|
||||
_if__(_VXWORKS__)
|
||||
@node VxWorks Remote
|
||||
@subsection _GDBN__ and VxWorks
|
||||
@cindex VxWorks
|
||||
|
||||
_GDBN__ enables developers to spawn and debug tasks running on networked
|
||||
VxWorks targets from a Unix host. Already-running tasks spawned from
|
||||
the VxWorks shell can also be debugged. _GDBN__ uses code that runs on
|
||||
both the UNIX host and on the VxWorks target. The program
|
||||
@code{_GDBP__} is installed and executed on the UNIX host.
|
||||
|
||||
The following information on connecting to VxWorks was current when
|
||||
this manual was produced; newer releases of VxWorks may use revised
|
||||
procedures.
|
||||
|
||||
The remote debugging interface (RDB) routines are installed and executed
|
||||
on the VxWorks target. These routines are included in the VxWorks library
|
||||
@file{rdb.a} and are incorporated into the system image when source-level
|
||||
debugging is enabled in the VxWorks configuration.
|
||||
|
||||
@kindex INCLUDE_RDB
|
||||
If you wish, you can define @code{INCLUDE_RDB} in the VxWorks
|
||||
configuration file @file{configAll.h} to include the RDB interface
|
||||
routines and spawn the source debugging task @code{tRdbTask} when
|
||||
VxWorks is booted. For more information on configuring and remaking
|
||||
_if__(_FSF__)
|
||||
VxWorks, see the manufacturer's manual.
|
||||
_fi__(_FSF__)
|
||||
_if__(!_FSF__)
|
||||
VxWorks, see the @cite{VxWorks Programmer's Guide}.
|
||||
_fi__(!_FSF__)
|
||||
|
||||
Once you have included the RDB interface in your VxWorks system image
|
||||
and set your Unix execution search path to find _GDBN__, you are ready
|
||||
to run _GDBN__. From your UNIX host, type:
|
||||
|
||||
@smallexample
|
||||
% _GDBP__
|
||||
@end smallexample
|
||||
|
||||
_GDBN__ will come up showing the prompt:
|
||||
|
||||
@smallexample
|
||||
(_GDBP__)
|
||||
@end smallexample
|
||||
|
||||
@menu
|
||||
* VxWorks connection:: Connecting to VxWorks
|
||||
* VxWorks download:: VxWorks Download
|
||||
* VxWorks attach:: Running Tasks
|
||||
@end menu
|
||||
|
||||
@node VxWorks connection
|
||||
@subsubsection Connecting to VxWorks
|
||||
|
||||
The _GDBN__ command @code{target} lets you connect to a VxWorks target on the
|
||||
network. To connect to a target whose host name is ``@code{tt}'', type:
|
||||
|
||||
@smallexample
|
||||
(_GDBP__) target vxworks tt
|
||||
@end smallexample
|
||||
|
||||
_GDBN__ will display a message similar to the following:
|
||||
|
||||
@smallexample
|
||||
Attaching remote machine across net... Success!
|
||||
@end smallexample
|
||||
|
||||
_GDBN__ will then attempt to read the symbol tables of any object modules
|
||||
loaded into the VxWorks target since it was last booted. _GDBN__ locates
|
||||
these files by searching the directories listed in the command search
|
||||
path (@pxref{Environment, ,Your Program's Environment}); if it fails
|
||||
to find an object file, it will display a message such as:
|
||||
|
||||
@smallexample
|
||||
prog.o: No such file or directory.
|
||||
@end smallexample
|
||||
|
||||
This will cause the @code{target} command to abort. When this happens,
|
||||
you should add the appropriate directory to the search path, with the
|
||||
_GDBN__ command @code{path}, and execute the @code{target} command
|
||||
again.
|
||||
|
||||
@node VxWorks download
|
||||
@subsubsection VxWorks Download
|
||||
|
||||
@cindex download to VxWorks
|
||||
If you have connected to the VxWorks target and you want to debug an
|
||||
object that has not yet been loaded, you can use the _GDBN__ @code{load}
|
||||
command to download a file from UNIX to VxWorks incrementally. The
|
||||
object file given as an argument to the @code{load} command is actually
|
||||
opened twice: first by the VxWorks target in order to download the code,
|
||||
then by _GDBN__ in order to read the symbol table. This can lead to
|
||||
problems if the current working directories on the two systems differ.
|
||||
It is simplest to set the working directory on both systems to the
|
||||
directory in which the object file resides, and then to reference the
|
||||
file by its name, without any path. Thus, to load a program
|
||||
@file{prog.o}, residing in @file{wherever/vw/demo/rdb}, on VxWorks type:
|
||||
|
||||
@smallexample
|
||||
-> cd "wherever/vw/demo/rdb"
|
||||
@end smallexample
|
||||
|
||||
On _GDBN__ type:
|
||||
|
||||
@smallexample
|
||||
(_GDBP__) cd wherever/vw/demo/rdb
|
||||
(_GDBP__) load prog.o
|
||||
@end smallexample
|
||||
|
||||
_GDBN__ will display a response similar to the following:
|
||||
|
||||
@smallexample
|
||||
Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
|
||||
@end smallexample
|
||||
|
||||
You can also use the @code{load} command to reload an object module
|
||||
after editing and recompiling the corresponding source file. Note that
|
||||
this will cause _GDBN__ to delete all currently-defined breakpoints,
|
||||
auto-displays, and convenience variables, and to clear the value
|
||||
history. (This is necessary in order to preserve the integrity of
|
||||
debugger data structures that reference the target system's symbol
|
||||
table.)
|
||||
|
||||
@node VxWorks attach
|
||||
@subsubsection Running Tasks
|
||||
|
||||
@cindex running VxWorks tasks
|
||||
You can also attach to an existing task using the @code{attach} command as
|
||||
follows:
|
||||
|
||||
@smallexample
|
||||
(_GDBP__) attach @var{task}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where @var{task} is the VxWorks hexadecimal task ID. The task can be running
|
||||
or suspended when you attach to it. If running, it will be suspended at
|
||||
the time of attachment.
|
||||
_fi__(_VXWORKS__)
|
||||
|
||||
_if__(_H8__)
|
||||
@node Hitachi H8/300 Remote
|
||||
@subsection _GDBN__ and the Hitachi H8/300
|
||||
_GDBN__ needs to know these things to talk to your H8/300:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
that you want to use @samp{target hms}, the remote debugging
|
||||
interface for the H8/300 (this is the default when
|
||||
GDB is configured specifically for the H8/300);
|
||||
|
||||
@item
|
||||
what serial device connects your host to your H8/300 (the first serial
|
||||
device available on your host is the default);
|
||||
|
||||
@ignore
|
||||
@c this is only for Unix hosts, not currently of interest.
|
||||
@item
|
||||
what speed to use over the serial device.
|
||||
@end ignore
|
||||
@end enumerate
|
||||
|
||||
@kindex device
|
||||
@cindex serial device for H8/300
|
||||
@ignore
|
||||
@c only for Unix hosts
|
||||
Use the special @code{gdb83} command @samp{device @var{port}} if you
|
||||
need to explicitly set the serial device. The default @var{port} is the
|
||||
first available port on your host. This is only necessary on Unix
|
||||
hosts, where it is typically something like @file{/dev/ttya}.
|
||||
|
||||
@kindex speed
|
||||
@cindex serial line speed for H8/300
|
||||
@code{gdb83} has another special command to set the communications speed
|
||||
for the H8/300: @samp{speed @var{bps}}. This command also is only used
|
||||
from Unix hosts; on DOS hosts, set the line speed as usual from outside
|
||||
GDB with the DOS @kbd{mode} command (for instance, @w{@samp{mode
|
||||
com2:9600,n,8,1,p}} for a 9600 bps connection).
|
||||
@end ignore
|
||||
|
||||
_GDBN__ depends on an auxiliary terminate-and-stay-resident program
|
||||
called @code{asynctsr} to communicate with the H8/300 development board
|
||||
through a PC serial port. You must also use the DOS @code{mode} command
|
||||
to set up the serial port on the DOS side.
|
||||
|
||||
The following sample session illustrates the steps needed to start a
|
||||
program under _GDBN__ control on your H8/300. The example uses a sample
|
||||
H8/300 program called @file{t.x}.
|
||||
|
||||
First hook up your H8/300 development board. In this example, we use a
|
||||
board attached to serial port @code{COM2}; if you use a different serial
|
||||
port, substitute its name in the argument of the @code{mode} command.
|
||||
When you call @code{asynctsr}, the auxiliary comms program used by the
|
||||
degugger, you give it just the numeric part of the serial port's name;
|
||||
for example, @samp{asyncstr 2} below runs @code{asyncstr} on
|
||||
@code{COM2}.
|
||||
|
||||
@smallexample
|
||||
(eg-C:\H8300\TEST) mode com2:9600,n,8,1,p
|
||||
|
||||
Resident portion of MODE loaded
|
||||
|
||||
COM2: 9600, n, 8, 1, p
|
||||
|
||||
(eg-C:\H8300\TEST) asynctsr 2
|
||||
@end smallexample
|
||||
|
||||
@quotation
|
||||
@emph{Warning:} We have noticed a bug in PC-NFS that conflicts with
|
||||
@code{asynctsr}. If you also run PC-NFS on your DOS host, you may need to
|
||||
disable it, or even boot without it, to use @code{asynctsr} to control
|
||||
your H8/300 board.
|
||||
@end quotation
|
||||
|
||||
Now that serial communications are set up, and the H8/300 is connected,
|
||||
you can start up _GDBN__. Call @code{_GDBP__} with the name of your
|
||||
program as the argument. @code{_GDBP__} prompts you, as usual, with the
|
||||
prompt @samp{(_GDBP__)}. Use two special commands to begin your debugging
|
||||
session: @samp{target hms} to specify cross-debugging to the Hitachi board,
|
||||
and the @code{load} command to download your program to the board.
|
||||
@code{load} displays the names of the
|
||||
program's sections, and a @samp{*} for each 2K of data downloaded. (If
|
||||
you want to refresh _GDBN__ data on symbols or on the executable file
|
||||
without downloading, use the _GDBN__ commands @code{file} or
|
||||
@code{symbol-file}. These commands, and @code{load} itself, are
|
||||
described in @ref{Files,,Commands to Specify Files}.)
|
||||
|
||||
@smallexample
|
||||
(eg-C:\H8300\TEST) _GDBP__ t.x
|
||||
GDB is free software and you are welcome to distribute copies
|
||||
of it under certain conditions; type "show copying" to see
|
||||
the conditions.
|
||||
There is absolutely no warranty for GDB; type "show warranty"
|
||||
for details.
|
||||
GDB _GDB_VN__, Copyright 1992 Free Software Foundation, Inc...
|
||||
(gdb) target hms
|
||||
Connected to remote H8/300 HMS system.
|
||||
(gdb) load t.x
|
||||
.text : 0x8000 .. 0xabde ***********
|
||||
.data : 0xabde .. 0xad30 *
|
||||
.stack : 0xf000 .. 0xf014 *
|
||||
@end smallexample
|
||||
|
||||
At this point, you're ready to run or debug your program. From here on,
|
||||
you can use all the usual _GDBN__ commands. The @code{break} command
|
||||
sets breakpoints; the @code{run} command starts your program;
|
||||
@code{print} or @code{x} display data; the @code{continue} command
|
||||
resumes execution after stopping at a breakpoint. You can use the
|
||||
@code{help} command at any time to find out more about _GDBN__ commands.
|
||||
|
||||
Remember, however, that @emph{operating system} facilities aren't
|
||||
available on your H8/300; for example, if your program hangs, you can't
|
||||
send an interrupt---but you can press the @sc{reset} switch!
|
||||
|
||||
Use the @sc{reset} button on the H8/300 board
|
||||
@itemize @bullet
|
||||
@item
|
||||
to interrupt your program (don't use @kbd{ctl-C} on the DOS host---it has
|
||||
no way to pass an interrupt signal to the H8/300); and
|
||||
|
||||
@item
|
||||
to return to the _GDBN__ command prompt after your program finishes
|
||||
normally. The communications protocol provides no other way for _GDBN__
|
||||
to detect program completion.
|
||||
@end itemize
|
||||
|
||||
In either case, _GDBN__ will see the effect of a @sc{reset} on the
|
||||
H8/300 board as a ``normal exit'' of your program.
|
||||
_fi__(_H8__)
|
||||
|
||||
_if__(_Z8000__)
|
||||
@node Z8000 Simulator
|
||||
@subsection _GDBN__ and its Zilog Z8000 Simulator
|
||||
|
||||
@cindex simulator, Z8000
|
||||
@cindex Zilog Z8000 simulator
|
||||
When configured for debugging Zilog Z8000 targets, _GDBN__ includes a Z8000
|
||||
simulator.
|
||||
|
||||
@table @code
|
||||
@item target z8ksim
|
||||
@kindex z8ksim
|
||||
This debugging target is a simulator for the Z8002, the unsegmented
|
||||
variant of the Z8000 architecture.
|
||||
@end table
|
||||
|
||||
@noindent
|
||||
After this point, you can debug Z8000 programs in the same style as
|
||||
programs for your host computer; use the @code{file} command to load a
|
||||
new program image, the @code{run} command to run your program, and so
|
||||
on.
|
||||
|
||||
As well as making available all the usual Z8000 registers (see
|
||||
@code{info reg}), this debugging target provides three additional items
|
||||
of information as specially named registers:
|
||||
|
||||
@table @code
|
||||
@item cycles
|
||||
Counts clock-ticks in the simulator.
|
||||
|
||||
@item insts
|
||||
Counts instructions run in the simulator.
|
||||
|
||||
@item time
|
||||
Execution time in 60ths of a second.
|
||||
@end table
|
||||
|
||||
You can refer to these values in _GDBN__ expressions with the usual
|
||||
conventions; for example, @w{@samp{b fputc if $cycles>5000}} sets a
|
||||
conditional breakpoint that will suspend only after at least 5000
|
||||
simulated clock ticks.
|
||||
_fi__(_Z8000__)
|
985
gdb/doc/gdbinv-s.texi
Normal file
985
gdb/doc/gdbinv-s.texi
Normal file
@ -0,0 +1,985 @@
|
||||
@c -*- Texinfo -*-
|
||||
@c Copyright (c) 1990 1991 1992 1993 Free Software Foundation, Inc.
|
||||
@c This file is part of the source for the GDB manual.
|
||||
@c This text diverted to "Remote Debugging" section in general case;
|
||||
@c however, if we're doing a manual specifically for one of these, it
|
||||
@c belongs up front (in "Getting In and Out" chapter).
|
||||
@ifset REMOTESTUB
|
||||
|
||||
@node Remote Serial
|
||||
@subsection The @value{GDBN} remote serial protocol
|
||||
|
||||
@cindex remote serial debugging, overview
|
||||
To debug a program running on another machine (the debugging
|
||||
@dfn{target} machine), you must first arrange for all the usual
|
||||
prerequisites for the program to run by itself. For example, for a C
|
||||
program, you need
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
A startup routine to set up the C runtime environment; these usually
|
||||
have a name like @file{crt0}. The startup routine may be supplied by
|
||||
your hardware supplier, or you may have to write your own.
|
||||
|
||||
@item
|
||||
You probably need a C subroutine library to support your program's
|
||||
subroutine calls, notably managing input and output.
|
||||
|
||||
@item
|
||||
A way of getting your program to the other machine---for example, a
|
||||
download program. These are often supplied by the hardware
|
||||
manufacturer, but you may have to write your own from hardware
|
||||
documentation.
|
||||
@end enumerate
|
||||
|
||||
The next step is to arrange for your program to use a serial port to
|
||||
communicate with the machine where @value{GDBN} is running (the @dfn{host}
|
||||
machine). In general terms, the scheme looks like this:
|
||||
|
||||
@table @emph
|
||||
@item On the host,
|
||||
@value{GDBN} already understands how to use this protocol; when everything
|
||||
else is set up, you can simply use the @samp{target remote} command
|
||||
(@pxref{Targets,,Specifying a Debugging Target}).
|
||||
|
||||
@item On the target,
|
||||
you must link with your program a few special-purpose subroutines that
|
||||
implement the @value{GDBN} remote serial protocol. The file containing these
|
||||
subroutines is called a @dfn{debugging stub}.
|
||||
@end table
|
||||
|
||||
The debugging stub is specific to the architecture of the remote
|
||||
machine; for example, use @file{sparc-stub.c} to debug programs on
|
||||
@sc{sparc} boards.
|
||||
|
||||
@cindex remote serial stub list
|
||||
These working remote stubs are distributed with @value{GDBN}:
|
||||
|
||||
@c FIXME! verify these...
|
||||
@table @code
|
||||
@item sparc-stub.c
|
||||
@kindex sparc-stub.c
|
||||
For @sc{sparc} architectures.
|
||||
|
||||
@item m68k-stub.c
|
||||
@kindex m68-stub.c
|
||||
For Motorola 680x0 architectures.
|
||||
|
||||
@item i386-stub.c
|
||||
@kindex i36-stub.c
|
||||
For Intel 386 and compatible architectures.
|
||||
@end table
|
||||
|
||||
The @file{README} file in the @value{GDBN} distribution may list other
|
||||
recently added stubs.
|
||||
|
||||
@menu
|
||||
* stub contents:: What the stub can do for you
|
||||
* bootstrapping:: What you must do for the stub
|
||||
* debug session:: Putting it all together
|
||||
* protocol:: Outline of the communication protocol
|
||||
@end menu
|
||||
|
||||
@node stub contents
|
||||
@subsubsection What the stub can do for you
|
||||
|
||||
@cindex remote serial stub
|
||||
The debugging stub for your architecture supplies these three
|
||||
subroutines:
|
||||
|
||||
@table @code
|
||||
@item set_debug_traps
|
||||
@kindex set_debug_traps
|
||||
@cindex remote serial stub, initialization
|
||||
This routine arranges to transfer control to @code{handle_exception}
|
||||
when your program stops. You must call this subroutine explicitly near
|
||||
the beginning of your program.
|
||||
|
||||
@item handle_exception
|
||||
@kindex handle_exception
|
||||
@cindex remote serial stub, main routine
|
||||
This is the central workhorse, but your program never calls it
|
||||
explicitly---the setup code arranges for @code{handle_exception} to
|
||||
run when a trap is triggered.
|
||||
|
||||
@code{handle_exception} takes control when your program stops during
|
||||
execution (for example, on a breakpoint), and mediates communications
|
||||
with @value{GDBN} on the host machine. This is where the communications
|
||||
protocol is implemented; @code{handle_exception} acts as the @value{GDBN}
|
||||
representative on the target machine; it begins by sending summary
|
||||
information on the state of your program, then continues to execute,
|
||||
retrieving and transmitting any information @value{GDBN} needs, until you
|
||||
execute a @value{GDBN} command that makes your program resume; at that point,
|
||||
@code{handle_exception} returns control to your own code on the target
|
||||
machine.
|
||||
|
||||
@item breakpoint
|
||||
@cindex @code{breakpoint} subroutine, remote
|
||||
Use this auxiliary subroutine to make your program contain a
|
||||
breakpoint. Depending on the particular situation, this may be the only
|
||||
way for @value{GDBN} to get control. For instance, if your target
|
||||
machine has some sort of interrupt button, you won't need to call this;
|
||||
pressing the interrupt button will transfer control to
|
||||
@code{handle_exception}---in efect, to @value{GDBN}. On some machines,
|
||||
simply receiving characters on the serial port may also trigger a trap;
|
||||
again, in that situation, you don't need to call @code{breakpoint} from
|
||||
your own program---simply running @samp{target remote} from the host
|
||||
@value{GDBN} session will get control.
|
||||
|
||||
Call @code{breakpoint} if none of these is true, or if you simply want
|
||||
to make certain your program stops at a predetermined point for the
|
||||
start of your debugging session.
|
||||
@end table
|
||||
|
||||
@node bootstrapping
|
||||
@subsubsection What you must do for the stub
|
||||
|
||||
@cindex remote stub, support routines
|
||||
The debugging stubs that come with @value{GDBN} are set up for a particular
|
||||
chip architecture, but they have no information about the rest of your
|
||||
debugging target machine. To allow the stub to work, you must supply
|
||||
these special low-level subroutines:
|
||||
|
||||
@table @code
|
||||
@item int getDebugChar()
|
||||
@kindex getDebugChar
|
||||
Write this subroutine to read a single character from the serial port.
|
||||
It may be identical to @code{getchar} for your target system; a
|
||||
different name is used to allow you to distinguish the two if you wish.
|
||||
|
||||
@item void putDebugChar(int)
|
||||
@kindex putDebugChar
|
||||
Write this subroutine to write a single character to the serial port.
|
||||
It may be identical to @code{putchar} for your target system; a
|
||||
different name is used to allow you to distinguish the two if you wish.
|
||||
|
||||
@item void flush_i_cache()
|
||||
@kindex flush_i_cache
|
||||
Write this subroutine to flush the instruction cache, if any, on your
|
||||
target machine. If there is no instruction cache, this subroutine may
|
||||
be a no-op.
|
||||
|
||||
On target machines that have instruction caches, @value{GDBN} requires this
|
||||
function to make certain that the state of your program is stable.
|
||||
@end table
|
||||
|
||||
@noindent
|
||||
You must also make sure this library routine is available:
|
||||
|
||||
@table @code
|
||||
@item void *memset(void *, int, int)
|
||||
@kindex memset
|
||||
This is the standard library function @code{memset} that sets an area of
|
||||
memory to a known value. If you have one of the free versions of
|
||||
@code{libc.a}, @code{memset} can be found there; otherwise, you must
|
||||
either obtain it from your hardware manufacturer, or write your own.
|
||||
@end table
|
||||
|
||||
If you do not use the GNU C compiler, you may need other standard
|
||||
library subroutines as well; this will vary from one stub to another,
|
||||
but in general the stubs are likely to use any of the common library
|
||||
subroutines which @code{gcc} generates as inline code.
|
||||
|
||||
|
||||
@node debug session
|
||||
@subsubsection Putting it all together
|
||||
|
||||
@cindex remote serial debugging summary
|
||||
In summary, when your program is ready to debug, you must follow these
|
||||
steps.
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Make sure you have the supporting low-level routines:
|
||||
@code{getDebugChar}, @code{putDebugChar}, @code{flush_i_cache},
|
||||
@code{memset}.
|
||||
|
||||
@item
|
||||
Insert these lines near the top of your program:
|
||||
|
||||
@example
|
||||
set_debug_traps();
|
||||
breakpoint();
|
||||
@end example
|
||||
|
||||
@item
|
||||
Compile and link together: your program, the @value{GDBN} debugging stub for
|
||||
your target architecture, and the supporting subroutines.
|
||||
|
||||
@item
|
||||
Make sure you have a serial connection between your target machine and
|
||||
the @value{GDBN} host, and identify the serial port used for this on the host.
|
||||
|
||||
@item
|
||||
Download your program to your target machine (or get it there by
|
||||
whatever means the manufacturer provides), and start it.
|
||||
|
||||
@item
|
||||
To start remote debugging, run @value{GDBN} on the host machine, and specify
|
||||
as an executable file the program that is running in the remote machine.
|
||||
This tells @value{GDBN} how to find your program's symbols and the contents
|
||||
of its pure text.
|
||||
|
||||
Then establish communication using the @code{target remote} command.
|
||||
Its argument is the name of the device you're using to control the
|
||||
target machine. For example:
|
||||
|
||||
@example
|
||||
target remote /dev/ttyb
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
if the serial line is connected to the device named @file{/dev/ttyb}.
|
||||
@ignore
|
||||
@c this is from the old text, but it doesn't seem to make sense now that I've
|
||||
@c seen an example... pesch 4sep1992
|
||||
This will stop the remote machine if it is not already stopped.
|
||||
@end ignore
|
||||
|
||||
@end enumerate
|
||||
|
||||
Now you can use all the usual commands to examine and change data and to
|
||||
step and continue the remote program.
|
||||
|
||||
To resume the remote program and stop debugging it, use the @code{detach}
|
||||
command.
|
||||
|
||||
@node protocol
|
||||
@subsubsection Outline of the communication protocol
|
||||
|
||||
@cindex debugging stub, example
|
||||
@cindex remote stub, example
|
||||
@cindex stub example, remote debugging
|
||||
The stub files provided with @value{GDBN} implement the target side of the
|
||||
communication protocol, and the @value{GDBN} side is implemented in the
|
||||
@value{GDBN} source file @file{remote.c}. Normally, you can simply allow
|
||||
these subroutines to communicate, and ignore the details. (If you're
|
||||
implementing your own stub file, you can still ignore the details: start
|
||||
with one of the existing stub files. @file{sparc-stub.c} is the best
|
||||
organized, and therefore the easiest to read.)
|
||||
|
||||
However, there may be occasions when you need to know something about
|
||||
the protocol---for example, if there is only one serial port to your
|
||||
target machine, you might want your program to do something special if
|
||||
it recognizes a packet meant for @value{GDBN}.
|
||||
|
||||
@cindex protocol, @value{GDBN} remote serial
|
||||
@cindex serial protocol, @value{GDBN} remote
|
||||
@cindex remote serial protocol
|
||||
All @value{GDBN} commands and responses (other than acknowledgements, which
|
||||
are single characters) are sent as a packet which includes a
|
||||
checksum. A packet is introduced with the character @samp{$}, and ends
|
||||
with the character @samp{#} followed by a two-digit checksum:
|
||||
|
||||
@example
|
||||
$@var{packet info}#@var{checksum}
|
||||
@end example
|
||||
|
||||
@cindex checksum, for @value{GDBN} remote
|
||||
@noindent
|
||||
@var{checksum} is computed as the modulo 256 sum of the @var{packet
|
||||
info} characters.
|
||||
|
||||
When either the host or the target machine receives a packet, the first
|
||||
response expected is an acknowledgement: a single character, either
|
||||
@samp{+} (to indicate the package was received correctly) or @samp{-}
|
||||
(to request retransmission).
|
||||
|
||||
The host (@value{GDBN}) sends commands, and the target (the debugging stub
|
||||
incorporated in your program) sends data in response. The target also
|
||||
sends data when your program stops.
|
||||
|
||||
Command packets are distinguished by their first character, which
|
||||
identifies the kind of command.
|
||||
|
||||
These are the commands currently supported:
|
||||
|
||||
@table @code
|
||||
@item g
|
||||
Requests the values of CPU registers.
|
||||
|
||||
@item G
|
||||
Sets the values of CPU registers.
|
||||
|
||||
@item m@var{addr},@var{count}
|
||||
Read @var{count} bytes at location @var{addr}.
|
||||
|
||||
@item M@var{addr},@var{count}:@dots{}
|
||||
Write @var{count} bytes at location @var{addr}.
|
||||
|
||||
@item c
|
||||
@itemx c@var{addr}
|
||||
Resume execution at the current address (or at @var{addr} if supplied).
|
||||
|
||||
@item s
|
||||
@itemx s@var{addr}
|
||||
Step the target program for one instruction, from either the current
|
||||
program counter or from @var{addr} if supplied.
|
||||
|
||||
@item k
|
||||
Kill the target program.
|
||||
|
||||
@item ?
|
||||
Report the most recent signal. To allow you to take advantage of the
|
||||
@value{GDBN} signal handling commands, one of the functions of the debugging
|
||||
stub is to report CPU traps as the corresponding POSIX signal values.
|
||||
@end table
|
||||
|
||||
@kindex set remotedebug
|
||||
@kindex show remotedebug
|
||||
@cindex packets, reporting on stdout
|
||||
@cindex serial connections, debugging
|
||||
If you have trouble with the serial connection, you can use the command
|
||||
@code{set remotedebug}. This makes @value{GDBN} report on all packets sent
|
||||
back and forth across the serial line to the remote machine. The
|
||||
packet-debugging information is printed on the @value{GDBN} standard output
|
||||
stream. @code{set remotedebug off} turns it off, and @code{show
|
||||
remotedebug} will show you its current state.
|
||||
@end ifset
|
||||
|
||||
@ifset Icmlx
|
||||
@node i960-Nindy Remote
|
||||
@subsection @value{GDBN} with a Remote i960 (Nindy)
|
||||
|
||||
@cindex Nindy
|
||||
@cindex i960
|
||||
@dfn{Nindy} is a ROM Monitor program for Intel 960 target systems. When
|
||||
@value{GDBN} is configured to control a remote Intel 960 using Nindy, you can
|
||||
tell @value{GDBN} how to connect to the 960 in several ways:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Through command line options specifying serial port, version of the
|
||||
Nindy protocol, and communications speed;
|
||||
|
||||
@item
|
||||
By responding to a prompt on startup;
|
||||
|
||||
@item
|
||||
By using the @code{target} command at any point during your @value{GDBN}
|
||||
session. @xref{Target Commands, ,Commands for Managing Targets}.
|
||||
|
||||
@end itemize
|
||||
|
||||
@menu
|
||||
* Nindy Startup:: Startup with Nindy
|
||||
* Nindy Options:: Options for Nindy
|
||||
* Nindy reset:: Nindy Reset Command
|
||||
@end menu
|
||||
|
||||
@node Nindy Startup
|
||||
@subsubsection Startup with Nindy
|
||||
|
||||
If you simply start @code{@value{GDBP}} without using any command-line
|
||||
options, you are prompted for what serial port to use, @emph{before} you
|
||||
reach the ordinary @value{GDBN} prompt:
|
||||
|
||||
@example
|
||||
Attach /dev/ttyNN -- specify NN, or "quit" to quit:
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Respond to the prompt with whatever suffix (after @samp{/dev/tty})
|
||||
identifies the serial port you want to use. You can, if you choose,
|
||||
simply start up with no Nindy connection by responding to the prompt
|
||||
with an empty line. If you do this, and later wish to attach to Nindy,
|
||||
use @code{target} (@pxref{Target Commands, ,Commands for Managing Targets}).
|
||||
|
||||
@node Nindy Options
|
||||
@subsubsection Options for Nindy
|
||||
|
||||
These are the startup options for beginning your @value{GDBN} session with a
|
||||
Nindy-960 board attached:
|
||||
|
||||
@table @code
|
||||
@item -r @var{port}
|
||||
Specify the serial port name of a serial interface to be used to connect
|
||||
to the target system. This option is only available when @value{GDBN} is
|
||||
configured for the Intel 960 target architecture. You may specify
|
||||
@var{port} as any of: a full pathname (e.g. @samp{-r /dev/ttya}), a
|
||||
device name in @file{/dev} (e.g. @samp{-r ttya}), or simply the unique
|
||||
suffix for a specific @code{tty} (e.g. @samp{-r a}).
|
||||
|
||||
@item -O
|
||||
(An uppercase letter ``O'', not a zero.) Specify that @value{GDBN} should use
|
||||
the ``old'' Nindy monitor protocol to connect to the target system.
|
||||
This option is only available when @value{GDBN} is configured for the Intel 960
|
||||
target architecture.
|
||||
|
||||
@quotation
|
||||
@emph{Warning:} if you specify @samp{-O}, but are actually trying to
|
||||
connect to a target system that expects the newer protocol, the connection
|
||||
will fail, appearing to be a speed mismatch. @value{GDBN} will repeatedly
|
||||
attempt to reconnect at several different line speeds. You can abort
|
||||
this process with an interrupt.
|
||||
@end quotation
|
||||
|
||||
@item -brk
|
||||
Specify that @value{GDBN} should first send a @code{BREAK} signal to the target
|
||||
system, in an attempt to reset it, before connecting to a Nindy target.
|
||||
|
||||
@quotation
|
||||
@emph{Warning:} Many target systems do not have the hardware that this
|
||||
requires; it only works with a few boards.
|
||||
@end quotation
|
||||
@end table
|
||||
|
||||
The standard @samp{-b} option controls the line speed used on the serial
|
||||
port.
|
||||
|
||||
@c @group
|
||||
@node Nindy reset
|
||||
@subsubsection Nindy Reset Command
|
||||
|
||||
@table @code
|
||||
@item reset
|
||||
@kindex reset
|
||||
For a Nindy target, this command sends a ``break'' to the remote target
|
||||
system; this is only useful if the target has been equipped with a
|
||||
circuit to perform a hard reset (or some other interesting action) when
|
||||
a break is detected.
|
||||
@end table
|
||||
@c @end group
|
||||
@end ifset
|
||||
|
||||
@ifset AMDxxixK
|
||||
@node EB29K Remote
|
||||
@subsection @value{GDBN} with a Remote EB29K
|
||||
|
||||
@cindex EB29K board
|
||||
@cindex running 29K programs
|
||||
|
||||
To use @value{GDBN} from a Unix system to run programs on AMD's EB29K
|
||||
board in a PC, you must first connect a serial cable between the PC
|
||||
and a serial port on the Unix system. In the following, we assume
|
||||
you've hooked the cable between the PC's @file{COM1} port and
|
||||
@file{/dev/ttya} on the Unix system.
|
||||
|
||||
@menu
|
||||
* Comms (EB29K):: Communications Setup
|
||||
* gdb-EB29K:: EB29K cross-debugging
|
||||
* Remote Log:: Remote Log
|
||||
@end menu
|
||||
|
||||
@node Comms (EB29K)
|
||||
@subsubsection Communications Setup
|
||||
|
||||
The next step is to set up the PC's port, by doing something like the
|
||||
following in DOS on the PC:
|
||||
|
||||
@example
|
||||
C:\> MODE com1:9600,n,8,1,none
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
This example---run on an MS DOS 4.0 system---sets the PC port to 9600
|
||||
bps, no parity, eight data bits, one stop bit, and no ``retry'' action;
|
||||
you must match the communications parameters when establishing the Unix
|
||||
end of the connection as well.
|
||||
@c FIXME: Who knows what this "no retry action" crud from the DOS manual may
|
||||
@c mean? It's optional; leave it out? ---pesch@cygnus.com, 25feb91
|
||||
|
||||
To give control of the PC to the Unix side of the serial line, type
|
||||
the following at the DOS console:
|
||||
|
||||
@example
|
||||
C:\> CTTY com1
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
(Later, if you wish to return control to the DOS console, you can use
|
||||
the command @code{CTTY con}---but you must send it over the device that
|
||||
had control, in our example over the @file{COM1} serial line).
|
||||
|
||||
From the Unix host, use a communications program such as @code{tip} or
|
||||
@code{cu} to communicate with the PC; for example,
|
||||
|
||||
@example
|
||||
cu -s 9600 -l /dev/ttya
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The @code{cu} options shown specify, respectively, the linespeed and the
|
||||
serial port to use. If you use @code{tip} instead, your command line
|
||||
may look something like the following:
|
||||
|
||||
@example
|
||||
tip -9600 /dev/ttya
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
Your system may define a different name where our example uses
|
||||
@file{/dev/ttya} as the argument to @code{tip}. The communications
|
||||
parameters, including which port to use, are associated with the
|
||||
@code{tip} argument in the ``remote'' descriptions file---normally the
|
||||
system table @file{/etc/remote}.
|
||||
@c FIXME: What if anything needs doing to match the "n,8,1,none" part of
|
||||
@c the DOS side's comms setup? cu can support -o (odd
|
||||
@c parity), -e (even parity)---apparently no settings for no parity or
|
||||
@c for character size. Taken from stty maybe...? John points out tip
|
||||
@c can set these as internal variables, eg ~s parity=none; man stty
|
||||
@c suggests that it *might* work to stty these options with stdin or
|
||||
@c stdout redirected... ---pesch@cygnus.com, 25feb91
|
||||
|
||||
@kindex EBMON
|
||||
Using the @code{tip} or @code{cu} connection, change the DOS working
|
||||
directory to the directory containing a copy of your 29K program, then
|
||||
start the PC program @code{EBMON} (an EB29K control program supplied
|
||||
with your board by AMD). You should see an initial display from
|
||||
@code{EBMON} similar to the one that follows, ending with the
|
||||
@code{EBMON} prompt @samp{#}---
|
||||
|
||||
@example
|
||||
C:\> G:
|
||||
|
||||
G:\> CD \usr\joe\work29k
|
||||
|
||||
G:\USR\JOE\WORK29K> EBMON
|
||||
Am29000 PC Coprocessor Board Monitor, version 3.0-18
|
||||
Copyright 1990 Advanced Micro Devices, Inc.
|
||||
Written by Gibbons and Associates, Inc.
|
||||
|
||||
Enter '?' or 'H' for help
|
||||
|
||||
PC Coprocessor Type = EB29K
|
||||
I/O Base = 0x208
|
||||
Memory Base = 0xd0000
|
||||
|
||||
Data Memory Size = 2048KB
|
||||
Available I-RAM Range = 0x8000 to 0x1fffff
|
||||
Available D-RAM Range = 0x80002000 to 0x801fffff
|
||||
|
||||
PageSize = 0x400
|
||||
Register Stack Size = 0x800
|
||||
Memory Stack Size = 0x1800
|
||||
|
||||
CPU PRL = 0x3
|
||||
Am29027 Available = No
|
||||
Byte Write Available = Yes
|
||||
|
||||
# ~.
|
||||
@end example
|
||||
|
||||
Then exit the @code{cu} or @code{tip} program (done in the example by
|
||||
typing @code{~.} at the @code{EBMON} prompt). @code{EBMON} will keep
|
||||
running, ready for @value{GDBN} to take over.
|
||||
|
||||
For this example, we've assumed what is probably the most convenient
|
||||
way to make sure the same 29K program is on both the PC and the Unix
|
||||
system: a PC/NFS connection that establishes ``drive @code{G:}'' on the
|
||||
PC as a file system on the Unix host. If you do not have PC/NFS or
|
||||
something similar connecting the two systems, you must arrange some
|
||||
other way---perhaps floppy-disk transfer---of getting the 29K program
|
||||
from the Unix system to the PC; @value{GDBN} will @emph{not} download it over the
|
||||
serial line.
|
||||
|
||||
@node gdb-EB29K
|
||||
@subsubsection EB29K cross-debugging
|
||||
|
||||
Finally, @code{cd} to the directory containing an image of your 29K
|
||||
program on the Unix system, and start @value{GDBN}---specifying as argument the
|
||||
name of your 29K program:
|
||||
|
||||
@example
|
||||
cd /usr/joe/work29k
|
||||
@value{GDBP} myfoo
|
||||
@end example
|
||||
|
||||
Now you can use the @code{target} command:
|
||||
|
||||
@example
|
||||
target amd-eb /dev/ttya 9600 MYFOO
|
||||
@c FIXME: test above 'target amd-eb' as spelled, with caps! caps are meant to
|
||||
@c emphasize that this is the name as seen by DOS (since I think DOS is
|
||||
@c single-minded about case of letters). ---pesch@cygnus.com, 25feb91
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
In this example, we've assumed your program is in a file called
|
||||
@file{myfoo}. Note that the filename given as the last argument to
|
||||
@code{target amd-eb} should be the name of the program as it appears to DOS.
|
||||
In our example this is simply @code{MYFOO}, but in general it can include
|
||||
a DOS path, and depending on your transfer mechanism may not resemble
|
||||
the name on the Unix side.
|
||||
|
||||
At this point, you can set any breakpoints you wish; when you are ready
|
||||
to see your program run on the 29K board, use the @value{GDBN} command
|
||||
@code{run}.
|
||||
|
||||
To stop debugging the remote program, use the @value{GDBN} @code{detach}
|
||||
command.
|
||||
|
||||
To return control of the PC to its console, use @code{tip} or @code{cu}
|
||||
once again, after your @value{GDBN} session has concluded, to attach to
|
||||
@code{EBMON}. You can then type the command @code{q} to shut down
|
||||
@code{EBMON}, returning control to the DOS command-line interpreter.
|
||||
Type @code{CTTY con} to return command input to the main DOS console,
|
||||
and type @kbd{~.} to leave @code{tip} or @code{cu}.
|
||||
|
||||
@node Remote Log
|
||||
@subsubsection Remote Log
|
||||
@kindex eb.log
|
||||
@cindex log file for EB29K
|
||||
|
||||
The @code{target amd-eb} command creates a file @file{eb.log} in the
|
||||
current working directory, to help debug problems with the connection.
|
||||
@file{eb.log} records all the output from @code{EBMON}, including echoes
|
||||
of the commands sent to it. Running @samp{tail -f} on this file in
|
||||
another window often helps to understand trouble with @code{EBMON}, or
|
||||
unexpected events on the PC side of the connection.
|
||||
|
||||
@end ifset
|
||||
|
||||
@ifset STmm
|
||||
@node ST2000 Remote
|
||||
@subsection @value{GDBN} with a Tandem ST2000
|
||||
|
||||
To connect your ST2000 to the host system, see the manufacturer's
|
||||
manual. Once the ST2000 is physically attached, you can run
|
||||
|
||||
@example
|
||||
target st2000 @var{dev} @var{speed}
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
to establish it as your debugging environment.
|
||||
|
||||
The @code{load} and @code{attach} commands are @emph{not} defined for
|
||||
this target; you must load your program into the ST2000 as you normally
|
||||
would for standalone operation. @value{GDBN} will read debugging information
|
||||
(such as symbols) from a separate, debugging version of the program
|
||||
available on your host computer.
|
||||
@c FIXME!! This is terribly vague; what little content is here is
|
||||
@c basically hearsay.
|
||||
|
||||
@cindex ST2000 auxiliary commands
|
||||
These auxiliary @value{GDBN} commands are available to help you with the ST2000
|
||||
environment:
|
||||
|
||||
@table @code
|
||||
@item st2000 @var{command}
|
||||
@kindex st2000 @var{cmd}
|
||||
@cindex STDBUG commands (ST2000)
|
||||
@cindex commands to STDBUG (ST2000)
|
||||
Send a @var{command} to the STDBUG monitor. See the manufacturer's
|
||||
manual for available commands.
|
||||
|
||||
@item connect
|
||||
@cindex connect (to STDBUG)
|
||||
Connect the controlling terminal to the STDBUG command monitor. When
|
||||
you are done interacting with STDBUG, typing either of two character
|
||||
sequences will get you back to the @value{GDBN} command prompt:
|
||||
@kbd{@key{RET}~.} (Return, followed by tilde and period) or
|
||||
@kbd{@key{RET}~@key{C-d}} (Return, followed by tilde and control-D).
|
||||
@end table
|
||||
@end ifset
|
||||
|
||||
@ifset VXWORKS
|
||||
@node VxWorks Remote
|
||||
@subsection @value{GDBN} and VxWorks
|
||||
@cindex VxWorks
|
||||
|
||||
@value{GDBN} enables developers to spawn and debug tasks running on networked
|
||||
VxWorks targets from a Unix host. Already-running tasks spawned from
|
||||
the VxWorks shell can also be debugged. @value{GDBN} uses code that runs on
|
||||
both the UNIX host and on the VxWorks target. The program
|
||||
@code{@value{GDBP}} is installed and executed on the UNIX host.
|
||||
|
||||
The following information on connecting to VxWorks was current when
|
||||
this manual was produced; newer releases of VxWorks may use revised
|
||||
procedures.
|
||||
|
||||
The remote debugging interface (RDB) routines are installed and executed
|
||||
on the VxWorks target. These routines are included in the VxWorks library
|
||||
@file{rdb.a} and are incorporated into the system image when source-level
|
||||
debugging is enabled in the VxWorks configuration.
|
||||
|
||||
@kindex INCLUDE_RDB
|
||||
If you wish, you can define @code{INCLUDE_RDB} in the VxWorks
|
||||
configuration file @file{configAll.h} to include the RDB interface
|
||||
routines and spawn the source debugging task @code{tRdbTask} when
|
||||
VxWorks is booted. For more information on configuring and remaking
|
||||
VxWorks, see the manufacturer's manual.
|
||||
@c VxWorks, see the @cite{VxWorks Programmer's Guide}.
|
||||
|
||||
Once you have included the RDB interface in your VxWorks system image
|
||||
and set your Unix execution search path to find @value{GDBN}, you are ready
|
||||
to run @value{GDBN}. From your UNIX host, type:
|
||||
|
||||
@smallexample
|
||||
% @value{GDBP}
|
||||
@end smallexample
|
||||
|
||||
@value{GDBN} will come up showing the prompt:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP})
|
||||
@end smallexample
|
||||
|
||||
@menu
|
||||
* VxWorks connection:: Connecting to VxWorks
|
||||
* VxWorks download:: VxWorks Download
|
||||
* VxWorks attach:: Running Tasks
|
||||
@end menu
|
||||
|
||||
@node VxWorks connection
|
||||
@subsubsection Connecting to VxWorks
|
||||
|
||||
The @value{GDBN} command @code{target} lets you connect to a VxWorks target on the
|
||||
network. To connect to a target whose host name is ``@code{tt}'', type:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) target vxworks tt
|
||||
@end smallexample
|
||||
|
||||
@value{GDBN} will display a message similar to the following:
|
||||
|
||||
@smallexample
|
||||
Attaching remote machine across net... Success!
|
||||
@end smallexample
|
||||
|
||||
@value{GDBN} will then attempt to read the symbol tables of any object modules
|
||||
loaded into the VxWorks target since it was last booted. @value{GDBN} locates
|
||||
these files by searching the directories listed in the command search
|
||||
path (@pxref{Environment, ,Your Program's Environment}); if it fails
|
||||
to find an object file, it will display a message such as:
|
||||
|
||||
@smallexample
|
||||
prog.o: No such file or directory.
|
||||
@end smallexample
|
||||
|
||||
This will cause the @code{target} command to abort. When this happens,
|
||||
you should add the appropriate directory to the search path, with the
|
||||
@value{GDBN} command @code{path}, and execute the @code{target} command
|
||||
again.
|
||||
|
||||
@node VxWorks download
|
||||
@subsubsection VxWorks Download
|
||||
|
||||
@cindex download to VxWorks
|
||||
If you have connected to the VxWorks target and you want to debug an
|
||||
object that has not yet been loaded, you can use the @value{GDBN} @code{load}
|
||||
command to download a file from UNIX to VxWorks incrementally. The
|
||||
object file given as an argument to the @code{load} command is actually
|
||||
opened twice: first by the VxWorks target in order to download the code,
|
||||
then by @value{GDBN} in order to read the symbol table. This can lead to
|
||||
problems if the current working directories on the two systems differ.
|
||||
It is simplest to set the working directory on both systems to the
|
||||
directory in which the object file resides, and then to reference the
|
||||
file by its name, without any path. Thus, to load a program
|
||||
@file{prog.o}, residing in @file{wherever/vw/demo/rdb}, on VxWorks type:
|
||||
|
||||
@smallexample
|
||||
-> cd "wherever/vw/demo/rdb"
|
||||
@end smallexample
|
||||
|
||||
On @value{GDBN} type:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) cd wherever/vw/demo/rdb
|
||||
(@value{GDBP}) load prog.o
|
||||
@end smallexample
|
||||
|
||||
@value{GDBN} will display a response similar to the following:
|
||||
|
||||
@smallexample
|
||||
Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
|
||||
@end smallexample
|
||||
|
||||
You can also use the @code{load} command to reload an object module
|
||||
after editing and recompiling the corresponding source file. Note that
|
||||
this will cause @value{GDBN} to delete all currently-defined breakpoints,
|
||||
auto-displays, and convenience variables, and to clear the value
|
||||
history. (This is necessary in order to preserve the integrity of
|
||||
debugger data structures that reference the target system's symbol
|
||||
table.)
|
||||
|
||||
@node VxWorks attach
|
||||
@subsubsection Running Tasks
|
||||
|
||||
@cindex running VxWorks tasks
|
||||
You can also attach to an existing task using the @code{attach} command as
|
||||
follows:
|
||||
|
||||
@smallexample
|
||||
(@value{GDBP}) attach @var{task}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where @var{task} is the VxWorks hexadecimal task ID. The task can be running
|
||||
or suspended when you attach to it. If running, it will be suspended at
|
||||
the time of attachment.
|
||||
@end ifset
|
||||
|
||||
@ifset Hviii
|
||||
@node Hitachi H8/300 Remote
|
||||
@subsection @value{GDBN} and the Hitachi H8/300
|
||||
@value{GDBN} needs to know these things to talk to your H8/300:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
that you want to use @samp{target hms}, the remote debugging
|
||||
interface for the H8/300 (this is the default when
|
||||
GDB is configured specifically for the H8/300);
|
||||
|
||||
@item
|
||||
what serial device connects your host to your H8/300 (the first serial
|
||||
device available on your host is the default);
|
||||
|
||||
@ignore
|
||||
@c this is only for Unix hosts, not currently of interest.
|
||||
@item
|
||||
what speed to use over the serial device.
|
||||
@end ignore
|
||||
@end enumerate
|
||||
|
||||
@kindex device
|
||||
@cindex serial device for H8/300
|
||||
@ignore
|
||||
@c only for Unix hosts
|
||||
Use the special @code{gdb83} command @samp{device @var{port}} if you
|
||||
need to explicitly set the serial device. The default @var{port} is the
|
||||
first available port on your host. This is only necessary on Unix
|
||||
hosts, where it is typically something like @file{/dev/ttya}.
|
||||
|
||||
@kindex speed
|
||||
@cindex serial line speed for H8/300
|
||||
@code{gdb83} has another special command to set the communications speed
|
||||
for the H8/300: @samp{speed @var{bps}}. This command also is only used
|
||||
from Unix hosts; on DOS hosts, set the line speed as usual from outside
|
||||
GDB with the DOS @kbd{mode} command (for instance, @w{@samp{mode
|
||||
com2:9600,n,8,1,p}} for a 9600 bps connection).
|
||||
@end ignore
|
||||
|
||||
@value{GDBN} depends on an auxiliary terminate-and-stay-resident program
|
||||
called @code{asynctsr} to communicate with the H8/300 development board
|
||||
through a PC serial port. You must also use the DOS @code{mode} command
|
||||
to set up the serial port on the DOS side.
|
||||
|
||||
The following sample session illustrates the steps needed to start a
|
||||
program under @value{GDBN} control on your H8/300. The example uses a sample
|
||||
H8/300 program called @file{t.x}.
|
||||
|
||||
First hook up your H8/300 development board. In this example, we use a
|
||||
board attached to serial port @code{COM2}; if you use a different serial
|
||||
port, substitute its name in the argument of the @code{mode} command.
|
||||
When you call @code{asynctsr}, the auxiliary comms program used by the
|
||||
degugger, you give it just the numeric part of the serial port's name;
|
||||
for example, @samp{asyncstr 2} below runs @code{asyncstr} on
|
||||
@code{COM2}.
|
||||
|
||||
@smallexample
|
||||
(eg-C:\H8300\TEST) mode com2:9600,n,8,1,p
|
||||
|
||||
Resident portion of MODE loaded
|
||||
|
||||
COM2: 9600, n, 8, 1, p
|
||||
|
||||
(eg-C:\H8300\TEST) asynctsr 2
|
||||
@end smallexample
|
||||
|
||||
@quotation
|
||||
@emph{Warning:} We have noticed a bug in PC-NFS that conflicts with
|
||||
@code{asynctsr}. If you also run PC-NFS on your DOS host, you may need to
|
||||
disable it, or even boot without it, to use @code{asynctsr} to control
|
||||
your H8/300 board.
|
||||
@end quotation
|
||||
|
||||
Now that serial communications are set up, and the H8/300 is connected,
|
||||
you can start up @value{GDBN}. Call @code{@value{GDBP}} with the name of your
|
||||
program as the argument. @code{@value{GDBP}} prompts you, as usual, with the
|
||||
prompt @samp{(@value{GDBP})}. Use two special commands to begin your debugging
|
||||
session: @samp{target hms} to specify cross-debugging to the Hitachi board,
|
||||
and the @code{load} command to download your program to the board.
|
||||
@code{load} displays the names of the
|
||||
program's sections, and a @samp{*} for each 2K of data downloaded. (If
|
||||
you want to refresh @value{GDBN} data on symbols or on the executable file
|
||||
without downloading, use the @value{GDBN} commands @code{file} or
|
||||
@code{symbol-file}. These commands, and @code{load} itself, are
|
||||
described in @ref{Files,,Commands to Specify Files}.)
|
||||
|
||||
@smallexample
|
||||
(eg-C:\H8300\TEST) @value{GDBP} t.x
|
||||
GDB is free software and you are welcome to distribute copies
|
||||
of it under certain conditions; type "show copying" to see
|
||||
the conditions.
|
||||
There is absolutely no warranty for GDB; type "show warranty"
|
||||
for details.
|
||||
GDB @value{GDBVN}, Copyright 1992 Free Software Foundation, Inc...
|
||||
(gdb) target hms
|
||||
Connected to remote H8/300 HMS system.
|
||||
(gdb) load t.x
|
||||
.text : 0x8000 .. 0xabde ***********
|
||||
.data : 0xabde .. 0xad30 *
|
||||
.stack : 0xf000 .. 0xf014 *
|
||||
@end smallexample
|
||||
|
||||
At this point, you're ready to run or debug your program. From here on,
|
||||
you can use all the usual @value{GDBN} commands. The @code{break} command
|
||||
sets breakpoints; the @code{run} command starts your program;
|
||||
@code{print} or @code{x} display data; the @code{continue} command
|
||||
resumes execution after stopping at a breakpoint. You can use the
|
||||
@code{help} command at any time to find out more about @value{GDBN} commands.
|
||||
|
||||
Remember, however, that @emph{operating system} facilities aren't
|
||||
available on your H8/300; for example, if your program hangs, you can't
|
||||
send an interrupt---but you can press the @sc{reset} switch!
|
||||
|
||||
Use the @sc{reset} button on the H8/300 board
|
||||
@itemize @bullet
|
||||
@item
|
||||
to interrupt your program (don't use @kbd{ctl-C} on the DOS host---it has
|
||||
no way to pass an interrupt signal to the H8/300); and
|
||||
|
||||
@item
|
||||
to return to the @value{GDBN} command prompt after your program finishes
|
||||
normally. The communications protocol provides no other way for @value{GDBN}
|
||||
to detect program completion.
|
||||
@end itemize
|
||||
|
||||
In either case, @value{GDBN} will see the effect of a @sc{reset} on the
|
||||
H8/300 board as a ``normal exit'' of your program.
|
||||
@end ifset
|
||||
|
||||
@ifset ZviiiK
|
||||
@node Z8000 Simulator
|
||||
@subsection @value{GDBN} and its Zilog Z8000 Simulator
|
||||
|
||||
@cindex simulator, Z8000
|
||||
@cindex Zilog Z8000 simulator
|
||||
When configured for debugging Zilog Z8000 targets, @value{GDBN} includes a Z8000
|
||||
simulator.
|
||||
|
||||
@table @code
|
||||
@item target z8ksim
|
||||
@kindex z8ksim
|
||||
This debugging target is a simulator for the Z8002, the unsegmented
|
||||
variant of the Z8000 architecture.
|
||||
@end table
|
||||
|
||||
@noindent
|
||||
After this point, you can debug Z8000 programs in the same style as
|
||||
programs for your host computer; use the @code{file} command to load a
|
||||
new program image, the @code{run} command to run your program, and so
|
||||
on.
|
||||
|
||||
As well as making available all the usual Z8000 registers (see
|
||||
@code{info reg}), this debugging target provides three additional items
|
||||
of information as specially named registers:
|
||||
|
||||
@table @code
|
||||
@item cycles
|
||||
Counts clock-ticks in the simulator.
|
||||
|
||||
@item insts
|
||||
Counts instructions run in the simulator.
|
||||
|
||||
@item time
|
||||
Execution time in 60ths of a second.
|
||||
@end table
|
||||
|
||||
You can refer to these values in @value{GDBN} expressions with the usual
|
||||
conventions; for example, @w{@samp{b fputc if $cycles>5000}} sets a
|
||||
conditional breakpoint that will suspend only after at least 5000
|
||||
simulated clock ticks.
|
||||
@end ifset
|
@ -1,13 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_GENERIC__>,<1>) In case none.m4 changes its mind abt default
|
||||
|
||||
_define__(<_AOUT__>,<1>)
|
||||
_define__(<_COFF__>,<1>)
|
||||
_define__(<_ELF__>,<1>)
|
||||
|
||||
_define__(<_I80386__>,<1>)
|
||||
_define__(<_M680X0__>,<1>)
|
||||
_define__(<_SPARC__>,<1>)
|
||||
_define__(<_VAX__>,<1>)
|
||||
|
||||
_divert__<>
|
17
gdb/doc/h8-config.texi
Normal file
17
gdb/doc/h8-config.texi
Normal file
@ -0,0 +1,17 @@
|
||||
@set Hviii
|
||||
@set HviiiEXCLUSIVE
|
||||
@clear NOVEL
|
||||
@set BARETARGET
|
||||
@set CONLY
|
||||
@set DOSHOST
|
||||
@set AGGLOMERATION
|
||||
@clear SERIAL
|
||||
@clear VXWORKS
|
||||
@clear POSIX
|
||||
@clear SPARC
|
||||
@clear AMDxxixK
|
||||
@clear Icmlx
|
||||
@clear REMOTESTUB
|
||||
@clear STmm
|
||||
@set PRECONFIGURED
|
||||
@clear ZviiiK
|
@ -1,16 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_REMOTESTUB__>,<0>)
|
||||
_define__(<_H8__>,<1>)
|
||||
_define__(<_GENERIC__>,<0>)
|
||||
_define__(<_AGGLOMERATION__>,<1>) GPL formatted separately
|
||||
_define__(<_PRECONFIGURED__>,<1>) manual is *only* for preconfigured sw
|
||||
_define__(<_BARE__>,<1>)
|
||||
_define__(<_CONLY__>,<1>)
|
||||
_define__(<_DOSHOST__>,<1>)
|
||||
_define__(<_AS__>,<as>)
|
||||
_define__(<_GCC__>,<gcc>)
|
||||
_define__(<_LD__>,<ld>)
|
||||
_define__(<_GDBP__>,<gdb>)
|
||||
_define__(<_GDBN__>,<GDB>)
|
||||
_define__(<_HOST__>,<Hitachi H8/300>)
|
||||
_divert__<>
|
@ -1,5 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_I80386__>,<1>)
|
||||
_define__(<_HOST__>,<Intel 80386>)
|
||||
_define__(<_MACH_DEP__>,<80386 Dependent>
|
||||
_divert__<>
|
@ -1,12 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_I960__>,<1>)
|
||||
_define__(<_AOUT__>,<0>)
|
||||
_define__(<_BOUT__>,<1>)
|
||||
_define__(<_COFF__>,<1>)
|
||||
_define__(<_AS__>,<gas960>)
|
||||
_define__(<_GCC__>,<gcc960>)
|
||||
_define__(<_LD__>,<gld960>)
|
||||
_define__(<_GDB__>,<gdb960>)
|
||||
_define__(<_HOST__>,<Intel 960>)
|
||||
_define__(<_MACH_DEP__>,<i960 Dependent>)
|
||||
_divert__<>
|
@ -1,20 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_ALL_ARCH__>,<1>)
|
||||
_define__(<_GENERIC__>,<1>) In case none.m4 changes its mind abt default
|
||||
|
||||
_define__(<_AOUT__>,<1>)
|
||||
_define__(<_BOUT__>,<1>)
|
||||
_define__(<_COFF__>,<1>)
|
||||
_define__(<_ELF__>,<1>)
|
||||
|
||||
_define__(<_LUCID__>,<1>)
|
||||
|
||||
_define__(<_AMD29K__>,<1>)
|
||||
_define__(<_I80386__>,<1>)
|
||||
_define__(<_I960__>,<1>)
|
||||
_define__(<_M680X0__>,<1>)
|
||||
_define__(<_SPARC__>,<1>)
|
||||
_define__(<_VAX__>,<1>)
|
||||
_define__(<_VXWORKS__>,<1>)
|
||||
|
||||
_divert__<>
|
@ -1,5 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_M680X0__>,<1>)
|
||||
_define__(<_HOST__>,<Motorola 680x0>)
|
||||
_define__(<_MACH_DEP__>,<M680x0 Dependent>)
|
||||
_divert__<>
|
@ -1,70 +0,0 @@
|
||||
|
||||
_divert__(-1)
|
||||
|
||||
Switches:
|
||||
|
||||
_define__(<_ALL_ARCH__>,<0>) (Meant as most inclusive; file turning
|
||||
it on is expected to also turn on
|
||||
all arch-related switches including
|
||||
"_GENERIC__")
|
||||
_define__(<_GENERIC__>,<1>) (may not be quite all configs;
|
||||
meant for "most vanilla" manual)
|
||||
_define__(<_AGGLOMERATION__>,<0>) is manual part of an agglomeration,
|
||||
with GPL formatted separately?
|
||||
_define__(<_PRECONFIGURED__>,<0>) is manual *only* for preconfigured sw?
|
||||
_define__(<_FSF__>,<1>) set to zero to include things
|
||||
FSF won't take which Cygnus may want.
|
||||
_define__(<_INTERNALS__>,<0>)
|
||||
|
||||
_define__(<_AOUT__>,<1>) Object formats. Note we turn on one.
|
||||
_define__(<_BOUT__>,<0>)
|
||||
_define__(<_COFF__>,<0>)
|
||||
_define__(<_ELF__>,<0>)
|
||||
|
||||
_define__(<_LUCID__>,<0>) A programming environment.
|
||||
|
||||
_define__(<_BARE__>,<0>) Turn on to indicate no OS facilities
|
||||
(like shells, user prog args, program
|
||||
environment, corefiles)
|
||||
|
||||
_define__(<_DOSHOST__>,<0>) Is this GDB DOS-hosted?
|
||||
|
||||
_define__(<_CONLY__>,<0>) Mention only C debugging if
|
||||
turned on.
|
||||
|
||||
_define__(<_REMOTESTUB__>,<1>) Generic remote serial stub
|
||||
_define__(<_AMD29K__>,<0>) Specific architectures. Note none
|
||||
_define__(<_H8__>,<0>)
|
||||
_define__(<_I80386__>,<0>) starts out on.
|
||||
_define__(<_I960__>,<0>)
|
||||
_define__(<_M680X0__>,<0>)
|
||||
_define__(<_SPARC__>,<0>)
|
||||
_define__(<_ST2000__>,<0>)
|
||||
_define__(<_VAX__>,<0>)
|
||||
_define__(<_VXWORKS__>,<0>)
|
||||
_define__(<_Z8000__>,<0>)
|
||||
|
||||
Text:
|
||||
|
||||
Default names; individual configs may override
|
||||
Assembler:
|
||||
_define__(<_AS__>,<as>)
|
||||
C Compiler:
|
||||
_define__(<_GCC__>,<gcc>)
|
||||
Linker:
|
||||
_define__(<_LD__>,<ld>)
|
||||
Debugger name:
|
||||
_define__(<_GDBN__>,<GDB>)
|
||||
Debugger program:
|
||||
_define__(<_GDBP__>,<gdb>)
|
||||
Debugger init file:
|
||||
_define__(<_GDBINIT__>,<.gdbinit>)
|
||||
|
||||
Text for host; individual configs *should* override, but this may
|
||||
catch some flubs
|
||||
_define__(<_HOST__>,<machine specific>)
|
||||
|
||||
"Machine Dependent" nodename
|
||||
_define__(<_MACH_DEP__>,<Machine Dependent>)
|
||||
|
||||
_divert__<>
|
@ -1,268 +0,0 @@
|
||||
divert(-1) -*-Text-*-
|
||||
` Copyright (c) 1991 Free Software Foundation, Inc.'
|
||||
` This file defines and documents the M4 macros used '
|
||||
` to preprocess some GNU manuals'
|
||||
` $Id$'
|
||||
|
||||
I. INTRODUCTION
|
||||
|
||||
This collection of M4 macros is meant to help in pre-processing texinfo
|
||||
files to allow configuring them by hosts; for example, the reader of an
|
||||
as manual who only has access to a 386 may not really want to see crud about
|
||||
VAXen.
|
||||
|
||||
A preprocessor is used, rather than extending texinfo, because this
|
||||
way we can hack the conditionals in only one place; otherwise we would
|
||||
have to write TeX macros, update makeinfo, and update the Emacs
|
||||
info-formatting functions.
|
||||
|
||||
II. COMPATIBILITY
|
||||
|
||||
These macros should work with GNU m4 and System V m4; they do not work
|
||||
with Sun or Berkeley M4.
|
||||
|
||||
III. USAGE
|
||||
|
||||
A. M4 INVOCATION
|
||||
Assume this file is called "pretex.m4". Then, to preprocess a
|
||||
document "mybook.texinfo" you might do something like the following:
|
||||
|
||||
m4 pretex.m4 none.m4 PARTIC.m4 mybook.texinfo >mybook-PARTIC.texinfo
|
||||
|
||||
---where your path is set to find GNU or SysV "m4", and the other m4
|
||||
files mentioned are as follows:
|
||||
|
||||
none.m4: A file that defines, as 0, all the options you might
|
||||
want to turn on using the conditionals defined below.
|
||||
Unlike the C preprocessor, m4 does not default
|
||||
undefined macros to 0. For example, here is a "none.m4"
|
||||
I have been using:
|
||||
_divert__(-1)
|
||||
|
||||
_define__(<_ALL_ARCH__>,<0>)
|
||||
_define__(<_INTERNALS__>,<0>)
|
||||
|
||||
_define__(<_AMD29K__>,<0>)
|
||||
_define__(<_I80386__>,<0>)
|
||||
_define__(<_I960__>,<0>)
|
||||
_define__(<_M680X0__>,<0>)
|
||||
_define__(<_SPARC__>,<0>)
|
||||
_define__(<_VAX__>,<0>)
|
||||
|
||||
_divert__<>
|
||||
|
||||
PARTIC.m4: A file that turns on whichever options you actually
|
||||
want the manual configured for, in this particular
|
||||
instance. Its contents are similar to one or more of
|
||||
the lines in "none.m4", but of course the second
|
||||
argument to _define__ is <1> rather than <0>.
|
||||
|
||||
This is also a convenient place to _define__ any macros
|
||||
that you want to expand to different text for
|
||||
different configurations---for example, the name of
|
||||
the program being described.
|
||||
|
||||
Naturally, these are just suggested conventions; you could put your macro
|
||||
definitions in any files or combinations of files you like.
|
||||
|
||||
These macros use the characters < and > as m4 quotes; if you need
|
||||
these characters in your text, you will also want to use the macros
|
||||
_0__ and _1__ from this package---see the description of "Quote
|
||||
Handling" in the "Implementation" section below.
|
||||
|
||||
B. WHAT GOES IN THE PRE-TEXINFO SOURCE
|
||||
|
||||
For the most part, the text of your book. In addition, you can
|
||||
have text that is included only conditionally, using the macros
|
||||
_if__ and _fi__ defined below. They BOTH take an argument! This is
|
||||
primarily meant for readability (so a human can more easily see what
|
||||
conditional end matches what conditional beginning), but the argument
|
||||
is actually used in the _fi__ as well as the _if__ implementation.
|
||||
You should always give a _fi__ the same argument as its matching
|
||||
_if__. Other arguments may appear to work for a while, but are almost
|
||||
certain to produce the wrong output for some configurations.
|
||||
|
||||
For example, here is an excerpt from the very beginning of the
|
||||
documentation for GNU as, to name the info file appropriately for
|
||||
different configurations:
|
||||
_if__(_ALL_ARCH__)
|
||||
@setfilename as.info
|
||||
_fi__(_ALL_ARCH__)
|
||||
_if__(_M680X0__ && !_ALL_ARCH__)
|
||||
@setfilename as-m680x0.info
|
||||
_fi__(_M680X0__ && !_ALL_ARCH__)
|
||||
_if__(_AMD29K__ && !_ALL_ARCH__)
|
||||
@setfilename as-29k.info
|
||||
_fi__(_AMD29K__ && !_ALL_ARCH__)
|
||||
|
||||
Note that you can use Boolean expressions in the arguments; the
|
||||
expression language is that of the built-in m4 macro `eval', described
|
||||
in the m4 manual.
|
||||
|
||||
IV. IMPLEMENTATION
|
||||
|
||||
A.PRIMITIVE RENAMING
|
||||
First, we redefine m4's built-ins to avoid conflict with plain text.
|
||||
The naming convention used is that our macros all begin with a single
|
||||
underbar and end with two underbars. The asymmetry is meant to avoid
|
||||
conflict with some other conventions (which we may want to document) that
|
||||
are intended to avoid conflict, like ANSI C predefined macros.
|
||||
|
||||
define(`_undefine__',defn(`undefine'))
|
||||
define(`_define__',defn(`define'))
|
||||
define(`_defn__',defn(`defn'))
|
||||
define(`_ppf__',`_define__(`_$1__',_defn__(`$1'))_undefine__(`$1')')
|
||||
_ppf__(`builtin')
|
||||
_ppf__(`changecom')
|
||||
_ppf__(`changequote')
|
||||
_ppf__(`decr')
|
||||
_ppf__(`define')
|
||||
_ppf__(`defn')
|
||||
_ppf__(`divert')
|
||||
_ppf__(`divnum')
|
||||
_ppf__(`dnl')
|
||||
_ppf__(`dumpdef')
|
||||
_ppf__(`errprint')
|
||||
_ppf__(`esyscmd')
|
||||
_ppf__(`eval')
|
||||
_ppf__(`format')
|
||||
_ppf__(`ifdef')
|
||||
_ppf__(`ifelse')
|
||||
_ppf__(`include')
|
||||
_ppf__(`incr')
|
||||
_ppf__(`index')
|
||||
_ppf__(`len')
|
||||
_ppf__(`m4exit')
|
||||
_ppf__(`m4wrap')
|
||||
_ppf__(`maketemp')
|
||||
_ppf__(`patsubst')
|
||||
_ppf__(`popdef')
|
||||
_ppf__(`pushdef')
|
||||
_ppf__(`regexp')
|
||||
_ppf__(`shift')
|
||||
_ppf__(`sinclude')
|
||||
_ppf__(`substr')
|
||||
_ppf__(`syscmd')
|
||||
_ppf__(`sysval')
|
||||
_ppf__(`traceoff')
|
||||
_ppf__(`traceon')
|
||||
_ppf__(`translit')
|
||||
_ppf__(`undefine')
|
||||
_ppf__(`undivert')
|
||||
_ppf__(`unix')
|
||||
|
||||
B. QUOTE HANDLING.
|
||||
|
||||
The characters used as quotes by M4, by default, are unfortunately
|
||||
quite likely to occur in ordinary text. To avoid surprises, we will
|
||||
use the characters <> ---which are just as suggestive (more so to
|
||||
Francophones, perhaps) but a little less common in text (save for
|
||||
those poor Francophones. You win some, you lose some). Still, we
|
||||
expect also to have to set < and > occasionally in text; to do that,
|
||||
we define a macro to turn off quote handling (_0__) and a macro to
|
||||
turn it back on (_1__), according to our convention.
|
||||
|
||||
BEWARE: This seems to make < and > unusable as relational operations
|
||||
in calls to the builtin "eval". So far I've gotten
|
||||
along without; but a better choice may be possible.
|
||||
|
||||
Note that we postponed this for a while, for convenience in discussing
|
||||
the issue and in the primitive renaming---not to mention in defining
|
||||
_0__ and _1__ themselves! However, the quote redefinitions MUST
|
||||
precede the _if__ / _fi__ definitions, because M4 will expand the text
|
||||
as given---if we use the wrong quotes here, we will get the wrong
|
||||
quotes when we use the conditionals.
|
||||
|
||||
_define__(_0__,`_changequote__(,)')_define__(_1__,`_changequote__(<,>)')
|
||||
_1__
|
||||
|
||||
C. CONDITIONALS
|
||||
|
||||
We define two macros, _if__ and _fi__. BOTH take arguments! This is
|
||||
meant both to help the human reader match up a _fi__ with its
|
||||
corresponding _if__ and to aid in the implementation. You may use the
|
||||
full expression syntax supported by M4 (see docn of `eval' builtin in
|
||||
the m4 manual).
|
||||
|
||||
The conditional macros are carefully defined to avoid introducing
|
||||
extra whitespace (i.e., blank lines or blank characters). One side
|
||||
effect exists---
|
||||
|
||||
BEWARE: text following an `_if__' on the same line is
|
||||
DISCARDED even if the condition is true; text
|
||||
following a `_fi__' on the same line is also
|
||||
always discarded.
|
||||
|
||||
The recommended convention is to always place _if__ and _fi__ on a
|
||||
line by themselves. This will also aid the human reader. TeX won't
|
||||
care about the line breaks; as for info, you may want to insert calls
|
||||
to `@refill' at the end of paragraphs containing conditionalized text,
|
||||
where you don't want line breaks separating unconditional from
|
||||
conditional text. info formatting will then give you nice looking
|
||||
paragraphs in the info file.
|
||||
|
||||
Nesting: conditionals are designed to nest, in the following way:
|
||||
*nothing* is output between an outer pair of false conditionals, even
|
||||
if there are true conditionals inside. A false conditional "defeats"
|
||||
all conditionals within it. The counter _IF_FS__ is used to
|
||||
implement this; kindly avoid redefining it directly.
|
||||
|
||||
_define__(<_IF_FS__>,<0>)
|
||||
|
||||
NOTE: The definitions for our "pushf" and "popf" macros use eval
|
||||
rather than incr and decr, because GNU m4 (0.75) tries to call eval
|
||||
for us when we say "incr" or "decr"---but doesn't notice we've changed
|
||||
eval's name.
|
||||
|
||||
_define__(
|
||||
<_pushf__>,
|
||||
<_define__(<_IF_FS__>,
|
||||
_eval__((_IF_FS__)+1))>)
|
||||
_define__(
|
||||
<_popf__>,
|
||||
<_ifelse__(0,_IF_FS__,
|
||||
<<>_dnl__<>>,
|
||||
<_define__(<_IF_FS__>,_eval__((_IF_FS__)-1))>)>)
|
||||
|
||||
_define__(
|
||||
<_if__>,
|
||||
<_ifelse__(1,_eval__( ($1) ),
|
||||
<<>_dnl__<>>,
|
||||
<_pushf__<>_divert__(-1)>)>)
|
||||
_define__(
|
||||
<_fi__>,
|
||||
<_ifelse__(1,_eval__( ($1) ),
|
||||
<<>_dnl__<>>,
|
||||
<_popf__<>_ifelse__(0,_IF_FS__,
|
||||
<_divert__<>_dnl__<>>,<>)>)>)
|
||||
|
||||
D. CHAPTER/SECTION MACRO
|
||||
In a parametrized manual, the heading level may need to be calculated;
|
||||
for example, a manual that has a chapter on machine dependencies
|
||||
should be conditionally structured as follows:
|
||||
- IF the manual is configured for a SINGLE machine type, use
|
||||
the chapter heading for that machine type, and run headings down
|
||||
from there (top level for a particular machine is chapter, then within
|
||||
that we have section, subsection etc);
|
||||
- ELSE, if MANY machine types are described in the chapter,
|
||||
use a generic chapter heading such as "@chapter Machine Dependencies",
|
||||
use "section" for the top level description of EACH machine, and run
|
||||
headings down from there (top level for a particular machine is
|
||||
section, then within that we have subsection, subsubsection etc).
|
||||
|
||||
The macro <_CHAPSEC__> is for this purpose: its argument is evaluated (so
|
||||
you can construct expressions to express choices such as above), then
|
||||
expands as follows:
|
||||
0: @chapter
|
||||
1: @section
|
||||
2: @subsection
|
||||
3: @subsubsection
|
||||
...and so on.
|
||||
|
||||
_define__(<_CHAPSEC__>,<@_cs__(_eval__($1))>)
|
||||
_define__(<_cs__>,<_ifelse__(
|
||||
0, $1, <chapter>,
|
||||
1, $1, <section>,
|
||||
<sub<>_cs__(_eval__($1 - 1))>)>)
|
||||
|
||||
_divert__<>_dnl__<>
|
@ -1,5 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_SPARC__>,<1>)
|
||||
_define__(<_HOST__>,<SPARC>)
|
||||
_define__(<_MACH_DEP__>,<SPARC Dependent>)
|
||||
_divert__<>
|
@ -1,5 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_VAX__>,<1>)
|
||||
_define__(<_HOST__>,<VAX>)
|
||||
_define__(<_MACH_DEP__>,<VAX Dependent>)
|
||||
_divert__<>
|
@ -1,5 +0,0 @@
|
||||
_divert__(-1)
|
||||
_define__(<_Z8000__>,<1>)
|
||||
_define__(<_HOST__>,<Zilog Z8000>)
|
||||
_define__(<_MACH_DEP__>,<Z8000 Dependent>)
|
||||
_divert__<>
|
Loading…
Reference in New Issue
Block a user