From 43bbd567f2d928b2628e508ee9c75a3920e26b4d Mon Sep 17 00:00:00 2001 From: "K. Richard Pixley" Date: Tue, 8 Dec 1992 04:59:31 +0000 Subject: recording file death --- gdb/Makefile | 963 ----- gdb/Makefile.dist | 575 --- gdb/Makefile.sdir | 1 - gdb/Makefile.srcdir | 1 - gdb/WHATS.NEW | 596 --- gdb/a68v-xdep.c | 158 - gdb/ansidecl.h | 93 - gdb/arm-opcode.h | 294 -- gdb/cadillac-patches | 1021 ------ gdb/cadillac.c | 1474 -------- gdb/config.gdb | 180 - gdb/config.status | 1 - gdb/config.sub | 446 --- gdb/config/altosgas.mh | 9 - gdb/config/altosgas.mt | 7 - gdb/config/am29k | 5 - gdb/config/go32.mt | 10 - gdb/config/i386sco.mt | 3 - gdb/config/i386v-g.mh | 7 - gdb/config/i386v-g.mt | 7 - gdb/config/i386v32-g.mh | 7 - gdb/config/i386v32-g.mt | 7 - gdb/config/i386v32.mt | 4 - gdb/config/i960.mt | 5 - gdb/config/mh-vax | 12 - gdb/config/mt-h8300hds | 4 - gdb/config/news1000.mt | 3 - gdb/config/sun3.mh | 3 - gdb/config/sun3.mt | 8 - gdb/config/sun4.mh | 3 - gdb/config/sun4.mt | 3 - gdb/config/sun4os3.mh | 3 - gdb/config/sun4os3.mt | 8 - gdb/config/sun4os5.mh | 29 - gdb/config/sun4os5.mt | 3 - gdb/configure | 882 ----- gdb/convex-opcode.h | 1677 --------- gdb/cplus-dem.c | 2280 ------------ gdb/demangle.h | 54 - gdb/doc/Makefile | 111 - gdb/doc/gdb-all.texi | 8437 ------------------------------------------- gdb/doc/gdb.alter-m4 | 205 -- gdb/doc/gdb.bugs-m4 | 221 -- gdb/doc/gdb.canned-m4 | 178 - gdb/doc/gdb.cmds-m4 | 160 - gdb/doc/gdb.ctl-m4 | 306 -- gdb/doc/gdb.data-m4 | 926 ----- gdb/doc/gdb.emacs-m4 | 166 - gdb/doc/gdb.files-m4 | 300 -- gdb/doc/gdb.gpl-m4 | 308 -- gdb/doc/gdb.install-m4 | 57 - gdb/doc/gdb.invoc-m4 | 207 -- gdb/doc/gdb.rdln-m4 | 7 - gdb/doc/gdb.rename-m4 | 112 - gdb/doc/gdb.run-m4 | 390 -- gdb/doc/gdb.sample-m4 | 263 -- gdb/doc/gdb.src-m4 | 288 -- gdb/doc/gdb.stack-m4 | 279 -- gdb/doc/gdb.stop-m4 | 920 ----- gdb/doc/gdb.symb-m4 | 132 - gdb/doc/gdb.tgts-m4 | 192 - gdb/doc/gdb.top-m4 | 451 --- gdb/doc/gdbinv-m.m4 | 13 - gdb/doc/gdbinv-s.m4 | 427 --- gdb/doc/interim-gdb.texinfo | 7901 ---------------------------------------- gdb/doc/interim-gdbinv-m.m4 | 13 - gdb/doc/interim-gdbinv-s.m4 | 427 --- gdb/doc/rc-cm.tex | 22 - gdb/doc/rc-ps.tex | 30 - gdb/doc/rc-pslong.tex | 30 - gdb/doc/rdl-apps.texi | 2 - gdb/doc/threecol.tex | 46 - gdb/ecoff.c | 336 -- gdb/expread.tab.c | 2948 --------------- gdb/expread.y | 1989 ---------- gdb/gdb-int.texinfo | 242 -- gdb/getpagesize.h | 25 - gdb/gmalloc.c | 1161 ------ gdb/gmalloc.h | 161 - gdb/go32-nat.c | 35 - gdb/hds-tdep.c | 2 - gdb/hp300hpux-xdep.c | 230 -- gdb/hp300ux-xdep.c | 233 -- gdb/hppa-coredep.c | 121 - gdb/hppab-xdep.c | 406 --- gdb/hppabsd-core.c | 251 -- gdb/hppabsd-tdep.c | 1422 -------- gdb/hppabsd-xdep.c | 413 --- gdb/hppah-xdep.c | 417 --- gdb/hppahpux-tdep.c | 1427 -------- gdb/hppahpux-xdep.c | 424 --- gdb/i386-xdep.c | 250 -- gdb/m68k-opcode.h | 1679 --------- gdb/m88k-opcode.h | 585 --- gdb/m88k-xdep.c | 342 -- gdb/mach386-xdep.c | 164 - gdb/mcheck.c | 124 - gdb/mips-opcode.h | 363 -- gdb/mips-xdep.c | 163 - gdb/mmap-alloc.c | 159 - gdb/mmap-sbrk.c | 144 - gdb/mtrace.awk | 36 - gdb/mtrace.c | 146 - gdb/nat-sparc.c | 297 -- gdb/nat-sun4os4.h | 27 - gdb/nat-trash.h | 2 - gdb/np1-opcode.h | 422 --- gdb/obstack.c | 333 -- gdb/obstack.h | 416 --- gdb/param-no-tm.h | 82 - gdb/param.h | 32 - gdb/pn-opcode.h | 282 -- gdb/pyr-opcode.h | 287 -- gdb/rem-m68k.shar | 893 ----- gdb/remote-multi.shar | 1313 ------- gdb/remote-sa.m68k.shar | 893 ----- gdb/remote-ser.c | 794 ---- gdb/remote-vx.68.c | 1539 -------- gdb/rs6000-xdep.c | 281 -- gdb/rs6k-opcode.def | 224 -- gdb/rs6k-opcode.h | 236 -- gdb/signame.c | 260 -- gdb/signame.h | 45 - gdb/sparc-opcode.h | 643 ---- gdb/sparc-xdep.c | 302 -- gdb/stab.def | 182 - gdb/stddef.h | 26 - gdb/stdlib.h | 10 - gdb/sun3-xdep.c | 167 - gdb/sun386-xdep.c | 289 -- gdb/symmetry-tdep.c | 494 --- gdb/symmetry-xdep.c | 557 --- gdb/tahoe-opcode.h | 213 -- gdb/tdesc.c | 1650 --------- gdb/tdesc.h | 329 -- gdb/tm-altosgas.h | 24 - gdb/tm-hppabsd.h | 6 - gdb/tm-hppahpux.h | 39 - gdb/tm-i386v-g.h | 32 - gdb/tm-sun4os5.h | 54 - gdb/tm-svr4.h | 37 - gdb/tm-vxworks68.h | 48 - gdb/tm-vxworks960.h | 48 - gdb/vax-opcode.h | 382 -- gdb/xm-hppabsd.h | 52 - gdb/xm-hppahpux.h | 46 - gdb/xm-sun4os5.h | 61 - gdb/xm-svr4.h | 56 - 148 files changed, 65176 deletions(-) delete mode 100755 gdb/Makefile.dist delete mode 100755 gdb/Makefile.sdir delete mode 100755 gdb/Makefile.srcdir delete mode 100755 gdb/WHATS.NEW delete mode 100755 gdb/ansidecl.h delete mode 100755 gdb/arm-opcode.h delete mode 100755 gdb/config.gdb delete mode 100755 gdb/config.status delete mode 100644 gdb/config/altosgas.mh delete mode 100644 gdb/config/altosgas.mt delete mode 100755 gdb/config/am29k delete mode 100644 gdb/config/go32.mt delete mode 100644 gdb/config/i386sco.mt delete mode 100644 gdb/config/i386v-g.mh delete mode 100644 gdb/config/i386v-g.mt delete mode 100644 gdb/config/i386v32-g.mh delete mode 100644 gdb/config/i386v32-g.mt delete mode 100644 gdb/config/i386v32.mt delete mode 100644 gdb/config/i960.mt delete mode 100755 gdb/config/mh-vax delete mode 100755 gdb/config/mt-h8300hds delete mode 100644 gdb/config/news1000.mt delete mode 100644 gdb/config/sun3.mh delete mode 100644 gdb/config/sun3.mt delete mode 100644 gdb/config/sun4.mh delete mode 100644 gdb/config/sun4.mt delete mode 100644 gdb/config/sun4os3.mh delete mode 100644 gdb/config/sun4os3.mt delete mode 100755 gdb/config/sun4os5.mh delete mode 100755 gdb/config/sun4os5.mt delete mode 100755 gdb/configure delete mode 100755 gdb/convex-opcode.h delete mode 100644 gdb/cplus-dem.c delete mode 100755 gdb/doc/threecol.tex delete mode 100755 gdb/expread.tab.c delete mode 100755 gdb/expread.y delete mode 100755 gdb/gdb-int.texinfo delete mode 100755 gdb/getpagesize.h delete mode 100755 gdb/gmalloc.c delete mode 100755 gdb/gmalloc.h delete mode 100644 gdb/go32-nat.c delete mode 100755 gdb/hp300hpux-xdep.c delete mode 100644 gdb/hp300ux-xdep.c delete mode 100644 gdb/hppabsd-tdep.c delete mode 100644 gdb/i386-xdep.c delete mode 100755 gdb/m68k-opcode.h delete mode 100755 gdb/mcheck.c delete mode 100755 gdb/mips-opcode.h delete mode 100644 gdb/mips-xdep.c delete mode 100755 gdb/mtrace.awk delete mode 100755 gdb/mtrace.c delete mode 100755 gdb/np1-opcode.h delete mode 100755 gdb/obstack.c delete mode 100755 gdb/obstack.h delete mode 100755 gdb/param-no-tm.h delete mode 100755 gdb/param.h delete mode 100755 gdb/pn-opcode.h delete mode 100755 gdb/pyr-opcode.h delete mode 100755 gdb/rem-m68k.shar delete mode 100755 gdb/remote-multi.shar delete mode 100755 gdb/remote-sa.m68k.shar delete mode 100644 gdb/remote-vx.68.c delete mode 100755 gdb/signame.c delete mode 100755 gdb/signame.h delete mode 100755 gdb/sparc-opcode.h delete mode 100644 gdb/sparc-xdep.c delete mode 100755 gdb/stab.def delete mode 100755 gdb/stddef.h delete mode 100755 gdb/stdlib.h delete mode 100644 gdb/sun3-xdep.c delete mode 100644 gdb/sun386-xdep.c delete mode 100755 gdb/symmetry-tdep.c delete mode 100755 gdb/symmetry-xdep.c delete mode 100755 gdb/tahoe-opcode.h delete mode 100755 gdb/tdesc.c delete mode 100755 gdb/tdesc.h delete mode 100644 gdb/tm-altosgas.h delete mode 100644 gdb/tm-i386v-g.h delete mode 100755 gdb/tm-vxworks68.h delete mode 100755 gdb/tm-vxworks960.h delete mode 100755 gdb/vax-opcode.h (limited to 'gdb') diff --git a/gdb/Makefile b/gdb/Makefile index 1bec69d..e69de29 100755 --- a/gdb/Makefile +++ b/gdb/Makefile @@ -1,963 +0,0 @@ -M_MAKEFILE=./tconfig/none ./xconfig/none -srcdir=. -# "no target". -# This can be used to build you a Makefile that only runs administrative -# commands like 'clean', 'gdb.tar.Z', etc. -# Target config file for "no target". This can be used to build you -# a Makefile that only runs administrative commands like 'clean', -# 'gdb.tar.Z', etc. -# -# Copyright (C) 1990 Free Software Foundation, Inc. - -# This file is part of GDB. - -# GDB is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 1, or (at your option) -# any later version. - -# GDB is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with GDB; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -ALLDEPFILES = $(ALLDEPFILES_MAINDIR) $(ALLDEPFILES_SUBDIR) -ALLDEPFILES_MAINDIR=\ -altos-xdep.c\ -am29k-pinsn.c\ -am29k-tdep.c\ -arm-convert.s\ -arm-pinsn.c\ -arm-tdep.c\ -arm-xdep.c\ -convex-pinsn.c\ -convex-tdep.c\ -convex-xdep.c\ -coredep.c\ -exec.c\ -gould-pinsn.c\ -gould-xdep.c\ -hp300ux-xdep.c\ -i386-pinsn.c\ -i386-tdep.c\ -i386-xdep.c\ -i960-pinsn.c\ -i960-tdep.c\ -infptrace.c\ -m68k-pinsn.c\ -m68k-tdep.c\ -m88k-pinsn.c\ -m88k-tdep.c\ -m88k-xdep.c\ -mips-pinsn.c\ -mips-tdep.c\ -mips-xdep.c\ -mipsread.c\ -news-xdep.c\ -nindy-tdep.c\ -ns32k-pinsn.c\ -pyr-pinsn.c\ -pyr-tdep.c\ -pyr-xdep.c\ -remote-eb.c\ -remote-nindy.c\ -remote-vx.c\ -solib.c\ -sparc-pinsn.c\ -sparc-tdep.c\ -sparc-xdep.c\ -sun3-xdep.c\ -sun386-xdep.c\ -symm-tdep.c\ -symm-xdep.c\ -tdesc.c\ -umax-xdep.c\ -vax-pinsn.c - -ALLDEPFILES_SUBDIR=\ -nindy-share/Onindy.c\ -nindy-share/nindy.c\ -nindy-share/ttybreak.c\ -nindy-share/ttyflush.c\ -vx-share/xdr_ld.c\ -vx-share/xdr_ptrace.c\ -vx-share/xdr_rdb.c\ -vx-share/xdr_regs.c - -ALLPARAM=\ -tm-29k.h\ -tm-3b1.h\ -tm-88k.h\ -tm-altos.h\ -tm-altosgas.h\ -tm-arm.h\ -tm-bigmips.h\ -tm-convex.h\ -tm-hp300bsd.h\ -tm-hp300hpux.h\ -tm-i386v-g.h\ -tm-i386v.h\ -tm-isi.h\ -tm-merlin.h\ -tm-mips.h\ -tm-news.h\ -tm-nindy960.h\ -tm-np1.h\ -tm-pn.h\ -tm-pyr.h\ -tm-sparc.h\ -tm-sun2.h\ -tm-sun2os4.h\ -tm-sun3.h\ -tm-sun386.h\ -tm-sun3os4.h\ -tm-sun4os4.h\ -tm-symmetry.h\ -tm-umax.h\ -tm-vax.h\ -tm-vx68.h\ -tm-vx960.h\ -xm-3b1.h\ -xm-88k.h\ -xm-altos.h\ -xm-arm.h\ -xm-bigmips.h\ -xm-convex.h\ -xm-hp300bsd.h\ -xm-hp300hpux.h\ -xm-i386v.h\ -xm-i386v32.h\ -xm-isi.h\ -xm-merlin.h\ -xm-mips.h\ -xm-news.h\ -xm-news1000.h\ -xm-np1.h\ -xm-pn.h\ -xm-pyr.h\ -xm-sparc.h\ -xm-sun2.h\ -xm-sun3.h\ -xm-sun386.h\ -xm-sun3os4.h\ -xm-sun4os4.h\ -xm-symmetry.h\ -xm-umax.h\ -xm-vax.h - -ALLCONFIG=\ -./tconfig/3b1\ -./tconfig/CVS.adm\ -./tconfig/altos\ -./tconfig/altosgas\ -./tconfig/am29k\ -./tconfig/arm\ -./tconfig/bigmips\ -./tconfig/convex\ -./tconfig/hp300bsd\ -./tconfig/hp300hpux\ -./tconfig/i386v\ -./tconfig/i386v-g\ -./tconfig/i386v32\ -./tconfig/i386v32-g\ -./tconfig/i960\ -./tconfig/isi\ -./tconfig/littlemips\ -./tconfig/m88k\ -./tconfig/m88k.orig\ -./tconfig/merlin\ -./tconfig/news\ -./tconfig/news1000\ -./tconfig/nindy960\ -./tconfig/none\ -./tconfig/np1\ -./tconfig/pn\ -./tconfig/pyramid\ -./tconfig/sun2os3\ -./tconfig/sun2os4\ -./tconfig/sun3\ -./tconfig/sun386\ -./tconfig/sun3os3\ -./tconfig/sun3os4\ -./tconfig/sun4\ -./tconfig/sun4os3\ -./tconfig/sun4os4\ -./tconfig/symmetry\ -./tconfig/umax\ -./tconfig/vax\ -./tconfig/vxworks68\ -./tconfig/vxworks960\ -./xconfig/3b1\ -./xconfig/CVS.adm\ -./xconfig/altos\ -./xconfig/altosgas\ -./xconfig/arm\ -./xconfig/bigmips\ -./xconfig/convex\ -./xconfig/hp300bsd\ -./xconfig/hp300hpux\ -./xconfig/i386v\ -./xconfig/i386v-g\ -./xconfig/i386v32\ -./xconfig/i386v32-g\ -./xconfig/isi\ -./xconfig/littlemips\ -./xconfig/m88k\ -./xconfig/m88k.orig\ -./xconfig/merlin\ -./xconfig/news\ -./xconfig/news1000\ -./xconfig/none\ -./xconfig/np1\ -./xconfig/pn\ -./xconfig/pyramid\ -./xconfig/sun2os3\ -./xconfig/sun2os4\ -./xconfig/sun3\ -./xconfig/sun386\ -./xconfig/sun3os3\ -./xconfig/sun3os4\ -./xconfig/sun4\ -./xconfig/sun4os3\ -./xconfig/sun4os4\ -./xconfig/symmetry\ -./xconfig/umax\ -./xconfig/vax - -##Copyright (C) 1989-1991 Free Software Foundation, Inc. - -# This file is part of GDB. - -# GDB is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 1, or (at your option) -# any later version. - -# GDB is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with GDB; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - -# Place to install binaries. -bindir=/usr/local/bin - -# System V: If you compile gdb with a compiler which uses the coff -# encapsulation feature (this is a function of the compiler used, NOT -# of the m-?.h file selected by config.gdb), you must make sure that -# the GNU nm is the one that is used by munch. - -# If you are compiling with GCC, make sure that either 1) You use the -# -traditional flag, or 2) You have the fixed include files where GCC -# can reach them. Otherwise the ioctl calls in inflow.c and readline.c -# will be incorrectly compiled. The "fixincludes" script in the gcc -# distribution will fix your include files up. -#CC=cc -#CC=gcc -traditional -GCC=gcc - -VPATH=$(srcdir) - -# It is also possible that you will need to add -I/usr/include/sys to the -# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which -# is where it should be according to Posix). - -YACC=bison -y -# YACC=yacc -SHELL=/bin/sh -MAKE=make -# We need either GNU m4 or SysV m4; Berkeley/Sun don't have quite enough. -#M4=gm4 -M4=/usr/5bin/m4 - -# Set this up with gcc if you have gnu ld and the loader will print out -# line numbers for undefinded refs. -#CC-LD=gcc -static -CC-LD=${CC} - -# define this to be "gmalloc.o" if you want to use the gnu malloc routine -# (useful for debugging memory allocation problems in gdb). To use your -# system malloc, uncomment the following two lines. -#GNU_MALLOC = -#MALLOC_CFLAGS = -DNO_MALLOC_CHECK -GNU_MALLOC = gmalloc.o mcheck.o mtrace.o -MALLOC_CFLAGS = - -# Where is the "include" directory? Traditionally ../include or ./include -INCLUDE_DIR = ${srcdir}/../include -INCLUDE_DEP = $$(INCLUDE_DIR) - -# Where is the source dir for the BFD library? Traditionally ../bfd or ./bfd -# (When we want the binary library built from it, we use ${BFD_DIR}${subdir}.) -BFD_DIR = ${srcdir}/../bfd -BFD_DEP = $$(BFD_DIR) - -# All the includes used for CFLAGS and for lint. -# -I. for config files. -# -I${srcdir} possibly for regex.h also. -INCLUDE_CFLAGS = -I. -I${srcdir} -I$(INCLUDE_DIR) -I${srcdir}/vx-share - -# {X,T}M_CFLAGS, if defined, has system-dependent CFLAGS. -# CFLAGS for both GDB and readline. -GLOBAL_CFLAGS = -g ${TM_CFLAGS} ${XM_CFLAGS} -#PROFILE_CFLAGS = -pg - -CFLAGS = ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${MALLOC_CFLAGS} ${INCLUDE_CFLAGS} -# None of the things in CFLAGS will do any harm, and on some systems -# (e.g. SunOS4) it is important to use the M_CFLAGS. -LDFLAGS = $(CFLAGS) - -# Where is the "-liberty" library, containing getopt and obstack? -LIBIBERTY_DIR = ${srcdir}/../libiberty -LIBIBERTY = ${LIBIBERTY_DIR}${subdir}/libiberty.a - -# Flags that describe where you can find the termcap library. -# You may need to make other arrangements for USG. -TERMCAP = -ltermcap - -# You must define REGEX and REGEX1 on USG machines. -# If your sysyem is missing alloca(), or, more likely, it's there but -# it doesn't work, define ALLOCA & ALLOCA1 - -# {X,T}M_CLIBS, if defined, has system-dependent libs -# For example, -lPW for System V to get alloca(). -# FIXME STOPGAP FOR BFD LIBRARY: BFD stuff -CLIBS = ${TERMCAP} $(XM_CLIBS) ${TM_CLIBS} ${BFD_DIR}${subdir}/libbfd.a \ - ${LIBIBERTY} -CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_DIR}/libbfd.a \ - ${LIBIBERTY} - -ADD_FILES = ${REGEX} ${ALLOCA} ${GNU_MALLOC} -ADD_DEPS = ${REGEX1} ${ALLOCA1} ${GNU_MALLOC} - -VERSION = 3.95 -DIST=gdb-$(VERSION) - -LINT=/usr/5bin/lint -LINTFLAGS= - -# Source files in the main directory. -# Files which are included via a tconfig/* or xconfig/* file -# should *not* be specified here; they're in "ALLDEPFILES". -SFILES_MAINDIR = \ - blockframe.c breakpoint.c command.c core.c \ - environ.c eval.c expprint.c findvar.c infcmd.c inflow.c infrun.c \ - main.c printcmd.c \ - remote.c source.c stack.c symmisc.c symtab.c symfile.c \ - utils.c valarith.c valops.c valprint.c values.c expread.y \ - signame.c cplus-dem.c mem-break.c target.c inftarg.c \ - dbxread.c coffread.c \ - ieee-float.c - -# Source files in subdirectories (which will be handled separately by -# 'make gdb.tar.Z'). -# Files which are included via a tconfig/* or xconfig/* file -# should *not* be specified here; they're in "ALLDEPFILES". -SFILES_SUBDIR = \ - ${srcdir}/vx-share/dbgRpcLib.h \ - ${srcdir}/vx-share/ptrace.h \ - ${srcdir}/vx-share/reg.h \ - ${srcdir}/vx-share/vxTypes.h \ - ${srcdir}/vx-share/vxWorks.h \ - ${srcdir}/vx-share/wait.h \ - ${srcdir}/vx-share/xdr_ld.h \ - ${srcdir}/vx-share/xdr_ptrace.h \ - ${srcdir}/vx-share/xdr_rdb.h \ - ${srcdir}/vx-share/xdr_regs.h \ - ${srcdir}/nindy-share/Makefile \ - ${srcdir}/nindy-share/VERSION \ - ${srcdir}/nindy-share/b.out.h \ - ${srcdir}/nindy-share/block_io.h \ - ${srcdir}/nindy-share/coff.h \ - ${srcdir}/nindy-share/demux.h \ - ${srcdir}/nindy-share/env.h \ - ${srcdir}/nindy-share/stop.h \ - ${srcdir}/nindy-share/ttycntl.h - -# All source files that go into linking GDB, except config-specified files. -SFILES = $(SFILES_MAINDIR) $(SFILES_SUBDIR) - -# All source files that lint should look at -LINTFILES = $(SFILES) expread.tab.c init.c - -# Any additional files specified on these lines should also be added to -# the OTHERS = definition below, so they go in the tar files. -SFILES_STAND = $(SFILES) standalone.c -SFILES_KGDB = $(SFILES) stuff.c kdb-start.c - -# Header files that are not named in tconfig/* or xconfig/* go here. -HFILES= breakpoint.h command.h defs.h environ.h \ - expression.h frame.h gdbcmd.h gdbcore.h \ - getpagesize.h ieee-float.h inferior.h param-no-tm.h param.h \ - signals.h signame.h symfile.h symtab.h \ - target.h tdesc.h terminal.h tm-68k.h tm-i960.h tm-sunos.h \ - value.h - -OPCODES = pn-opcode.h np1-opcode.h sparc-opcode.h vax-opcode.h m68k-opcode.h \ - ns32k-opcode.h convx-opcode.h pyr-opcode.h mips-opcode.h \ - am29k-opcode.h - -REMOTE_EXAMPLES = rem-m68k.shar rem-multi.shar - -MALLOCSRC = gmalloc.c mcheck.c mtrace.c mtrace.awk \ - ansidecl.h stdlib.h gmalloc.h stddef.h - -POSSLIBS_MAINDIR = regex.c regex.h alloca.c $(MALLOCSRC) -POSSLIBS = $(POSSLIBS_MAINDIR) - -TESTS = testbpt.c testfun.c testrec.c testreg.c testregs.c - -# tdesc-lib cannot be named simply tdesc, because if if it were GNU make -# would try to make it from tdesc.c. -# tdesc-lib removed from the list due to Motorola copyrights...gnu@cygnus.com -OTHERS = Makefile.dist depend alldeps.mak Makefile.sdir \ - createtags munch config.gdb config.status \ - ChangeLog ChangeLog-3.x \ - README TODO TAGS WHATS.NEW \ - doc \ - .gdbinit COPYING expread.tab.c stab.def \ - copying.c Projects Convex.notes copying.awk \ - saber.suppress standalone.c stuff.c kdb-start.c \ - hp-include # tests - -DEPFILES= ${TDEPFILES} ${XDEPFILES} - -SOURCES=$(SFILES) $(ALLDEPFILES) -TAGFILES = $(SOURCES) ${HFILES} ${OPCODES} ${ALLPARAM} ${POSSLIBS} -TAGFILES_MAINDIR = $(SFILES_MAINDIR) $(ALLDEPFILES_MAINDIR) \ - ${HFILES} ${OPCODES} ${ALLPARAM} ${POSSLIBS_MAINDIR} -TARFILES = ${TAGFILES_MAINDIR} ${OTHERS} ${REMOTE_EXAMPLES} - -OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \ - values.o eval.o valops.o valarith.o valprint.o printcmd.o \ - symtab.o symfile.o symmisc.o infcmd.o infrun.o remote.o \ - command.o utils.o expread.o expprint.o environ.o version.o \ - copying.o $(DEPFILES) signame.o cplus-dem.o mem-break.o target.o \ - inftarg.o ieee-float.o putenv.o \ - dbxread.o coffread.o # mipsread.o - -RAPP_OBS = rgdb.o rudp.o rserial.o serial.o udp.o $(XDEPFILES) - -TSOBS = core.o inflow.o - -NTSOBS = standalone.o - -TSSTART = /lib/crt0.o - -NTSSTART = kdb-start.o - -RL_LIB = readline/libreadline.a -RL_LIB_DEP = $(RL_LIB) - -# Prevent Sun make from putting in the machine type. Setting -# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1. -.c.o: - ${CC} -c ${CFLAGS} $< - -all: gdb - -install: gdb - cp gdb $(bindir)/gdb.new - mv $(bindir)/gdb.new $(bindir)/gdb - $(M_INSTALL) - -init.c: $(srcdir)/munch $(MUNCH_DEFINE) $(OBS) $(TSOBS) - $(srcdir)/munch ${MUNCH_DEFINE} $(OBS) $(TSOBS) > init.c - -gdb: $(OBS) $(TSOBS) ${ADD_DEPS} ${RL_LIB_DEP} ${CDEPS} init.o - ${CC-LD} $(LDFLAGS) -o gdb init.o $(OBS) $(TSOBS) $(ADD_FILES) \ - ${RL_LIB} $(CLIBS) - -saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c - #setopt load_flags $(CFLAGS) -I$(BFD_DIR) -DHOST_SYS=SUN4_SYS - #load ./init.c $(SFILES) - #unload ${srcdir}/expread.y ${srcdir}/vx-share/*.h - #unload ${srcdir}/nindy-share/[A-Z]* - #load ${srcdir}/expread.tab.c readline/libreadline.a - #load copying.c version.c - #load `echo " "$(DEPFILES) | sed -e 's/\.o/.c/g' -e 's, , ../,g'` - #load ${LIBIBERTY_DIR}/*.c - #load ${BFD_DIR}/*.c - #load -ltermcap - ##void mcheck(a) void (*a)(); { } - ##void mtrace() { } - - - -# This is useful when debugging GDB, because some Unix's don't let you run GDB -# on itself without copying the executable. So "make gdb1" will make -# gdb and put a copy in gdb1, and you can run it with "gdb gdb1". -# Removing gdb1 before the copy is the right thing if gdb1 is open -# in another process. -gdb1: gdb - rm -f gdb1 - cp gdb gdb1 - -# This is a remote stub which runs under unix and starts up an -# inferior process. This is at least useful for debugging GDB's -# remote support. -rapp: $(RAPP_OBS) - rm -f rapp_init.c - ${srcdir}/munch ${RAPP_OBS} > rapp_init.c - ${CC-LD} $(LDFLAGS) -o $@ rapp_init.c $(RAPP_OBS) - -Makefiles= Makefile.sdir $(M_MAKEFILE) \ - ${srcdir}/alldeps.mak ${srcdir}/Makefile.dist - -MAKE_MAKEFILE= echo "M_MAKEFILE=$(M_MAKEFILE)" | \ - cat - ${Makefiles} ${srcdir}/depend >Makefile - -Makefile: $(Makefiles) - $(MAKE_MAKEFILE) - -alldeps.mak: ${srcdir}/tconfig ${srcdir}/xconfig - rm -f alldeps.mak alldeps.tmp allparam.tmp allconfig.tmp - for i in `ls -d ${srcdir}/tconfig/*[0-9A-Za-z] \ - ${srcdir}/xconfig/*[0-9A-Za-z] | grep -v RCS` ; do \ - echo $$i >>allconfig.tmp; \ - awk <$$i ' \ - $$1 == "TDEPFILES=" || $$1 == "XDEPFILES=" { \ - for (i = 2; i <= NF; i++) \ - print $$i >> "alldeps.tmp" ; \ - } \ - $$1 == "TM_FILE=" || $$1 == "XM_FILE=" { \ - print $$2 >> "allparam.tmp" }' ; \ - done - sort alldeps2.tmp - echo 'ALLDEPFILES = $$(ALLDEPFILES_MAINDIR) $$(ALLDEPFILES_SUBDIR)' \ - >>alldeps.mak; - grep -v / alldeps2.tmp | \ - awk 'BEGIN {printf "ALLDEPFILES_MAINDIR="} \ - NR == 0 {printf $$0;} \ - NR != 0 {printf "\\\n" $$0} \ - END {printf "\n\n"}' >>alldeps.mak; - grep / alldeps2.tmp | \ - awk 'BEGIN {printf "ALLDEPFILES_SUBDIR="} \ - NR == 0 {printf $$0;} \ - NR != 0 {printf "\\\n" $$0} \ - END {printf "\n\n"}' >>alldeps.mak; - sort >alldeps.mak; - sort >alldeps.mak; - rm -f alldeps.tmp alldeps2.tmp allparam.tmp allconfig.tmp - -# The sed script makes everything which depends on {x,t}m.h depend on -# config.status as well, in case someone reconfigures gdb out from -# under an already compiled gdb. -depend: $(SOURCES) Makefile.dist - @echo Ignore errors about non-existent system-supplied include files - @echo for systems other than the one you are using. - @echo "If xm.h and tm.h don't exist, the error messages saying so" - @echo can safely be ignored. - @echo Also ignore parse errors in valops.c, and any errors in - @echo arm-convert.s. - -$(GCC) -MM $(CFLAGS) -I$(BFD_DIR) \ - `ls $(SOURCES) | sort -u` >depend.tmp - depend - $(MAKE_MAKEFILE) - rm depend.tmp - -config.status: - @echo "You must configure gdb. Look at the README file for details." - @false - -# These are not generated by "make depend" because they only are there -# for some machines. -# But these rules don't do what we want; we want to hack the foo.o: tm.h -# dependency to do the right thing. -tm-isi.h tm-sun3.h tm-news.h tm-hp300bsd.h tm-altos.h : tm-68k.h -tm-hp300hpux.h tm-sun2.h tm-3b1.h : tm-68k.h -xm-news1000.h : xm-news.h -xm-i386-sv32.h : xm-i386.h -tm-i386gas.h: tm-i386.h -xm-sun4os4.h : xm-sparc.h -tm-sun4os4.h : tm-sparc.h - -kdb : $(NTSSTART) $(OBS) $(NTSOBS) ${ADD_DEPS} ${RL_LIB_DEP} - rm -f init.c - $(srcdir)/munch ${MUNCH_DEFINE} $(OBS) $(NTSOBS) > init.c - $(CC) $(LDFLAGS) -c init.c $(CLIBS) - ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o $(ADD_FILES) \ - ${RL_LIB} -lc $(CLIBS) - -# Put the proper machine-specific files first. -# createtags will edit the .o in DEPFILES into .c -TAGS: ${TAGFILES} - $(srcdir)/createtags $(TM_FILE) ${XM_FILE} $(DEPFILES) ${TAGFILES} -tags: TAGS - -# FIXME: Get alldeps.mak up to date, config.gdb none, THEN make gdb.tar.Z! -gdb.tar.Z: ${TARFILES} - rm -f gdb.tar; rm -rf $(DIST) - cd readline ; make readline.tar - mkdir $(DIST) - cd $(DIST) ; for i in ${TARFILES} ; do ln -s ../$$i . ; done - mkdir $(DIST)/readline - cd $(DIST)/readline ; tar xf ../../readline/readline.tar - mkdir $(DIST)/xconfig ${DIST}/tconfig - cd $(DIST)/tconfig ; \ - for i in $(ALLCONFIG) ; do ln -s ../../$$i ../$$i ; done - mkdir $(DIST)/vx-share $(DIST)/nindy-share - cd $(DIST)/tconfig ; \ - for i in $(SFILES_SUBDIR) $(ALLDEPFILES_SUBDIR); \ - do ln -s ../../$$i ../$$i ; done - tar chf - $(DIST) | compress >gdb.tar.Z - rm -rf $(DIST) - -clean: - rm -f ${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} - rm -f init.c init.o version.c - rm -f gdb core gdb.tar gdb.tar.Z make.log - rm -f gdb[0-9] - rm -f gdb.dvi gdb-all* - cd readline ; make clean - -distclean: clean expread.tab.c TAGS - rm -f tm.h xm.h config.status - rm -f y.output yacc.acts yacc.tmp - rm -f ${TESTS} Makefile - -realclean: clean - rm -f expread.tab.c TAGS - rm -f tm.h xm.h config.status - rm -f Makefile - -gdb-all.texinfo: ${srcdir}/doc/gdb.texinfo - ${M4} $(srcdir)/doc/pretex.m4 $(srcdir)/doc/none.m4 $(srcdir)/doc/all.m4 $(srcdir)/doc/gdb.texinfo >gdb-all.texinfo - -gdb.dvi : gdb-all.texinfo - tex gdb-all.texinfo - texindex gdb-all.?? - tex gdb-all.texinfo - mv gdb-all.dvi gdb.dvi - rm -f gdb-all.?? gdb-all.??? - -# This should work eventually, but we're using texinfo2, and many makeinfo's -# can't cope with all the markup. In the meantime, we distribute the info -# files as formatted by the elisp texinfo2 code. -#gdb.info: gdb-all.texinfo -# makeinfo gdb-all.texinfo - -# Make copying.c from COPYING -copying.c : COPYING copying.awk - awk -f copying.awk < COPYING > copying.c - -version.c : Makefile.dist - echo 'char *version = "$(VERSION)";' >version.c - -${srcdir}/expread.tab.c : $(srcdir)/expread.y - @echo 'Expect 4 shift/reduce conflict.' - ${YACC} $(srcdir)/expread.y - mv y.tab.c ${srcdir}/expread.tab.c - -expread.o : ${srcdir}/expread.tab.c defs.h param.h symtab.h \ - frame.h expression.h - $(CC) -c ${CFLAGS} `echo ${srcdir}/expread.tab.c | sed 's,^\./,,'` - mv expread.tab.o expread.o - -# dbxread, coffread, mipsread have dependencies on BFD header files. -dbxread.o: ${srcdir}/dbxread.c - ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/dbxread.c - -coffread.o: ${srcdir}/coffread.c - ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/coffread.c - -mipsread.o: ${srcdir}/mipsread.c - ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/mipsread.c - -# Drag in the files that are in another directory. - -xdr_ld.o: ${srcdir}/vx-share/xdr_ld.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_ld.c - -xdr_ptrace.o: ${srcdir}/vx-share/xdr_ptrace.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_ptrace.c - -xdr_rdb.o: ${srcdir}/vx-share/xdr_rdb.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_rdb.c - -xdr_regs.o: ${srcdir}/vx-share/xdr_regs.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_regs.c - -nindy.o: ${srcdir}/nindy-share/nindy.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/nindy.c - -Onindy.o: ${srcdir}/nindy-share/Onindy.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/Onindy.c - -ttybreak.o: ${srcdir}/nindy-share/ttybreak.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/ttybreak.c - -ttyflush.o: ${srcdir}/nindy-share/ttyflush.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/ttyflush.c - -tdesc-lib/libdc.o : force_update - cd tdesc-lib ; ${MAKE} "SYSV_DEFINE=${SYSV_DEFINE}" - -# In LOCAL_INCLUDES, -I${srcdir} is right if srcdir is an absolute path, -# and -I../${srcdir} is right if it is relative (e.g. ".."), so search both. -readline/libreadline.a : force_update - cd readline ; ${MAKE} "SYSV=${SYSV_DEFINE}"\ - "VPATH=${srcdir}/readline:../${srcdir}/readline"\ - "LOCAL_INCLUDES=-I../ -I${srcdir}/ -I../${srcdir}/"\ - "DEBUG_FLAGS=${GLOBAL_CFLAGS}" "CC=${CC}" libreadline.a - -lint: $(LINTFILES) - $(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) - -gdb.cxref: $(SFILES) - cxref -I. $(SFILES) >gdb.cxref - -force_update : - -# When used with GDB, the demangler should never look for leading -# underscores because GDB strips them off during symbol read-in. Thus -# -Dnounderscore. - -cplus-dem.o : cplus-dem.c - ${CC} -c ${CFLAGS} -Dnounderscore \ - `echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'` -altos-xdep.o : altos-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -am29k-pinsn.o : am29k-pinsn.c defs.h target.h am29k-opcode.h -am29k-tdep.o : am29k-tdep.c defs.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h $(INCLUDE_DIR)/obstack.h frame.h param.h tm.h config.status \ - param-no-tm.h xm.h config.status value.h symtab.h inferior.h breakpoint.h -arm-pinsn.o : arm-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - arm-opcode.h -arm-tdep.o : arm-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h arm-opcode.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -arm-xdep.o : arm-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h arm-opcode.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -blockframe.o : blockframe.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - frame.h gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h value.h \ - target.h -breakpoint.o : breakpoint.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - frame.h breakpoint.h value.h expression.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h gdbcmd.h command.h inferior.h target.h -coffread.o : coffread.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - breakpoint.h value.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h symfile.h \ - $(BFD_DIR)/libcoff.h -command.o : command.c defs.h command.h symtab.h value.h -convex-pinsn.o : convex-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - symtab.h convx-opcode.h -convex-tdep.o : convex-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - command.h symtab.h value.h frame.h inferior.h breakpoint.h \ - $(INCLUDE_DIR)/wait.h gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h \ - gdbcmd.h -convex-xdep.o : convex-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - command.h symtab.h value.h frame.h inferior.h breakpoint.h \ - $(INCLUDE_DIR)/wait.h gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h \ - gdbcmd.h -core.o : core.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h inferior.h \ - breakpoint.h value.h symtab.h command.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h target.h gdbcore.h -coredep.o : coredep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h $(INCLUDE_DIR)/obstack.h -cplus-dem.o : cplus-dem.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status -dbxread.o : dbxread.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - $(INCLUDE_DIR)/a.out.gnu.h $(INCLUDE_DIR)/reloc.h $(INCLUDE_DIR)/stab.gnu.h \ - $(INCLUDE_DIR)/stab.def symtab.h breakpoint.h value.h command.h target.h \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h $(BFD_DIR)/liba.out.h \ - symfile.h -environ.o : environ.c environ.h defs.h -eval.o : eval.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h value.h \ - expression.h target.h frame.h -exec.o : exec.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h inferior.h \ - breakpoint.h value.h symtab.h target.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -expprint.o : expprint.c defs.h symtab.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - expression.h value.h -findvar.o : findvar.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - frame.h value.h gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h \ - inferior.h breakpoint.h target.h -gould-pinsn.o : gould-pinsn.c gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h $(INCLUDE_DIR)/obstack.h defs.h param.h tm.h config.status \ - param-no-tm.h xm.h config.status symtab.h frame.h np1-opcode.h -gould-xdep.o : gould-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -hp300ux-xdep.o : hp300ux-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - frame.h inferior.h breakpoint.h value.h symtab.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -i386-pinsn.o : i386-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h $(INCLUDE_DIR)/obstack.h -i386-tdep.o : i386-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -i386-xdep.o : i386-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -i960-pinsn.o : i960-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h -i960-tdep.o : i960-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - value.h frame.h signame.h ieee-float.h -ieee-float.o : ieee-float.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - ieee-float.h -infcmd.o : infcmd.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h frame.h \ - inferior.h breakpoint.h value.h environ.h gdbcmd.h command.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h target.h -inflow.o : inflow.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h command.h signals.h terminal.h \ - target.h -infptrace.o : infptrace.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h target.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -infrun.o : infrun.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h frame.h \ - inferior.h breakpoint.h value.h $(INCLUDE_DIR)/wait.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h signame.h command.h terminal.h \ - target.h -inftarg.o : inftarg.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h target.h $(INCLUDE_DIR)/wait.h \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h ieee-float.h -m68k-pinsn.o : m68k-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - m68k-opcode.h gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -m68k-tdep.o : m68k-tdep.c defs.h ieee-float.h -main.o : main.c defs.h gdbcmd.h command.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - symtab.h inferior.h breakpoint.h value.h frame.h signals.h target.h -mem-break.o : mem-break.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status -mips-pinsn.o : mips-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - mips-opcode.h -mips-tdep.o : mips-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcmd.h command.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -mips-xdep.o : mips-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -mipsread.o : mipsread.c param.h tm.h config.status param-no-tm.h xm.h config.status \ - $(INCLUDE_DIR)/obstack.h defs.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h symfile.h $(INCLUDE_DIR)/intel-coff.h -news-xdep.o : news-xdep.c -Onindy.o : ${srcdir}/nindy-share/Onindy.c ${srcdir}/nindy-share/ttycntl.h \ - ${srcdir}/nindy-share/block_io.h $(INCLUDE_DIR)/wait.h ${srcdir}/nindy-share/env.h \ - /usr/include/string.h -nindy.o : ${srcdir}/nindy-share/nindy.c ${srcdir}/nindy-share/ttycntl.h ${srcdir}/nindy-share/block_io.h \ - $(INCLUDE_DIR)/wait.h ${srcdir}/nindy-share/env.h /usr/include/string.h -ttybreak.o : ${srcdir}/nindy-share/ttybreak.c ${srcdir}/nindy-share/ttycntl.h -ttyflush.o : ${srcdir}/nindy-share/ttyflush.c ${srcdir}/nindy-share/ttycntl.h -nindy-tdep.o : nindy-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - frame.h -ns32k-pinsn.o : ns32k-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - symtab.h ns32k-opcode.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -printcmd.o : printcmd.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - symtab.h value.h expression.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h gdbcmd.h command.h target.h -pyr-pinsn.o : pyr-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - pyr-opcode.h gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -pyr-tdep.o : pyr-tdep.c -pyr-xdep.o : pyr-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -remote-eb.o : remote-eb.c defs.h tm-29k.h param-no-tm.h xm.h config.status inferior.h \ - breakpoint.h value.h symtab.h frame.h param.h $(INCLUDE_DIR)/wait.h \ - terminal.h target.h -remote-nindy.o : remote-nindy.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - frame.h inferior.h breakpoint.h value.h symtab.h target.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h command.h ieee-float.h \ - $(INCLUDE_DIR)/wait.h ${srcdir}/nindy-share/ttycntl.h ${srcdir}/nindy-share/demux.h \ - ${srcdir}/nindy-share/env.h ${srcdir}/nindy-share/stop.h -remote-vx.o : remote-vx.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h $(INCLUDE_DIR)/wait.h target.h \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h command.h symfile.h \ - ${srcdir}/vx-share/xdr_ptrace.h ${srcdir}/vx-share/xdr_regs.h ${srcdir}/vx-share/reg.h \ - ${srcdir}/vx-share/xdr_ld.h ${srcdir}/vx-share/xdr_rdb.h ${srcdir}/vx-share/dbgRpcLib.h -remote.o : remote.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h target.h $(INCLUDE_DIR)/wait.h \ - terminal.h -signame.o : signame.c signame.h defs.h param.h tm.h config.status param-no-tm.h xm.h config.status -solib.o : solib.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h command.h target.h frame.h -source.o : source.c defs.h symtab.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - command.h gdbcmd.h frame.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h regex.h -sparc-pinsn.o : sparc-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - symtab.h sparc-opcode.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h /usr/include/string.h target.h -sparc-tdep.o : sparc-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h signame.h target.h ieee-float.h \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -sparc-xdep.o : sparc-xdep.c defs.h tm-sparc.h param-no-tm.h xm.h config.status inferior.h \ - breakpoint.h value.h symtab.h frame.h param.h target.h gdbcore.h \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h -stack.o : stack.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h frame.h \ - gdbcmd.h command.h value.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h target.h breakpoint.h -sun3-xdep.o : sun3-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status inferior.h \ - breakpoint.h value.h symtab.h frame.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -sun386-xdep.o : sun386-xdep.c -symfile.o : symfile.c defs.h symtab.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h frame.h target.h \ - value.h symfile.h gdbcmd.h command.h breakpoint.h -symm-tdep.o : symm-tdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -symm-xdep.o : symm-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -symmisc.o : symmisc.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - breakpoint.h value.h command.h -symtab.o : symtab.c defs.h symtab.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h frame.h target.h \ - value.h symfile.h gdbcmd.h command.h -target.o : target.c defs.h target.h gdbcmd.h command.h symtab.h inferior.h \ - breakpoint.h value.h frame.h param.h tm.h config.status param-no-tm.h xm.h config.status \ - $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h symfile.h -tdesc.o : tdesc.c -umax-xdep.o : umax-xdep.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status frame.h \ - inferior.h breakpoint.h value.h symtab.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h -utils.o : utils.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status signals.h gdbcmd.h \ - command.h terminal.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h \ - $(INCLUDE_DIR)/obstack.h target.h -valarith.o : valarith.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status value.h \ - symtab.h expression.h target.h -valops.o : valops.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h value.h \ - frame.h inferior.h breakpoint.h gdbcore.h $(INCLUDE_DIR)/bfd.h \ - $(INCLUDE_DIR)/ansidecl.h target.h -valprint.o : valprint.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - value.h gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h gdbcmd.h \ - command.h target.h -values.o : values.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h value.h \ - gdbcore.h $(INCLUDE_DIR)/bfd.h $(INCLUDE_DIR)/ansidecl.h frame.h command.h \ - gdbcmd.h -vax-pinsn.o : vax-pinsn.c defs.h param.h tm.h config.status param-no-tm.h xm.h config.status symtab.h \ - vax-opcode.h -xdr_ld.o : ${srcdir}/vx-share/xdr_ld.c ${srcdir}/vx-share/vxWorks.h ${srcdir}/vx-share/vxTypes.h \ - /usr/include/rpc/rpc.h ${srcdir}/vx-share/xdr_ld.h -xdr_ptrace.o : ${srcdir}/vx-share/xdr_ptrace.c -xdr_rdb.o : ${srcdir}/vx-share/xdr_rdb.c ${srcdir}/vx-share/vxWorks.h ${srcdir}/vx-share/vxTypes.h \ - ${srcdir}/vx-share/xdr_rdb.h -xdr_regs.o : ${srcdir}/vx-share/xdr_regs.c diff --git a/gdb/Makefile.dist b/gdb/Makefile.dist deleted file mode 100755 index 94040a5..0000000 --- a/gdb/Makefile.dist +++ /dev/null @@ -1,575 +0,0 @@ -##Copyright (C) 1989-1991 Free Software Foundation, Inc. - -# This file is part of GDB. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# Destination directory of the software tree build -destdir = /usr/local - -# Place to install binaries in the destination tree. -bindir=$(destdir)/bin - -# System V: If you compile gdb with a compiler which uses the coff -# encapsulation feature (this is a function of the compiler used, NOT -# of the m-?.h file selected by config.gdb), you must make sure that -# the GNU nm is the one that is used by munch. - -# If you are compiling with GCC, make sure that either 1) You use the -# -traditional flag, or 2) You have the fixed include files where GCC -# can reach them. Otherwise the ioctl calls in inflow.c -# will be incorrectly compiled. The "fixincludes" script in the gcc -# distribution will fix your include files up. -#CC=cc -#CC=gcc -traditional -GCC=gcc - -VPATH=$(srcdir) - -# It is also possible that you will need to add -I/usr/include/sys to the -# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which -# is where it should be according to Posix). - -YACC=bison -y -# YACC=yacc -SHELL=/bin/sh -MAKE=make - -# Documentation (gdb.dvi) needs either GNU m4 or SysV m4; -# Berkeley/Sun don't have quite enough. -#M4=/usr/5bin/m4 -M4=gm4 -# where to find texinfo; if you have PostScript fonts you may want to try -# the Cygnus mods (which also have different header/footer layout) -#TEXIDIR=${srcdir}/../texinfo/cygnus -TEXIDIR=${srcdir}/../texinfo/fsf - -# Set this up with gcc if you have gnu ld and the loader will print out -# line numbers for undefinded refs. -#CC-LD=gcc -static -CC-LD=${CC} - -# define this to be "gmalloc.o" if you want to use the gnu malloc routine -# (useful for debugging memory allocation problems in gdb). To use your -# system malloc, uncomment the following two lines. -#GNU_MALLOC = -#MALLOC_CFLAGS = -DNO_MALLOC_CHECK -GNU_MALLOC = gmalloc.o mcheck.o mtrace.o -MALLOC_CFLAGS = - -# Where is the "include" directory? Traditionally ../include or ./include -INCLUDE_DIR = ${srcdir}/../include -INCLUDE_DEP = $$(INCLUDE_DIR) - -# Where is the source dir for the BFD library? Traditionally ../bfd or ./bfd -# (When we want the binary library built from it, we use ${BFD_DIR}${subdir}.) -BFD_DIR = ${srcdir}/../bfd -BFD_DEP = $$(BFD_DIR) -BFD_LIB = $(BFD_DIR)${subdir}/libbfd.a - -# 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}/../readline -READLINE_DEP = $$(READLINE_DIR) -RL_LIB = $(READLINE_DIR)${subdir}/libreadline.a - -# All the includes used for CFLAGS and for lint. -# -I. for config files. -# -I${srcdir} possibly for regex.h also. -INCLUDE_CFLAGS = -I. -I${srcdir} -I$(INCLUDE_DIR) -I$(READLINE_DIR) -I${srcdir}/vx-share - -# {X,T}M_CFLAGS, if defined, has system-dependent CFLAGS. -# CFLAGS for GDB -GLOBAL_CFLAGS = -g ${TM_CFLAGS} ${XM_CFLAGS} -#PROFILE_CFLAGS = -pg - -CFLAGS = ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${MALLOC_CFLAGS} ${INCLUDE_CFLAGS} -# None of the things in CFLAGS will do any harm, and on some systems -# (e.g. SunOS4) it is important to use the M_CFLAGS. -LDFLAGS = $(CFLAGS) - -# Where is the "-liberty" library, containing getopt and obstack? -LIBIBERTY_DIR = ${srcdir}/../libiberty -LIBIBERTY = ${LIBIBERTY_DIR}${subdir}/libiberty.a - -# Flags that describe where you can find the termcap library. -# You may need to make other arrangements for USG. -TERMCAP = -ltermcap - -# The xconfig file must define REGEX and REGEX1 on USG machines. -# If your sysyem is missing alloca(), or, more likely, it's there but -# it doesn't work, define ALLOCA & ALLOCA1 too. -# If your system is missing putenv(), add putenv.c to XM_ADD_FILES. - -# Libraries and corresponding dependencies for compiling gdb. -# {X,T}M_CLIBS, defined in *config files, have host- and target-dependent libs. -# TERMCAP comes last, since readline depends on it. -CLIBS = $(XM_CLIBS) ${TM_CLIBS} ${BFD_LIB} ${LIBIBERTY} ${RL_LIB} ${TERMCAP} -CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_LIB} ${LIBIBERTY} ${RL_LIB} - -ADD_FILES = ${REGEX} ${ALLOCA} ${GNU_MALLOC} ${XM_ADD_FILES} ${TM_ADD_FILES} -ADD_DEPS = ${REGEX1} ${ALLOCA1} ${GNU_MALLOC} ${XM_ADD_FILES} ${TM_ADD_FILES} - -VERSION = 3.96 -DIST=gdb-$(VERSION) - -LINT=/usr/5bin/lint -LINTFLAGS= - -# Source files in the main directory. -# Files which are included via a tconfig/* or xconfig/* file -# should *not* be specified here; they're in "ALLDEPFILES". -SFILES_MAINDIR = \ - blockframe.c breakpoint.c command.c core.c \ - environ.c eval.c expprint.c findvar.c infcmd.c inflow.c infrun.c \ - main.c printcmd.c \ - remote.c source.c stack.c symmisc.c symtab.c symfile.c \ - utils.c valarith.c valops.c valprint.c values.c expread.y \ - signame.c cplus-dem.c mem-break.c target.c inftarg.c \ - dbxread.c coffread.c \ - ieee-float.c - -# Source files in subdirectories (which will be handled separately by -# 'make gdb.tar.Z'). -# Files which are included via a tconfig/* or xconfig/* file -# should *not* be specified here; they're in "ALLDEPFILES". -SFILES_SUBDIR = \ - ${srcdir}/vx-share/dbgRpcLib.h \ - ${srcdir}/vx-share/ptrace.h \ - ${srcdir}/vx-share/reg.h \ - ${srcdir}/vx-share/vxTypes.h \ - ${srcdir}/vx-share/vxWorks.h \ - ${srcdir}/vx-share/wait.h \ - ${srcdir}/vx-share/xdr_ld.h \ - ${srcdir}/vx-share/xdr_ptrace.h \ - ${srcdir}/vx-share/xdr_rdb.h \ - ${srcdir}/vx-share/xdr_regs.h \ - ${srcdir}/nindy-share/Makefile \ - ${srcdir}/nindy-share/VERSION \ - ${srcdir}/nindy-share/b.out.h \ - ${srcdir}/nindy-share/block_io.h \ - ${srcdir}/nindy-share/coff.h \ - ${srcdir}/nindy-share/demux.h \ - ${srcdir}/nindy-share/env.h \ - ${srcdir}/nindy-share/stop.h \ - ${srcdir}/nindy-share/ttycntl.h - -# All source files that go into linking GDB, except config-specified files. -SFILES = $(SFILES_MAINDIR) $(SFILES_SUBDIR) - -# All source files that lint should look at -LINTFILES = $(SFILES) expread.tab.c init.c - -# Documentation source files -SFILES_DOCDIR = \ - ${srcdir}/doc/gdb.texinfo \ - ${srcdir}/doc/pretex.m4 \ - ${srcdir}/doc/none.m4 \ - ${srcdir}/doc/all.m4 \ - ${srcdir}/doc/gdb.alter-m4 \ - ${srcdir}/doc/gdb.bugs-m4 \ - ${srcdir}/doc/gdb.canned-m4 \ - ${srcdir}/doc/gdb.cmds-m4 \ - ${srcdir}/doc/gdb.ctl-m4 \ - ${srcdir}/doc/gdb.data-m4 \ - ${srcdir}/doc/gdb.emacs-m4 \ - ${srcdir}/doc/gdb.files-m4 \ - ${srcdir}/doc/gdb.gpl-m4 \ - ${srcdir}/doc/gdb.install-m4 \ - ${srcdir}/doc/gdb.inv.m-m4 \ - ${srcdir}/doc/gdb.inv.s-m4 \ - ${srcdir}/doc/gdb.invoc-m4 \ - ${srcdir}/doc/gdb.rdln-m4 \ - ${srcdir}/doc/gdb.rename-m4 \ - ${srcdir}/doc/gdb.run-m4 \ - ${srcdir}/doc/gdb.sample-m4 \ - ${srcdir}/doc/gdb.src-m4 \ - ${srcdir}/doc/gdb.stack-m4 \ - ${srcdir}/doc/gdb.stop-m4 \ - ${srcdir}/doc/gdb.symb-m4 \ - ${srcdir}/doc/gdb.tgts-m4 \ - ${srcdir}/doc/gdb.top-m4 - -# Any additional files specified on these lines should also be added to -# the OTHERS = definition below, so they go in the tar files. -SFILES_STAND = $(SFILES) standalone.c -SFILES_KGDB = $(SFILES) stuff.c kdb-start.c - -# Header files that are not named in tconfig/* or xconfig/* go here. -HFILES= breakpoint.h command.h defs.h environ.h \ - expression.h frame.h gdbcmd.h gdbcore.h \ - getpagesize.h ieee-float.h inferior.h param-no-tm.h param.h \ - signals.h signame.h symfile.h symtab.h \ - target.h tdesc.h terminal.h tm-68k.h tm-i960.h tm-sunos.h \ - value.h - -# Header files for machine opcode tables. -# when OPCODE_DIR changes to ../include, remove the whole $(OPCODES) -# business, since they will be included in the separate includes tar file -# rather than in the gdb tar file. -OPCODE_DIR = -OPCODES = $(OPCODE_DIR)pn-opcode.h $(OPCODE_DIR)np1-opcode.h \ - $(OPCODE_DIR)sparc-opcode.h $(OPCODE_DIR)vax-opcode.h \ - $(OPCODE_DIR)m68k-opcode.h $(OPCODE_DIR)ns32k-opcode.h \ - $(OPCODE_DIR)convx-opcode.h $(OPCODE_DIR)pyr-opcode.h \ - $(OPCODE_DIR)mips-opcode.h $(OPCODE_DIR)am29k-opcode.h \ - $(OPCODE_DIR)arm-opcode.h $(OPCODE_DIR)m88k-opcode.h \ - $(OPCODE_DIR)tahoe-opcode.h - -REMOTE_EXAMPLES = m68k-stub.c i386-stub.c rem-multi.shar - -MALLOCSRC = gmalloc.c mcheck.c mtrace.c mtrace.awk \ - ansidecl.h gmalloc.h - -POSSLIBS_MAINDIR = regex.c regex.h alloca.c $(MALLOCSRC) -POSSLIBS = $(POSSLIBS_MAINDIR) - -TESTS = testbpt.c testfun.c testrec.c testreg.c testregs.c - -# tdesc-lib cannot be named simply tdesc, because if it were, GNU make -# would try to make it from tdesc.c. -# tdesc-lib removed from the list due to Motorola copyrights...gnu@cygnus.com -OTHERS = Makefile Makefile.dist depend alldeps.mak Makefile.sdir \ - createtags munch config.gdb config.status \ - ChangeLog ChangeLog-3.x \ - README TODO TAGS WHATS.NEW Projects \ - .gdbinit COPYING expread.tab.c \ - copying.c Convex.notes copying.awk \ - saber.suppress standalone.c stuff.c kdb-start.c \ - putenv.c - -# Subdirectories of gdb, which should be included in their entirety in -# gdb-xxx.tar.Z: -TARDIRS = doc hp-include # tests - -DEPFILES= ${TDEPFILES} ${XDEPFILES} - -SOURCES=$(SFILES) $(ALLDEPFILES) -TAGFILES = $(SOURCES) ${HFILES} ${OPCODES} ${ALLPARAM} ${POSSLIBS} -TAGFILES_MAINDIR = $(SFILES_MAINDIR) $(ALLDEPFILES_MAINDIR) \ - ${HFILES} ${OPCODES} ${ALLPARAM} ${POSSLIBS_MAINDIR} -TARFILES = ${TAGFILES_MAINDIR} ${OTHERS} ${REMOTE_EXAMPLES} - -OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \ - values.o eval.o valops.o valarith.o valprint.o printcmd.o \ - symtab.o symfile.o symmisc.o infcmd.o infrun.o remote.o \ - command.o utils.o expread.o expprint.o environ.o version.o \ - copying.o $(DEPFILES) signame.o cplus-dem.o mem-break.o target.o \ - inftarg.o ieee-float.o putenv.o \ - dbxread.o coffread.o # mipsread.o - -RAPP_OBS = rgdb.o rudp.o rserial.o serial.o udp.o $(XDEPFILES) - -TSOBS = core.o inflow.o - -NTSOBS = standalone.o - -TSSTART = /lib/crt0.o - -NTSSTART = kdb-start.o - -# Prevent Sun make from putting in the machine type. Setting -# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1. -.c.o: - ${CC} -c ${CFLAGS} $< - -all: gdb - -install: gdb - cp gdb $(bindir)/gdb.new - mv $(bindir)/gdb.new $(bindir)/gdb - $(M_INSTALL) - -init.c: $(srcdir)/munch $(MUNCH_DEFINE) $(OBS) $(TSOBS) - $(srcdir)/munch ${MUNCH_DEFINE} $(OBS) $(TSOBS) > init.c - -gdb: $(OBS) $(TSOBS) ${ADD_DEPS} ${CDEPS} init.o - ${CC-LD} $(LDFLAGS) -o gdb init.o $(OBS) $(TSOBS) $(ADD_FILES) \ - $(CLIBS) - -saber_gdb: $(SFILES) $(DEPFILES) copying.c version.c - #setopt load_flags $(CFLAGS) -I$(BFD_DIR) -DHOST_SYS=SUN4_SYS - #load ./init.c $(SFILES) - #unload ${srcdir}/expread.y ${srcdir}/vx-share/*.h - #unload ${srcdir}/nindy-share/[A-Z]* - #load ${srcdir}/expread.tab.c - #load copying.c version.c - #load `echo " "$(DEPFILES) | sed -e 's/\.o/.c/g' -e 's, , ../,g'` - #load ${LIBIBERTY_DIR}/*.c - #load ${BFD_DIR}/*.c - #load ${READLINE_DIR}/*.c - #load -ltermcap - ##void mcheck(a) void (*a)(); { } - ##void mtrace() { } - - - -# This is useful when debugging GDB, because some Unix's don't let you run GDB -# on itself without copying the executable. So "make gdb1" will make -# gdb and put a copy in gdb1, and you can run it with "gdb gdb1". -# Removing gdb1 before the copy is the right thing if gdb1 is open -# in another process. -gdb1: gdb - rm -f gdb1 - cp gdb gdb1 - -# This is a remote stub which runs under unix and starts up an -# inferior process. This is at least useful for debugging GDB's -# remote support. -rapp: $(RAPP_OBS) - rm -f rapp_init.c - ${srcdir}/munch ${RAPP_OBS} > rapp_init.c - ${CC-LD} $(LDFLAGS) -o $@ rapp_init.c $(RAPP_OBS) - -# Support for building Makefile out of configured pieces, automatically -# generated dependencies, etc. -Makefiles= Makefile.sdir $(M_MAKEFILE) \ - ${srcdir}/alldeps.mak ${srcdir}/Makefile.dist - -MAKE_MAKEFILE= echo "M_MAKEFILE=$(M_MAKEFILE)" | \ - cat - ${Makefiles} ${srcdir}/depend > Makefile - -Makefile: $(Makefiles) - $(MAKE_MAKEFILE) - -alldeps.mak: ${srcdir}/tconfig ${srcdir}/xconfig - rm -f alldeps.mak alldeps.tmp allparam.tmp allconfig.tmp - for i in `ls -d ${srcdir}/tconfig/*[0-9A-Za-z] \ - ${srcdir}/xconfig/*[0-9A-Za-z] | \ - grep -v RCS | grep -v CVS.adm | grep -v SCCS` ; do \ - echo $$i >>allconfig.tmp; \ - awk <$$i ' \ - $$1 == "TDEPFILES=" || $$1 == "XDEPFILES=" { \ - for (i = 2; i <= NF; i++) \ - print $$i >> "alldeps.tmp" ; \ - } \ - $$1 == "TM_FILE=" || $$1 == "XM_FILE=" { \ - print $$2 >> "allparam.tmp" }' ; \ - done - sort alldeps2.tmp - echo 'ALLDEPFILES = $$(ALLDEPFILES_MAINDIR) $$(ALLDEPFILES_SUBDIR)' \ - >>alldeps.mak; - grep -v / alldeps2.tmp | \ - awk 'BEGIN {printf "ALLDEPFILES_MAINDIR="} \ - NR == 0 {printf $$0;} \ - NR != 0 {printf "\\\n" $$0} \ - END {printf "\n\n"}' >>alldeps.mak; - grep / alldeps2.tmp | \ - awk 'BEGIN {printf "ALLDEPFILES_SUBDIR="} \ - NR == 0 {printf $$0;} \ - NR != 0 {printf "\\\n" $$0} \ - END {printf "\n\n"}' >>alldeps.mak; - sort >alldeps.mak; - sort >alldeps.mak; - rm -f alldeps.tmp alldeps2.tmp allparam.tmp allconfig.tmp - -# The sed script makes everything which depends on {x,t}m.h depend on -# config.status as well, in case someone reconfigures gdb out from -# under an already compiled gdb. -depend: $(SOURCES) Makefile.dist - @echo Ignore errors about non-existent system-supplied include files - @echo for systems other than the one you are using. - @echo "If xm.h and tm.h don't exist, the error messages saying so" - @echo can safely be ignored. - @echo Also ignore parse errors in valops.c, and any errors in - @echo arm-convert.s. - -$(GCC) -MM $(CFLAGS) -I$(BFD_DIR) \ - `ls $(SOURCES) | grep -v \.h$$ |sort -u` >depend.tmp - depend - $(MAKE_MAKEFILE) - rm depend.tmp - -config.status: - @echo "You must configure gdb. Look at the README file for details." - @false - -# These are not generated by "make depend" because they only are there -# for some machines. -# But these rules don't do what we want; we want to hack the foo.o: tm.h -# dependency to do the right thing. -tm-isi.h tm-sun3.h tm-news.h tm-hp300bsd.h tm-altos.h : tm-68k.h -tm-hp300hpux.h tm-sun2.h tm-3b1.h : tm-68k.h -xm-news1000.h : xm-news.h -xm-i386-sv32.h : xm-i386.h -tm-i386gas.h: tm-i386.h -xm-sun4os4.h : xm-sparc.h -tm-sun4os4.h : tm-sparc.h - -kdb : $(NTSSTART) $(OBS) $(NTSOBS) ${ADD_DEPS} ${CDEPS} - rm -f init.c - $(srcdir)/munch ${MUNCH_DEFINE} $(OBS) $(NTSOBS) > init.c - $(CC) $(LDFLAGS) -c init.c $(CLIBS) - ld -o kdb $(NTSSTART) $(OBS) $(NTSOBS) init.o $(ADD_FILES) \ - -lc $(CLIBS) - -# Put the proper machine-specific files first. -# createtags will edit the .o in DEPFILES into .c -TAGS: ${TAGFILES} - $(srcdir)/createtags $(TM_FILE) ${XM_FILE} $(DEPFILES) ${TAGFILES} -tags: TAGS - -# FIXME: Get alldeps.mak up to date, config.gdb none, THEN make gdb.tar.Z! -gdb.tar.Z: ${TARFILES} ${TARDIRS} - rm -f gdb.tar; rm -rf $(DIST) - mkdir $(DIST) - cd $(DIST) ; for i in ${TARFILES} ; do ln -s ../$$i . ; done - cd $(DIST); for i in ${TARDIRS}; do \ - (mkdir $$i; cd $$i; \ - ln -s ../../$$i/* .; \ - rm -rf SCCS CVS.adm RCS); done - mkdir $(DIST)/xconfig ${DIST}/tconfig - cd $(DIST)/tconfig ; \ - for i in $(ALLCONFIG) ; do ln -s ../../$$i ../$$i ; done - mkdir $(DIST)/vx-share $(DIST)/nindy-share - cd $(DIST)/tconfig ; \ - for i in $(SFILES_SUBDIR) $(ALLDEPFILES_SUBDIR); \ - do ln -s ../../$$i ../$$i ; done - tar chf - $(DIST) | compress >gdb.tar.Z - rm -rf $(DIST) - -clean: - rm -f ${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} - rm -f init.c init.o version.c - rm -f gdb core gdb.tar gdb.tar.Z make.log - rm -f gdb[0-9] - rm -f gdb.dvi rdl-apps.texinfo gdb-all* - -distclean: clean expread.tab.c TAGS - rm -f tm.h xm.h config.status - rm -f y.output yacc.acts yacc.tmp - rm -f ${TESTS} Makefile - -realclean: clean - rm -f expread.tab.c TAGS - rm -f tm.h xm.h config.status - rm -f Makefile - -rdl-apps.texinfo: ${READLINE_DIR}/inc-readline.texinfo \ - ${READLINE_DIR}/inc-history.texinfo - echo "@include ${READLINE_DIR}/inc-readline.texinfo" >rdl-apps.texinfo - echo "@include ${READLINE_DIR}/inc-history.texinfo" >>rdl-apps.texinfo - -gdb-all.texinfo: ${SFILES_DOCDIR} - ( cd $(srcdir)/doc; \ - ${M4} pretex.m4 none.m4 all.m4 gdb.texinfo ) >gdb-all.texinfo - -gdb.dvi : gdb-all.texinfo rdl-apps.texinfo - TEXINPUTS=${TEXIDIR}:$$TEXINPUTS tex gdb-all.texinfo - texindex gdb-all.?? - TEXINPUTS=${TEXIDIR}:$$TEXINPUTS tex gdb-all.texinfo - mv gdb-all.dvi gdb.dvi - rm -f gdb-all.?? gdb-all.??? - -# This should work eventually, but we're using texinfo2, and many makeinfo's -# can't cope with all the markup. In the meantime, we distribute the info -# files as formatted by the elisp texinfo2 code. -#gdb.info: gdb-all.texinfo -# makeinfo gdb-all.texinfo - -# Make copying.c from COPYING -copying.c : COPYING copying.awk - awk -f copying.awk < COPYING > copying.c - -version.c : Makefile.dist - echo 'char *version = "$(VERSION)";' >version.c - -${srcdir}/expread.tab.c : $(srcdir)/expread.y - @echo 'Expect 4 shift/reduce conflict.' - ${YACC} $(srcdir)/expread.y - mv y.tab.c ${srcdir}/expread.tab.c - -expread.o : ${srcdir}/expread.tab.c defs.h param.h symtab.h \ - frame.h expression.h - $(CC) -c ${CFLAGS} `echo ${srcdir}/expread.tab.c | sed 's,^\./,,'` - mv expread.tab.o expread.o - -# dbxread, coffread, mipsread have dependencies on BFD header files. -dbxread.o: ${srcdir}/dbxread.c - ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/dbxread.c - -coffread.o: ${srcdir}/coffread.c - ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/coffread.c - -mipsread.o: ${srcdir}/mipsread.c - ${CC} -c ${CFLAGS} -I$(BFD_DIR) ${srcdir}/mipsread.c - -# Drag in the files that are in another directory. - -xdr_ld.o: ${srcdir}/vx-share/xdr_ld.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_ld.c - -xdr_ptrace.o: ${srcdir}/vx-share/xdr_ptrace.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_ptrace.c - -xdr_rdb.o: ${srcdir}/vx-share/xdr_rdb.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_rdb.c - -xdr_regs.o: ${srcdir}/vx-share/xdr_regs.c - ${CC} -c ${CFLAGS} ${srcdir}/vx-share/xdr_regs.c - -nindy.o: ${srcdir}/nindy-share/nindy.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/nindy.c - -Onindy.o: ${srcdir}/nindy-share/Onindy.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/Onindy.c - -ttybreak.o: ${srcdir}/nindy-share/ttybreak.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/ttybreak.c - -ttyflush.o: ${srcdir}/nindy-share/ttyflush.c - ${CC} -c ${CFLAGS} ${srcdir}/nindy-share/ttyflush.c - -tdesc-lib/libdc.o : force_update - cd tdesc-lib ; ${MAKE} "SYSV_DEFINE=${SYSV_DEFINE}" - -lint: $(LINTFILES) - $(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) - -gdb.cxref: $(SFILES) - cxref -I. $(SFILES) >gdb.cxref - -force_update : - -# When used with GDB, the demangler should never look for leading -# underscores because GDB strips them off during symbol read-in. Thus -# -Dnounderscore. - -cplus-dem.o : cplus-dem.c - ${CC} -c ${CFLAGS} -Dnounderscore \ - `echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'` diff --git a/gdb/Makefile.sdir b/gdb/Makefile.sdir deleted file mode 100755 index b5fb6b3..0000000 --- a/gdb/Makefile.sdir +++ /dev/null @@ -1 +0,0 @@ -srcdir=. diff --git a/gdb/Makefile.srcdir b/gdb/Makefile.srcdir deleted file mode 100755 index b5fb6b3..0000000 --- a/gdb/Makefile.srcdir +++ /dev/null @@ -1 +0,0 @@ -srcdir=. diff --git a/gdb/WHATS.NEW b/gdb/WHATS.NEW deleted file mode 100755 index c189965..0000000 --- a/gdb/WHATS.NEW +++ /dev/null @@ -1,596 +0,0 @@ - What has changed since GDB-3.5? - (Organized release by release) - -*** Changes in GDB-4.6: - - * Better support for C++ function names - -GDB now accepts as input the "demangled form" of C++ overloaded function -names and member function names, and can do command completion on such names -(using TAB, TAB-TAB, and ESC-?). The names have to be quoted with a pair of -single quotes. Examples are 'func (int, long)' and 'obj::operator==(obj&)'. -Make use of command completion, it is your friend. - -GDB also now accepts a variety of C++ mangled symbol formats. They are -the GNU g++ style, the Cfront (ARM) style, and the Lucid (lcc) style. -You can tell GDB which format to use by doing a 'set demangle-style {gnu, -lucid, cfront, auto}'. 'gnu' is the default. Do a 'set demangle-style foo' -for the list of formats. - - * G++ symbol mangling problem - -Recent versions of gcc have a bug in how they emit debugging information for -C++ methods (when using dbx-style stabs). The file 'gcc.patch' (in this -directory) can be applied to gcc to fix the problem. Alternatively, if you -can't fix gcc, you can #define GCC_MANGLE_BUG when compling gdb/symtab.c. The -usual symptom is difficulty with setting breakpoints on methods. GDB complains -about the method being non-existent. (We believe that version 2.2.2 of GCC has -this problem.) - - * New 'maintenance' command - -All of the commands related to hacking GDB internals have been moved out of -the main command set, and now live behind the 'maintenance' command. This -can also be abbreviated as 'mt'. The following changes were made: - - dump-me -> maintenance dump-me - info all-breakpoints -> maintenance info breakpoints - printmsyms -> maintenance print msyms - printobjfiles -> maintenance print objfiles - printpsyms -> maintenance print psymbols - printsyms -> maintenance print symbols - -The following commands are new: - - maintenance demangle Call internal GDB demangler routine to - demangle a C++ link name and prints the result. - maintenance print type Print a type chain for a given symbol - - * Change to .gdbinit file processing - -We now read the $HOME/.gdbinit file before processing the argv arguments -(e.g. reading symbol files or core files). This allows global parameters to -be set, which will apply during the symbol reading. The ./.gdbinit is still -read after argv processing. - - * New hosts supported - -Solaris-2.0 !!! sparc-sun-solaris2 or sun4sol2 - -Linux support i386-unknown-linux or linux - -We are also including code to support the HP/PA running BSD and HPUX. This -is almost guaranteed not to work, as we didn't have time to test or build it -for this release. We are including it so that the more adventurous (or -masochistic) of you can play with it. We also had major problems with the -fact that the compiler that we got from HP doesn't support the -g option. -It costs extra. - - * New targets supported - -Hitachi H8/300 h8300-hitachi-hms or h8300hms - - * More smarts about finding #include files - -GDB now remembers the compilation directory for all include files, and for -all files from which C is generated (like yacc and lex sources). This -greatly improves GDB's ability to find yacc/lex sources, and include files, -especially if you are debugging your program from a directory different from -the one that contains your sources. - -We also fixed a bug which caused difficulty with listing and setting -breakpoints in include files which contain C code. (In the past, you had to -try twice in order to list an include file that you hadn't looked at before.) - - * Interesting infernals change - -GDB now deals with arbitrary numbers of sections, where the symbols for each -section must be relocated relative to that section's landing place in the -target's address space. This work was needed to support ELF with embedded -stabs used by Solaris-2.0. - - * Bug fixes (of course!) - -There have been loads of fixes for the following things: - mips, rs6000, 29k/udi, m68k, g++, type handling, elf/dwarf, m88k, - i960, stabs, DOS(GO32), procfs, etc... - -See the ChangeLog for details. - -*** Changes in GDB-4.5: - - * New machines supported (host and target) - -IBM RS6000 running AIX rs6000-ibm-aix or rs6000 - -SGI Irix-4.x mips-sgi-irix4 or iris4 - - * New malloc package - -GDB now uses a new memory manager called mmalloc, based on gmalloc. -Mmalloc is capable of handling mutiple heaps of memory. It is also -capable of saving a heap to a file, and then mapping it back in later. -This can be used to greatly speedup the startup of GDB by using a -pre-parsed symbol table which lives in a mmalloc managed heap. For -more details, please read mmalloc/mmalloc.texi. - - * info proc - -The 'info proc' command (SVR4 only) has been enhanced quite a bit. See -'help info proc' for details. - - * MIPS ecoff symbol table format - -The code that reads MIPS symbol table format is now supported on all hosts. -Thanks to MIPS for releasing the sym.h and symconst.h files to make this -possible. - - * File name changes for MS-DOS - -Many files in the config directories have been renamed to make it easier to -support GDB on MS-DOSe systems (which have very restrictive file name -conventions :-( ). MS-DOSe host support (under DJ Delorie's GO32 -environment) is close to working but has some remaining problems. Note -that debugging of DOS programs is not supported, due to limitations -in the ``operating system'', but it can be used to host cross-debugging. - - * Cross byte order fixes - -Many fixes have been made to support cross debugging of Sparc and MIPS -targets from hosts whose byte order differs. - - * New -mapped and -readnow options - -If memory-mapped files are available on your system through the 'mmap' -system call, you can use the -mapped option on the `file' or -`symbol-file' commands to cause GDB to write the symbols from your -program into a reusable file. If the program you are debugging is -called `/path/fred', the mapped symbol file will be `./fred.syms'. -Future GDB debugging sessions will notice the presence of this file, -and will quickly map in symbol information from it, rather than reading -the symbol table from the executable program. Using the '-mapped' -option in a GDB `file' or `symbol-file' command has the same effect as -starting GDB with the '-mapped' command-line option. - -You can cause GDB to read the entire symbol table immediately by using -the '-readnow' option with any of the commands that load symbol table -information (or on the GDB command line). This makes the command -slower, but makes future operations faster. - -The -mapped and -readnow options are typically combined in order to -build a `fred.syms' file that contains complete symbol information. -A simple GDB invocation to do nothing but build a `.syms' file for future -use is: - - gdb -batch -nx -mapped -readnow programname - -The `.syms' file is specific to the host machine on which GDB is run. -It holds an exact image of GDB's internal symbol table. It cannot be -shared across multiple host platforms. - - * longjmp() handling - -GDB is now capable of stepping and nexting over longjmp(), _longjmp(), and -siglongjmp() without losing control. This feature has not yet been ported to -all systems. It currently works on many 386 platforms, all MIPS-based -platforms (SGI, DECstation, etc), and Sun3/4. - - * Solaris 2.0 - -Preliminary work has been put in to support the new Solaris OS from Sun. At -this time, it can control and debug processes, but it is not capable of -reading symbols. - - * Bug fixes - -As always, many many bug fixes. The major areas were with g++, and mipsread. -People using the MIPS-based platforms should experience fewer mysterious -crashes and trashed symbol tables. - -*** Changes in GDB-4.4: - - * New machines supported (host and target) - -SCO Unix on i386 IBM PC clones i386-sco-sysv or i386sco - (except core files) -BSD Reno on Vax vax-dec-bsd -Ultrix on Vax vax-dec-ultrix - - * New machines supported (target) - -AMD 29000 embedded, using EBMON a29k-none-none - - * C++ support - -GDB continues to improve its handling of C++. `References' work better. -The demangler has also been improved, and now deals with symbols mangled as -per the Annotated C++ Reference Guide. - -GDB also now handles `stabs' symbol information embedded in MIPS -`ecoff' symbol tables. Since the ecoff format was not easily -extensible to handle new languages such as C++, this appeared to be a -good way to put C++ debugging info into MIPS binaries. This option -will be supported in the GNU C compiler, version 2, when it is -released. - - * New features for SVR4 - -GDB now handles SVR4 shared libraries, in the same fashion as SunOS -shared libraries. Debugging dynamically linked programs should present -only minor differences from debugging statically linked programs. - -The `info proc' command will print out information about any process -on an SVR4 system (including the one you are debugging). At the moment, -it prints the address mappings of the process. - -If you bring up GDB on another SVR4 system, please send mail to -bug-gdb@prep.ai.mit.edu to let us know what changes were reqired (if any). - - * Better dynamic linking support in SunOS - -Reading symbols from shared libraries which contain debugging symbols -now works properly. However, there remain issues such as automatic -skipping of `transfer vector' code during function calls, which -make it harder to debug code in a shared library, than to debug the -same code linked statically. - - * New Getopt - -GDB is now using the latest `getopt' routines from the FSF. This -version accepts the -- prefix for options with long names. GDB will -continue to accept the old forms (-option and +option) as well. -Various single letter abbreviations for options have been explicity -added to the option table so that they won't get overshadowed in the -future by other options that begin with the same letter. - - * Bugs fixed - -The `cleanup_undefined_types' bug that many of you noticed has been squashed. -Many assorted bugs have been handled. Many more remain to be handled. -See the various ChangeLog files (primarily in gdb and bfd) for details. - - -*** Changes in GDB-4.3: - - * New machines supported (host and target) - -Amiga 3000 running Amix m68k-cbm-svr4 or amix -NCR 3000 386 running SVR4 i386-ncr-svr4 or ncr3000 -Motorola Delta 88000 running Sys V m88k-motorola-sysv or delta88 - - * Almost SCO Unix support - -We had hoped to support: -SCO Unix on i386 IBM PC clones i386-sco-sysv or i386sco -(except for core file support), but we discovered very late in the release -that it has problems with process groups that render gdb unusable. Sorry -about that. I encourage people to fix it and post the fixes. - - * Preliminary ELF and DWARF support - -GDB can read ELF object files on System V Release 4, and can handle -debugging records for C, in DWARF format, in ELF files. This support -is preliminary. If you bring up GDB on another SVR4 system, please -send mail to bug-gdb@prep.ai.mit.edu to let us know what changes were -reqired (if any). - - * New Readline - -GDB now uses the latest `readline' library. One user-visible change -is that two tabs will list possible command completions, which previously -required typing M-? (meta-question mark, or ESC ?). - - * Bugs fixed - -The `stepi' bug that many of you noticed has been squashed. -Many bugs in C++ have been handled. Many more remain to be handled. -See the various ChangeLog files (primarily in gdb and bfd) for details. - - * State of the MIPS world (in case you wondered): - -GDB can understand the symbol tables emitted by the compilers -supplied by most vendors of MIPS-based machines, including DEC. These -symbol tables are in a format that essentially nobody else uses. - -Some versions of gcc come with an assembler post-processor called -mips-tfile. This program is required if you want to do source-level -debugging of gcc-compiled programs. I believe FSF does not ship -mips-tfile with gcc version 1, but it will eventually come with gcc -version 2. - -Debugging of g++ output remains a problem. g++ version 1.xx does not -really support it at all. (If you're lucky, you should be able to get -line numbers and stack traces to work, but no parameters or local -variables.) With some work it should be possible to improve the -situation somewhat. - -When gcc version 2 is released, you will have somewhat better luck. -However, even then you will get confusing results for inheritance and -methods. - -We will eventually provide full debugging of g++ output on -DECstations. This will probably involve some kind of stabs-in-ecoff -encapulation, but the details have not been worked out yet. - - -*** Changes in GDB-4.2: - - * Improved configuration - -Only one copy of `configure' exists now, and it is not self-modifying. -Porting BFD is simpler. - - * Stepping improved - -The `step' and `next' commands now only stop at the first instruction -of a source line. This prevents the multiple stops that used to occur -in switch statements, for-loops, etc. `Step' continues to stop if a -function that has debugging information is called within the line. - - * Bug fixing - -Lots of small bugs fixed. More remain. - - * New host supported (not target) - -Intel 386 PC clone running Mach i386-none-mach - - -*** Changes in GDB-4.1: - - * Multiple source language support - -GDB now has internal scaffolding to handle several source languages. -It determines the type of each source file from its filename extension, -and will switch expression parsing and number formatting to match the -language of the function in the currently selected stack frame. -You can also specifically set the language to be used, with -`set language c' or `set language modula-2'. - - * GDB and Modula-2 - -GDB now has preliminary support for the GNU Modula-2 compiler, -currently under development at the State University of New York at -Buffalo. Development of both GDB and the GNU Modula-2 compiler will -continue through the fall of 1991 and into 1992. - -Other Modula-2 compilers are currently not supported, and attempting to -debug programs compiled with them will likely result in an error as the -symbol table is read. Feel free to work on it, though! - -There are hooks in GDB for strict type checking and range checking, -in the `Modula-2 philosophy', but they do not currently work. - - * set write on/off - -GDB can now write to executable and core files (e.g. patch -a variable's value). You must turn this switch on, specify -the file ("exec foo" or "core foo"), *then* modify it, e.g. -by assigning a new value to a variable. Modifications take -effect immediately. - - * Automatic SunOS shared library reading - -When you run your program, GDB automatically determines where its -shared libraries (if any) have been loaded, and reads their symbols. -The `share' command is no longer needed. This also works when -examining core files. - - * set listsize - -You can specify the number of lines that the `list' command shows. -The default is 10. - - * New machines supported (host and target) - -SGI Iris (MIPS) running Irix V3: mips-sgi-irix or iris -Sony NEWS (68K) running NEWSOS 3.x: m68k-sony-sysv or news -Ultracomputer (29K) running Sym1: a29k-nyu-sym1 or ultra3 - - * New hosts supported (not targets) - -IBM RT/PC: romp-ibm-aix or rtpc - - * New targets supported (not hosts) - -AMD 29000 embedded with COFF a29k-none-coff -AMD 29000 embedded with a.out a29k-none-aout -Ultracomputer remote kernel debug a29k-nyu-kern - - * New remote interfaces - -AMD 29000 Adapt -AMD 29000 Minimon - - -*** Changes in GDB-4.0: - - * New Facilities - -Wide output is wrapped at good places to make the output more readable. - -Gdb now supports cross-debugging from a host machine of one type to a -target machine of another type. Communication with the target system -is over serial lines. The ``target'' command handles connecting to the -remote system; the ``load'' command will download a program into the -remote system. Serial stubs for the m68k and i386 are provided. Gdb -also supports debugging of realtime processes running under VxWorks, -using SunRPC Remote Procedure Calls over TCP/IP to talk to a debugger -stub on the target system. - -New CPUs supported include the AMD 29000 and Intel 960. - -GDB now reads object files and symbol tables via a ``binary file'' -library, which allows a single copy of GDB to debug programs of multiple -object file types such as a.out and coff. - -There is now a GDB reference card in "doc/refcard.tex". (Make targets -refcard.dvi and refcard.ps are available to format it). - - - * Control-Variable user interface simplified - -All variables that control the operation of the debugger can be set -by the ``set'' command, and displayed by the ``show'' command. - -For example, ``set prompt new-gdb=>'' will change your prompt to new-gdb=>. -``Show prompt'' produces the response: -Gdb's prompt is new-gdb=>. - -What follows are the NEW set commands. The command ``help set'' will -print a complete list of old and new set commands. ``help set FOO'' -will give a longer description of the variable FOO. ``show'' will show -all of the variable descriptions and their current settings. - -confirm on/off: Enables warning questions for operations that are - hard to recover from, e.g. rerunning the program while - it is already running. Default is ON. - -editing on/off: Enables EMACS style command line editing - of input. Previous lines can be recalled with - control-P, the current line can be edited with control-B, - you can search for commands with control-R, etc. - Default is ON. - -history filename NAME: NAME is where the gdb command history - will be stored. The default is .gdb_history, - or the value of the environment variable - GDBHISTFILE. - -history size N: The size, in commands, of the command history. The - default is 256, or the value of the environment variable - HISTSIZE. - -history save on/off: If this value is set to ON, the history file will - be saved after exiting gdb. If set to OFF, the - file will not be saved. The default is OFF. - -history expansion on/off: If this value is set to ON, then csh-like - history expansion will be performed on - command line input. The default is OFF. - -radix N: Sets the default radix for input and output. It can be set - to 8, 10, or 16. Note that the argument to "radix" is interpreted - in the current radix, so "set radix 10" is always a no-op. - -height N: This integer value is the number of lines on a page. Default - is 24, the current `stty rows'' setting, or the ``li#'' - setting from the termcap entry matching the environment - variable TERM. - -width N: This integer value is the number of characters on a line. - Default is 80, the current `stty cols'' setting, or the ``co#'' - setting from the termcap entry matching the environment - variable TERM. - -Note: ``set screensize'' is obsolete. Use ``set height'' and -``set width'' instead. - -print address on/off: Print memory addresses in various command displays, - such as stack traces and structure values. Gdb looks - more ``symbolic'' if you turn this off; it looks more - ``machine level'' with it on. Default is ON. - -print array on/off: Prettyprint arrays. New convenient format! Default - is OFF. - -print demangle on/off: Print C++ symbols in "source" form if on, - "raw" form if off. - -print asm-demangle on/off: Same, for assembler level printouts - like instructions. - -print vtbl on/off: Prettyprint C++ virtual function tables. Default is OFF. - - - * Support for Epoch Environment. - -The epoch environment is a version of Emacs v18 with windowing. One -new command, ``inspect'', is identical to ``print'', except that if you -are running in the epoch environment, the value is printed in its own -window. - - - * Support for Shared Libraries - -GDB can now debug programs and core files that use SunOS shared libraries. -Symbols from a shared library cannot be referenced -before the shared library has been linked with the program (this -happens after you type ``run'' and before the function main() is entered). -At any time after this linking (including when examining core files -from dynamically linked programs), gdb reads the symbols from each -shared library when you type the ``sharedlibrary'' command. -It can be abbreviated ``share''. - -sharedlibrary REGEXP: Load shared object library symbols for files - matching a unix regular expression. No argument - indicates to load symbols for all shared libraries. - -info sharedlibrary: Status of loaded shared libraries. - - - * Watchpoints - -A watchpoint stops execution of a program whenever the value of an -expression changes. Checking for this slows down execution -tremendously whenever you are in the scope of the expression, but is -quite useful for catching tough ``bit-spreader'' or pointer misuse -problems. Some machines such as the 386 have hardware for doing this -more quickly, and future versions of gdb will use this hardware. - -watch EXP: Set a watchpoint (breakpoint) for an expression. - -info watchpoints: Information about your watchpoints. - -delete N: Deletes watchpoint number N (same as breakpoints). -disable N: Temporarily turns off watchpoint number N (same as breakpoints). -enable N: Re-enables watchpoint number N (same as breakpoints). - - - * C++ multiple inheritance - -When used with a GCC version 2 compiler, GDB supports multiple inheritance -for C++ programs. - - * C++ exception handling - -Gdb now supports limited C++ exception handling. Besides the existing -ability to breakpoint on an exception handler, gdb can breakpoint on -the raising of an exception (before the stack is peeled back to the -handler's context). - -catch FOO: If there is a FOO exception handler in the dynamic scope, - set a breakpoint to catch exceptions which may be raised there. - Multiple exceptions (``catch foo bar baz'') may be caught. - -info catch: Lists all exceptions which may be caught in the - current stack frame. - - - * Minor command changes - -The command ``call func (arg, arg, ...)'' now acts like the print -command, except it does not print or save a value if the function's result -is void. This is similar to dbx usage. - -The ``up'' and ``down'' commands now always print the frame they end up -at; ``up-silently'' and `down-silently'' can be used in scripts to change -frames without printing. - - * New directory command - -'dir' now adds directories to the FRONT of the source search path. -The path starts off empty. Source files that contain debug information -about the directory in which they were compiled can be found even -with an empty path; Sun CC and GCC include this information. If GDB can't -find your source file in the current directory, type "dir .". - - * Configuring GDB for compilation - -For normal use, type ``./configure host''. See README or gdb.texinfo -for more details. - -GDB now handles cross debugging. If you are remotely debugging between -two different machines, type ``./configure host -target=targ''. -Host is the machine where GDB will run; targ is the machine -where the program that you are debugging will run. diff --git a/gdb/a68v-xdep.c b/gdb/a68v-xdep.c index d81cbe8..e69de29 100644 --- a/gdb/a68v-xdep.c +++ b/gdb/a68v-xdep.c @@ -1,158 +0,0 @@ -/* Host-dependent code for Apollo-68ksfor GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "gdbcore.h" - -extern int errno; - -#if defined (GDB_TARGET_IS_SUN3) -/* All of this stuff is only relevant if both host and target are sun3. */ -void -fetch_inferior_registers () -{ - struct regs inferior_registers; -#ifdef FP0_REGNUM - struct fp_status inferior_fp_registers; -#endif - extern char registers[]; - - registers_fetched (); - - ptrace (PTRACE_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0); -#ifdef FP0_REGNUM - ptrace (PTRACE_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); -#endif - - bcopy (&inferior_registers, registers, 16 * 4); -#ifdef FP0_REGNUM - bcopy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.fps_regs); -#endif - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; -#ifdef FP0_REGNUM - bcopy (&inferior_fp_registers.fps_control, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); -#endif -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; -#ifdef FP0_REGNUM - struct fp_status inferior_fp_registers; -#endif - extern char registers[]; - - bcopy (registers, &inferior_registers, 16 * 4); -#ifdef FP0_REGNUM - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fps_regs); -#endif - inferior_registers.r_ps = *(int *)®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_registers.r_pc = *(int *)®isters[REGISTER_BYTE (PC_REGNUM)]; - -#ifdef FP0_REGNUM - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &inferior_fp_registers.fps_control, - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); -#endif - - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0); -#if FP0_REGNUM - ptrace (PTRACE_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0); -#endif -} - -/* Machine-dependent code for pulling registers out of a Sun-3 core file. */ - -void -fetch_core_registers (core_reg_sect, core_reg_size, which) - char *core_reg_sect; - unsigned core_reg_size; - int which; -{ - extern char registers[]; - struct regs *regs = (struct regs *) core_reg_sect; - - if (which == 0) { - if (core_reg_size < sizeof (struct regs)) - error ("Can't find registers in core file"); - - bcopy ((char *)regs, registers, 16 * 4); - supply_register (PS_REGNUM, ®s->r_ps); - supply_register (PC_REGNUM, ®s->r_pc); - - } else if (which == 2) { - -#define fpustruct ((struct fpu *) core_reg_sect) - - if (core_reg_size >= sizeof (struct fpu)) - { -#ifdef FP0_REGNUM - bcopy (fpustruct->f_fpstatus.fps_regs, - ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof fpustruct->f_fpstatus.fps_regs); - bcopy (&fpustruct->f_fpstatus.fps_control, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof fpustruct->f_fpstatus - - sizeof fpustruct->f_fpstatus.fps_regs); -#endif - } - else - fprintf (stderr, "Couldn't read float regs from core file\n"); - } -} -#else /* Not sun3 target. */ -/* These functions shouldn't be called when we're cross-debugging. */ - -void -fetch_inferior_registers () -{ -} - -/* ARGSUSED */ -void -store_inferior_registers (regno) - int regno; -{ -} - -/* ARGSUSED */ -void -fetch_core_registers (core_reg_sect, core_reg_size, which) - char *core_reg_sect; - unsigned core_reg_size; - int which; -{ -} -#endif /* Not sun3 target. */ diff --git a/gdb/ansidecl.h b/gdb/ansidecl.h deleted file mode 100755 index aecdb5e..0000000 --- a/gdb/ansidecl.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (C) 1989 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* ANSI and traditional C compatibility macros - - ANSI C is assumed if __STDC__ is #defined. - - Macros - PTR - Generic pointer type - LONG_DOUBLE - `long double' type - CONST - `const' keyword - VOLATILE - `volatile' keyword - SIGNED - `signed' keyword - PTRCONST - Generic const pointer (void *const) - - EXFUN(name, prototype) - declare external function NAME - with prototype PROTOTYPE - DEFUN(name, arglist, args) - define function NAME with - args ARGLIST of types in ARGS - DEFUN_VOID(name) - define function NAME with no args - AND - argument separator for ARGS - NOARGS - null arglist - DOTS - `...' in args - - For example: - extern int EXFUN(printf, (CONST char *format DOTS)); - int DEFUN(fprintf, (stream, format), - FILE *stream AND CONST char *format DOTS) { ... } - void DEFUN_VOID(abort) { ... } -*/ - -#ifndef _ANSIDECL_H - -#define _ANSIDECL_H 1 - - -/* Every source file includes this file, - so they will all get the switch for lint. */ -/* LINTLIBRARY */ - - -#ifdef __STDC__ - -#define PTR void * -#define PTRCONST void *CONST -#define LONG_DOUBLE long double - -#define AND , -#define NOARGS void -#define CONST const -#define VOLATILE volatile -#define SIGNED signed -#define DOTS , ... - -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(NOARGS) - -#else /* Not ANSI C. */ - -#define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#define AND ; -#define NOARGS -#define CONST -#define VOLATILE -#define SIGNED -#define DOTS - -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() - -#endif /* ANSI C. */ - - -#endif /* ansidecl.h */ diff --git a/gdb/arm-opcode.h b/gdb/arm-opcode.h deleted file mode 100755 index d27a54e..0000000 --- a/gdb/arm-opcode.h +++ /dev/null @@ -1,294 +0,0 @@ -/* ARM opcode list. - Copyright (C) 1989, Free Software Foundation, Inc. - -This file is part of GDB and GAS. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* types of instruction (encoded in bits 26 and 27 of the instruction) */ - -#define TYPE_ARITHMETIC 0 -#define TYPE_LDR_STR 1 -#define TYPE_BLOCK_BRANCH 2 -#define TYPE_SWI 3 - -/* bit 25 decides whether an instruction is a block move or a branch */ -#define SUBTYPE_BLOCK 0 -#define SUBTYPE_BRANCH 1 - -/* codes to distinguish the arithmetic instructions */ - -#define OPCODE_AND 0 -#define OPCODE_EOR 1 -#define OPCODE_SUB 2 -#define OPCODE_RSB 3 -#define OPCODE_ADD 4 -#define OPCODE_ADC 5 -#define OPCODE_SBC 6 -#define OPCODE_RSC 7 -#define OPCODE_TST 8 -#define OPCODE_TEQ 9 -#define OPCODE_CMP 10 -#define OPCODE_CMN 11 -#define OPCODE_ORR 12 -#define OPCODE_MOV 13 -#define OPCODE_BIC 14 -#define OPCODE_MVN 15 - -/* condition codes */ - -#define COND_EQ 0 -#define COND_NE 1 -#define COND_CS 2 -#define COND_CC 3 -#define COND_MI 4 -#define COND_PL 5 -#define COND_VS 6 -#define COND_VC 7 -#define COND_HI 8 -#define COND_LS 9 -#define COND_GE 10 -#define COND_LT 11 -#define COND_GT 12 -#define COND_LE 13 -#define COND_AL 14 -#define COND_NV 15 - -/* Describes the format of an ARM machine instruction */ - -struct generic_fmt { - unsigned rest :25; /* the rest of the instruction */ - unsigned subtype :1; /* used to decide between block and branch */ - unsigned type :2; /* one of TYPE_* */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct arith_fmt { - unsigned operand2 :12; /* #nn or rn or rn shift #m or rn shift rm */ - unsigned dest :4; /* place where the answer goes */ - unsigned operand1 :4; /* first operand to instruction */ - unsigned set :1; /* == 1 means set processor flags */ - unsigned opcode :4; /* one of OPCODE_* defined above */ - unsigned immed :1; /* operand2 is an immediate value */ - unsigned type :2; /* == TYPE_ARITHMETIC */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct ldr_str_fmt { - unsigned offset :12; /* #nn or rn or rn shift #m */ - unsigned reg :4; /* destination for LDR, source for STR */ - unsigned base :4; /* base register */ - unsigned is_load :1; /* == 1 for LDR */ - unsigned writeback :1; /* == 1 means write back (base+offset) into base */ - unsigned byte :1; /* == 1 means byte access else word */ - unsigned up :1; /* == 1 means add offset else subtract it */ - unsigned pre_index :1; /* == 1 means [a,b] form else [a],b form */ - unsigned immed :1; /* == 0 means immediate offset */ - unsigned type :2; /* == TYPE_LDR_STR */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct block_fmt { - unsigned mask :16; /* register mask */ - unsigned base :4; /* register used as base of move */ - unsigned is_load :1; /* == 1 for LDM */ - unsigned writeback :1; /* == 1 means update base after move */ - unsigned set :1; /* == 1 means set flags in pc if included in mask */ - unsigned increment :1; /* == 1 means increment base register */ - unsigned before :1; /* == 1 means inc/dec before each move */ - unsigned is_block :1; /* == SUBTYPE_BLOCK */ - unsigned type :2; /* == TYPE_BLOCK_BRANCH */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -struct branch_fmt { - unsigned dest :24; /* destination of the branch */ - unsigned link :1; /* branch with link (function call) */ - unsigned is_branch :1; /* == SUBTYPE_BRANCH */ - unsigned type :2; /* == TYPE_BLOCK_BRANCH */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -#define ROUND_N 0 -#define ROUND_P 1 -#define ROUND_M 2 -#define ROUND_Z 3 - -#define FLOAT2_MVF 0 -#define FLOAT2_MNF 1 -#define FLOAT2_ABS 2 -#define FLOAT2_RND 3 -#define FLOAT2_SQT 4 -#define FLOAT2_LOG 5 -#define FLOAT2_LGN 6 -#define FLOAT2_EXP 7 -#define FLOAT2_SIN 8 -#define FLOAT2_COS 9 -#define FLOAT2_TAN 10 -#define FLOAT2_ASN 11 -#define FLOAT2_ACS 12 -#define FLOAT2_ATN 13 - -#define FLOAT3_ADF 0 -#define FLOAT3_MUF 1 -#define FLOAT3_SUF 2 -#define FLOAT3_RSF 3 -#define FLOAT3_DVF 4 -#define FLOAT3_RDF 5 -#define FLOAT3_POW 6 -#define FLOAT3_RPW 7 -#define FLOAT3_RMF 8 -#define FLOAT3_FML 9 -#define FLOAT3_FDV 10 -#define FLOAT3_FRD 11 -#define FLOAT3_POL 12 - -struct float2_fmt { - unsigned operand2 :3; /* second operand */ - unsigned immed :1; /* == 1 if second operand is a constant */ - unsigned pad1 :1; /* == 0 */ - unsigned rounding :2; /* ROUND_* */ - unsigned is_double :1; /* == 1 if precision is double (only if not extended) */ - unsigned pad2 :4; /* == 1 */ - unsigned dest :3; /* destination */ - unsigned is_2_op :1; /* == 1 if 2 operand ins */ - unsigned operand1 :3; /* first operand (only of is_2_op == 0) */ - unsigned is_extended :1; /* == 1 if precision is extended */ - unsigned opcode :4; /* FLOAT2_* or FLOAT3_* depending on is_2_op */ - unsigned must_be_2 :2; /* == 2 */ - unsigned type :2; /* == TYPE_SWI */ - unsigned cond :4; /* COND_* */ -}; - -struct swi_fmt { - unsigned argument :24; /* argument to SWI (syscall number) */ - unsigned must_be_3 :2; /* == 3 */ - unsigned type :2; /* == TYPE_SWI */ - unsigned cond :4; /* one of COND_* defined above */ -}; - -union insn_fmt { - struct generic_fmt generic; - struct arith_fmt arith; - struct ldr_str_fmt ldr_str; - struct block_fmt block; - struct branch_fmt branch; - struct swi_fmt swi; - unsigned long ins; -}; - -struct opcode { - unsigned long value, mask; /* recognise instruction if (op&mask)==value */ - char *assembler; /* how to disassemble this instruction */ -}; - -/* format of the assembler string : - - %% % - %d print the bitfield in decimal - %x print the bitfield in hex - %r print as an ARM register - %f print a floating point constant if >7 else an fp register - %c print condition code (always bits 28-31) - %P print floating point precision in arithmetic insn - %Q print floating point precision in ldf/stf insn - %R print floating point rounding mode - %'c print specified char iff bit is one - %`c print specified char iff bit is zero - %?ab print a if bit is one else print b - %p print 'p' iff bits 12-15 are 15 - %o print operand2 (immediate or register + shift) - %a print address for ldr/str instruction - %b print branch destination - %A print address for ldc/stc/ldf/stf instruction - %m print register mask for ldm/stm instruction -*/ - -static struct opcode opcodes[] = { - /* ARM instructions */ - 0x00000090, 0x0fe000f0, "mul%20's %12-15r, %16-19r, %0-3r", - 0x00200090, 0x0fe000f0, "mla%20's %12-15r, %16-19r, %0-3r, %8-11r", - 0x00000000, 0x0de00000, "and%c%20's %12-15r, %16-19r, %o", - 0x00200000, 0x0de00000, "eor%c%20's %12-15r, %16-19r, %o", - 0x00400000, 0x0de00000, "sub%c%20's %12-15r, %16-19r, %o", - 0x00600000, 0x0de00000, "rsb%c%20's %12-15r, %16-19r, %o", - 0x00800000, 0x0de00000, "add%c%20's %12-15r, %16-19r, %o", - 0x00a00000, 0x0de00000, "adc%c%20's %12-15r, %16-19r, %o", - 0x00c00000, 0x0de00000, "sbc%c%20's %12-15r, %16-19r, %o", - 0x00e00000, 0x0de00000, "rsc%c%20's %12-15r, %16-19r, %o", - 0x01000000, 0x0de00000, "tst%c%p %16-19r, %o", - 0x01200000, 0x0de00000, "teq%c%p %16-19r, %o", - 0x01400000, 0x0de00000, "cmp%c%p %16-19r, %o", - 0x01600000, 0x0de00000, "cmn%c%p %16-19r, %o", - 0x01800000, 0x0de00000, "orr%c%20's %12-15r, %16-19r, %o", - 0x01a00000, 0x0de00000, "mov%c%20's %12-15r, %o", - 0x01c00000, 0x0de00000, "bic%c%20's %12-15r, %16-19r, %o", - 0x01e00000, 0x0de00000, "mvn%c%20's %12-15r, %o", - 0x04000000, 0x0c100000, "str%c%22'b %12-15r, %a", - 0x04100000, 0x0c100000, "ldr%c%22'b %12-15r, %a", - 0x08000000, 0x0e100000, "stm%c%23?id%24?ba %16-19r%22`!, %m", - 0x08100000, 0x0e100000, "ldm%c%23?id%24?ba %16-19r%22`!, %m%22'^", - 0x0a000000, 0x0e000000, "b%c%24'l %b", - 0x0f000000, 0x0f000000, "swi%c %0-23x", - /* Floating point coprocessor instructions */ - 0x0e000100, 0x0ff08f10, "adf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e100100, 0x0ff08f10, "muf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e200100, 0x0ff08f10, "suf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e300100, 0x0ff08f10, "rsf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e400100, 0x0ff08f10, "dvf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e500100, 0x0ff08f10, "rdf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e600100, 0x0ff08f10, "pow%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e700100, 0x0ff08f10, "rpw%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e800100, 0x0ff08f10, "rmf%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e900100, 0x0ff08f10, "fml%c%P%R %12-14f, %16-18f, %0-3f", - 0x0ea00100, 0x0ff08f10, "fdv%c%P%R %12-14f, %16-18f, %0-3f", - 0x0eb00100, 0x0ff08f10, "frd%c%P%R %12-14f, %16-18f, %0-3f", - 0x0ec00100, 0x0ff08f10, "pol%c%P%R %12-14f, %16-18f, %0-3f", - 0x0e008100, 0x0ff08f10, "mvf%c%P%R %12-14f, %0-3f", - 0x0e108100, 0x0ff08f10, "mnf%c%P%R %12-14f, %0-3f", - 0x0e208100, 0x0ff08f10, "abs%c%P%R %12-14f, %0-3f", - 0x0e308100, 0x0ff08f10, "rnd%c%P%R %12-14f, %0-3f", - 0x0e408100, 0x0ff08f10, "sqt%c%P%R %12-14f, %0-3f", - 0x0e508100, 0x0ff08f10, "log%c%P%R %12-14f, %0-3f", - 0x0e608100, 0x0ff08f10, "lgn%c%P%R %12-14f, %0-3f", - 0x0e708100, 0x0ff08f10, "exp%c%P%R %12-14f, %0-3f", - 0x0e808100, 0x0ff08f10, "sin%c%P%R %12-14f, %0-3f", - 0x0e908100, 0x0ff08f10, "cos%c%P%R %12-14f, %0-3f", - 0x0ea08100, 0x0ff08f10, "tan%c%P%R %12-14f, %0-3f", - 0x0eb08100, 0x0ff08f10, "asn%c%P%R %12-14f, %0-3f", - 0x0ec08100, 0x0ff08f10, "acs%c%P%R %12-14f, %0-3f", - 0x0ed08100, 0x0ff08f10, "atn%c%P%R %12-14f, %0-3f", - 0x0e000110, 0x0ff00f1f, "flt%c%P%R %16-18f, %12-15r", - 0x0e100110, 0x0fff0f98, "fix%c%R %12-15r, %0-2f", - 0x0e200110, 0x0fff0fff, "wfs%c %12-15r", - 0x0e300110, 0x0fff0fff, "rfs%c %12-15r", - 0x0e400110, 0x0fff0fff, "wfc%c %12-15r", - 0x0e500110, 0x0fff0fff, "rfc%c %12-15r", - 0x0e90f110, 0x0ff8fff0, "cmf%c %16-18f, %0-3f", - 0x0eb0f110, 0x0ff8fff0, "cnf%c %16-18f, %0-3f", - 0x0ed0f110, 0x0ff8fff0, "cmfe%c %16-18f, %0-3f", - 0x0ef0f110, 0x0ff8fff0, "cnfe%c %16-18f, %0-3f", - 0x0c000100, 0x0e100f00, "stf%c%Q %12-14f, %A", - 0x0c100100, 0x0e100f00, "ldf%c%Q %12-14f, %A", - /* Generic coprocessor instructions */ - 0x0e000000, 0x0f000010, "cdp%c %8-11d, %20-23d, cr%12-15d, cr%16-19d, cr%0-3d, {%5-7d}", - 0x0e000010, 0x0f100010, "mrc%c %8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}", - 0x0e100010, 0x0f100010, "mcr%c %8-11d, %21-23d, %12-15r, cr%16-19d, cr%0-3d, {%5-7d}", - 0x0c000000, 0x0e100000, "stc%c%22`l %8-11d, cr%12-15d, %A", - 0x0c100000, 0x0e100000, "ldc%c%22`l %8-11d, cr%12-15d, %A", - /* the rest */ - 0x00000000, 0x00000000, "undefined instruction %0-31x", -}; -#define N_OPCODES (sizeof opcodes / sizeof opcodes[0]) diff --git a/gdb/cadillac-patches b/gdb/cadillac-patches index 74fff63..e69de29 100755 --- a/gdb/cadillac-patches +++ b/gdb/cadillac-patches @@ -1,1021 +0,0 @@ -# Apply these patches to GDB to produce an Energize GDB. -# To apply these patches, first cd to gdb-XX/gdb, run "patch -p0 cond_string = NULL; - if (from_tty) - printf_filtered ("Breakpoint %d now unconditional.\n", bnum); -+ if (cadillac) -+ cadillac_condition_breakpoint(b); - } - else - { -*************** -*** 281,286 **** ---- 283,290 ---- - typed in or the decompiled expression. */ - b->cond_string = savestring (arg, strlen (arg)); - b->cond = parse_exp_1 (&arg, block_for_pc (b->address), 0); -+ if (cadillac) -+ cadillac_condition_breakpoint(b); - if (*arg) - error ("Junk at end of expression"); - } -*************** -*** 316,330 **** - ALL_BREAKPOINTS (b) - if (b->number == bnum) - { -! if (from_tty && input_from_terminal_p ()) -! { -! printf_filtered ("Type commands for when breakpoint %d is hit, one per line.\n\ - End with a line saying just \"end\".\n", bnum); -- fflush (stdout); -- } - l = read_command_lines (); - free_command_lines (&b->commands); - b->commands = l; - return; - } - error ("No breakpoint number %d.", bnum); ---- 320,333 ---- - ALL_BREAKPOINTS (b) - if (b->number == bnum) - { -! if ((from_tty && input_from_terminal_p ()) || cadillac) -! printf_filtered ("Type commands for when breakpoint %d is hit, one per line.\n\ - End with a line saying just \"end\".\n", bnum); - l = read_command_lines (); - free_command_lines (&b->commands); - b->commands = l; -+ if (cadillac) -+ cadillac_commands_breakpoint(b); - return; - } - error ("No breakpoint number %d.", bnum); -*************** -*** 925,930 **** ---- 928,935 ---- - { - b->ignore_count--; - this_bp_stop = 0; -+ if (cadillac) -+ cadillac_ignore_breakpoint(b); - } - else - { -*************** -*** 1365,1370 **** ---- 1370,1378 ---- - mention (b) - struct breakpoint *b; - { -+ if (cadillac) -+ cadillac_create_breakpoint(b); -+ - switch (b->type) - { - case bp_watchpoint: -*************** -*** 2106,2111 **** ---- 2114,2122 ---- - register struct breakpoint *b; - register bpstat bs; - -+ if (cadillac) -+ cadillac_delete_breakpoint(bpt); -+ - if (bpt->inserted) - target_remove_breakpoint(bpt->address, bpt->shadow_contents); - -*************** -*** 2277,2282 **** ---- 2288,2295 ---- - if (b->number == bptnum) - { - b->ignore_count = count; -+ if (cadillac) -+ cadillac_ignore_breakpoint(b); - if (!from_tty) - return; - else if (count == 0) -*************** -*** 2301,2307 **** - struct breakpoint *b; - - ALL_BREAKPOINTS (b) -! b->ignore_count = 0; - } - - /* Command to set ignore-count of breakpoint N to COUNT. */ ---- 2314,2324 ---- - struct breakpoint *b; - - ALL_BREAKPOINTS (b) -! { -! b->ignore_count = 0; -! if (cadillac) -! cadillac_ignore_breakpoint(b); -! } - } - - /* Command to set ignore-count of breakpoint N to COUNT. */ -*************** -*** 2368,2373 **** ---- 2385,2393 ---- - { - bpt->enable = enabled; - -+ if (cadillac) -+ cadillac_enable_breakpoint(bpt); -+ - if (xgdb_verbose && bpt->type == bp_breakpoint) - printf ("breakpoint #%d enabled\n", bpt->number); - -*************** -*** 2415,2420 **** ---- 2435,2443 ---- - disable_breakpoint (bpt) - struct breakpoint *bpt; - { -+ if (cadillac) -+ cadillac_disable_breakpoint(bpt); -+ - bpt->enable = disabled; - - if (xgdb_verbose && bpt->type == bp_breakpoint) -diff -rc command.c command.c -*** command.c Mon Jun 22 20:33:41 1992 ---- command.c Sat Jun 27 12:30:01 1992 -*************** -*** 1149,1155 **** - } - - if (pid != -1) -! while ((rc = wait (&status)) != pid && rc != -1) - ; - else - error ("Fork failed"); ---- 1149,1155 ---- - } - - if (pid != -1) -! while ((rc = cadillac ? cadillac_wait(&status) : wait (&status)) != pid && rc != -1) - ; - else - error ("Fork failed"); -diff -rc config/amix.mh config/amix.mh -*** config/amix.mh Tue Jun 9 19:05:16 1992 ---- config/amix.mh Sat Jun 27 12:31:29 1992 -*************** -*** 22,24 **** ---- 22,31 ---- - - # SVR4 puts the BSD compatible install in /usr/ucb. - INSTALL = /usr/ucb/install -c -+ -+ # These are the libs that are needed for the Cadillac version of gdb on -+ # SVR4. Note that we MUST include the standard C library before libucb.a, -+ # otherwise we get lots of broken stuff we don't want. -+ CONNECTION_LIB = deblib/connection/libconn.a -+ CADILLAC_LIBS = ${CONNECTION_LIB} -L/usr/lib -lm -lnet -lresolv -lform \ -+ -lsocket -lc /usr/ucblib/libucb.a -lnsl -diff -rc config/ncr3000.mh config/ncr3000.mh -*** config/ncr3000.mh Mon Jun 15 12:25:13 1992 ---- config/ncr3000.mh Sat Jun 27 12:31:30 1992 -*************** -*** 38,40 **** ---- 38,47 ---- - # The /usr/ucb/install program is incompatible (complains about unknown - # group staff). Use good old cp... - INSTALL = cp -+ -+ # These are the libs that are needed for the Cadillac version of gdb on -+ # SVR4. Note that we MUST include the standard C library before libucb.a, -+ # otherwise we get lots of broken stuff we don't want. -+ CONNECTION_LIB = deblib/connection/libconn.a -+ CADILLAC_LIBS = ${CONNECTION_LIB} -L/usr/lib -lm -lnet -lresolv -lform \ -+ -lsocket -lc /usr/ucblib/libucb.a -lnsl -diff -rc configure.in configure.in -*** configure.in Mon Jun 22 17:25:00 1992 ---- configure.in Sat Jun 27 12:31:29 1992 -*************** -*** 1,4 **** -! configdirs="doc" - srcname="GDB" - srctrigger=main.c - target_dependent=true ---- 1,4 ---- -! configdirs="deblib doc" - srcname="GDB" - srctrigger=main.c - target_dependent=true -diff -rc defs.h defs.h -*** defs.h Thu Jun 25 04:50:31 1992 ---- defs.h Sat Jun 27 12:30:02 1992 -*************** -*** 770,773 **** ---- 770,842 ---- - extern CORE_ADDR - push_word (); - -+ /* Energize/Cadillac stuff */ -+ -+ /* Non-zero means that we're doing the cadillac interface. */ -+ extern int cadillac; -+ -+ /* Get a pty for use with cadillac */ -+ extern char *cadillac_getpty PARAMS ((void)); -+ -+ /* Notify cadillac of new process creation */ -+ extern void cadillac_new_process PARAMS ((void)); -+ -+ /* Low level wait routine for wait_for_inferior */ -+ extern int cadillac_wait PARAMS ((int *)); -+ -+ /* Initialize */ -+ extern void cadillac_initialize PARAMS ((char *, char *)); -+ -+ /* Main loop for cadillac protocol driver */ -+ extern void cadillac_main_loop PARAMS ((void)); -+ -+ struct cmd_list_element; -+ -+ /* Command hook for cadillac */ -+ extern void cadillac_call_command PARAMS ((struct cmd_list_element *, -+ char *, int)); -+ -+ /* Read commands for the command command, and others */ -+ extern char *cadillac_command_line_input PARAMS ((void)); -+ -+ struct symbol; -+ struct type; -+ -+ extern void cadillac_start_variable_annotation PARAMS ((char *, -+ struct symbol *, -+ struct type *, -+ CORE_ADDR, -+ char *)); -+ -+ extern void cadillac_end_variable_annotation PARAMS ((void)); -+ -+ extern void cadillac_annotate_function PARAMS ((char *, int, int)); -+ -+ struct objfile; -+ extern void cadillac_symbol_file PARAMS ((struct objfile *)); -+ -+ /*extern void cadillac_query PARAMS ((char *, ...));*/ -+ extern void cadillac_query (); /* Prototypes for varargs don't work */ -+ -+ extern char *cadillac_command_line_input PARAMS ((void)); -+ -+ extern void cadillac_acknowledge_query PARAMS ((char *)); -+ -+ extern void cadillac_fputs PARAMS ((const char *)); -+ -+ struct breakpoint; -+ extern void cadillac_condition_breakpoint PARAMS ((struct breakpoint *)); -+ -+ extern void cadillac_commands_breakpoint PARAMS ((struct breakpoint *)); -+ -+ extern void cadillac_ignore_breakpoint PARAMS ((struct breakpoint *)); -+ -+ extern void cadillac_create_breakpoint PARAMS ((struct breakpoint *)); -+ -+ extern void cadillac_delete_breakpoint PARAMS ((struct breakpoint *)); -+ -+ extern void cadillac_enable_breakpoint PARAMS ((struct breakpoint *)); -+ -+ extern void cadillac_disable_breakpoint PARAMS ((struct breakpoint *)); -+ - #endif /* !defined (DEFS_H) */ -diff -rc inflow.c inflow.c -*** inflow.c Tue Jun 23 21:49:19 1992 ---- inflow.c Sat Jun 27 12:30:03 1992 -*************** -*** 81,87 **** - static short pgrp_inferior; - static short pgrp_ours; - # else /* not def SHORT_PGRP */ -! static int pgrp_inferior; - static int pgrp_ours; - # endif /* not def SHORT_PGRP */ - #else /* not def TIOCGPGRP */ ---- 81,87 ---- - static short pgrp_inferior; - static short pgrp_ours; - # else /* not def SHORT_PGRP */ -! int pgrp_inferior; - static int pgrp_ours; - # endif /* not def SHORT_PGRP */ - #else /* not def TIOCGPGRP */ -diff -rc infrun.c infrun.c -*** infrun.c Tue Jun 23 21:49:22 1992 ---- infrun.c Sat Jun 27 12:30:04 1992 -*************** -*** 617,622 **** ---- 617,624 ---- - Here we must get it up to actual execution of the real program. */ - - inferior_pid = pid; /* Needed for wait_for_inferior stuff below */ -+ if (cadillac) -+ cadillac_new_process(); - - clear_proceed_status (); - -*************** -*** 755,760 **** ---- 757,764 ---- - - attach (pid); - inferior_pid = pid; -+ if (cadillac) -+ cadillac_new_process(); - push_target (&child_ops); - - mark_breakpoints_out (); -diff -rc inftarg.c inftarg.c -*** inftarg.c Sun Mar 29 15:21:27 1992 ---- inftarg.c Sat Jun 27 12:30:04 1992 -*************** -*** 58,64 **** - #ifdef USE_PROC_FS - pid = proc_wait (status); - #else -! pid = wait (status); - #endif - if (pid == -1) /* No more children to wait for */ - { ---- 58,67 ---- - #ifdef USE_PROC_FS - pid = proc_wait (status); - #else -! if (cadillac) -! pid = cadillac_wait (status); -! else -! pid = wait (status); - #endif - if (pid == -1) /* No more children to wait for */ - { -diff -rc main.c main.c -*** main.c Mon Jun 8 23:09:23 1992 ---- main.c Sat Jun 27 12:30:05 1992 -*************** -*** 397,402 **** ---- 397,403 ---- - char *corearg = NULL; - char *cdarg = NULL; - char *ttyarg = NULL; -+ char *cadillac_id = NULL; - - /* Pointers to all arguments of +command option. */ - char **cmdarg; -*************** -*** 492,497 **** ---- 493,499 ---- - {"tty", required_argument, 0, 't'}, - {"baud", required_argument, 0, 'b'}, - {"b", required_argument, 0, 'b'}, -+ {"context", required_argument, 0, 12}, - /* Allow machine descriptions to add more options... */ - #ifdef ADDITIONAL_OPTIONS - ADDITIONAL_OPTIONS -*************** -*** 524,529 **** ---- 526,534 ---- - case 11: - cdarg = optarg; - break; -+ case 12: -+ cadillac_id = optarg; -+ break; - case 's': - symarg = optarg; - break; -*************** -*** 670,675 **** ---- 675,683 ---- - free ((PTR)dirarg); - do_cleanups (ALL_CLEANUPS); - -+ if (cadillac_id) -+ cadillac_initialize (cadillac_id, execarg); -+ - if (execarg != NULL - && symarg != NULL - && strcmp (execarg, symarg) == 0) -*************** -*** 691,696 **** ---- 699,705 ---- - if (!setjmp (to_top_level)) - symbol_file_command (symarg, 0); - } -+ - do_cleanups (ALL_CLEANUPS); - - /* After the symbol file has been read, print a newline to get us -*************** -*** 818,824 **** - if (!setjmp (to_top_level)) - { - do_cleanups (ALL_CLEANUPS); /* Do complete cleanup */ -! command_loop (); - quit_command ((char *)0, instream == stdin); - } - } ---- 827,836 ---- - if (!setjmp (to_top_level)) - { - do_cleanups (ALL_CLEANUPS); /* Do complete cleanup */ -! if (cadillac_id) -! cadillac_main_loop(); -! else -! command_loop (); - quit_command ((char *)0, instream == stdin); - } - } -*************** -*** 880,886 **** - else if (c->function.cfunc == NO_FUNCTION) - error ("That is not a command, just a help topic."); - else -! (*c->function.cfunc) (arg, from_tty & caution); - } - - /* Tell the user if the language has changed (except first time). */ ---- 892,901 ---- - else if (c->function.cfunc == NO_FUNCTION) - error ("That is not a command, just a help topic."); - else -! if (cadillac) -! cadillac_call_command (c, arg, from_tty & caution); -! else -! (*c->function.cfunc) (arg, from_tty & caution); - } - - /* Tell the user if the language has changed (except first time). */ -*************** -*** 1516,1522 **** - while (1) - { - dont_repeat (); -! p = command_line_input ((char *) NULL, instream == stdin); - if (p == NULL) - /* Treat end of file like "end". */ - break; ---- 1531,1540 ---- - while (1) - { - dont_repeat (); -! if (cadillac) -! p = cadillac_command_line_input(); -! else -! p = command_line_input ((char *) NULL, instream == stdin); - if (p == NULL) - /* Treat end of file like "end". */ - break; -*************** -*** 1820,1826 **** - void - print_prompt () - { -! printf ("%s", prompt); - fflush (stdout); - } - ---- 1838,1844 ---- - void - print_prompt () - { -! printf_filtered ("%s", prompt); - fflush (stdout); - } - -diff -rc printcmd.c printcmd.c -*** printcmd.c Thu Jun 25 03:58:47 1992 ---- printcmd.c Sat Jun 27 12:30:05 1992 -*************** -*** 778,783 **** ---- 778,792 ---- - { - int histindex = record_latest_value (val); - -+ if (cadillac) -+ { -+ char buf[20]; -+ -+ sprintf(buf, "$%d", histindex); -+ cadillac_start_variable_annotation(buf, NULL, VALUE_TYPE(val), -+ VALUE_ADDRESS(val), ""); -+ } -+ - if (inspect) - printf ("\031(gdb-makebuffer \"%s\" %d '(\"", exp, histindex); - else -*************** -*** 784,789 **** ---- 793,800 ---- - if (histindex >= 0) printf_filtered ("$%d = ", histindex); - - print_formatted (val, format, fmt.size); -+ if (cadillac) -+ cadillac_end_variable_annotation(); - printf_filtered ("\n"); - if (inspect) - printf("\") )\030"); -*************** -*** 1610,1620 **** ---- 1621,1641 ---- - standard indentation here is 4 spaces, and val_print indents - 2 for each recurse. */ - val = read_var_value (sym, FRAME_INFO_ID (fi)); -+ -+ if (cadillac) -+ cadillac_start_variable_annotation(SYMBOL_NAME(sym), sym, -+ VALUE_TYPE(val), -+ VALUE_ADDRESS(val), ""); -+ - if (val) - val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), VALUE_ADDRESS (val), - stream, 0, 0, 2, Val_no_prettyprint); - else - fputs_filtered ("???", stream); -+ -+ if (cadillac) -+ cadillac_end_variable_annotation(); -+ - first = 0; - } - -diff -rc stack.c stack.c -*** stack.c Sat Jun 20 16:30:33 1992 ---- stack.c Sat Jun 27 12:30:06 1992 -*************** -*** 159,165 **** - if (addressprint) - printf_filtered ("%s in ", local_hex_string(fi->pc)); - -! fputs_demangled (fname, stdout, 0); - fputs_filtered (" (...)\n", stdout); - - return; ---- 159,168 ---- - if (addressprint) - printf_filtered ("%s in ", local_hex_string(fi->pc)); - -! if (cadillac) -! cadillac_annotate_function(fname, 0, level); -! else -! fputs_demangled (fname, stdout, 0); - fputs_filtered (" (...)\n", stdout); - - return; -*************** -*** 218,224 **** - if (addressprint) - if (fi->pc != sal.pc || !sal.symtab) - printf_filtered ("%s in ", local_hex_string(fi->pc)); -! fputs_demangled (funname ? funname : "??", stdout, 0); - wrap_here (" "); - fputs_filtered (" (", stdout); - if (args) ---- 221,230 ---- - if (addressprint) - if (fi->pc != sal.pc || !sal.symtab) - printf_filtered ("%s in ", local_hex_string(fi->pc)); -! if (cadillac) -! cadillac_annotate_function(funname ? funname : "??", 0, level); -! else -! fputs_demangled (funname ? funname : "??", stdout, 0); - wrap_here (" "); - fputs_filtered (" (", stdout); - if (args) -*************** -*** 255,261 **** - { - if (addressprint && mid_statement) - printf_filtered ("%s\t", local_hex_string(fi->pc)); -! print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); - } - current_source_line = max (sal.line - lines_to_list/2, 1); - } ---- 261,268 ---- - { - if (addressprint && mid_statement) - printf_filtered ("%s\t", local_hex_string(fi->pc)); -! if (!cadillac) -! print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); - } - current_source_line = max (sal.line - lines_to_list/2, 1); - } -*************** -*** 429,435 **** - if (funname) - { - printf_filtered (" in "); -! fputs_demangled (funname, stdout, DMGL_ANSI | DMGL_PARAMS); - } - wrap_here (" "); - if (sal.symtab) ---- 436,446 ---- - if (funname) - { - printf_filtered (" in "); -! if (cadillac) -! cadillac_annotate_function(funname, DMGL_ANSI | DMGL_PARAMS, -! selected_frame_level); -! else -! fputs_demangled (funname, stdout, DMGL_ANSI | DMGL_PARAMS); - } - wrap_here (" "); - if (sal.symtab) -diff -rc symfile.c symfile.c -*** symfile.c Sat Jun 13 09:20:12 1992 ---- symfile.c Sat Jun 27 12:30:06 1992 -*************** -*** 555,560 **** ---- 555,563 ---- - fflush (stdout); - } - -+ if (cadillac) -+ cadillac_symbol_file(objfile); -+ - return (objfile); - } - -diff -rc utils.c utils.c -*** utils.c Mon Jun 15 07:27:07 1992 ---- utils.c Sat Jun 27 12:30:07 1992 -*************** -*** 96,101 **** ---- 96,102 ---- - - char *error_pre_print; - char *warning_pre_print = "\nwarning: "; -+ - - /* Add a new cleanup to the cleanup_chain, - and return the previous chain pointer -*************** -*** 694,700 **** - register int ans2; - - /* Automatically answer "yes" if input is not from a terminal. */ -! if (!input_from_terminal_p ()) - return 1; - - while (1) ---- 695,701 ---- - register int ans2; - - /* Automatically answer "yes" if input is not from a terminal. */ -! if (!input_from_terminal_p () && !cadillac) - return 1; - - while (1) -*************** -*** 701,721 **** - { - va_start (args); - ctlstr = va_arg (args, char *); - vfprintf_filtered (stdout, ctlstr, args); -- va_end (args); - printf_filtered ("(y or n) "); -! fflush (stdout); -! answer = fgetc (stdin); -! clearerr (stdin); /* in case of C-d */ -! if (answer == EOF) /* C-d */ -! return 1; -! if (answer != '\n') /* Eat rest of input line, to EOF or newline */ -! do -! { -! ans2 = fgetc (stdin); -! clearerr (stdin); -! } -! while (ans2 != EOF && ans2 != '\n'); - if (answer >= 'a') - answer -= 040; - if (answer == 'Y') ---- 702,734 ---- - { - va_start (args); - ctlstr = va_arg (args, char *); -+ if (cadillac) -+ cadillac_query (ctlstr, args); - vfprintf_filtered (stdout, ctlstr, args); - printf_filtered ("(y or n) "); -! if (cadillac) -! { -! char *buf; -! -! buf = cadillac_command_line_input(); -! answer = buf ? *buf : 'Y'; -! cadillac_acknowledge_query(buf); -! } -! else -! { -! fflush (stdout); -! answer = fgetc (stdin); -! clearerr (stdin); /* in case of C-d */ -! if (answer == EOF) /* C-d */ -! return 1; -! if (answer != '\n') /* Eat rest of input line, to EOF or newline */ -! do -! { -! ans2 = fgetc (stdin); -! clearerr (stdin); -! } -! while (ans2 != EOF && ans2 != '\n'); -! } - if (answer >= 'a') - answer -= 040; - if (answer == 'Y') -*************** -*** 723,728 **** ---- 736,742 ---- - if (answer == 'N') - return 0; - printf_filtered ("Please answer y or n.\n"); -+ va_end (args); - } - } - -*************** -*** 989,994 **** ---- 1003,1014 ---- - if (linebuffer == 0) - return; - -+ if (cadillac) -+ { -+ cadillac_fputs(linebuffer); -+ return; -+ } -+ - /* Don't do any filtering if it is disabled. */ - if (stream != stdout - || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)) -diff -rc valprint.c valprint.c -*** valprint.c Tue Jun 23 23:24:51 1992 ---- valprint.c Sat Jun 27 12:30:07 1992 -*************** -*** 485,490 **** ---- 485,491 ---- - struct type **dont_print; - { - int i, len, n_baseclasses; -+ char expr_tag[100]; /* Cadillac */ - - check_stub_type (type); - -*************** -*** 549,554 **** ---- 550,563 ---- - fprint_symbol (stream, TYPE_FIELD_NAME (type, i)); - fputs_filtered (" = ", stream); - } -+ -+ sprintf(expr_tag, ".%s", TYPE_FIELD_NAME(type, i)); -+ -+ if (cadillac) -+ cadillac_start_variable_annotation(expr_tag, NULL, -+ TYPE_FIELD_TYPE(type, i), -+ (CORE_ADDR) (valaddr + TYPE_FIELD_BITPOS(type, i) / 8), -+ ""); - if (TYPE_FIELD_PACKED (type, i)) - { - value v; -*************** -*** 567,572 **** ---- 576,583 ---- - valaddr + TYPE_FIELD_BITPOS (type, i) / 8, - 0, stream, format, 0, recurse + 1, pretty); - } -+ if (cadillac) -+ cadillac_end_variable_annotation(); - } - if (pretty) - { -*************** -*** 801,806 **** ---- 812,818 ---- - unsigned int rep1; - /* Number of repetitions we have detected so far. */ - unsigned int reps; -+ char expr_tag[100]; /* Cadillac */ - - if (i != 0) - if (arrayprint) -*************** -*** 822,827 **** ---- 834,845 ---- - ++rep1; - } - -+ sprintf(expr_tag, "[%d]", i); -+ if (cadillac) -+ cadillac_start_variable_annotation(expr_tag, NULL, -+ elttype, -+ (CORE_ADDR) (valaddr + i * eltlen), -+ ""); - if (reps > REPEAT_COUNT_THRESHOLD) - { - val_print (elttype, valaddr + i * eltlen, -*************** -*** 838,843 **** ---- 856,863 ---- - recurse + 1, pretty); - things_printed++; - } -+ if (cadillac) -+ cadillac_end_variable_annotation(); - } - if (i < len) - fprintf_filtered (stream, "..."); diff --git a/gdb/cadillac.c b/gdb/cadillac.c index 4f59924..e69de29 100755 --- a/gdb/cadillac.c +++ b/gdb/cadillac.c @@ -1,1474 +0,0 @@ -/* Energize (formerly known as Cadillac) interface routines. - Copyright 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "symtab.h" -#include "inferior.h" -#include "command.h" -#include "bfd.h" -#include "symfile.h" -#include "objfiles.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef USG -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -/* Non-zero means that we're doing the cadillac interface. */ -int cadillac = 0; - -/* Connection block for debugger<=>kernel communications. */ -static Connection *conn = 0; - -/* fd for our socket to the kernel. */ -static int kerfd; - -/* The kernel's ID for this instance of the program. */ -static int program_id; - -static int instance_id; - -/* The fd for the pty associated with the inferior. */ -static int inferior_pty = -1; -static int inferior_tty = -1; - -static int has_run = 0; - -extern int pgrp_inferior; - -extern char *source_path; - -char **pprompt; /* Pointer to pointer to prompt */ - -/* Tell cadillac_command_line_input() where to get its text from */ -static int doing_breakcommands_message = 0; - -/* Stash command text here */ -static char *command_line_text = 0; -static int command_line_length = 0; - -/* Flags returned by wait_for_events() */ -#define KERNEL_EVENT 1 -#define PTY_EVENT 2 - - -/* This routine redirects the output of fputs_filtered to the kernel so that - the user can see what's going on in his debugger window. */ - -void -cadillac_fputs(ptr) - const char *ptr; -{ - if (conn) - CVWriteTranscriptInfo (conn, instance_id, (char *)ptr); - else - fputs (ptr, stdout); -} - -void -cadillac_query(query, args) - char *query; - va_list args; -{ - char buf[100]; - - vsprintf(buf, query, args); - - CVWriteQueryInfo(conn, - instance_id, - CQueryConfirm, - qno_unknown, - buf, - ""); /* transcript */ -} - -void -cadillac_acknowledge_query(ack) - char *ack; -{ - CVWriteQueryInfo(conn, - instance_id, - CQueryAcknowleged, - 0, - ack, - ""); /* transcript */ -} - -/* Copy all data from the pty to the kernel. */ - -static void -pty_to_kernel() -{ - CTtyRequest *req; - char buf[1024]; - int cc; - - while (1) - { - cc = read(inferior_pty, buf, sizeof(buf)); - - if (cc == 0 - || (cc < 0 - && errno == EWOULDBLOCK)) - break; - - if (cc < 0) - { - close(inferior_pty); - inferior_pty = -1; - perror("pty read error"); - break; - } - - req = CWriteTtyRequest(conn, TextIORType); - CWriteVstringLen(conn, buf, cc); - CWriteLength(conn); - } - CWriteRequestBuffer(conn); -} - -/* Copy data from the kernel to the pty. */ - -static void -kernel_to_pty(data, len) - char *data; - int len; -{ - int cc; - - cc = write(inferior_pty, data, len); - - if (cc != len) - { - if (cc < 0) - { - close(inferior_pty); - inferior_pty = -1; - perror("pty write error"); - return; - } - printf("Couldn't write all the data to the pty, wanted %d, got %d\n", - len, cc); - } -} - -static char * -full_filename(symtab) - struct symtab *symtab; -{ - int pathlen; - char *filename; - - if (!symtab) - return NULL; - - if (symtab->fullname) - return savestring(symtab->fullname, strlen(symtab->fullname)); - - if (symtab->dirname) - pathlen = strlen(symtab->dirname); - else - pathlen = 0; - if (symtab->filename) - pathlen += strlen(symtab->filename); - - filename = xmalloc(pathlen+1); - - if (symtab->dirname) - strcpy(filename, symtab->dirname); - else - *filename = '\000'; - if (symtab->filename) - strcat(filename, symtab->filename); - - return filename; -} - -/* Tell the cadillac kernel how high the stack is so that frame numbers (which - are relative to the current stack height make sense. - - Calculate the number of frames on the stack, and the number of subroutine - invocations that haven't changed since the last call to this routine. The - second number is calculated by comparing the PCs of the current stack frames - to the PCs of the previous set of stack frames. The screw here is that a - subroutine may call several different procedures, which means that the PC - in its frame changes, even though you are still in the same subroutine. We - resolve this by converting the frames PC into the PC at the start of the - function (for efficiency, this is done only if the simple comparison test - fails). */ - -struct pclist -{ - CORE_ADDR pc; - struct pclist *next; -}; - -/* Non-zero means that Cadillac kernel already knows how high the stack is. */ -static int stack_info_valid = 0; - -static void -send_stack_info() -{ - struct pclist *pclist = 0, *pli, *opli; - static struct pclist *old_pclist; - FRAME frame; - int height, similar; - - if (stack_info_valid) - return; - - height = 0; - similar = 0; - -/* First, calculate the stack height, and build the new pclist */ - - for (frame = get_current_frame(); - frame != 0; - frame = get_prev_frame(frame)) - { - (height)++; - pli = (struct pclist *)xmalloc(sizeof(struct pclist)); - - pli->pc = frame->pc; - pli->next = pclist; - pclist = pli; - } - -/* Now, figure out how much of the stack hasn't changed */ - - for (pli = pclist, opli = old_pclist; - pli != 0 && opli != 0; - pli = pli->next, opli = opli->next, (similar)++) - { - if ((pli->pc != opli->pc) - && (get_pc_function_start(pli->pc) - != get_pc_function_start(opli->pc))) - break; - } - -/* Free up all elements of the old pclist */ - - opli = old_pclist; - - while (opli) - { - pli = opli->next; - free (opli); - opli = pli; - } - - old_pclist = pclist; /* Install the new pclist */ - - CVWriteStackSizeInfo(conn, - instance_id, - height, /* Frame depth */ - CInnerFrameIs0, - similar, /* Frame diff */ - "" /* Transcript */ - ); - - stack_info_valid = 1; -} - -/* Tell the kernel where we are in the program, and what the stack looks like. - */ - -static void -send_status() -{ - static int linecount = 48; - struct symtab_and_line sal; - struct symbol *symbol; - char *funcname, *filename; - static int sent_prog_inst = 0; - - if (!has_run) - return; - - if (inferior_pid == 0) /* target has died */ - { - CVWriteProgramTerminatedInfo(conn, - instance_id, - "" - ); - return; - } - - sal = find_pc_line(stop_pc, 0); - symbol = find_pc_function(stop_pc); - - funcname = symbol ? symbol->name : ""; - filename = full_filename(sal.symtab); - - if (!sent_prog_inst) - { - sent_prog_inst = 1; - CVWriteProgramInstanceInfo(conn, - program_id, - instance_id, - "", /* hostname */ - "", /* arglist */ - "" - ); - } - - send_stack_info(); - - CVWriteStackFrameInfo(conn, - instance_id, - sal.line, - CFileLinePos, - 0, /* XXX - frame # */ - funcname, - filename, - "" /* XXX ? transcript */ - ); - - CVWriteProgramStoppedInfo(conn, - instance_id, - 0, /* XXX - breakpoint # or signal # */ - CDebuggerCommand, - funcname, - "" /* XXX ? transcript */ - ); - - if (filename) - free(filename); -} - -/* Call this to output annotated function names. Names will be demangled if - necessary. arg_mode contains flags that are passed on to cplus_demangle. */ - -void -cadillac_annotate_function(funcname, arg_mode, level) - char *funcname; - int arg_mode; - int level; -{ - extern int demangle; - char *demangled_name = NULL; - - - if (funcname == NULL) - return; - - if (demangle) - { - demangled_name = cplus_demangle(funcname, arg_mode); - - if (demangled_name) - funcname = demangled_name; - } - - send_stack_info(); - - if (level < 0) level = 0; - - CVWriteBackTraceEntryInfo(conn, - instance_id, - level, /* frameNo */ - funcname); - - if (demangled_name) - free(demangled_name); -} - -/* Call this just prior to printing out the name & value of a variable. This - tells the kernel where to annotate the output. */ - -/* The args are: - expression - A text handle on what GDB can use to reference this value. - This can be a symbol name, or a convenience var, etc... - symbol - Used to determine the scope of the data. May be NULL. - type - Determines if we have a pointer ref, and the print name of the type. - Used in ShowValue message. - valaddr - The address in target memory of the data. - field - The field name of the struct or union element being referenced. -*/ - -static char cum_expr[200]; /* Cumulative expression */ -static char *expr_stack[100] = {cum_expr}; /* Pointers to end of expressions */ -static char **last_expr = expr_stack; /* Current expr stack pointer */ - -void -cadillac_start_variable_annotation(expression, symbol, type, valaddr, field) - char *expression; - struct symbol *symbol; - struct type *type; - CORE_ADDR valaddr; - char *field; -{ - int ref_type; - int stor_cl; - enum type_code type_code; - enum address_class sym_class; - char *type_cast; - - send_stack_info(); - - strcpy(*last_expr++, expression); - *last_expr = *(last_expr-1) + strlen(expression); - - switch (TYPE_CODE(type)) - { - case TYPE_CODE_ARRAY: - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_ENUM: - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - ref_type = CValueValueRef; - break; - case TYPE_CODE_PTR: - ref_type = CValuePointerRef; - break; - default: - ref_type = CValueUndefRef; - break; - } - -/* Make sure that pointer points at something we understand */ - - if (ref_type == CValuePointerRef) - switch (TYPE_CODE(TYPE_TARGET_TYPE(type))) - { - case TYPE_CODE_PTR: - case TYPE_CODE_ARRAY: - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_ENUM: - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - break; - default: - ref_type = CValueUndefRef; - break; - } - - if (symbol) - { - sym_class = SYMBOL_CLASS(symbol); - - switch (sym_class) - { - case LOC_CONST: - case LOC_CONST_BYTES: - stor_cl = CValueStorStaticConst; - break; - case LOC_STATIC: - stor_cl = CValueStorStaticVar; - break; - case LOC_REGISTER: - case LOC_REGPARM: - stor_cl = CValueStorRegister; - break; - case LOC_ARG: - case LOC_REF_ARG: - case LOC_LOCAL: - case LOC_LOCAL_ARG: - stor_cl = CValueStorLocalVar; - break; - default: - stor_cl = CValueStorUndef; - break; - } - } - else - stor_cl = CValueStorUndef; - - type_cast = TYPE_NAME(type); - - CVWriteValueBeginInfo(conn, - instance_id, - valaddr, - ref_type, - stor_cl, - 0, /* XXX - frameno */ - cum_expr, - field, - type_cast, - ""); /* transcript */ -} - -void -cadillac_end_variable_annotation() -{ - last_expr--; /* Pop the expr stack */ - **last_expr = '\000'; /* Cut off the last part of the expr */ - - CVWriteValueEndInfo(conn, - instance_id, - ""); /* transcript */ -} - -/* Tell the kernel that the target is now running. */ - -static void -go_busy() -{ - CVWriteProgramBusyInfo(conn, - instance_id, - ""); /* XXX ? transcript */ - CWriteRequestBuffer(conn); /* Must take place synchronusly! */ - stack_info_valid = 0; -} - - -void -cadillac_symbol_file(objfile) - struct objfile *objfile; -{ - CVWriteSymbolTableInfo(conn, - objfile->name, - ""); /* Transcript */ -} - -/* execute_command_1(echo, queue, cmd, args) - echo - non-zero means echo the - command. queue - non-zero means don't execute it now, just save it away for - later. cmd - string containing printf control sequences. args - list of - arguments needed by those control sequences. - */ - -/* Linked list of queued up commands */ -static struct command_line *queued_commands = 0; -static struct command_line *last_queued_command = 0; - -/* Call this routine to save a command for later. The command string is - copied into freshly malloc'ed memory. */ - -static void -queue_command(cmd) - char *cmd; -{ - char *buf; - struct command_line *cl; - unsigned long s; - - s = (strlen(cmd) + 1) + 7 & ~(unsigned long)7; - - buf = (char *)xmalloc(s + sizeof(struct command_line)); - cl = (struct command_line *)(buf + s); - cl->next = 0; - cl->line = buf; - - strncpy(cl->line, cmd, s); - - if (queued_commands) - last_queued_command->next = cl; - else - queued_commands = cl; - - last_queued_command = cl; -} - -/* Call this procedure to take a command off of the command queue. It returns - a pointer to a buf which the caller is responsible for freeing. NULL is - returned if there are no commands queued. */ - -static char * -dequeue_command() -{ - struct command_line *cl; - char *cmd; - - cl = queued_commands; - - if (!cl) - return NULL; - - queued_commands = cl->next; - - return cl->line; -} - -static void -execute_command_1(va_alist) - va_dcl -{ - char buf[100]; /* XXX - make buf dynamic! */ - - int echo; - int queue; - char *cmd; - va_list args; - - va_start(args); - - echo = va_arg(args, int); - queue = va_arg(args, int); - cmd = va_arg(args, char *); - - vsprintf(buf, cmd, args); - - if (queue) - queue_command(buf); - else - { - if (echo) - printf_filtered("%s\n", buf); - execute_command(buf, 1); - } - - va_end(args); -} - -#ifdef KERNEL_RECORD -FILE *kerout; - -static int -kernel_record(fd, ptr, num) - int fd, num; - char *ptr; - -{ - fwrite(ptr, num, 1, kerout); - fflush(kerout); - return write(fd, ptr, num); -} -#endif - -void -cadillac_condition_breakpoint(b) - struct breakpoint *b; -{ - CVWriteBreakConditionInfo(conn, - instance_id, - b->number, - b->cond_string ? b->cond_string : "", - "" /* transcript */ - ); -} - -void -cadillac_commands_breakpoint(b) - struct breakpoint *b; -{ - struct command_line *l; - - CVWriteBreakCommandBegInfo(conn, - instance_id, - b->number, - ""); /* transcript */ - - for (l = b->commands; l; l = l->next) - CVWriteBreakCommandEntryInfo(conn, - instance_id, - l->line, - ""); /* transcript */ - - CVWriteBreakCommandEndInfo(conn, - instance_id, - ""); /* transcript */ -} - -static void -breakpoint_notify(b, action) - struct breakpoint *b; - int action; -{ - struct symbol *sym; - char *funcname = ""; - char *filename; - char *included_in_filename = ""; - - if (b->type != bp_breakpoint) - return; - - filename = full_filename(b->symtab); - - sym = find_pc_function(b->address); - if (sym) - funcname = SYMBOL_NAME(sym); - - CVWriteBreakpointInfo (conn, - instance_id, - b->number, - b->line_number, - CFileLinePos, - CBreakOnInstrAccess, - action, - b->ignore_count, - funcname, - filename ? filename : "", - "", /* included_in_filename */ - "" /* transcript */ - ); - - if (b->commands) - cadillac_commands_breakpoint(b); - - cadillac_condition_breakpoint(b); - - if (filename) - free(filename); -} - -void -cadillac_create_breakpoint(b) - struct breakpoint *b; -{ - breakpoint_notify(b, CEnableBreakpoint); -} - -void -cadillac_delete_breakpoint(b) - struct breakpoint *b; -{ - breakpoint_notify(b, CDeleteBreakpoint); -} - -void -cadillac_enable_breakpoint(b) - struct breakpoint *b; -{ - breakpoint_notify(b, CEnableBreakpoint); -} - -void -cadillac_disable_breakpoint(b) - struct breakpoint *b; -{ - breakpoint_notify(b, CDisableBreakpoint); -} - -void -cadillac_ignore_breakpoint(b) - struct breakpoint *b; -{ - breakpoint_notify(b, CBreakAttrUnchanged); -} - -/* Open up a pty and its associated tty. Return the fd of the tty. */ - -static void -getpty() -{ - int n, ptyfd, ttyfd; - static char dev[30]; - struct stat statbuf; - struct termios termios; - -#define HIGHPTY (('z' - 'p') * 16 - 1) - - for (n = 0; n <= HIGHPTY; n++) - { - sprintf(dev, "/dev/pty%c%x", n/16 + 'p', n%16); - if (stat(dev, &statbuf)) - break; - ptyfd = open(dev, O_RDWR); - if (ptyfd < 0) - continue; - sprintf(dev, "/dev/tty%c%x", n/16 + 'p', n%16); - ttyfd = open(dev, O_RDWR); - if (ttyfd < 0) {close(ptyfd); continue;} - - /* Setup pty for non-blocking I/O. Also make it give us a SIGIO when - there's data available. */ - - n = fcntl(ptyfd, F_GETFL, 0); - fcntl(ptyfd, F_SETFL, n|FNDELAY|FASYNC); - fcntl(ptyfd, F_SETOWN, getpid()); - - tcgetattr(ttyfd, &termios); - termios.c_oflag &= ~OPOST; /* No post-processing */ - tcsetattr(ttyfd, TCSANOW, &termios); - - inferior_pty = ptyfd; - inferior_tty = ttyfd; - return; - } - - error ("getpty: can't get a pty\n"); -} - -/* Examine a protocol packet from the driver. */ - -static void -kernel_dispatch(queue) - int queue; /* Non-zero means we should just queue up - commands. */ -{ - register CHeader *head; - - head = (CHeader *)CPeekNextRequest (conn); - if (head == NULL) - { - fprintf (stderr, "EOF on kernel read!\n"); - exit (1); - } - - if (head->reqType < LastTtyRequestRType) - { - CTtyRequest* req = CReadTtyRequest (conn); - switch (req->head.reqType) - { - case AcceptConnectionRType: - /* Tell the rest of the world that cadillac is now set up */ - CSkipRequest (conn); - break; - - case RefuseConnectionRType: - fprintf (stderr, "Debugger connection refused\n"); - exit (1); - - case KillProgramRType: - exit (0); - - case TextIORType: - { - char *p; - ReqLen len; - - p = CGetVstring(conn, &len); - kernel_to_pty(p, len); - } - break; - default: - fprintf(stderr, "Unknown request type = %d\n", - req->head.reqType); - break; - } - } - else - { - CVDebuggerRequest *req = CVReadDebuggerRequest (conn); - if (!req) - { - fprintf (stderr, "CVReadDebuggerRequest returned NULL, type = %d\n", - head->reqType); - exit(1); - } - - switch (req->head.request->reqType) - { - case OpenProgramInstanceRType: - { - char *arglist, buf[100]; /* XXX - Make buf dynamic! */ - int arglen; - /* XXX - should notice when program_id changes */ - arglist = req->openProgramInstance.progArglist.text; - arglen = req->openProgramInstance.progArglist.byteLen; - - execute_command_1(1, queue, "break main"); - execute_command_1(1, queue, "enable delete $bpnum"); - if (arglist) - { - execute_command_1(1, queue, "set args %.*s", arglen, arglist); - } - execute_command_1(1, queue, "run"); - } - break; - case SearchPathRType: - directory_command(req->searchPath.searchPath.text, 0); - break; - case QuitDebuggerRType: - execute_command_1(1, queue, "quit"); - break; - case RunRType: - if (req->run.request->useArglist == CNewArglist) - { - execute_command_1(1, queue, "set args %.*s", - req->run.progArglist.byteLen, - req->run.progArglist.text); - } - execute_command_1(1, queue, "run"); - break; - case ContinueRType: - execute_command_1(1, queue, "continue"); - break; - case StepRType: - execute_command_1(1, queue, "step %d", req->step.request->stepCount); - break; - case NextRType: - execute_command_1(1, queue, "next %d", req->next.request->nextCount); - break; - case ChangeStackFrameRType: - switch (req->changeStackFrame.request->frameMovement) - { - case CToCurrentStackFrame: - execute_command_1(1, queue, "frame %d", - req->changeStackFrame.request->frameNo); - break; - case CToInnerStackFrame: - execute_command_1(1, queue, "down %d", - req->changeStackFrame.request->frameNo); - break; - case CToOuterStackFrame: - execute_command_1(1, queue, "up %d", - req->changeStackFrame.request->frameNo); - break; - case CToAbsoluteStackFrame: - execute_command_1(1, queue, "frame %d", - req->changeStackFrame.request->frameNo); - break; - } - break; - case BackTraceRType: - /* XXX - deal with limit??? */ - execute_command_1(1, queue, "backtrace"); - break; - case FinishRType: - execute_command_1(1, queue, "finish"); - break; - case TerminateProgramRType: - execute_command_1(1, queue, "kill"); - break; - case NewBreakpointRType: - { - char *tail; - int skipped; - - tail = strrchr(req->newBreakpoint.fileName.text, '/'); - if (!tail) - tail = req->newBreakpoint.fileName.text; - else - tail++; - skipped = tail - req->newBreakpoint.fileName.text; - execute_command_1(1, queue, "break %.*s:%d", - req->newBreakpoint.fileName.byteLen - skipped, - tail, - req->newBreakpoint.request->fileLinePos); - } - break; - case StopRType: - killpg(pgrp_inferior, SIGINT); - break; - case UserInputRType: - { - char *text; - long len; - - /* XXX - should really break command up into seperate lines - and spoon-feed it to execute_command */ - - text = req->userInput.userInput.text; - len = req->userInput.userInput.byteLen; - - if (text[len-1] == '\n') text[len-1] = '\000'; - - while (*text == ' ' || *text == '\t') text++; - - if (strcmp(text, "]*[") == 0) /* XXX - What does this mean??? */ - break; - - if (*text != '\000') - execute_command_1(0, queue, "%s", text); - else - print_prompt(); /* User just typed a blank line */ - } - break; - case QueryResponseRType: - { - char *resp; - - if (req->queryResponse.request->response) - resp = "y"; - else - resp = "n"; - execute_command_1(1, 1, resp); - printf_filtered("%s\n", resp); - } - break; - case ChangeBreakpointRType: - switch (req->changeBreakpoint.request->breakpointAttr) - { - case CBreakAttrUnchanged: - execute_command_1(1, queue, "ignore %d %d", - req->changeBreakpoint.request->breakpointId, - req->changeBreakpoint.request->ignoreCount); - break; - case CEnableBreakpoint: - execute_command_1(1, queue, "enable %d", - req->changeBreakpoint.request->breakpointId); - break; - case CDisableBreakpoint: - execute_command_1(1, queue, "disable %d", - req->changeBreakpoint.request->breakpointId); - break; - case CDeleteBreakpoint: - execute_command_1(1, queue, "delete %d", - req->changeBreakpoint.request->breakpointId); - break; - case CEnableDisableBreakpoint: - execute_command_1(1, queue, "enable once %d", - req->changeBreakpoint.request->breakpointId); - break; - case CEnableDeleteBreakpoint: - execute_command_1(1, queue, "enable delete %d", - req->changeBreakpoint.request->breakpointId); - break; - default: - printf_filtered("ChangeBreakpointRType: unknown breakpointAttr\n"); - printf_filtered(" breakpointAttr = %d\n", - req->changeBreakpoint.request->breakpointAttr); - printf_filtered(" breakpointId = %d\n", - req->changeBreakpoint.request->breakpointId); - printf_filtered(" breakpointType = %d\n", - req->changeBreakpoint.request->breakpointType); - printf_filtered(" ignoreCount = %d\n", - req->changeBreakpoint.request->ignoreCount); - break; - } - break; - case BreakConditionRType: - execute_command_1(1, queue, "condition %d %.*s", - req->breakCondition.request->breakpointId, - req->breakCondition.condition.byteLen, - req->breakCondition.condition.text); - break; - case BreakCommandsRType: - /* Put pointers to where cadillac_command_line_input() can find - them. */ - doing_breakcommands_message = 1; - command_line_length = req->breakCommands.commands.byteLen; - command_line_text = req->breakCommands.commands.text; - execute_command_1(1, queue, "commands %d", - req->breakCommands.request->breakpointId); - command_line_text = (char *)NULL; - command_line_length = 0; - doing_breakcommands_message = 0; - break; - case ShowValueRType: - { - char expr[100], *p = expr; - - expr[0] = 0; - - if (req->showValue.request->ref_type == CValuePointerRef) - strcat(expr, "* "); - - if (req->showValue.type_cast.byteLen) - { - strcat(expr, "("); - strncat(expr, req->showValue.type_cast.text, - req->showValue.type_cast.byteLen); - strcat(expr, ") "); - } - - if (req->showValue.field.byteLen) - strcat(expr, "("); - - strncat(expr, req->showValue.expression.text, - req->showValue.expression.byteLen); - - if (req->showValue.field.byteLen) - { - strcat(expr, ")"); - - strncat(expr, req->showValue.field.text, - req->showValue.field.byteLen); - } - - execute_command_1(1, queue, "print %s", expr); - } - break; - case SetValueRType: - { - char expr[100], *p = expr; - - expr[0] = 0; - - if (req->setValue.request->ref_type == CValuePointerRef) - strcat(expr, "* "); - -#if 0 - if (req->setValue.type_cast.byteLen) - { - strcat(expr, "("); - strncat(expr, req->setValue.type_cast.text, - req->setValue.type_cast.byteLen); - strcat(expr, ") "); - } -#endif - if (req->setValue.field.byteLen) - strcat(expr, "("); - - strncat(expr, req->setValue.expression.text, - req->setValue.expression.byteLen); - - if (req->setValue.field.byteLen) - { - strcat(expr, ")"); - - strncat(expr, req->setValue.field.text, - req->setValue.field.byteLen); - } - - execute_command_1(1, queue, "print %s = (%s) %s", expr, - req->setValue.type_cast.text, - req->setValue.value.text); - } - break; - default: - fprintf(stderr, "Unknown request type = %d\n", - req->head.request->reqType); - break; - } - free (req); /* Should probably call CVFreeDebuggerRequest() here, but - can't do so if interrupt level has mucked with req-> - request. CVFreeDebuggerRequest() only ends up calling - free() anyway! */ - } -} - -/* Return a bitmask indicating if the kernel or the pty did something - interesting. Set poll to non-zero if you don't want to wait. */ - -static int -wait_for_events(poll) - int poll; -{ - fd_set readfds; - int numfds; - int eventmask = 0; - static struct timeval tv = {0}; - - /* Output all pending requests. */ - CWriteRequestBuffer(conn); - - FD_ZERO(&readfds); - - /* Wait till there's some activity from the kernel or the pty. */ - do - { - FD_SET(kerfd, &readfds); - if (inferior_pty > 0) - FD_SET(inferior_pty, &readfds); - if (poll) - numfds = select(sizeof(readfds)*8, &readfds, 0, 0, &tv); - else - numfds = select(sizeof(readfds)*8, &readfds, 0, 0, 0); - } - while (numfds <= 0 && !poll); - - if (FD_ISSET(inferior_pty, &readfds)) - eventmask |= PTY_EVENT; - - if (FD_ISSET(kerfd, &readfds)) - eventmask |= KERNEL_EVENT; - - return eventmask; -} - -/* This is called from read_command_lines() to provide the text for breakpoint - commands, which is supplied in a BreakCommands message. Each call to this - routine supplies a single line of text, with the newline removed. */ - -/* This routine may be invoked in two different contexts. In the first, it - is being called as a result of the BreakCommands message. In this case, - all of the command text is immediately available. In the second case, it is - called as a result of the user typing the 'command' command. The command - text then needs to be glommed out of UserInput messages (and possibly other - messages as well). The most 'straighforward' way of doing this is to - basically simulate the main loop, but just accumulate the command text - instead of sending it to execute_command(). */ - -char * -cadillac_command_line_input() -{ - char *p; - - if (doing_breakcommands_message) - { - if (command_line_length <= 0) - return (char *)NULL; - - p = command_line_text; - - while (command_line_length-- > 0) - { - if (*command_line_text == '\n') - { - *command_line_text = '\000'; - command_line_text++; - break; - } - command_line_text++; - } - - printf_filtered("%s\n", p); - return p; - } - else - { - /* We come here when the user has typed the 'command' or 'define' command - to the GDB window. We are basically deep inside of the 'command' - command processing routine right now, and will be called to get a new - line of input. We expect that kernel_dispatch will queue up only one - command at a time. */ - - int eventmask; - static char buf[100]; - - eventmask = wait_for_events(0); - - if (eventmask & PTY_EVENT) - pty_to_kernel(); - - if (eventmask & KERNEL_EVENT) - kernel_dispatch(1); /* Queue up commands */ - -/* Note that command has been echoed by the time we get here */ - - p = dequeue_command(); - - if (p) - { - strncpy(buf, p, sizeof(buf)); - free(p); - return buf; - } - else - return NULL; - } -} - -/* Establish contact with the kernel. */ - -void -cadillac_initialize(cadillac_id, execarg) - char *cadillac_id; - char *execarg; -{ - CTtyRequest *req; - char *ctmp; - extern long strtol(char *str, char **ptr, int base); - char pathname[MAXPATHLEN]; - int n; - - if (!execarg) execarg = ""; - - printf("gdb-debugger pid=%d\n", getpid()); /* XXX - debugging only */ - - /* First establish the connection with the kernel. */ - - kerfd = COpenClientSocket(NULL); - if (kerfd < 0) { - printf("COpenClientSocket() failed\n"); - exit(1); - } - - /* Setup for I/O interrupts when appropriate. */ - - n = fcntl(kerfd, F_GETFL, 0); - fcntl(kerfd, F_SETFL, n|FASYNC); - fcntl(kerfd, F_SETOWN, getpid()); - - /* Setup connection buffering. */ - - CSetSocketBufferSize (kerfd, 12000); - - /* Generate a new connection control block. */ - - conn = NewConnection (0, kerfd, kerfd); - if (!conn) { - printf("NewConnection() failed\n"); - exit(1); - } - -#ifdef KERNEL_RECORD - kerout = fopen("kernel.output", "+w"); - - CReadWriteHooks(conn, conn->previewMethod, conn->readMethod, kernel_record); -#endif - - /* Tell the kernel that we are the "debugger". */ - - req = CWriteTtyRequest (conn, QueryConnectionRType); - req->generic.queryconnection.major = 0; - req->generic.queryconnection.minor = 0; - req->generic.queryconnection.cadillacId1=strtol(cadillac_id, &ctmp, 16); - req->generic.queryconnection.cadillacId2 = strtol(++ctmp, NULL, 16); - req->generic.queryconnection.nProtocols = 1; - CWriteProtocol (conn, 0, 0, "debugger"); - CWriteLength (conn); - - /* Tell the kernel that we are actually running. */ - - /* KROCK ALERT!!! The kernel doesn't really care about the arguments to - the program at all! It only cares that argument 7 be the name of the - target program. So, we just fill in the rest of the slots with - padding. I hope the kernel never cares about this! */ - - req = CWriteTtyRequest (conn, RunningProgramRType); - req->runningprogram.argc = 8; - getwd (pathname); - CWriteVstring0 (conn, pathname); - - CWriteVstring0 (conn, "0"); - CWriteVstring0 (conn, "1"); - CWriteVstring0 (conn, "2"); - CWriteVstring0 (conn, "3"); - CWriteVstring0 (conn, "4"); - CWriteVstring0 (conn, "5"); - CWriteVstring0 (conn, "6"); - CWriteVstring0 (conn, execarg); - CWriteLength (conn); - - /* Tell the kernel our PID and all that */ - - program_id = 1; - CVWriteDebugProgramInfo(conn, - getpid(), - program_id, - execarg, - ""); - - /* Tell the rest of the world that Cadillac is now set up. */ - cadillac = 1; - - setsid(); /* Drop controlling tty, become pgrp master */ - getpty(); /* Setup the pty */ - dup2(inferior_tty, 0); /* Attach all GDB I/O to the pty */ - dup2(inferior_tty, 1); - dup2(inferior_tty, 2); -} - -/* This is called from execute_command, and provides a wrapper around - various command routines in a place where both protocol messages and - user input both flow through. -*/ - -void -cadillac_call_command(cmdblk, arg, from_tty) - struct cmd_list_element *cmdblk; - char *arg; - int from_tty; -{ - if (cmdblk->class == class_run) - { - go_busy(); - has_run = 1; - (*cmdblk->function.cfunc)(arg, from_tty); - send_status(); - } - else - (*cmdblk->function.cfunc)(arg, from_tty); - - print_prompt(); -} - -void -cadillac_new_process() -{ - instance_id = inferior_pid; -} - -static void -iosig(signo) - int signo; -{ - while (1) - { - int eventmask; - - eventmask = wait_for_events(1); - - if (eventmask == 0) - return; - - if (eventmask & PTY_EVENT) - pty_to_kernel(); - - if (eventmask & KERNEL_EVENT) - kernel_dispatch(1); - } -} - -int -cadillac_wait(status) - int *status; -{ - int pid; - - signal(SIGIO, iosig); - - pid = wait(status); - - signal(SIGIO, SIG_DFL); - return pid; -} - -static void -null_routine(arg) - int arg; -{ -} - -/* All requests from the Cadillac kernel eventually end up here. */ - -void -cadillac_main_loop() -{ - CTtyRequest *req; - struct cleanup *old_chain; - - doing_breakcommands_message = 0; - -/* We will come thru here any time there is an error, so send status if - necessary. */ - - send_status(); - - print_prompt(); - - /* The actual event loop! */ - - while (1) - { - int eventmask; - char *cmd; - - old_chain = make_cleanup(null_routine, 0); - -/* First, empty out the command queue, then check for new requests. */ - - while (cmd = dequeue_command()) - { - execute_command_1(1, 0, cmd); - free(cmd); - } - - eventmask = wait_for_events(0); - - if (eventmask & PTY_EVENT) - pty_to_kernel(); - - if (eventmask & KERNEL_EVENT) - kernel_dispatch(0); - - bpstat_do_actions(&stop_bpstat); - do_cleanups(old_chain); - } -} diff --git a/gdb/config.gdb b/gdb/config.gdb deleted file mode 100755 index c380fe4..0000000 --- a/gdb/config.gdb +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/sh - -# Shell script to do machine-dependent things in -# preparation for compiling gdb. -# -# Usage: config.gdb machine -# -# If config.gdb succeeds, it leaves its status in config.status. -# If config.gdb fails after disturbing the status quo, -# config.status is removed. - -progname=$0 -host= -target= -list_hosts= -list_targets= -srcdir= - -for arg in $*; do - case $arg in - -srcdir=*|+srcdir=*) - srcdir=`echo $arg | sed 's/[+-]srcdir=//'` - ;; - -host|+host) - list_hosts=true - ;; - -target|+target) - list_targets=true - ;; - -host=*|+host=*) - if [ "$host" = "" ]; then - host=`echo $arg | sed 's/[+-]host=//'` - else - echo Error: Attempt to specify host machine twice - bad=true - fi - ;; - -target=*|+target=*) - if [ "$target" = "" ]; then - target=`echo $arg | sed 's/[+-]target=//'` - else - echo Error: Attempt to specify target machine twice - bad=true - fi - ;; - *) - if [ "$host" = "" ]; then - host=$arg - else - if [ "$target" = "" ]; then - target=$arg - else - echo Error: More arguments than host and target machine names - bad=true - fi - fi - ;; - esac -done - -if [ "$target" = "" ]; then target=$host; fi -if [ "$host" = "" ]; then bad=true; fi - -# Find the source files, if location was not specified -if [ "$srcdir" = "" ]; then - srcdirdefaulted=true - srcdir=. - if [ ! -r main.c ]; then - srcdir=.. - fi -fi -if [ ! -r ${srcdir}/main.c ]; then - if [ "$srcdirdefaulted" != "true" ]; then - echo "$progname: Can't find debugger sources in \`${srcdir}'." 1>&2 - else - echo "$progname: Can't find debugger sources in \`.' or \`..'." 1>&2 - fi - exit 1 -fi - -if [ "$list_hosts" = "true" ]; then - cd $srcdir/xconfig - for i in * ; do -# The {} in ${i} are required or else /bin/sh in sony newsos 3.2 removes -# the quote after it. - awk <$i "NR == 1 { lastchar = substr(\"${i}\", length(\"${i}\"), 1) -if (lastchar != \"~\" && lastchar != \"#\") \ -printf \"%-12s %s\n\", \"${i}\", substr(\$0,2) }" - done -fi - -if [ "$list_targets" = "true" ]; then - cd $srcdir/tconfig - for i in * ; do - awk <$i "NR == 1 { lastchar = substr(\"${i}\", length(\"${i}\"), 1) -if (lastchar != \"~\" && lastchar != \"#\") \ -printf \"%-12s %s\n\", \"${i}\", substr(\$0,2) }" - done -fi - -if [ "$list_hosts" = "true" -o "$list_targets" = "true" ]; then - exit 0 -fi - -if [ "$host" != "" -a ! -f $srcdir/xconfig/$host ]; then - echo "No such host $host" - bad=true -fi - -if [ "$target" != "" -a ! -f $srcdir/tconfig/$target ]; then - echo "No such target $target" - bad=true -fi - -if [ "$bad" = "true" ] ; then - echo "Usage: " - echo " $progname [+srcdir=\`dir'] machine" - echo " For normal usage" - echo " $progname [+srcdir=\`dir'] \`host' \`target'" - echo " $progname [+srcdir=\`dir'] +host=\`host' +target=\`target'" - echo " If you are doing remote debugging between machines of two" - echo " different types (cross-debugging). \`host' is the type of" - echo " machine on which GDB will be running. \`target' is the" - echo " machine that the program you are debugging will be" - echo " running on." - echo " $progname +host" - echo " Print a list of valid host machine types." - echo " $progname +target" - echo " Print a list of valid target machine types." - echo - echo " +srcdir=\`dir' means that the sources are in \`dir'. For" - echo " example, \`cd /obj/hp300; config.gdb +srcdir=/src/gdb hp300'" - echo " If +srcdir is not specified, sources can either be in \`.'" - echo " or \`..'." - echo - - if [ -r config.status ] - then - cat config.status - fi - exit 1 -fi - -rm -f tm.h xm.h - -cat $srcdir/xconfig/$host $srcdir/tconfig/$target | awk '$1 == "#msg" { - print substr($0,6)}' -paramfile=${srcdir}/`awk ' - $1 == "TM_FILE=" { print $2 }' <$srcdir/tconfig/$target` -if [ "$paramfile" != "${srcdir}/" ] ; then - # Make a symlink if possible, otherwise try a hard link - ln -s $paramfile tm.h 2>/dev/null || ln $paramfile tm.h -fi - -paramfile=${srcdir}/`awk ' - $1 == "XM_FILE=" { print $2 }' <$srcdir/xconfig/$host` -if [ "$paramfile" != "${srcdir}/" ] ; then - # Make a symlink if possible, otherwise try a hard link - ln -s $paramfile xm.h 2>/dev/null || ln $paramfile xm.h -fi - -rm -f config.status - -case ${srcdir} in - .) - ;; - *) - echo "srcdir=${srcdir}" >./Makefile.sdir - grep -s "source ${srcdir}/.gdbinit" .gdbinit 2>/dev/null || \ - echo "source ${srcdir}/.gdbinit" >> .gdbinit -esac - -rm -f Makefile -make "srcdir=${srcdir}" \ - "M_MAKEFILE=$srcdir/tconfig/$target $srcdir/xconfig/$host" \ - -f $srcdir/Makefile.dist Makefile - -echo "GDB is now set up for host machine $host and target machine $target." \ - | tee config.status -exit 0 diff --git a/gdb/config.status b/gdb/config.status deleted file mode 100755 index ec87176..0000000 --- a/gdb/config.status +++ /dev/null @@ -1 +0,0 @@ -GDB is now set up for host machine none and target machine none. diff --git a/gdb/config.sub b/gdb/config.sub index dac9ab8..e69de29 100755 --- a/gdb/config.sub +++ b/gdb/config.sub @@ -1,446 +0,0 @@ -#!/bin/sh - -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration (e.g. a typo). - -# Please email any bugs, comments, and/or additions to this file to: -# configure@cygnus.com - -# decode aliases into canonical names - -case "$1" in -# cpu alone is a valid alias for cpu-none-none. -vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc | ns32k \ - | alliant | arm | c1 | c2 | mips | pyramid | tron | a29k \ - | romp | rs6000 | i960 | h8300) - cpu=$1 - vendor=none - os=none - ;; -altos | altos3068) - cpu=m68k - vendor=altos - os=sysv # maybe? - ;; -altosgas) - cpu=m68k - vendor=altos - os=gas - ;; -am29k) - cpu=a29k - vendor=none - os=bsd - ;; -amdahl) - cpu=580 - vendor=amdahl - os=uts - ;; -amigados) - cpu=m68k - vendor=cbm - os=amigados # Native AmigaDOS - ;; -amigaunix | amix) - cpu=m68k - vendor=cbm - os=svr4 # System V Release 4 (svr4 is an industry recognized acronym) - ;; -apollo68) - cpu=m68k - vendor=apollo - os=sysv # maybe? - ;; -balance) - cpu=ns32k - vendor=sequent - os=dynix - ;; -convex-c1) - cpu=c1 - vendor=convex - os=sysv # maybe? - ;; -convex-c2) - cpu=c2 - vendor=convex - os=sysv # maybe? - ;; -cray | ymp) - cpu=ymp - vendor=cray - os=unicos - ;; -cray2) - cpu=cray2 - vendor=cray - os=unicos - ;; -dec3100 | decstatn | decstation | decstation-3100 | pmax | pmin) - cpu=mips - vendor=dec - os=ultrix - ;; -delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - os=sysv # maybe? - ;; - -delta88) - cpu=m88k - vendor=motorola - os=m88kbcs - ;; - -gmicro) - cpu=tron - vendor=gmicro - os=sysv # maybe? - ;; - -h8300hds) - cpu=h8300 - vendor=hitachi - os=hds - ;; - -# start-sanitize-v9 -hal-32 | hal32) - cpu=sparc64 - vendor=hal - os=hal32 - ;; -hal-64 | hal64) - cpu=sparc64 - vendor=hal - os=hal64 - ;; -sparc64) - cpu=sparc64 - vendor=sun - os=v9 - ;; -sparc64-v7 | sparc64v7) - cpu=sparc64 - vendor=sun - os=v7 - ;; -# end-sanitize-v9 -hp300bsd) - cpu=m68k - vendor=hp - os=bsd - ;; -hp300hpux | hpux | hp9k3[2-9][0-9]) - cpu=m68k - vendor=hp - os=hpux - ;; -hp9k31[0-9] | hp9k2[0-9][0-9]) - cpu=m68000 - vendor=hp - os=hpux - ;; -i386sco) - cpu=i386 - vendor=sco - os=sysv # maybe? - ;; -i386v) - cpu=i386 - vendor=none - os=sysv - ;; -i386v32) - cpu=i386 - vendor=none - os=sysv32 - ;; -iris | iris4d) - cpu=mips - vendor=sgi - os=irix # maybe? - ;; - -dpx2) - vendor=bull - cpu=m68k - os=sysv - ;; -isi | isi68) - cpu=m68k - vendor=isi - os=sysv # maybe? - ;; -littlemips) - cpu=mips - vendor=little - os=bsd - ;; -magnum | m3230) - cpu=mips - vendor=mips - os=sysv # maybe? - ;; -merlin) - cpu=ns32k - vendor=utek - os=sysv # maybe? - ;; -miniframe) - cpu=m68000 - vendor=convergent - os=sysv # maybe? - ;; -mmax) - cpu=ns32k - vendor=encore - os=sysv # maybe? - ;; -news | news700 | news800 | news900) - cpu=m68k - vendor=sony - os=newsos3 # Based on bsd-4.3 - ;; -news1000) - cpu=m68030 - vendor=sony - os=newsos3 # ? - ;; -news-3600 | bigmips | risc-news) - cpu=mips - vendor=sony - os=newsos4 # Presumably? - ;; -next) - cpu=m68k - vendor=next - os=sysv # maybe? - ;; -nindy960) - cpu=i960 - vendor=intel - os=nindy - ;; -none) - cpu=none - vendor=none - os=none - ;; -np1) - cpu=np1 - vendor=gould - os=sysv # maybe? - ;; -rtpc) - cpu=romp - vendor=ibm - os=aix # maybe? - ;; -pbd) - cpu=sparc - vendor=unicom - os=sysv - ;; -pn) - cpu=pn - vendor=gould - os=sysv # maybe? - ;; -ps2) - cpu=i386 - vendor=ibm - os=sysv # maybe? - ;; -sun2) - cpu=m68000 - vendor=sun - os=sunos4 - ;; -sun2os3) - cpu=m68000 - vendor=sun - os=sunos3 - ;; -sun2os4) - cpu=m68000 - vendor=sun - os=sunos4 - ;; -sun3) - cpu=m68k - vendor=sun - os=sunos4 - ;; -sun3os3) - cpu=m68k - vendor=sun - os=sunos3 - ;; -sun3os4) - cpu=m68k - vendor=sun - os=sunos4 - ;; -sun386 | roadrunner | sun386i) - cpu=i386 - vendor=sun - os=sunos - ;; -sun4) - cpu=sparc - vendor=sun - os=sunos4 - ;; -sun4os3) - cpu=sparc - vendor=sun - os=sunos3 - ;; -sun4os4) - cpu=sparc - vendor=sun - os=sunos4 - ;; -symmetry) - cpu=i386 - vendor=sequent - os=dynix - ;; -tower | tower-32) - cpu=m68k - vendor=ncr - os=sysv # maybe? - ;; -ultra3) - cpu=a29k - vendor=nyu - os=sym1 - ;; -umax) - cpu=ns32k - vendor=encore - os=sysv # maybe? - ;; -unixpc | safari | pc7300 | 3b1 | 7300 | 7300-att | att-7300) - cpu=m68k - vendor=att - os=sysv # maybe? - ;; -vax-dec) - cpu=vax - vendor=dec - os=ultrix # maybe? - ;; -vxworks68) - cpu=m68k - vendor=wrs - os=vxworks - ;; -vxworks960) - cpu=i960 - vendor=wrs - os=vxworks - ;; -xmp) - cpu=xmp - vendor=cray - os=unicos - ;; -# not an alias. parse what we expect to be a canonical name. -*) - cpu=`echo $1 | sed 's/-.*$//'` - - if [ "${cpu}" = "$1" ] ; then - # no vendor so this is an invalid name. - echo '***' No vendor: configuration \`$1\' not recognized 1>&2 - exit 1 - else - # parse out vendor - rest=`echo $1 | sed "s/${cpu}-//"` - vendor=`echo ${rest} | sed 's/-.*$//'` - - if [ "${vendor}" = "${rest}" ] ; then - # a missing os is acceptable - os=none - else - os=`echo ${rest} | sed "s/${vendor}-//"` - fi - fi - ;; -esac - -# At this point we should have three parts of a canonical name in cpu, -# vendor, and os. - -# verify that the cpu is known. - -case "${cpu}" in -none | vax | tahoe | i386 | i860 | m68k | m68000 | m88k | sparc \ - | ns32k | alliant | arm | c1 | c2 | mips | pyramid | tron \ - | a29k | romp | rs6000 | i960 | xmp | ymp | cray2 | 580 | h8300) - ;; - -# start-sanitize-v9 -sparc64) ;; -# end-sanitize-v9 - -*) - echo '***' Invalid cpu \`${cpu}\': configuration \`$1\' not recognized 1>&2 - exit 1 - ;; -esac - -# verify that the vendor is known. - -case "${vendor}" in - altos | amdahl | aout | apollo | att | bcs | bout |\ - cbm | convergent | convex | coff | cray | dec | encore |\ - gould | hitachi | intel | isi | hp | ibm | little | mips | motorola |\ - ncr | next | none | nyu | sco | sequent | sgi | sony | sun |\ - unicom | utek | wrs | bull ) ;; - -# start-sanitize-v9 -hal) ;; -# end-sanitize-v9 - -*) - echo '***' Invalid vendor \`${vendor}\': configuration \`$1\' not recognized 1>&2 - exit 1 - ;; -esac - -# verify that the os is known, if it exists. - -case "${os}" in -aix* | aout | bout | bsd* | coff | ctix* | dynix* | esix* | hpux* \ - | hds | irix* | isc* | kern | mach* | newsos* | nindy* | none \ - | osf* | sco* | sunos* | sysv* | ultrix* | unos* | v88r* \ - | vms* | vxworks* | sym[1-9]* | unicos* | uts | svr4 \ - | amigados) - ;; - -# start-sanitize-v9 -hal32 | hal64 | v7 | v9) ;; -# end-sanitize-v9 - -*) - echo '***' Invalid os \`${os}\': configuration \`$1\' not recognized 1>&2 - exit 1 - ;; -esac - -echo ${cpu}-${vendor}-${os} diff --git a/gdb/config/altosgas.mh b/gdb/config/altosgas.mh deleted file mode 100644 index b9b231a..0000000 --- a/gdb/config/altosgas.mh +++ /dev/null @@ -1,9 +0,0 @@ -# Host: Altos 3068 (68k, System V release 2), using COFF encapsulation -#msg Use of the coff encapsulation features require the GNU binutils utilities -#msg To be ahead of their System V counterparts in your path. - -XDEPFILES= infptrace.o altos-xdep.o -XM_FILE= xm-altos.h -REGEX=regex.o -REGEX1=regex.o -SYSV_DEFINE=-DSYSV diff --git a/gdb/config/altosgas.mt b/gdb/config/altosgas.mt deleted file mode 100644 index 7c2912e..0000000 --- a/gdb/config/altosgas.mt +++ /dev/null @@ -1,7 +0,0 @@ -# Target: Altos 3068 (68k, System V release 2), using COFF encapsulation - -#msg Use of the coff encapsulation features require the GNU binutils utilities -#msg To be ahead of their System V counterparts in your path. - -TDEPFILES= m68k-pinsn.o exec.o -TM_FILE= tm-altosgas.h diff --git a/gdb/config/am29k b/gdb/config/am29k deleted file mode 100755 index 562e43f..0000000 --- a/gdb/config/am29k +++ /dev/null @@ -1,5 +0,0 @@ -# Target: AMD 29000 on EB29K board over a serial line. -TDEPFILES= exec.o am29k-pinsn.o remote-eb.o am29k-tdep.o -TM_FILE= tm-29k.h -# The following is for ../include/a.out.encap.h -TM_CFLAGS = -DCOFF_ENCAPSULATE -DTARGET=TARGET_AM29K diff --git a/gdb/config/go32.mt b/gdb/config/go32.mt deleted file mode 100644 index a37facd..0000000 --- a/gdb/config/go32.mt +++ /dev/null @@ -1,10 +0,0 @@ - - -fishall: - echo "Can't make GDB for go32 (yet :) " - touch $(OBS) - touch $(RAPP_OBS) - touch $(TSOBS) - touch $(NTSSTART) - touch gdb - diff --git a/gdb/config/i386sco.mt b/gdb/config/i386sco.mt deleted file mode 100644 index 720eea2..0000000 --- a/gdb/config/i386sco.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: Intel 386 running SCO Unix (pre-SVR4) -TDEPFILES= exec.o i386-tdep.o i386-pinsn.o -TM_FILE= tm-i386v.h diff --git a/gdb/config/i386v-g.mh b/gdb/config/i386v-g.mh deleted file mode 100644 index 2316ffb..0000000 --- a/gdb/config/i386v-g.mh +++ /dev/null @@ -1,7 +0,0 @@ -# Host: Intel 386 running System V, using COFF encapsulation -XDEPFILES= infptrace.o coredep.o i386-xdep.o i387-tdep.o -XM_FILE= xm-i386v.h -XM_CLIBS= -lPW -SYSV_DEFINE=-DSYSV -REGEX=regex.o -REGEX1=regex.o diff --git a/gdb/config/i386v-g.mt b/gdb/config/i386v-g.mt deleted file mode 100644 index cd07b5c..0000000 --- a/gdb/config/i386v-g.mt +++ /dev/null @@ -1,7 +0,0 @@ -# Target: Intel 386 running System V, using COFF encapsulation - -#msg Use of the COFF encapsulation features requires the GNU binary utilities -#msg to be ahead of their System V counterparts in your path. - -TDEPFILES= exec.o i386-tdep.o i386-pinsn.o -TM_FILE= tm-i386v-g.h diff --git a/gdb/config/i386v32-g.mh b/gdb/config/i386v32-g.mh deleted file mode 100644 index 0349512..0000000 --- a/gdb/config/i386v32-g.mh +++ /dev/null @@ -1,7 +0,0 @@ -# Host: Intel 386 running System V release 3.2, using COFF encapsulation -XDEPFILES= infptrace.o coredep.o i386-xdep.o i387-tdep.o -XM_FILE= xm-i386v32.h -XM_CLIBS= -lPW -SYSV_DEFINE=-DSYSV -REGEX=regex.o -REGEX1=regex.o diff --git a/gdb/config/i386v32-g.mt b/gdb/config/i386v32-g.mt deleted file mode 100644 index e2cd6b4..0000000 --- a/gdb/config/i386v32-g.mt +++ /dev/null @@ -1,7 +0,0 @@ -# Target: Intel 386 running System V release 3.2, using COFF encapsulation - -#msg Use of the COFF encapsulation features requires the GNU binary utilities -#msg to be ahead of their System V counterparts in your path. - -TDEPFILES= exec.o i386-tdep.o i386-pinsn.o -TM_FILE= tm-i386v-g.h diff --git a/gdb/config/i386v32.mt b/gdb/config/i386v32.mt deleted file mode 100644 index 1ca4cae..0000000 --- a/gdb/config/i386v32.mt +++ /dev/null @@ -1,4 +0,0 @@ -# Target: Intel 386 running System V release 3.2 -TDEPFILES= exec.o i386-tdep.o i386-pinsn.o -TM_FILE= tm-i386v.h -MT_CFLAGS= diff --git a/gdb/config/i960.mt b/gdb/config/i960.mt deleted file mode 100644 index f6a7556..0000000 --- a/gdb/config/i960.mt +++ /dev/null @@ -1,5 +0,0 @@ -# Target: Intel 80960, under NINDY or under VxWorks, selected at runtime. -#msg -#msg You must specify either "nindy960" or "vxworks960"; there is no -#msg generic i960 target any more. -#msg diff --git a/gdb/config/mh-vax b/gdb/config/mh-vax deleted file mode 100755 index 79ecb09..0000000 --- a/gdb/config/mh-vax +++ /dev/null @@ -1,12 +0,0 @@ -# Host: DEC VAX running BSD or Ultrix -# The following types of /bin/cc failures have been observed: -# 1. Something in readline.c which I have never seen -# 2. ``"values.c", line 816: compiler error: schain botch'' -#msg /bin/cc has been known to fail on VAXen running BSD4.3 -#msg If this occurs, use gcc -#msg (but see comments in Makefile.dist about compiling with gcc). - -XDEPFILES= infptrace.o coredep.o -REGEX=regex.o -REGEX1=regex.o -XM_FILE= xm-vax.h diff --git a/gdb/config/mt-h8300hds b/gdb/config/mt-h8300hds deleted file mode 100755 index fbc6ac9..0000000 --- a/gdb/config/mt-h8300hds +++ /dev/null @@ -1,4 +0,0 @@ -# Target: H8300 with HDS monitor -TDEPFILES= exec.o h8300-tdep.o hds-tdep.o -TM_FILE= tm-h8300.h -TM_CFLAGS= diff --git a/gdb/config/news1000.mt b/gdb/config/news1000.mt deleted file mode 100644 index ca16e59..0000000 --- a/gdb/config/news1000.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: Sony news series 1000 (68030) running NewsOS version 3. -TDEPFILES= m68k-pinsn.o exec.o -TM_FILE= tm-news.h diff --git a/gdb/config/sun3.mh b/gdb/config/sun3.mh deleted file mode 100644 index 4ec8d54..0000000 --- a/gdb/config/sun3.mh +++ /dev/null @@ -1,3 +0,0 @@ -# Host: Sun 3, running SunOS 4 -XDEPFILES= infptrace.o sun3-xdep.o -XM_FILE= xm-sun3os4.h diff --git a/gdb/config/sun3.mt b/gdb/config/sun3.mt deleted file mode 100644 index 9c93c56..0000000 --- a/gdb/config/sun3.mt +++ /dev/null @@ -1,8 +0,0 @@ -# Target: Sun 3, running SunOS 4, as a target system -# The system-supplied assembler re-orders the symbols so that gdb -# can't find "gcc_compiled.". -#msg If you compile your program with GCC, use the GNU assembler. -#msg - -TDEPFILES= exec.o m68k-pinsn.o solib.o m68k-tdep.o -TM_FILE= tm-sun3os4.h diff --git a/gdb/config/sun4.mh b/gdb/config/sun4.mh deleted file mode 100644 index 1769007..0000000 --- a/gdb/config/sun4.mh +++ /dev/null @@ -1,3 +0,0 @@ -# Host: Sun 4 or Sparcstation, running SunOS 4 -XDEPFILES= infptrace.o sparc-xdep.o ser-termios.o -XM_FILE= xm-sun4os4.h diff --git a/gdb/config/sun4.mt b/gdb/config/sun4.mt deleted file mode 100644 index 39928b8..0000000 --- a/gdb/config/sun4.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: Sun 4 or Sparcstation, running SunOS 4 -TDEPFILES= exec.o sparc-tdep.o sparc-pinsn.o solib.o -TM_FILE= tm-sun4os4.h diff --git a/gdb/config/sun4os3.mh b/gdb/config/sun4os3.mh deleted file mode 100644 index 742c9cb..0000000 --- a/gdb/config/sun4os3.mh +++ /dev/null @@ -1,3 +0,0 @@ -# Host: Sun 4 or Sparcstation, running SunOS 3 -XDEPFILES= infptrace.o sparc-xdep.o -XM_FILE= xm-sparc.h diff --git a/gdb/config/sun4os3.mt b/gdb/config/sun4os3.mt deleted file mode 100644 index b1890e8..0000000 --- a/gdb/config/sun4os3.mt +++ /dev/null @@ -1,8 +0,0 @@ -# Target: Sun 4 or Sparcstation, running SunOS 3 -# The system-supplied assembler re-orders the symbols so that gdb -# can't find "gcc_compiled.". -#msg If you compile your program with GCC, use the GNU assembler. -#msg - -TDEPFILES= exec.o sparc-tdep.o sparc-pinsn.o -TM_FILE= tm-sparc.h diff --git a/gdb/config/sun4os5.mh b/gdb/config/sun4os5.mh deleted file mode 100755 index 8ec7ab8..0000000 --- a/gdb/config/sun4os5.mh +++ /dev/null @@ -1,29 +0,0 @@ -# Host: Sun 4 or Sparcstation, running SunOS 5 -XDEPFILES= procfs.o -XM_FILE= xm-sun4os5.h -SYSV_DEFINE=-DSYSV -REGEX=regex.o -REGEX1=regex.o - -# We need to find alloca() somewhere. Gcc has one built in, but most other -# compilers don't. Using the one in /usr/ucblib/libucb.a is tricky because -# we have to be careful not to pull in anything else from the library (lots -# of things are broken in most SVR4 versions). The best solution is to just -# compile alloca.c and link it into the executable. If we end up not needing -# it, then the code is just dead. Once alloca.c moves to libiberty, then we -# can eliminate this semi-kludge. -####ALLOCA=alloca.o -####ALLOCA1=alloca.o - -# SVR4 comes standard with terminfo, and in some implementations, the -# old termcap descriptions are incomplete. So ensure that we use the -# new terminfo interface and latest terminal descriptions. -TERMCAP=-ltermlib - -# SVR4 puts the BSD compatible install in /usr/ucb. -INSTALL = /usr/ucb/install -c - -# Sun's compilers require the -xs option to produce debug information -# in the final linked executable. Otherwise they leave it in the .o -# files only, with undocumented pointers to it in the linked executable. -MH_CFLAGS=-xs diff --git a/gdb/config/sun4os5.mt b/gdb/config/sun4os5.mt deleted file mode 100755 index 3f797ab..0000000 --- a/gdb/config/sun4os5.mt +++ /dev/null @@ -1,3 +0,0 @@ -# Target: Sun 4 or Sparcstation, running SunOS 5 -TDEPFILES= exec.o sparc-tdep.o sparc-pinsn.o solib.o -TM_FILE= tm-sun4os5.h diff --git a/gdb/configure b/gdb/configure deleted file mode 100755 index 5b73541..0000000 --- a/gdb/configure +++ /dev/null @@ -1,882 +0,0 @@ -#!/bin/sh - -# Configuration script -# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc. - -#This file is part of GNU. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -# $Id$ - -# -# Shell script to create proper links to machine-dependent files in -# preparation for compilation. -# -# If configure succeeds, it leaves its status in config.status. -# If configure fails after disturbing the status quo, -# config.status is removed. -# - -remove=rm -hard_link=ln -symbolic_link='ln -s' - -#for Test -#remove="echo rm" -#hard_link="echo ln" -#symbolic_link="echo ln -s" - -progname=$0 - -# clear some things potentially inherited from environment. -ansi= -arguments=$* -defaulttargets= -destdir= -fatal= -hostsubdir= -Makefile=Makefile -Makefile_in=Makefile.in -norecursion= -recurring= -removing= -srcdir= -srctrigger= -target= -targets= -commontargets= -configdirs= -targetsubdir= -template= -verbose= - -for arg in $*; -do - case ${arg} in - -ansi | +a*) - ansi=true - clib=clib - ;; - -destdir=* | +destdir=* | +destdi=* | +destd=* | +dest=* | +des=* | +de=* | +d=*) - destdir=`echo ${arg} | sed 's/[+-]d[a-z]*=//'` - ;; - -languages=* | +languages=* | +language=* | +languag=* \ - | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \ - | +l=*) - languages="${languages} `echo ${arg} | sed 's/[+-]l[a-z]*=//'`" - ;; - -gas | +g*) - gas=yes - ;; - -help | +h*) - fatal=true - ;; - -nfp | +nf*) - nfp=yes - ;; - -norecursion | +no*) - norecursion=true - ;; - -recurring | +recurring | +recurrin | +recurri | +recurr | +recur | +recu | +rec | +re) - recurring=true - ;; - -rm | +rm) - removing=${arg} - ;; -# -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*) -# srcdir=`echo ${arg} | sed 's/[+-]s[a-z]*=//'` -# ;; - -subdirs | +f* | +su*) - subdirs=${arg} - ;; - -target=* | +target=* | +targe=* | +targ=* | +tar=* | +ta=*) - if [ -n "${targets}" ] ; then - subdirs="+subdirs" - fi - - newtargets="${targets} `echo ${arg} | sed 's/[+-]t[a-z]*=//'`" - targets="${newtargets}" - ;; - -template=* | +template=* | +templat=* | +templa=* | +templ=* | +temp=* | +tem=* | +te=*) - template=`echo ${arg} | sed 's/[+-]template=//'` - ;; - -v | -verbose | +v*) - verbose=${arg} - ;; - -* | +*) - (echo ; - echo "Unrecognized option: \"${arg}\"". ; - echo) 1>&2 - fatal=true - ;; - *) - if [ -n "${hosts}" ] ; then - subdirs="+subdirs" - fi - - newhosts="${hosts} ${arg}" - hosts=${newhosts} - ;; - esac -done - -if [ -n "${verbose}" ] ; then - echo `pwd`/configure $* -fi - -# process host and target only if not rebuilding configure itself or removing. -if [ -z "${template}" -a -z "${removing}" -a -z "${fatal}" ] ; then - # Complain if an arg is missing - if [ -z "${hosts}" ] ; then - (echo ; - echo "configure: No HOST specified." ; - echo) 1>&2 - fatal=true - fi -fi - -if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then - (echo "Usage: configure HOST" ; - echo ; - echo "Options: [defaults in brackets]" ; - echo " +ansi configure w/ANSI library. [no ansi lib]" ; - echo " +destdir=MYDIR configure for installation into MYDIR. [/usr/local]" ; - echo " +subdirs configure in subdirectories. [in source directories]" ; - echo " +lang=LANG configure to build LANG. [gcc]" ; - echo " +help print this message. [normal config]" ; - echo " +gas configure the compilers for use with gas. [native as]" ; - echo " +nfp configure the compilers default to soft floating point. [hard float]" ; - echo " +norecursion configure this directory only. [recurse]" ; - echo " +rm remove this configuration. [build a configuration]" ; - echo " +target=TARGET configure for TARGET. [TARGET = HOST]" ; - echo " +template=TEM rebuild configure using TEM. [normal config]" ; - echo ; - echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; - echo "Asking for more than one \"+target\" implies \"+subdirs\". Any other" ; - echo "options given will apply to all targets.") 1>&2 - - if [ -r config.status ] ; then - cat config.status - fi - - exit 1 -fi - -#### configure.in common parts come in here. -srcname="GDB" -srctrigger=main.c - -## end of common part. - -# are we rebuilding config itself? -if [ -n "${template}" ] ; then - if [ ! -r ${template} ] ; then - echo '***' "Can't find template ${template}." 1>&2 - exit 1 - fi - -# prep the template - sed -e '/^#### configure.in common parts come in here.$/,/^## end of common part.$/c\ -#### configure.in common parts come in here.\ -## end of common part.' \ - -e '/^#### configure.in per-host parts come in here.$/,/^## end of per-host part.$/c\ -#### configure.in per-host parts come in here.\ -## end of per-host part.' \ - -e '/^#### configure.in per-target parts come in here.$/,/^## end of per-target part.$/c\ -#### configure.in per-target parts come in here.\ -## end of per-target part.' \ - -e '/^#### configure.in post-target parts come in here.$/,/^## end of post-target part.$/c\ -#### configure.in post-target parts come in here.\ -## end of post-target part.' \ - < ${template} > template.new - - if [ -r configure.in ] ; then - if [ -z "`grep '^# per\-host:' configure.in`" ] ; then - echo '***' `pwd`/configure.in has no "per-host:" line. 1>&2 - exit 1 - fi - - if [ -z "`grep '^# per\-target:' configure.in`" ] ; then - echo '***' `pwd`/configure.in has no "per-target:" line. 1>&2 - exit 1 - fi - - # split configure.in into common, per-host, per-target, - # and post-target parts. Post-target is optional. - sed -e '/^# per\-host:/,$d' configure.in > configure.com - sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' configure.in > configure.hst - if grep -s '^# post-target:' configure.in ; then - sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' configure.in > configure.tgt - sed -e '1,/^# post\-target:/d' configure.in > configure.pos - else - sed -e '1,/^# per\-target:/d' configure.in > configure.tgt - echo >configure.pos - fi - - # and insert them - sed -e '/^#### configure.in common parts come in here.$/ r configure.com' \ - -e '/^#### configure.in per\-host parts come in here.$/ r configure.hst' \ - -e '/^#### configure.in per\-target parts come in here.$/ r configure.tgt' \ - -e '/^#### configure.in post\-target parts come in here.$/ r configure.pos' \ - template.new > configure.new - - rm -f configure.com configure.tgt configure.hst configure.pos - else - echo Warning: no configure.in in `pwd` - cat ${template} >> configure - fi - - chmod a+x configure.new - rm template.new -# mv configure configure.old - mv configure.new configure - - if [ -n "${verbose}" ] ; then - echo Rebuilt configure in `pwd` - fi - - # Now update config.sub from the template directory. - if echo "$template" | grep -s 'configure$' ; then - cp `echo "$template" | sed s/configure$/config.sub/` ./config.sub.new - # mv config.sub config.sub.old - mv config.sub.new config.sub - - if [ -n "${verbose}" ] ; then - echo Rebuilt config.sub in `pwd` - fi - fi - - if [ -z "${norecursion}" ] ; then - # If template is relative path, make it absolute for recurring. - if echo "${template}" | grep -s '^/' ; then - true - else - template=`pwd`/${template} - fi - - while [ -n "${configdirs}" ] ; do - # set configdir to car of configdirs, configdirs to cdr of configdirs - set ${configdirs}; configdir=$1; shift; configdirs=$* - - if [ "`echo ${configdir}.*`" != "${configdir}.*" ] ; then - targetspecificdirs=${configdir}.* - else - targetspecificdirs= - fi - - for i in ${configdir} ${targetspecificdirs} ; do - if [ -d $i ] ; then - if [ -r $i/configure ] ; then - (cd $i ; - ./configure +template=${template} ${verbose}) - else - echo Warning: No configure script in `pwd`/$i - fi - else - if [ -n "${verbose}" ] ; then - echo Warning: directory $i is missing. - fi - fi - done - done - fi - - exit 0 -fi - -# some sanity checks on configure.in -if [ -z "${srctrigger}" ] ; then - echo Warning: srctrigger not set in configure.in. `pwd` not configured. - exit 1 -fi - -for host in ${hosts} ; do - # Default other arg - if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then - targets=${host} - defaulttargets=true - fi - - host_alias=${host} - - result=`/bin/sh ./config.sub ${host}` - host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` - host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` - host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` - host=${host_cpu}-${host_vendor}-${host_os} - host_makefile_frag=config/hmake-${host} - -#### configure.in per-host parts come in here. - -# map host info into gdb names. - -case "${host_cpu}" in - -m68k) - case "${host_vendor}" in - att) gdb_host=3b1 ;; - altos) - case "${host_os}" in - gas) gdb_host=altosgas ;; - *) gdb_host=altos ;; - esac - ;; - hp) - case ${host_os} in - hpux) gdb_host=hp300hpux ;; - bsd) gdb_host=hp300bsd ;; - esac - ;; - - isi) gdb_host=isi ;; - sony) gdb_host=news ;; - sun) - case "${host_os}" in - sunos3) gdb_host=sun3os3 ;; - sunos4) gdb_host=sun3os4 ;; - *) gdb_host=sun3 ;; - esac - ;; - esac - ;; - -m68000) - case "${host_vendor}" in - sun) - case "${host_os}" in - sunos3) gdb_host=sun2os3 ;; - sunos4) gdb_host=sun2os4 ;; - *) gdb_host=sun2 ;; - esac - esac - ;; - -sparc) - case "${host_os}" in - sunos3) gdb_host=sun4os3 ;; - sunos4) gdb_host=sun4os4 ;; - *) gdb_host=sun4 ;; - esac - ;; - -m68030) - case "${host_vendor}" in - sony) gdb_host=news1000 ;; - esac - ;; - -mips) - case "${host_vendor}" in - sony) gdb_host=bigmips ;; - dec) gdb_host=dec3100 ;; - little) gdb_host=littlemips ;; - sgi) gdb_host=irix3 ;; - esac - ;; - -i386) - case "${host_vendor}" in - sun) gdb_host=sun386 ;; - sco) gdb_host=i386sco ;; - sequent) gdb_host=symmetry ;; - *) - case "${host_os}" in - sysv) gdb_host=i386v ;; - sysv32) gdb_host=i386v32 ;; - esac - ;; - esac - ;; - -c1 | c2) gdb_host=convex ;; - -ns32k) - case "${host_vendor}" in - umax) gdb_host=umax ;; - esac - ;; - -romp) - gdb_host=rtbsd - ;; - -a29k) - gdb_host=ultra3 - ;; - -arm | vax | m88k | merlin | none | np1 | pn | pyramid | tahoe) - gdb_host=${host_cpu} - ;; - -### unhandled hosts -#altosgas -#i386v-g -#i386v32-g - -esac - -if [ ! -f xconfig/${gdb_host} ]; then - echo '***' "Gdb does not support host ${host}" 1>&2 - exit 1 -fi - -# We really shouldn't depend on there being a space after XM_FILE= ... -hostfile=`awk '$1 == "XM_FILE=" { print $2 }' &2 - exit 1 -fi - -if [ -z "${removing}" ] ; then - cat xconfig/${gdb_host} tconfig/${gdb_target} | awk '$1 == "#msg" { - print substr($0,6)}' -fi - -# We really shouldn't depend on there being a space after TM_FILE= ... -targetfile=`awk '$1 == "TM_FILE=" { print $2 }' &1 | grep Target- | grep -v Target-independent`" ] ; then - rm -rf ${hostsubdir} - fi - else - echo Warning: no `pwd`/${hostsubdir} to remove. - fi - else - rm -f ${Makefile} config.status ${links} - fi - else - if [ -n "${subdirs}" ] ; then - # check for existing status before allowing forced subdirs. - if [ -f ${Makefile} ] ; then - echo '***' "${Makefile} already exists in source directory. `pwd` not configured." 1>&2 - exit 1 - fi - - if [ ! -d ${hostsubdir} ] ; then mkdir ${hostsubdir} ; fi - cd ${hostsubdir} - - if [ ! -d ${targetsubdir} ] ; then - if [ -z "${commontargets}" ] ; then - mkdir ${targetsubdir} - else - if [ ! -d Target-independent ] ; then - mkdir Target-independent - fi - - ${symbolic_link} Target-independent ${targetsubdir} - fi # if target independent - fi # if no target dir yet - - cd ${targetsubdir} - - srcdir=../.. - else - # if not subdir builds, then make sure none exist. - if [ -n "`(ls .) 2>&1 | grep Host-`" ] ; then - echo '***' "Configured subdirs exist. `pwd` not configured." 1>&2 - exit 1 - fi - fi - - # Find the source files, if location was not specified. - if [ -z "${srcdir}" ] ; then - srcdirdefaulted=1 - srcdir=. - if [ -n "${srctrigger}" -a ! -r ${srctrigger} ] ; then - srcdir=.. - fi - fi - - if [ -n "${srctrigger}" -a ! -r ${srcdir}/${srctrigger} ] ; then - if [ -z "${srcdirdefaulted}" ] ; then - echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/${srcdir}" 1>&2 - else - echo '***' "${progname}: Can't find ${srcname} sources in `pwd`/. or `pwd`/.." 1>&2 - fi - - echo '***' \(At least ${srctrigger} is missing.\) 1>&2 - exit 1 - fi - - # Set up the list of links to be made. - # ${links} is the list of link names, and ${files} is the list of names to link to. - - # Make the links. - while [ -n "${files}" ] ; do - # set file to car of files, files to cdr of files - set ${files}; file=$1; shift; files=$* - set ${links}; link=$1; shift; links=$* - - if [ ! -r ${srcdir}/${file} ] ; then - echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 - echo '***' "since the file \"${file}\" does not exist." 1>&2 - exit 1 - fi - - ${remove} -f ${link} - rm -f config.status - # Make a symlink if possible, otherwise try a hard link - ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link} - - if [ ! -r ${link} ] ; then - echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 - exit 1 - fi - - if [ -n "${verbose}" ] ; then - echo "Linked \"${link}\" to \"${srcdir}/${file}\"." - fi - done - - # Create a .gdbinit file which runs the one in srcdir - # and tells GDB to look there for source files. - - case ${srcdir} in - .) - ;; - *) - echo "dir ." > .gdbinit - echo "dir ${srcdir}" >> .gdbinit - echo "source ${srcdir}/.gdbinit" >> .gdbinit - ;; - esac - - # Install a makefile, and make it set VPATH - # if necessary so that the sources are found. - # Also change its value of srcdir. - - # FIXME-someday: This business of always writing to .tem and mv back - # is so that I don't screw things up while developing. Once this - # template is stable, these should be optimized. xoxorich. - - # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. - if [ "${host}" != "${target}" ] ; then - echo "CROSS=-DCROSS_COMPILE" > ${Makefile} - echo "ALL=start.encap" >> ${Makefile} - else - echo "ALL=all.internal" > ${Makefile} - fi - - # set target, host, VPATH - echo "host_alias = ${host_alias}" >> ${Makefile} - echo "host_cpu = ${host_cpu}" >> ${Makefile} - echo "host_vendor = ${host_vendor}" >> ${Makefile} - echo "host_os = ${host_os}" >> ${Makefile} - - echo "target_alias = ${target_alias}" >> ${Makefile} - echo "target_cpu = ${target_cpu}" >> ${Makefile} - echo "target_vendor = ${target_vendor}" >> ${Makefile} - echo "target_os = ${target_os}" >> ${Makefile} - - if [ -n "${subdirs}" ] ; then - echo "subdir = /${hostsubdir}/${targetsubdir}" >> ${Makefile} - else - echo "subdir =" >> ${Makefile} - fi - - # echo "workdir = `pwd`" >> ${Makefile} - echo "VPATH = ${srcdir}" >> ${Makefile} - - # add "Makefile.in" (or whatever it's called) - cat ${srcdir}/${Makefile_in} >> ${Makefile} - - # Conditionalize the makefile for this host. - if [ -f ${srcdir}/${host_makefile_frag} ] ; then - (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ; - sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem - mv Makefile.tem ${Makefile} - fi - - # Conditionalize the makefile for this target. - if [ -f ${srcdir}/${target_makefile_frag} ] ; then - (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ; - sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem - mv Makefile.tem ${Makefile} - fi - - # set srcdir - sed "s@^srcdir = \.@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - # set destdir - if [ -n "${destdir}" ] ; then - sed "s:^destdir =.*$:destdir = ${destdir}:" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - fi - - # reset SUBDIRS - sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - # reset NONSUBDIRS - sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - using= - if [ -f ${srcdir}/${host_makefile_frag} ] ; then - using=" using \"${host_makefile_frag}\"" - fi - - # remove any form feeds. - sed -e "s/ //" ${Makefile} > Makefile.tem - mv Makefile.tem ${Makefile} - - if [ -f ${srcdir}/${target_makefile_frag} ] ; then - if [ -z "${using}" ] ; then - andusing=" using \"${target_makefile_frag}\"" - else - andusing="${using} and \"${target_makefile_frag}\"" - fi - else - andusing=${using} - fi - - if [ -n "${verbose}" -o -z "${recurring}" ] ; then - echo "Created \"${Makefile}\"" in `pwd`${andusing}. - fi - -#### configure.in post-target parts come in here. - -case ${srcdir} in - .) - ;; - *) - grep -s "source ${srcdir}/.gdbinit" .gdbinit 2>/dev/null || \ - echo "source ${srcdir}/.gdbinit" >> .gdbinit -esac - -cat ${srcdir}/alldeps.mak ${srcdir}/depend >>Makefile -## end of post-target part. - - # describe the chosen configuration in config.status. - # Make that file a shellscript which will reestablish - # the same configuration. Used in Makefiles to rebuild - # Makefiles. - - echo "#!/bin/sh -# ${srcname} was configured as follows: -${srcdir}/configure" ${arguments} `if [ -z "${norecursion}" ] ; then echo +norecursion ; else true ; fi` > config.status - chmod a+x config.status - - originaldir=`pwd` - cd ${srcdir} - fi - - # If there are subdirectories, then recurse. - if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then - for configdir in ${configdirs} ; do - if [ -n "${verbose}" ] ; then - echo Configuring ${configdir}... - fi - - if [ -d ${configdir} ] ; then - (cd ${configdir} ; - ./configure +recurring ${host_alias} +target=${target_alias} \ - ${verbose} ${subdirs} ${removing} +destdir=${destdir}) \ - | sed 's/^/ /' - else - if [ -n "${verbose}" ] ; then - echo Warning: directory \"${configdir}\" is missing. - fi - fi - done - fi - done # for each target - - # Now build a Makefile for this host. - if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then - cd ${hostsubdir} - cat > GNUmakefile << E!O!F -# Makefile generated by configure for host ${host_alias}. - -ALL := $(shell ls -d Target-*) - -%: - $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true - -all: -E!O!F - cd .. - fi -done # for each host - -exit 0 - -# -# Local Variables: -# fill-column: 131 -# End: -# - -# end of configure diff --git a/gdb/convex-opcode.h b/gdb/convex-opcode.h deleted file mode 100755 index 523c874..0000000 --- a/gdb/convex-opcode.h +++ /dev/null @@ -1,1677 +0,0 @@ -/* Include information for instruction dissasembly on the Convex. - Copyright (C) 1989, Free Software Foundation. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define xxx 0 -#define rrr 1 -#define rr 2 -#define rxr 3 -#define r 4 -#define nops 5 -#define nr 6 -#define pcrel 7 -#define lr 8 -#define rxl 9 -#define rlr 10 -#define rrl 11 -#define iml 12 -#define imr 13 -#define a1r 14 -#define a1l 15 -#define a2r 16 -#define a2l 17 -#define a3 18 -#define a4 19 -#define a5 20 -#define V 1 -#define S 2 -#define VM 3 -#define A 4 -#define VL 5 -#define VS 6 -#define VLS 7 -#define PSW 8 -/* Prevent an error during "make depend". */ -#if !defined (PC) -#define PC 9 -#endif -#define ITR 10 -#define VV 11 -#define ITSR 12 -#define TOC 13 -#define CIR 14 -#define TTR 15 -#define VMU 16 -#define VML 17 -#define ICR 18 -#define TCPU 19 -#define CPUID 20 -#define TID 21 -char *op[] = { - "", - "v0\0v1\0v2\0v3\0v4\0v5\0v6\0v7", - "s0\0s1\0s2\0s3\0s4\0s5\0s6\0s7", - "vm", - "sp\0a1\0a2\0a3\0a4\0a5\0ap\0fp", - "vl", - "vs", - "vls", - "psw", - "pc", - "itr", - "vv", - "itsr", - "toc", - "cir", - "ttr", - "vmu", - "vml", - "icr", - "tcpu", - "cpuid", - "tid", -}; -struct formstr format0[] = { - {0,0,rrr,V,S,S}, /* mov */ - {0,0,rrr,S,S,V}, /* mov */ - {1,1,rrr,V,V,V}, /* merg.t */ - {2,1,rrr,V,V,V}, /* mask.t */ - {1,2,rrr,V,S,V}, /* merg.f */ - {2,2,rrr,V,S,V}, /* mask.f */ - {1,1,rrr,V,S,V}, /* merg.t */ - {2,1,rrr,V,S,V}, /* mask.t */ - {3,3,rrr,V,V,V}, /* mul.s */ - {3,4,rrr,V,V,V}, /* mul.d */ - {4,3,rrr,V,V,V}, /* div.s */ - {4,4,rrr,V,V,V}, /* div.d */ - {3,3,rrr,V,S,V}, /* mul.s */ - {3,4,rrr,V,S,V}, /* mul.d */ - {4,3,rrr,V,S,V}, /* div.s */ - {4,4,rrr,V,S,V}, /* div.d */ - {5,0,rrr,V,V,V}, /* and */ - {6,0,rrr,V,V,V}, /* or */ - {7,0,rrr,V,V,V}, /* xor */ - {8,0,rrr,V,V,V}, /* shf */ - {5,0,rrr,V,S,V}, /* and */ - {6,0,rrr,V,S,V}, /* or */ - {7,0,rrr,V,S,V}, /* xor */ - {8,0,rrr,V,S,V}, /* shf */ - {9,3,rrr,V,V,V}, /* add.s */ - {9,4,rrr,V,V,V}, /* add.d */ - {10,3,rrr,V,V,V}, /* sub.s */ - {10,4,rrr,V,V,V}, /* sub.d */ - {9,3,rrr,V,S,V}, /* add.s */ - {9,4,rrr,V,S,V}, /* add.d */ - {10,3,rrr,V,S,V}, /* sub.s */ - {10,4,rrr,V,S,V}, /* sub.d */ - {9,5,rrr,V,V,V}, /* add.b */ - {9,6,rrr,V,V,V}, /* add.h */ - {9,7,rrr,V,V,V}, /* add.w */ - {9,8,rrr,V,V,V}, /* add.l */ - {9,5,rrr,V,S,V}, /* add.b */ - {9,6,rrr,V,S,V}, /* add.h */ - {9,7,rrr,V,S,V}, /* add.w */ - {9,8,rrr,V,S,V}, /* add.l */ - {10,5,rrr,V,V,V}, /* sub.b */ - {10,6,rrr,V,V,V}, /* sub.h */ - {10,7,rrr,V,V,V}, /* sub.w */ - {10,8,rrr,V,V,V}, /* sub.l */ - {10,5,rrr,V,S,V}, /* sub.b */ - {10,6,rrr,V,S,V}, /* sub.h */ - {10,7,rrr,V,S,V}, /* sub.w */ - {10,8,rrr,V,S,V}, /* sub.l */ - {3,5,rrr,V,V,V}, /* mul.b */ - {3,6,rrr,V,V,V}, /* mul.h */ - {3,7,rrr,V,V,V}, /* mul.w */ - {3,8,rrr,V,V,V}, /* mul.l */ - {3,5,rrr,V,S,V}, /* mul.b */ - {3,6,rrr,V,S,V}, /* mul.h */ - {3,7,rrr,V,S,V}, /* mul.w */ - {3,8,rrr,V,S,V}, /* mul.l */ - {4,5,rrr,V,V,V}, /* div.b */ - {4,6,rrr,V,V,V}, /* div.h */ - {4,7,rrr,V,V,V}, /* div.w */ - {4,8,rrr,V,V,V}, /* div.l */ - {4,5,rrr,V,S,V}, /* div.b */ - {4,6,rrr,V,S,V}, /* div.h */ - {4,7,rrr,V,S,V}, /* div.w */ - {4,8,rrr,V,S,V}, /* div.l */ -}; -struct formstr format1[] = { - {11,0,xxx,0,0,0}, /* exit */ - {12,0,a3,0,0,0}, /* jmp */ - {13,2,a3,0,0,0}, /* jmpi.f */ - {13,1,a3,0,0,0}, /* jmpi.t */ - {14,2,a3,0,0,0}, /* jmpa.f */ - {14,1,a3,0,0,0}, /* jmpa.t */ - {15,2,a3,0,0,0}, /* jmps.f */ - {15,1,a3,0,0,0}, /* jmps.t */ - {16,0,a3,0,0,0}, /* tac */ - {17,0,a1r,A,0,0}, /* ldea */ - {18,8,a1l,VLS,0,0}, /* ld.l */ - {18,9,a1l,VM,0,0}, /* ld.x */ - {19,0,a3,0,0,0}, /* tas */ - {20,0,a3,0,0,0}, /* pshea */ - {21,8,a2l,VLS,0,0}, /* st.l */ - {21,9,a2l,VM,0,0}, /* st.x */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {22,0,a3,0,0,0}, /* call */ - {23,0,a3,0,0,0}, /* calls */ - {24,0,a3,0,0,0}, /* callq */ - {25,0,a1r,A,0,0}, /* pfork */ - {26,5,a2r,S,0,0}, /* ste.b */ - {26,6,a2r,S,0,0}, /* ste.h */ - {26,7,a2r,S,0,0}, /* ste.w */ - {26,8,a2r,S,0,0}, /* ste.l */ - {18,5,a1r,A,0,0}, /* ld.b */ - {18,6,a1r,A,0,0}, /* ld.h */ - {18,7,a1r,A,0,0}, /* ld.w */ - {27,7,a1r,A,0,0}, /* incr.w */ - {21,5,a2r,A,0,0}, /* st.b */ - {21,6,a2r,A,0,0}, /* st.h */ - {21,7,a2r,A,0,0}, /* st.w */ - {27,8,a1r,S,0,0}, /* incr.l */ - {18,5,a1r,S,0,0}, /* ld.b */ - {18,6,a1r,S,0,0}, /* ld.h */ - {18,7,a1r,S,0,0}, /* ld.w */ - {18,8,a1r,S,0,0}, /* ld.l */ - {21,5,a2r,S,0,0}, /* st.b */ - {21,6,a2r,S,0,0}, /* st.h */ - {21,7,a2r,S,0,0}, /* st.w */ - {21,8,a2r,S,0,0}, /* st.l */ - {18,5,a1r,V,0,0}, /* ld.b */ - {18,6,a1r,V,0,0}, /* ld.h */ - {18,7,a1r,V,0,0}, /* ld.w */ - {18,8,a1r,V,0,0}, /* ld.l */ - {21,5,a2r,V,0,0}, /* st.b */ - {21,6,a2r,V,0,0}, /* st.h */ - {21,7,a2r,V,0,0}, /* st.w */ - {21,8,a2r,V,0,0}, /* st.l */ -}; -struct formstr format2[] = { - {28,5,rr,A,A,0}, /* cvtw.b */ - {28,6,rr,A,A,0}, /* cvtw.h */ - {29,7,rr,A,A,0}, /* cvtb.w */ - {30,7,rr,A,A,0}, /* cvth.w */ - {28,5,rr,S,S,0}, /* cvtw.b */ - {28,6,rr,S,S,0}, /* cvtw.h */ - {29,7,rr,S,S,0}, /* cvtb.w */ - {30,7,rr,S,S,0}, /* cvth.w */ - {28,3,rr,S,S,0}, /* cvtw.s */ - {31,7,rr,S,S,0}, /* cvts.w */ - {32,3,rr,S,S,0}, /* cvtd.s */ - {31,4,rr,S,S,0}, /* cvts.d */ - {31,8,rr,S,S,0}, /* cvts.l */ - {32,8,rr,S,S,0}, /* cvtd.l */ - {33,3,rr,S,S,0}, /* cvtl.s */ - {33,4,rr,S,S,0}, /* cvtl.d */ - {34,0,rr,A,A,0}, /* ldpa */ - {8,0,nr,A,0,0}, /* shf */ - {18,6,nr,A,0,0}, /* ld.h */ - {18,7,nr,A,0,0}, /* ld.w */ - {33,7,rr,S,S,0}, /* cvtl.w */ - {28,8,rr,S,S,0}, /* cvtw.l */ - {35,1,rr,S,S,0}, /* plc.t */ - {36,0,rr,S,S,0}, /* tzc */ - {37,6,rr,A,A,0}, /* eq.h */ - {37,7,rr,A,A,0}, /* eq.w */ - {37,6,nr,A,0,0}, /* eq.h */ - {37,7,nr,A,0,0}, /* eq.w */ - {37,5,rr,S,S,0}, /* eq.b */ - {37,6,rr,S,S,0}, /* eq.h */ - {37,7,rr,S,S,0}, /* eq.w */ - {37,8,rr,S,S,0}, /* eq.l */ - {38,6,rr,A,A,0}, /* leu.h */ - {38,7,rr,A,A,0}, /* leu.w */ - {38,6,nr,A,0,0}, /* leu.h */ - {38,7,nr,A,0,0}, /* leu.w */ - {38,5,rr,S,S,0}, /* leu.b */ - {38,6,rr,S,S,0}, /* leu.h */ - {38,7,rr,S,S,0}, /* leu.w */ - {38,8,rr,S,S,0}, /* leu.l */ - {39,6,rr,A,A,0}, /* ltu.h */ - {39,7,rr,A,A,0}, /* ltu.w */ - {39,6,nr,A,0,0}, /* ltu.h */ - {39,7,nr,A,0,0}, /* ltu.w */ - {39,5,rr,S,S,0}, /* ltu.b */ - {39,6,rr,S,S,0}, /* ltu.h */ - {39,7,rr,S,S,0}, /* ltu.w */ - {39,8,rr,S,S,0}, /* ltu.l */ - {40,6,rr,A,A,0}, /* le.h */ - {40,7,rr,A,A,0}, /* le.w */ - {40,6,nr,A,0,0}, /* le.h */ - {40,7,nr,A,0,0}, /* le.w */ - {40,5,rr,S,S,0}, /* le.b */ - {40,6,rr,S,S,0}, /* le.h */ - {40,7,rr,S,S,0}, /* le.w */ - {40,8,rr,S,S,0}, /* le.l */ - {41,6,rr,A,A,0}, /* lt.h */ - {41,7,rr,A,A,0}, /* lt.w */ - {41,6,nr,A,0,0}, /* lt.h */ - {41,7,nr,A,0,0}, /* lt.w */ - {41,5,rr,S,S,0}, /* lt.b */ - {41,6,rr,S,S,0}, /* lt.h */ - {41,7,rr,S,S,0}, /* lt.w */ - {41,8,rr,S,S,0}, /* lt.l */ - {9,7,rr,S,A,0}, /* add.w */ - {8,0,rr,A,A,0}, /* shf */ - {0,0,rr,A,A,0}, /* mov */ - {0,0,rr,S,A,0}, /* mov */ - {0,7,rr,S,S,0}, /* mov.w */ - {8,0,rr,S,S,0}, /* shf */ - {0,0,rr,S,S,0}, /* mov */ - {0,0,rr,A,S,0}, /* mov */ - {5,0,rr,A,A,0}, /* and */ - {6,0,rr,A,A,0}, /* or */ - {7,0,rr,A,A,0}, /* xor */ - {42,0,rr,A,A,0}, /* not */ - {5,0,rr,S,S,0}, /* and */ - {6,0,rr,S,S,0}, /* or */ - {7,0,rr,S,S,0}, /* xor */ - {42,0,rr,S,S,0}, /* not */ - {40,3,rr,S,S,0}, /* le.s */ - {40,4,rr,S,S,0}, /* le.d */ - {41,3,rr,S,S,0}, /* lt.s */ - {41,4,rr,S,S,0}, /* lt.d */ - {9,3,rr,S,S,0}, /* add.s */ - {9,4,rr,S,S,0}, /* add.d */ - {10,3,rr,S,S,0}, /* sub.s */ - {10,4,rr,S,S,0}, /* sub.d */ - {37,3,rr,S,S,0}, /* eq.s */ - {37,4,rr,S,S,0}, /* eq.d */ - {43,6,rr,A,A,0}, /* neg.h */ - {43,7,rr,A,A,0}, /* neg.w */ - {3,3,rr,S,S,0}, /* mul.s */ - {3,4,rr,S,S,0}, /* mul.d */ - {4,3,rr,S,S,0}, /* div.s */ - {4,4,rr,S,S,0}, /* div.d */ - {9,6,rr,A,A,0}, /* add.h */ - {9,7,rr,A,A,0}, /* add.w */ - {9,6,nr,A,0,0}, /* add.h */ - {9,7,nr,A,0,0}, /* add.w */ - {9,5,rr,S,S,0}, /* add.b */ - {9,6,rr,S,S,0}, /* add.h */ - {9,7,rr,S,S,0}, /* add.w */ - {9,8,rr,S,S,0}, /* add.l */ - {10,6,rr,A,A,0}, /* sub.h */ - {10,7,rr,A,A,0}, /* sub.w */ - {10,6,nr,A,0,0}, /* sub.h */ - {10,7,nr,A,0,0}, /* sub.w */ - {10,5,rr,S,S,0}, /* sub.b */ - {10,6,rr,S,S,0}, /* sub.h */ - {10,7,rr,S,S,0}, /* sub.w */ - {10,8,rr,S,S,0}, /* sub.l */ - {3,6,rr,A,A,0}, /* mul.h */ - {3,7,rr,A,A,0}, /* mul.w */ - {3,6,nr,A,0,0}, /* mul.h */ - {3,7,nr,A,0,0}, /* mul.w */ - {3,5,rr,S,S,0}, /* mul.b */ - {3,6,rr,S,S,0}, /* mul.h */ - {3,7,rr,S,S,0}, /* mul.w */ - {3,8,rr,S,S,0}, /* mul.l */ - {4,6,rr,A,A,0}, /* div.h */ - {4,7,rr,A,A,0}, /* div.w */ - {4,6,nr,A,0,0}, /* div.h */ - {4,7,nr,A,0,0}, /* div.w */ - {4,5,rr,S,S,0}, /* div.b */ - {4,6,rr,S,S,0}, /* div.h */ - {4,7,rr,S,S,0}, /* div.w */ - {4,8,rr,S,S,0}, /* div.l */ -}; -struct formstr format3[] = { - {32,3,rr,V,V,0}, /* cvtd.s */ - {31,4,rr,V,V,0}, /* cvts.d */ - {33,4,rr,V,V,0}, /* cvtl.d */ - {32,8,rr,V,V,0}, /* cvtd.l */ - {0,0,rrl,S,S,VM}, /* mov */ - {0,0,rlr,S,VM,S}, /* mov */ - {0,0,0,0,0,0}, - {44,0,rr,S,S,0}, /* lop */ - {36,0,rr,V,V,0}, /* tzc */ - {44,0,rr,V,V,0}, /* lop */ - {0,0,0,0,0,0}, - {42,0,rr,V,V,0}, /* not */ - {8,0,rr,S,V,0}, /* shf */ - {35,1,rr,V,V,0}, /* plc.t */ - {45,2,rr,V,V,0}, /* cprs.f */ - {45,1,rr,V,V,0}, /* cprs.t */ - {37,3,rr,V,V,0}, /* eq.s */ - {37,4,rr,V,V,0}, /* eq.d */ - {43,3,rr,V,V,0}, /* neg.s */ - {43,4,rr,V,V,0}, /* neg.d */ - {37,3,rr,S,V,0}, /* eq.s */ - {37,4,rr,S,V,0}, /* eq.d */ - {43,3,rr,S,S,0}, /* neg.s */ - {43,4,rr,S,S,0}, /* neg.d */ - {40,3,rr,V,V,0}, /* le.s */ - {40,4,rr,V,V,0}, /* le.d */ - {41,3,rr,V,V,0}, /* lt.s */ - {41,4,rr,V,V,0}, /* lt.d */ - {40,3,rr,S,V,0}, /* le.s */ - {40,4,rr,S,V,0}, /* le.d */ - {41,3,rr,S,V,0}, /* lt.s */ - {41,4,rr,S,V,0}, /* lt.d */ - {37,5,rr,V,V,0}, /* eq.b */ - {37,6,rr,V,V,0}, /* eq.h */ - {37,7,rr,V,V,0}, /* eq.w */ - {37,8,rr,V,V,0}, /* eq.l */ - {37,5,rr,S,V,0}, /* eq.b */ - {37,6,rr,S,V,0}, /* eq.h */ - {37,7,rr,S,V,0}, /* eq.w */ - {37,8,rr,S,V,0}, /* eq.l */ - {40,5,rr,V,V,0}, /* le.b */ - {40,6,rr,V,V,0}, /* le.h */ - {40,7,rr,V,V,0}, /* le.w */ - {40,8,rr,V,V,0}, /* le.l */ - {40,5,rr,S,V,0}, /* le.b */ - {40,6,rr,S,V,0}, /* le.h */ - {40,7,rr,S,V,0}, /* le.w */ - {40,8,rr,S,V,0}, /* le.l */ - {41,5,rr,V,V,0}, /* lt.b */ - {41,6,rr,V,V,0}, /* lt.h */ - {41,7,rr,V,V,0}, /* lt.w */ - {41,8,rr,V,V,0}, /* lt.l */ - {41,5,rr,S,V,0}, /* lt.b */ - {41,6,rr,S,V,0}, /* lt.h */ - {41,7,rr,S,V,0}, /* lt.w */ - {41,8,rr,S,V,0}, /* lt.l */ - {43,5,rr,V,V,0}, /* neg.b */ - {43,6,rr,V,V,0}, /* neg.h */ - {43,7,rr,V,V,0}, /* neg.w */ - {43,8,rr,V,V,0}, /* neg.l */ - {43,5,rr,S,S,0}, /* neg.b */ - {43,6,rr,S,S,0}, /* neg.h */ - {43,7,rr,S,S,0}, /* neg.w */ - {43,8,rr,S,S,0}, /* neg.l */ -}; -struct formstr format4[] = { - {46,0,nops,0,0,0}, /* nop */ - {47,0,pcrel,0,0,0}, /* br */ - {48,2,pcrel,0,0,0}, /* bri.f */ - {48,1,pcrel,0,0,0}, /* bri.t */ - {49,2,pcrel,0,0,0}, /* bra.f */ - {49,1,pcrel,0,0,0}, /* bra.t */ - {50,2,pcrel,0,0,0}, /* brs.f */ - {50,1,pcrel,0,0,0}, /* brs.t */ -}; -struct formstr format5[] = { - {51,5,rr,V,V,0}, /* ldvi.b */ - {51,6,rr,V,V,0}, /* ldvi.h */ - {51,7,rr,V,V,0}, /* ldvi.w */ - {51,8,rr,V,V,0}, /* ldvi.l */ - {28,3,rr,V,V,0}, /* cvtw.s */ - {31,7,rr,V,V,0}, /* cvts.w */ - {28,8,rr,V,V,0}, /* cvtw.l */ - {33,7,rr,V,V,0}, /* cvtl.w */ - {52,5,rxr,V,V,0}, /* stvi.b */ - {52,6,rxr,V,V,0}, /* stvi.h */ - {52,7,rxr,V,V,0}, /* stvi.w */ - {52,8,rxr,V,V,0}, /* stvi.l */ - {52,5,rxr,S,V,0}, /* stvi.b */ - {52,6,rxr,S,V,0}, /* stvi.h */ - {52,7,rxr,S,V,0}, /* stvi.w */ - {52,8,rxr,S,V,0}, /* stvi.l */ -}; -struct formstr format6[] = { - {53,0,r,A,0,0}, /* ldsdr */ - {54,0,r,A,0,0}, /* ldkdr */ - {55,3,r,S,0,0}, /* ln.s */ - {55,4,r,S,0,0}, /* ln.d */ - {56,0,nops,0,0,0}, /* patu */ - {57,0,r,A,0,0}, /* pate */ - {58,0,nops,0,0,0}, /* pich */ - {59,0,nops,0,0,0}, /* plch */ - {0,0,lr,PSW,A,0}, /* mov */ - {0,0,rxl,A,PSW,0}, /* mov */ - {0,0,lr,PC,A,0}, /* mov */ - {60,0,r,S,0,0}, /* idle */ - {0,0,lr,ITR,S,0}, /* mov */ - {0,0,rxl,S,ITR,0}, /* mov */ - {0,0,0,0,0,0}, - {0,0,rxl,S,ITSR,0}, /* mov */ - {61,0,nops,0,0,0}, /* rtnq */ - {62,0,nops,0,0,0}, /* cfork */ - {63,0,nops,0,0,0}, /* rtn */ - {64,0,nops,0,0,0}, /* wfork */ - {65,0,nops,0,0,0}, /* join */ - {66,0,nops,0,0,0}, /* rtnc */ - {67,3,r,S,0,0}, /* exp.s */ - {67,4,r,S,0,0}, /* exp.d */ - {68,3,r,S,0,0}, /* sin.s */ - {68,4,r,S,0,0}, /* sin.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {69,3,r,S,0,0}, /* cos.s */ - {69,4,r,S,0,0}, /* cos.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {70,7,r,A,0,0}, /* psh.w */ - {0,0,0,0,0,0}, - {71,7,r,A,0,0}, /* pop.w */ - {0,0,0,0,0,0}, - {70,7,r,S,0,0}, /* psh.w */ - {70,8,r,S,0,0}, /* psh.l */ - {71,7,r,S,0,0}, /* pop.w */ - {71,8,r,S,0,0}, /* pop.l */ - {72,0,nops,0,0,0}, /* eni */ - {73,0,nops,0,0,0}, /* dsi */ - {74,0,nops,0,0,0}, /* bkpt */ - {75,0,nops,0,0,0}, /* msync */ - {76,0,r,S,0,0}, /* mski */ - {77,0,r,S,0,0}, /* xmti */ - {0,0,rxl,S,VV,0}, /* mov */ - {78,0,nops,0,0,0}, /* tstvv */ - {0,0,lr,VS,A,0}, /* mov */ - {0,0,rxl,A,VS,0}, /* mov */ - {0,0,lr,VL,A,0}, /* mov */ - {0,0,rxl,A,VL,0}, /* mov */ - {0,7,lr,VS,S,0}, /* mov.w */ - {0,7,rxl,S,VS,0}, /* mov.w */ - {0,7,lr,VL,S,0}, /* mov.w */ - {0,7,rxl,S,VL,0}, /* mov.w */ - {79,0,r,A,0,0}, /* diag */ - {80,0,nops,0,0,0}, /* pbkpt */ - {81,3,r,S,0,0}, /* sqrt.s */ - {81,4,r,S,0,0}, /* sqrt.d */ - {82,0,nops,0,0,0}, /* casr */ - {0,0,0,0,0,0}, - {83,3,r,S,0,0}, /* atan.s */ - {83,4,r,S,0,0}, /* atan.d */ -}; -struct formstr format7[] = { - {84,5,r,V,0,0}, /* sum.b */ - {84,6,r,V,0,0}, /* sum.h */ - {84,7,r,V,0,0}, /* sum.w */ - {84,8,r,V,0,0}, /* sum.l */ - {85,0,r,V,0,0}, /* all */ - {86,0,r,V,0,0}, /* any */ - {87,0,r,V,0,0}, /* parity */ - {0,0,0,0,0,0}, - {88,5,r,V,0,0}, /* max.b */ - {88,6,r,V,0,0}, /* max.h */ - {88,7,r,V,0,0}, /* max.w */ - {88,8,r,V,0,0}, /* max.l */ - {89,5,r,V,0,0}, /* min.b */ - {89,6,r,V,0,0}, /* min.h */ - {89,7,r,V,0,0}, /* min.w */ - {89,8,r,V,0,0}, /* min.l */ - {84,3,r,V,0,0}, /* sum.s */ - {84,4,r,V,0,0}, /* sum.d */ - {90,3,r,V,0,0}, /* prod.s */ - {90,4,r,V,0,0}, /* prod.d */ - {88,3,r,V,0,0}, /* max.s */ - {88,4,r,V,0,0}, /* max.d */ - {89,3,r,V,0,0}, /* min.s */ - {89,4,r,V,0,0}, /* min.d */ - {90,5,r,V,0,0}, /* prod.b */ - {90,6,r,V,0,0}, /* prod.h */ - {90,7,r,V,0,0}, /* prod.w */ - {90,8,r,V,0,0}, /* prod.l */ - {35,2,lr,VM,S,0}, /* plc.f */ - {35,1,lr,VM,S,0}, /* plc.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr formatx[] = { - {0,0,0,0,0,0}, -}; -struct formstr format1a[] = { - {91,0,imr,A,0,0}, /* halt */ - {92,0,a4,0,0,0}, /* sysc */ - {18,6,imr,A,0,0}, /* ld.h */ - {18,7,imr,A,0,0}, /* ld.w */ - {5,0,imr,A,0,0}, /* and */ - {6,0,imr,A,0,0}, /* or */ - {7,0,imr,A,0,0}, /* xor */ - {8,0,imr,A,0,0}, /* shf */ - {9,6,imr,A,0,0}, /* add.h */ - {9,7,imr,A,0,0}, /* add.w */ - {10,6,imr,A,0,0}, /* sub.h */ - {10,7,imr,A,0,0}, /* sub.w */ - {3,6,imr,A,0,0}, /* mul.h */ - {3,7,imr,A,0,0}, /* mul.w */ - {4,6,imr,A,0,0}, /* div.h */ - {4,7,imr,A,0,0}, /* div.w */ - {18,7,iml,VL,0,0}, /* ld.w */ - {18,7,iml,VS,0,0}, /* ld.w */ - {0,0,0,0,0,0}, - {8,7,imr,S,0,0}, /* shf.w */ - {93,0,a5,0,0,0}, /* trap */ - {0,0,0,0,0,0}, - {37,6,imr,A,0,0}, /* eq.h */ - {37,7,imr,A,0,0}, /* eq.w */ - {38,6,imr,A,0,0}, /* leu.h */ - {38,7,imr,A,0,0}, /* leu.w */ - {39,6,imr,A,0,0}, /* ltu.h */ - {39,7,imr,A,0,0}, /* ltu.w */ - {40,6,imr,A,0,0}, /* le.h */ - {40,7,imr,A,0,0}, /* le.w */ - {41,6,imr,A,0,0}, /* lt.h */ - {41,7,imr,A,0,0}, /* lt.w */ -}; -struct formstr format1b[] = { - {18,4,imr,S,0,0}, /* ld.d */ - {18,10,imr,S,0,0}, /* ld.u */ - {18,8,imr,S,0,0}, /* ld.l */ - {18,7,imr,S,0,0}, /* ld.w */ - {5,0,imr,S,0,0}, /* and */ - {6,0,imr,S,0,0}, /* or */ - {7,0,imr,S,0,0}, /* xor */ - {8,0,imr,S,0,0}, /* shf */ - {9,6,imr,S,0,0}, /* add.h */ - {9,7,imr,S,0,0}, /* add.w */ - {10,6,imr,S,0,0}, /* sub.h */ - {10,7,imr,S,0,0}, /* sub.w */ - {3,6,imr,S,0,0}, /* mul.h */ - {3,7,imr,S,0,0}, /* mul.w */ - {4,6,imr,S,0,0}, /* div.h */ - {4,7,imr,S,0,0}, /* div.w */ - {9,3,imr,S,0,0}, /* add.s */ - {10,3,imr,S,0,0}, /* sub.s */ - {3,3,imr,S,0,0}, /* mul.s */ - {4,3,imr,S,0,0}, /* div.s */ - {40,3,imr,S,0,0}, /* le.s */ - {41,3,imr,S,0,0}, /* lt.s */ - {37,6,imr,S,0,0}, /* eq.h */ - {37,7,imr,S,0,0}, /* eq.w */ - {38,6,imr,S,0,0}, /* leu.h */ - {38,7,imr,S,0,0}, /* leu.w */ - {39,6,imr,S,0,0}, /* ltu.h */ - {39,7,imr,S,0,0}, /* ltu.w */ - {40,6,imr,S,0,0}, /* le.h */ - {40,7,imr,S,0,0}, /* le.w */ - {41,6,imr,S,0,0}, /* lt.h */ - {41,7,imr,S,0,0}, /* lt.w */ -}; -struct formstr e0_format0[] = { - {10,3,rrr,S,V,V}, /* sub.s */ - {10,4,rrr,S,V,V}, /* sub.d */ - {4,3,rrr,S,V,V}, /* div.s */ - {4,4,rrr,S,V,V}, /* div.d */ - {10,11,rrr,S,V,V}, /* sub.s.f */ - {10,12,rrr,S,V,V}, /* sub.d.f */ - {4,11,rrr,S,V,V}, /* div.s.f */ - {4,12,rrr,S,V,V}, /* div.d.f */ - {3,11,rrr,V,V,V}, /* mul.s.f */ - {3,12,rrr,V,V,V}, /* mul.d.f */ - {4,11,rrr,V,V,V}, /* div.s.f */ - {4,12,rrr,V,V,V}, /* div.d.f */ - {3,11,rrr,V,S,V}, /* mul.s.f */ - {3,12,rrr,V,S,V}, /* mul.d.f */ - {4,11,rrr,V,S,V}, /* div.s.f */ - {4,12,rrr,V,S,V}, /* div.d.f */ - {5,2,rrr,V,V,V}, /* and.f */ - {6,2,rrr,V,V,V}, /* or.f */ - {7,2,rrr,V,V,V}, /* xor.f */ - {8,2,rrr,V,V,V}, /* shf.f */ - {5,2,rrr,V,S,V}, /* and.f */ - {6,2,rrr,V,S,V}, /* or.f */ - {7,2,rrr,V,S,V}, /* xor.f */ - {8,2,rrr,V,S,V}, /* shf.f */ - {9,11,rrr,V,V,V}, /* add.s.f */ - {9,12,rrr,V,V,V}, /* add.d.f */ - {10,11,rrr,V,V,V}, /* sub.s.f */ - {10,12,rrr,V,V,V}, /* sub.d.f */ - {9,11,rrr,V,S,V}, /* add.s.f */ - {9,12,rrr,V,S,V}, /* add.d.f */ - {10,11,rrr,V,S,V}, /* sub.s.f */ - {10,12,rrr,V,S,V}, /* sub.d.f */ - {9,13,rrr,V,V,V}, /* add.b.f */ - {9,14,rrr,V,V,V}, /* add.h.f */ - {9,15,rrr,V,V,V}, /* add.w.f */ - {9,16,rrr,V,V,V}, /* add.l.f */ - {9,13,rrr,V,S,V}, /* add.b.f */ - {9,14,rrr,V,S,V}, /* add.h.f */ - {9,15,rrr,V,S,V}, /* add.w.f */ - {9,16,rrr,V,S,V}, /* add.l.f */ - {10,13,rrr,V,V,V}, /* sub.b.f */ - {10,14,rrr,V,V,V}, /* sub.h.f */ - {10,15,rrr,V,V,V}, /* sub.w.f */ - {10,16,rrr,V,V,V}, /* sub.l.f */ - {10,13,rrr,V,S,V}, /* sub.b.f */ - {10,14,rrr,V,S,V}, /* sub.h.f */ - {10,15,rrr,V,S,V}, /* sub.w.f */ - {10,16,rrr,V,S,V}, /* sub.l.f */ - {3,13,rrr,V,V,V}, /* mul.b.f */ - {3,14,rrr,V,V,V}, /* mul.h.f */ - {3,15,rrr,V,V,V}, /* mul.w.f */ - {3,16,rrr,V,V,V}, /* mul.l.f */ - {3,13,rrr,V,S,V}, /* mul.b.f */ - {3,14,rrr,V,S,V}, /* mul.h.f */ - {3,15,rrr,V,S,V}, /* mul.w.f */ - {3,16,rrr,V,S,V}, /* mul.l.f */ - {4,13,rrr,V,V,V}, /* div.b.f */ - {4,14,rrr,V,V,V}, /* div.h.f */ - {4,15,rrr,V,V,V}, /* div.w.f */ - {4,16,rrr,V,V,V}, /* div.l.f */ - {4,13,rrr,V,S,V}, /* div.b.f */ - {4,14,rrr,V,S,V}, /* div.h.f */ - {4,15,rrr,V,S,V}, /* div.w.f */ - {4,16,rrr,V,S,V}, /* div.l.f */ -}; -struct formstr e0_format1[] = { - {0,0,0,0,0,0}, - {94,0,a3,0,0,0}, /* tst */ - {95,0,a3,0,0,0}, /* lck */ - {96,0,a3,0,0,0}, /* ulk */ - {17,0,a1r,S,0,0}, /* ldea */ - {97,0,a1r,A,0,0}, /* spawn */ - {98,0,a1r,A,0,0}, /* ldcmr */ - {99,0,a2r,A,0,0}, /* stcmr */ - {100,0,a1r,A,0,0}, /* popr */ - {101,0,a2r,A,0,0}, /* pshr */ - {102,7,a1r,A,0,0}, /* rcvr.w */ - {103,7,a2r,A,0,0}, /* matm.w */ - {104,7,a2r,A,0,0}, /* sndr.w */ - {104,8,a2r,S,0,0}, /* sndr.l */ - {102,8,a1r,S,0,0}, /* rcvr.l */ - {103,8,a2r,S,0,0}, /* matm.l */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {105,7,a2r,A,0,0}, /* putr.w */ - {105,8,a2r,S,0,0}, /* putr.l */ - {106,7,a1r,A,0,0}, /* getr.w */ - {106,8,a1r,S,0,0}, /* getr.l */ - {26,13,a2r,S,0,0}, /* ste.b.f */ - {26,14,a2r,S,0,0}, /* ste.h.f */ - {26,15,a2r,S,0,0}, /* ste.w.f */ - {26,16,a2r,S,0,0}, /* ste.l.f */ - {107,7,a2r,A,0,0}, /* matr.w */ - {108,7,a2r,A,0,0}, /* mat.w */ - {109,7,a1r,A,0,0}, /* get.w */ - {110,7,a1r,A,0,0}, /* rcv.w */ - {0,0,0,0,0,0}, - {111,7,a1r,A,0,0}, /* inc.w */ - {112,7,a2r,A,0,0}, /* put.w */ - {113,7,a2r,A,0,0}, /* snd.w */ - {107,8,a2r,S,0,0}, /* matr.l */ - {108,8,a2r,S,0,0}, /* mat.l */ - {109,8,a1r,S,0,0}, /* get.l */ - {110,8,a1r,S,0,0}, /* rcv.l */ - {0,0,0,0,0,0}, - {111,8,a1r,S,0,0}, /* inc.l */ - {112,8,a2r,S,0,0}, /* put.l */ - {113,8,a2r,S,0,0}, /* snd.l */ - {18,13,a1r,V,0,0}, /* ld.b.f */ - {18,14,a1r,V,0,0}, /* ld.h.f */ - {18,15,a1r,V,0,0}, /* ld.w.f */ - {18,16,a1r,V,0,0}, /* ld.l.f */ - {21,13,a2r,V,0,0}, /* st.b.f */ - {21,14,a2r,V,0,0}, /* st.h.f */ - {21,15,a2r,V,0,0}, /* st.w.f */ - {21,16,a2r,V,0,0}, /* st.l.f */ -}; -struct formstr e0_format2[] = { - {28,5,rr,V,V,0}, /* cvtw.b */ - {28,6,rr,V,V,0}, /* cvtw.h */ - {29,7,rr,V,V,0}, /* cvtb.w */ - {30,7,rr,V,V,0}, /* cvth.w */ - {28,13,rr,V,V,0}, /* cvtw.b.f */ - {28,14,rr,V,V,0}, /* cvtw.h.f */ - {29,15,rr,V,V,0}, /* cvtb.w.f */ - {30,15,rr,V,V,0}, /* cvth.w.f */ - {31,8,rr,V,V,0}, /* cvts.l */ - {32,7,rr,V,V,0}, /* cvtd.w */ - {33,3,rr,V,V,0}, /* cvtl.s */ - {28,4,rr,V,V,0}, /* cvtw.d */ - {31,16,rr,V,V,0}, /* cvts.l.f */ - {32,15,rr,V,V,0}, /* cvtd.w.f */ - {33,11,rr,V,V,0}, /* cvtl.s.f */ - {28,12,rr,V,V,0}, /* cvtw.d.f */ - {114,0,rr,S,S,0}, /* enal */ - {8,7,rr,S,S,0}, /* shf.w */ - {115,0,rr,S,S,0}, /* enag */ - {0,0,0,0,0,0}, - {28,4,rr,S,S,0}, /* cvtw.d */ - {32,7,rr,S,S,0}, /* cvtd.w */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,3,rr,S,S,0}, /* frint.s */ - {116,4,rr,S,S,0}, /* frint.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,3,rr,V,V,0}, /* frint.s */ - {116,4,rr,V,V,0}, /* frint.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,11,rr,V,V,0}, /* frint.s.f */ - {116,12,rr,V,V,0}, /* frint.d.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {81,3,rr,V,V,0}, /* sqrt.s */ - {81,4,rr,V,V,0}, /* sqrt.d */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {81,11,rr,V,V,0}, /* sqrt.s.f */ - {81,12,rr,V,V,0}, /* sqrt.d.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e0_format3[] = { - {32,11,rr,V,V,0}, /* cvtd.s.f */ - {31,12,rr,V,V,0}, /* cvts.d.f */ - {33,12,rr,V,V,0}, /* cvtl.d.f */ - {32,16,rr,V,V,0}, /* cvtd.l.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {36,2,rr,V,V,0}, /* tzc.f */ - {44,2,rr,V,V,0}, /* lop.f */ - {117,2,rr,V,V,0}, /* xpnd.f */ - {42,2,rr,V,V,0}, /* not.f */ - {8,2,rr,S,V,0}, /* shf.f */ - {35,17,rr,V,V,0}, /* plc.t.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {37,11,rr,V,V,0}, /* eq.s.f */ - {37,12,rr,V,V,0}, /* eq.d.f */ - {43,11,rr,V,V,0}, /* neg.s.f */ - {43,12,rr,V,V,0}, /* neg.d.f */ - {37,11,rr,S,V,0}, /* eq.s.f */ - {37,12,rr,S,V,0}, /* eq.d.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {40,11,rr,V,V,0}, /* le.s.f */ - {40,12,rr,V,V,0}, /* le.d.f */ - {41,11,rr,V,V,0}, /* lt.s.f */ - {41,12,rr,V,V,0}, /* lt.d.f */ - {40,11,rr,S,V,0}, /* le.s.f */ - {40,12,rr,S,V,0}, /* le.d.f */ - {41,11,rr,S,V,0}, /* lt.s.f */ - {41,12,rr,S,V,0}, /* lt.d.f */ - {37,13,rr,V,V,0}, /* eq.b.f */ - {37,14,rr,V,V,0}, /* eq.h.f */ - {37,15,rr,V,V,0}, /* eq.w.f */ - {37,16,rr,V,V,0}, /* eq.l.f */ - {37,13,rr,S,V,0}, /* eq.b.f */ - {37,14,rr,S,V,0}, /* eq.h.f */ - {37,15,rr,S,V,0}, /* eq.w.f */ - {37,16,rr,S,V,0}, /* eq.l.f */ - {40,13,rr,V,V,0}, /* le.b.f */ - {40,14,rr,V,V,0}, /* le.h.f */ - {40,15,rr,V,V,0}, /* le.w.f */ - {40,16,rr,V,V,0}, /* le.l.f */ - {40,13,rr,S,V,0}, /* le.b.f */ - {40,14,rr,S,V,0}, /* le.h.f */ - {40,15,rr,S,V,0}, /* le.w.f */ - {40,16,rr,S,V,0}, /* le.l.f */ - {41,13,rr,V,V,0}, /* lt.b.f */ - {41,14,rr,V,V,0}, /* lt.h.f */ - {41,15,rr,V,V,0}, /* lt.w.f */ - {41,16,rr,V,V,0}, /* lt.l.f */ - {41,13,rr,S,V,0}, /* lt.b.f */ - {41,14,rr,S,V,0}, /* lt.h.f */ - {41,15,rr,S,V,0}, /* lt.w.f */ - {41,16,rr,S,V,0}, /* lt.l.f */ - {43,13,rr,V,V,0}, /* neg.b.f */ - {43,14,rr,V,V,0}, /* neg.h.f */ - {43,15,rr,V,V,0}, /* neg.w.f */ - {43,16,rr,V,V,0}, /* neg.l.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e0_format4[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e0_format5[] = { - {51,13,rr,V,V,0}, /* ldvi.b.f */ - {51,14,rr,V,V,0}, /* ldvi.h.f */ - {51,15,rr,V,V,0}, /* ldvi.w.f */ - {51,16,rr,V,V,0}, /* ldvi.l.f */ - {28,11,rr,V,V,0}, /* cvtw.s.f */ - {31,15,rr,V,V,0}, /* cvts.w.f */ - {28,16,rr,V,V,0}, /* cvtw.l.f */ - {33,15,rr,V,V,0}, /* cvtl.w.f */ - {52,13,rxr,V,V,0}, /* stvi.b.f */ - {52,14,rxr,V,V,0}, /* stvi.h.f */ - {52,15,rxr,V,V,0}, /* stvi.w.f */ - {52,16,rxr,V,V,0}, /* stvi.l.f */ - {52,13,rxr,S,V,0}, /* stvi.b.f */ - {52,14,rxr,S,V,0}, /* stvi.h.f */ - {52,15,rxr,S,V,0}, /* stvi.w.f */ - {52,16,rxr,S,V,0}, /* stvi.l.f */ -}; -struct formstr e0_format6[] = { - {0,0,rxl,S,CIR,0}, /* mov */ - {0,0,lr,CIR,S,0}, /* mov */ - {0,0,lr,TOC,S,0}, /* mov */ - {0,0,lr,CPUID,S,0}, /* mov */ - {0,0,rxl,S,TTR,0}, /* mov */ - {0,0,lr,TTR,S,0}, /* mov */ - {118,0,nops,0,0,0}, /* ctrsl */ - {119,0,nops,0,0,0}, /* ctrsg */ - {0,0,rxl,S,VMU,0}, /* mov */ - {0,0,lr,VMU,S,0}, /* mov */ - {0,0,rxl,S,VML,0}, /* mov */ - {0,0,lr,VML,S,0}, /* mov */ - {0,0,rxl,S,ICR,0}, /* mov */ - {0,0,lr,ICR,S,0}, /* mov */ - {0,0,rxl,S,TCPU,0}, /* mov */ - {0,0,lr,TCPU,S,0}, /* mov */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {120,0,nops,0,0,0}, /* stop */ - {0,0,0,0,0,0}, - {0,0,rxl,S,TID,0}, /* mov */ - {0,0,lr,TID,S,0}, /* mov */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e0_format7[] = { - {84,13,r,V,0,0}, /* sum.b.f */ - {84,14,r,V,0,0}, /* sum.h.f */ - {84,15,r,V,0,0}, /* sum.w.f */ - {84,16,r,V,0,0}, /* sum.l.f */ - {85,2,r,V,0,0}, /* all.f */ - {86,2,r,V,0,0}, /* any.f */ - {87,2,r,V,0,0}, /* parity.f */ - {0,0,0,0,0,0}, - {88,13,r,V,0,0}, /* max.b.f */ - {88,14,r,V,0,0}, /* max.h.f */ - {88,15,r,V,0,0}, /* max.w.f */ - {88,16,r,V,0,0}, /* max.l.f */ - {89,13,r,V,0,0}, /* min.b.f */ - {89,14,r,V,0,0}, /* min.h.f */ - {89,15,r,V,0,0}, /* min.w.f */ - {89,16,r,V,0,0}, /* min.l.f */ - {84,11,r,V,0,0}, /* sum.s.f */ - {84,12,r,V,0,0}, /* sum.d.f */ - {90,11,r,V,0,0}, /* prod.s.f */ - {90,12,r,V,0,0}, /* prod.d.f */ - {88,11,r,V,0,0}, /* max.s.f */ - {88,12,r,V,0,0}, /* max.d.f */ - {89,11,r,V,0,0}, /* min.s.f */ - {89,12,r,V,0,0}, /* min.d.f */ - {90,13,r,V,0,0}, /* prod.b.f */ - {90,14,r,V,0,0}, /* prod.h.f */ - {90,15,r,V,0,0}, /* prod.w.f */ - {90,16,r,V,0,0}, /* prod.l.f */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e1_format0[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {10,18,rrr,S,V,V}, /* sub.s.t */ - {10,19,rrr,S,V,V}, /* sub.d.t */ - {4,18,rrr,S,V,V}, /* div.s.t */ - {4,19,rrr,S,V,V}, /* div.d.t */ - {3,18,rrr,V,V,V}, /* mul.s.t */ - {3,19,rrr,V,V,V}, /* mul.d.t */ - {4,18,rrr,V,V,V}, /* div.s.t */ - {4,19,rrr,V,V,V}, /* div.d.t */ - {3,18,rrr,V,S,V}, /* mul.s.t */ - {3,19,rrr,V,S,V}, /* mul.d.t */ - {4,18,rrr,V,S,V}, /* div.s.t */ - {4,19,rrr,V,S,V}, /* div.d.t */ - {5,1,rrr,V,V,V}, /* and.t */ - {6,1,rrr,V,V,V}, /* or.t */ - {7,1,rrr,V,V,V}, /* xor.t */ - {8,1,rrr,V,V,V}, /* shf.t */ - {5,1,rrr,V,S,V}, /* and.t */ - {6,1,rrr,V,S,V}, /* or.t */ - {7,1,rrr,V,S,V}, /* xor.t */ - {8,1,rrr,V,S,V}, /* shf.t */ - {9,18,rrr,V,V,V}, /* add.s.t */ - {9,19,rrr,V,V,V}, /* add.d.t */ - {10,18,rrr,V,V,V}, /* sub.s.t */ - {10,19,rrr,V,V,V}, /* sub.d.t */ - {9,18,rrr,V,S,V}, /* add.s.t */ - {9,19,rrr,V,S,V}, /* add.d.t */ - {10,18,rrr,V,S,V}, /* sub.s.t */ - {10,19,rrr,V,S,V}, /* sub.d.t */ - {9,20,rrr,V,V,V}, /* add.b.t */ - {9,21,rrr,V,V,V}, /* add.h.t */ - {9,22,rrr,V,V,V}, /* add.w.t */ - {9,23,rrr,V,V,V}, /* add.l.t */ - {9,20,rrr,V,S,V}, /* add.b.t */ - {9,21,rrr,V,S,V}, /* add.h.t */ - {9,22,rrr,V,S,V}, /* add.w.t */ - {9,23,rrr,V,S,V}, /* add.l.t */ - {10,20,rrr,V,V,V}, /* sub.b.t */ - {10,21,rrr,V,V,V}, /* sub.h.t */ - {10,22,rrr,V,V,V}, /* sub.w.t */ - {10,23,rrr,V,V,V}, /* sub.l.t */ - {10,20,rrr,V,S,V}, /* sub.b.t */ - {10,21,rrr,V,S,V}, /* sub.h.t */ - {10,22,rrr,V,S,V}, /* sub.w.t */ - {10,23,rrr,V,S,V}, /* sub.l.t */ - {3,20,rrr,V,V,V}, /* mul.b.t */ - {3,21,rrr,V,V,V}, /* mul.h.t */ - {3,22,rrr,V,V,V}, /* mul.w.t */ - {3,23,rrr,V,V,V}, /* mul.l.t */ - {3,20,rrr,V,S,V}, /* mul.b.t */ - {3,21,rrr,V,S,V}, /* mul.h.t */ - {3,22,rrr,V,S,V}, /* mul.w.t */ - {3,23,rrr,V,S,V}, /* mul.l.t */ - {4,20,rrr,V,V,V}, /* div.b.t */ - {4,21,rrr,V,V,V}, /* div.h.t */ - {4,22,rrr,V,V,V}, /* div.w.t */ - {4,23,rrr,V,V,V}, /* div.l.t */ - {4,20,rrr,V,S,V}, /* div.b.t */ - {4,21,rrr,V,S,V}, /* div.h.t */ - {4,22,rrr,V,S,V}, /* div.w.t */ - {4,23,rrr,V,S,V}, /* div.l.t */ -}; -struct formstr e1_format1[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {26,20,a2r,S,0,0}, /* ste.b.t */ - {26,21,a2r,S,0,0}, /* ste.h.t */ - {26,22,a2r,S,0,0}, /* ste.w.t */ - {26,23,a2r,S,0,0}, /* ste.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {18,20,a1r,V,0,0}, /* ld.b.t */ - {18,21,a1r,V,0,0}, /* ld.h.t */ - {18,22,a1r,V,0,0}, /* ld.w.t */ - {18,23,a1r,V,0,0}, /* ld.l.t */ - {21,20,a2r,V,0,0}, /* st.b.t */ - {21,21,a2r,V,0,0}, /* st.h.t */ - {21,22,a2r,V,0,0}, /* st.w.t */ - {21,23,a2r,V,0,0}, /* st.l.t */ -}; -struct formstr e1_format2[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {28,20,rr,V,V,0}, /* cvtw.b.t */ - {28,21,rr,V,V,0}, /* cvtw.h.t */ - {29,22,rr,V,V,0}, /* cvtb.w.t */ - {30,22,rr,V,V,0}, /* cvth.w.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {31,23,rr,V,V,0}, /* cvts.l.t */ - {32,22,rr,V,V,0}, /* cvtd.w.t */ - {33,18,rr,V,V,0}, /* cvtl.s.t */ - {28,19,rr,V,V,0}, /* cvtw.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {116,18,rr,V,V,0}, /* frint.s.t */ - {116,19,rr,V,V,0}, /* frint.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {81,18,rr,V,V,0}, /* sqrt.s.t */ - {81,19,rr,V,V,0}, /* sqrt.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e1_format3[] = { - {32,18,rr,V,V,0}, /* cvtd.s.t */ - {31,19,rr,V,V,0}, /* cvts.d.t */ - {33,19,rr,V,V,0}, /* cvtl.d.t */ - {32,23,rr,V,V,0}, /* cvtd.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {36,1,rr,V,V,0}, /* tzc.t */ - {44,1,rr,V,V,0}, /* lop.t */ - {117,1,rr,V,V,0}, /* xpnd.t */ - {42,1,rr,V,V,0}, /* not.t */ - {8,1,rr,S,V,0}, /* shf.t */ - {35,24,rr,V,V,0}, /* plc.t.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {37,18,rr,V,V,0}, /* eq.s.t */ - {37,19,rr,V,V,0}, /* eq.d.t */ - {43,18,rr,V,V,0}, /* neg.s.t */ - {43,19,rr,V,V,0}, /* neg.d.t */ - {37,18,rr,S,V,0}, /* eq.s.t */ - {37,19,rr,S,V,0}, /* eq.d.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {40,18,rr,V,V,0}, /* le.s.t */ - {40,19,rr,V,V,0}, /* le.d.t */ - {41,18,rr,V,V,0}, /* lt.s.t */ - {41,19,rr,V,V,0}, /* lt.d.t */ - {40,18,rr,S,V,0}, /* le.s.t */ - {40,19,rr,S,V,0}, /* le.d.t */ - {41,18,rr,S,V,0}, /* lt.s.t */ - {41,19,rr,S,V,0}, /* lt.d.t */ - {37,20,rr,V,V,0}, /* eq.b.t */ - {37,21,rr,V,V,0}, /* eq.h.t */ - {37,22,rr,V,V,0}, /* eq.w.t */ - {37,23,rr,V,V,0}, /* eq.l.t */ - {37,20,rr,S,V,0}, /* eq.b.t */ - {37,21,rr,S,V,0}, /* eq.h.t */ - {37,22,rr,S,V,0}, /* eq.w.t */ - {37,23,rr,S,V,0}, /* eq.l.t */ - {40,20,rr,V,V,0}, /* le.b.t */ - {40,21,rr,V,V,0}, /* le.h.t */ - {40,22,rr,V,V,0}, /* le.w.t */ - {40,23,rr,V,V,0}, /* le.l.t */ - {40,20,rr,S,V,0}, /* le.b.t */ - {40,21,rr,S,V,0}, /* le.h.t */ - {40,22,rr,S,V,0}, /* le.w.t */ - {40,23,rr,S,V,0}, /* le.l.t */ - {41,20,rr,V,V,0}, /* lt.b.t */ - {41,21,rr,V,V,0}, /* lt.h.t */ - {41,22,rr,V,V,0}, /* lt.w.t */ - {41,23,rr,V,V,0}, /* lt.l.t */ - {41,20,rr,S,V,0}, /* lt.b.t */ - {41,21,rr,S,V,0}, /* lt.h.t */ - {41,22,rr,S,V,0}, /* lt.w.t */ - {41,23,rr,S,V,0}, /* lt.l.t */ - {43,20,rr,V,V,0}, /* neg.b.t */ - {43,21,rr,V,V,0}, /* neg.h.t */ - {43,22,rr,V,V,0}, /* neg.w.t */ - {43,23,rr,V,V,0}, /* neg.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e1_format4[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e1_format5[] = { - {51,20,rr,V,V,0}, /* ldvi.b.t */ - {51,21,rr,V,V,0}, /* ldvi.h.t */ - {51,22,rr,V,V,0}, /* ldvi.w.t */ - {51,23,rr,V,V,0}, /* ldvi.l.t */ - {28,18,rr,V,V,0}, /* cvtw.s.t */ - {31,22,rr,V,V,0}, /* cvts.w.t */ - {28,23,rr,V,V,0}, /* cvtw.l.t */ - {33,22,rr,V,V,0}, /* cvtl.w.t */ - {52,20,rxr,V,V,0}, /* stvi.b.t */ - {52,21,rxr,V,V,0}, /* stvi.h.t */ - {52,22,rxr,V,V,0}, /* stvi.w.t */ - {52,23,rxr,V,V,0}, /* stvi.l.t */ - {52,20,rxr,S,V,0}, /* stvi.b.t */ - {52,21,rxr,S,V,0}, /* stvi.h.t */ - {52,22,rxr,S,V,0}, /* stvi.w.t */ - {52,23,rxr,S,V,0}, /* stvi.l.t */ -}; -struct formstr e1_format6[] = { - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -struct formstr e1_format7[] = { - {84,20,r,V,0,0}, /* sum.b.t */ - {84,21,r,V,0,0}, /* sum.h.t */ - {84,22,r,V,0,0}, /* sum.w.t */ - {84,23,r,V,0,0}, /* sum.l.t */ - {85,1,r,V,0,0}, /* all.t */ - {86,1,r,V,0,0}, /* any.t */ - {87,1,r,V,0,0}, /* parity.t */ - {0,0,0,0,0,0}, - {88,20,r,V,0,0}, /* max.b.t */ - {88,21,r,V,0,0}, /* max.h.t */ - {88,22,r,V,0,0}, /* max.w.t */ - {88,23,r,V,0,0}, /* max.l.t */ - {89,20,r,V,0,0}, /* min.b.t */ - {89,21,r,V,0,0}, /* min.h.t */ - {89,22,r,V,0,0}, /* min.w.t */ - {89,23,r,V,0,0}, /* min.l.t */ - {84,18,r,V,0,0}, /* sum.s.t */ - {84,19,r,V,0,0}, /* sum.d.t */ - {90,18,r,V,0,0}, /* prod.s.t */ - {90,19,r,V,0,0}, /* prod.d.t */ - {88,18,r,V,0,0}, /* max.s.t */ - {88,19,r,V,0,0}, /* max.d.t */ - {89,18,r,V,0,0}, /* min.s.t */ - {89,19,r,V,0,0}, /* min.d.t */ - {90,20,r,V,0,0}, /* prod.b.t */ - {90,21,r,V,0,0}, /* prod.h.t */ - {90,22,r,V,0,0}, /* prod.w.t */ - {90,23,r,V,0,0}, /* prod.l.t */ - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, - {0,0,0,0,0,0}, -}; -char *lop[] = { - "mov", /* 0 */ - "merg", /* 1 */ - "mask", /* 2 */ - "mul", /* 3 */ - "div", /* 4 */ - "and", /* 5 */ - "or", /* 6 */ - "xor", /* 7 */ - "shf", /* 8 */ - "add", /* 9 */ - "sub", /* 10 */ - "exit", /* 11 */ - "jmp", /* 12 */ - "jmpi", /* 13 */ - "jmpa", /* 14 */ - "jmps", /* 15 */ - "tac", /* 16 */ - "ldea", /* 17 */ - "ld", /* 18 */ - "tas", /* 19 */ - "pshea", /* 20 */ - "st", /* 21 */ - "call", /* 22 */ - "calls", /* 23 */ - "callq", /* 24 */ - "pfork", /* 25 */ - "ste", /* 26 */ - "incr", /* 27 */ - "cvtw", /* 28 */ - "cvtb", /* 29 */ - "cvth", /* 30 */ - "cvts", /* 31 */ - "cvtd", /* 32 */ - "cvtl", /* 33 */ - "ldpa", /* 34 */ - "plc", /* 35 */ - "tzc", /* 36 */ - "eq", /* 37 */ - "leu", /* 38 */ - "ltu", /* 39 */ - "le", /* 40 */ - "lt", /* 41 */ - "not", /* 42 */ - "neg", /* 43 */ - "lop", /* 44 */ - "cprs", /* 45 */ - "nop", /* 46 */ - "br", /* 47 */ - "bri", /* 48 */ - "bra", /* 49 */ - "brs", /* 50 */ - "ldvi", /* 51 */ - "stvi", /* 52 */ - "ldsdr", /* 53 */ - "ldkdr", /* 54 */ - "ln", /* 55 */ - "patu", /* 56 */ - "pate", /* 57 */ - "pich", /* 58 */ - "plch", /* 59 */ - "idle", /* 60 */ - "rtnq", /* 61 */ - "cfork", /* 62 */ - "rtn", /* 63 */ - "wfork", /* 64 */ - "join", /* 65 */ - "rtnc", /* 66 */ - "exp", /* 67 */ - "sin", /* 68 */ - "cos", /* 69 */ - "psh", /* 70 */ - "pop", /* 71 */ - "eni", /* 72 */ - "dsi", /* 73 */ - "bkpt", /* 74 */ - "msync", /* 75 */ - "mski", /* 76 */ - "xmti", /* 77 */ - "tstvv", /* 78 */ - "diag", /* 79 */ - "pbkpt", /* 80 */ - "sqrt", /* 81 */ - "casr", /* 82 */ - "atan", /* 83 */ - "sum", /* 84 */ - "all", /* 85 */ - "any", /* 86 */ - "parity", /* 87 */ - "max", /* 88 */ - "min", /* 89 */ - "prod", /* 90 */ - "halt", /* 91 */ - "sysc", /* 92 */ - "trap", /* 93 */ - "tst", /* 94 */ - "lck", /* 95 */ - "ulk", /* 96 */ - "spawn", /* 97 */ - "ldcmr", /* 98 */ - "stcmr", /* 99 */ - "popr", /* 100 */ - "pshr", /* 101 */ - "rcvr", /* 102 */ - "matm", /* 103 */ - "sndr", /* 104 */ - "putr", /* 105 */ - "getr", /* 106 */ - "matr", /* 107 */ - "mat", /* 108 */ - "get", /* 109 */ - "rcv", /* 110 */ - "inc", /* 111 */ - "put", /* 112 */ - "snd", /* 113 */ - "enal", /* 114 */ - "enag", /* 115 */ - "frint", /* 116 */ - "xpnd", /* 117 */ - "ctrsl", /* 118 */ - "ctrsg", /* 119 */ - "stop", /* 120 */ -}; -char *rop[] = { - "", /* 0 */ - ".t", /* 1 */ - ".f", /* 2 */ - ".s", /* 3 */ - ".d", /* 4 */ - ".b", /* 5 */ - ".h", /* 6 */ - ".w", /* 7 */ - ".l", /* 8 */ - ".x", /* 9 */ - ".u", /* 10 */ - ".s.f", /* 11 */ - ".d.f", /* 12 */ - ".b.f", /* 13 */ - ".h.f", /* 14 */ - ".w.f", /* 15 */ - ".l.f", /* 16 */ - ".t.f", /* 17 */ - ".s.t", /* 18 */ - ".d.t", /* 19 */ - ".b.t", /* 20 */ - ".h.t", /* 21 */ - ".w.t", /* 22 */ - ".l.t", /* 23 */ - ".t.t", /* 24 */ -}; diff --git a/gdb/cplus-dem.c b/gdb/cplus-dem.c deleted file mode 100644 index b9c6288..0000000 --- a/gdb/cplus-dem.c +++ /dev/null @@ -1,2280 +0,0 @@ -/* Demangler for GNU C++ - Copyright 1989, 1991 Free Software Foundation, Inc. - Written by James Clark (jjc@jclark.uucp) - Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* This is for g++ 1.95.03 (November 13 version). */ - -/* This file exports two functions; cplus_mangle_opname and cplus_demangle. - - This file imports xmalloc and xrealloc, which are like malloc and - realloc except that they generate a fatal error if there is no - available memory. */ - -/* GDB-specific, FIXME. */ -#include "defs.h" -#include "demangle.h" - -#include -#include - -/* In order to allow a single demangler executable to demangle strings - using various common values of CPLUS_MARKER, as well as any specific - one set at compile time, we maintain a string containing all the - commonly used ones, and check to see if the marker we are looking for - is in that string. CPLUS_MARKER is usually '$' on systems where the - assembler can deal with that. Where the assembler can't, it's usually - '.' (but on many systems '.' is used for other things). We put the - current defined CPLUS_MARKER first (which defaults to '$'), followed - by the next most common value, followed by an explicit '$' in case - the value of CPLUS_MARKER is not '$'. - - We could avoid this if we could just get g++ to tell us what the actual - cplus marker character is as part of the debug information, perhaps by - ensuring that it is the character that terminates the gcc_compiled - marker symbol (FIXME). */ - -#if !defined (CPLUS_MARKER) -#define CPLUS_MARKER '$' -#endif - -static const char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' }; - -#ifndef __STDC__ -#define const -#endif - -/* Stuff that is shared between sub-routines. - * Using a shared structure allows cplus_demangle to be reentrant. */ - -struct work_stuff -{ - int options; - char **typevec; - int ntypes; - int typevec_size; - int constructor; - int destructor; - int static_type; /* A static member function */ - int const_type; /* A const member function */ -}; - -#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI) -#define PRINT_ARG_TYPES (work -> options & DMGL_PARAMS) - -static const struct optable -{ - const char *in; - const char *out; - int flags; -} optable[] = { - "nw", " new", DMGL_ANSI, /* new (1.92, ansi) */ - "dl", " delete", DMGL_ANSI, /* new (1.92, ansi) */ - "new", " new", 0, /* old (1.91, and 1.x) */ - "delete", " delete", 0, /* old (1.91, and 1.x) */ - "as", "=", DMGL_ANSI, /* ansi */ - "ne", "!=", DMGL_ANSI, /* old, ansi */ - "eq", "==", DMGL_ANSI, /* old, ansi */ - "ge", ">=", DMGL_ANSI, /* old, ansi */ - "gt", ">", DMGL_ANSI, /* old, ansi */ - "le", "<=", DMGL_ANSI, /* old, ansi */ - "lt", "<", DMGL_ANSI, /* old, ansi */ - "plus", "+", 0, /* old */ - "pl", "+", DMGL_ANSI, /* ansi */ - "apl", "+=", DMGL_ANSI, /* ansi */ - "minus", "-", 0, /* old */ - "mi", "-", DMGL_ANSI, /* ansi */ - "ami", "-=", DMGL_ANSI, /* ansi */ - "mult", "*", 0, /* old */ - "ml", "*", DMGL_ANSI, /* ansi */ - "amu", "*=", DMGL_ANSI, /* ansi (ARM/Lucid) */ - "aml", "*=", DMGL_ANSI, /* ansi (GNU/g++) */ - "convert", "+", 0, /* old (unary +) */ - "negate", "-", 0, /* old (unary -) */ - "trunc_mod", "%", 0, /* old */ - "md", "%", DMGL_ANSI, /* ansi */ - "amd", "%=", DMGL_ANSI, /* ansi */ - "trunc_div", "/", 0, /* old */ - "dv", "/", DMGL_ANSI, /* ansi */ - "adv", "/=", DMGL_ANSI, /* ansi */ - "truth_andif", "&&", 0, /* old */ - "aa", "&&", DMGL_ANSI, /* ansi */ - "truth_orif", "||", 0, /* old */ - "oo", "||", DMGL_ANSI, /* ansi */ - "truth_not", "!", 0, /* old */ - "nt", "!", DMGL_ANSI, /* ansi */ - "postincrement","++", 0, /* old */ - "pp", "++", DMGL_ANSI, /* ansi */ - "postdecrement","--", 0, /* old */ - "mm", "--", DMGL_ANSI, /* ansi */ - "bit_ior", "|", 0, /* old */ - "or", "|", DMGL_ANSI, /* ansi */ - "aor", "|=", DMGL_ANSI, /* ansi */ - "bit_xor", "^", 0, /* old */ - "er", "^", DMGL_ANSI, /* ansi */ - "aer", "^=", DMGL_ANSI, /* ansi */ - "bit_and", "&", 0, /* old */ - "ad", "&", DMGL_ANSI, /* ansi */ - "aad", "&=", DMGL_ANSI, /* ansi */ - "bit_not", "~", 0, /* old */ - "co", "~", DMGL_ANSI, /* ansi */ - "call", "()", 0, /* old */ - "cl", "()", DMGL_ANSI, /* ansi */ - "alshift", "<<", 0, /* old */ - "ls", "<<", DMGL_ANSI, /* ansi */ - "als", "<<=", DMGL_ANSI, /* ansi */ - "arshift", ">>", 0, /* old */ - "rs", ">>", DMGL_ANSI, /* ansi */ - "ars", ">>=", DMGL_ANSI, /* ansi */ - "component", "->", 0, /* old */ - "pt", "->", DMGL_ANSI, /* ansi; Lucid C++ form */ - "rf", "->", DMGL_ANSI, /* ansi; ARM/GNU form */ - "indirect", "*", 0, /* old */ - "method_call", "->()", 0, /* old */ - "addr", "&", 0, /* old (unary &) */ - "array", "[]", 0, /* old */ - "vc", "[]", DMGL_ANSI, /* ansi */ - "compound", ", ", 0, /* old */ - "cm", ", ", DMGL_ANSI, /* ansi */ - "cond", "?:", 0, /* old */ - "cn", "?:", DMGL_ANSI, /* psuedo-ansi */ - "max", ">?", 0, /* old */ - "mx", ">?", DMGL_ANSI, /* psuedo-ansi */ - "min", "*", DMGL_ANSI, /* ansi */ -}; - - -typedef struct string /* Beware: these aren't required to be */ -{ /* '\0' terminated. */ - char *b; /* pointer to start of string */ - char *p; /* pointer after last character */ - char *e; /* pointer after end of allocated space */ -} string; - -#define STRING_EMPTY(str) ((str) -> b == (str) -> p) -#define PREPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_prepend(str, " ");} -#define APPEND_BLANK(str) {if (!STRING_EMPTY(str)) \ - string_append(str, " ");} - -#define ARM_VTABLE_STRING "__vtbl__" /* Lucid/cfront virtual table prefix */ -#define ARM_VTABLE_STRLEN 8 /* strlen (ARM_VTABLE_STRING) */ - -/* Prototypes for local functions */ - -static char * -mop_up PARAMS ((struct work_stuff *, string *, int)); - -#if 0 -static int -demangle_method_args PARAMS ((struct work_stuff *work, const char **, string *)); -#endif - -static int -demangle_template PARAMS ((struct work_stuff *work, const char **, string *)); - -static int -demangle_qualified PARAMS ((struct work_stuff *, const char **, string *, - int)); - -static int -demangle_class PARAMS ((struct work_stuff *, const char **, string *)); - -static int -demangle_fund_type PARAMS ((struct work_stuff *, const char **, string *)); - -static int -demangle_signature PARAMS ((struct work_stuff *, const char **, string *)); - -static int -demangle_prefix PARAMS ((struct work_stuff *, const char **, string *)); - -static int -gnu_special PARAMS ((struct work_stuff *, const char **, string *)); - -static int -cfront_special PARAMS ((struct work_stuff *, const char **, string *)); - -static void -string_need PARAMS ((string *, int)); - -static void -string_delete PARAMS ((string *)); - -static void -string_init PARAMS ((string *)); - -static void -string_clear PARAMS ((string *)); - -#if 0 -static int -string_empty PARAMS ((string *)); -#endif - -static void -string_append PARAMS ((string *, const char *)); - -static void -string_appends PARAMS ((string *, string *)); - -static void -string_appendn PARAMS ((string *, const char *, int)); - -static void -string_prepend PARAMS ((string *, const char *)); - -static void -string_prependn PARAMS ((string *, const char *, int)); - -static int -get_count PARAMS ((const char **, int *)); - -static int -consume_count PARAMS ((const char **)); - -static int -demangle_args PARAMS ((struct work_stuff *, const char **, string *)); - -static int -do_type PARAMS ((struct work_stuff *, const char **, string *)); - -static int -do_arg PARAMS ((struct work_stuff *, const char **, string *)); - -static void -demangle_function_name PARAMS ((struct work_stuff *, const char **, string *, - const char *)); - -static void -remember_type PARAMS ((struct work_stuff *, const char *, int)); - -static void -forget_types PARAMS ((struct work_stuff *)); - -#if 0 -static void -string_prepends PARAMS ((string *, string *)); -#endif - -/* Translate count to integer, consuming tokens in the process. - Conversion terminates on the first non-digit character. */ - -static int -consume_count (type) - const char **type; -{ - int count = 0; - - do - { - count *= 10; - count += **type - '0'; - (*type)++; - } while (isdigit (**type)); - return (count); -} - -/* Takes operator name as e.g. "++" and returns mangled - operator name (e.g. "postincrement_expr"), or NULL if not found. - - If OPTIONS & DMGL_ANSI == 1, return the ANSI name; - if OPTIONS & DMGL_ANSI == 0, return the old GNU name. */ - -char * -cplus_mangle_opname (opname, options) - char *opname; - int options; -{ - int i; - int len; - - len = strlen (opname); - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].out) == len - && (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI) - && memcmp (optable[i].out, opname, len) == 0) - return ((char *)optable[i].in); - } - return (0); -} - -/* char *cplus_demangle (const char *name, int options) - - If NAME is a mangled function name produced by GNU C++, then - a pointer to a malloced string giving a C++ representation - of the name will be returned; otherwise NULL will be returned. - It is the caller's responsibility to free the string which - is returned. - - The OPTIONS arg may contain one or more of the following bits: - - DMGL_ANSI ANSI qualifiers such as `const' and `void' are - included. - DMGL_PARAMS Function parameters are included. - - For example, - - cplus_demangle ("foo__1Ai", DMGL_PARAMS) => "A::foo(int)" - cplus_demangle ("foo__1Ai", DMGL_PARAMS | DMGL_ANSI) => "A::foo(int)" - cplus_demangle ("foo__1Ai", 0) => "A::foo" - - cplus_demangle ("foo__1Afe", DMGL_PARAMS) => "A::foo(float,...)" - cplus_demangle ("foo__1Afe", DMGL_PARAMS | DMGL_ANSI)=> "A::foo(float,...)" - cplus_demangle ("foo__1Afe", 0) => "A::foo" - - Note that any leading underscores, or other such characters prepended by - the compilation system, are presumed to have already been stripped from - TYPE. */ - -char * -cplus_demangle (mangled, options) - const char *mangled; - int options; -{ - string decl; - int success = 0; - struct work_stuff work[1]; - char *demangled = NULL; - - if ((mangled != NULL) && (*mangled != '\0')) - { - memset ((char *) work, 0, sizeof (work)); - work -> options = options; - - string_init (&decl); - - /* First check to see if gnu style demangling is active and if the - string to be demangled contains a CPLUS_MARKER. If so, attempt to - recognize one of the gnu special forms rather than looking for a - standard prefix. In particular, don't worry about whether there - is a "__" string in the mangled string. Consider "_$_5__foo" for - example. */ - - if ((AUTO_DEMANGLING || GNU_DEMANGLING) - && (strpbrk (mangled, cplus_markers)) != NULL) - { - success = gnu_special (work, &mangled, &decl); - } - else - { - success = demangle_prefix (work, &mangled, &decl); - } - if (success && (*mangled != '\0')) - { - success = demangle_signature (work, &mangled, &decl); - } - demangled = mop_up (work, &decl, success); - } - return (demangled); -} - -static char * -mop_up (work, declp, success) - struct work_stuff *work; - string *declp; - int success; -{ - int i; - char *demangled = NULL; - - /* Discard the remembered types, if any. */ - - forget_types (work); - if (work -> typevec != NULL) - { - free ((char *) work -> typevec); - } - - /* If demangling was successful, ensure that the demangled string is null - terminated and return it. Otherwise, free the demangling decl. */ - - if (!success) - { - string_delete (declp); - } - else - { - string_appendn (declp, "", 1); - demangled = declp -> b; - } - return (demangled); -} - -/* - -LOCAL FUNCTION - - demangle_signature -- demangle the signature part of a mangled name - -SYNOPSIS - - static int - demangle_signature (struct work_stuff *work, const char **mangled, - string *declp); - -DESCRIPTION - - Consume and demangle the signature portion of the mangled name. - - DECLP is the string where demangled output is being built. At - entry it contains the demangled root name from the mangled name - prefix. I.E. either a demangled operator name or the root function - name. In some special cases, it may contain nothing. - - *MANGLED points to the current unconsumed location in the mangled - name. As tokens are consumed and demangling is performed, the - pointer is updated to continuously point at the next token to - be consumed. - - Demangling GNU style mangled names is nasty because there is no - explicit token that marks the start of the outermost function - argument list. -*/ - -static int -demangle_signature (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int success = 1; - int func_done = 0; - int expect_func = 0; - const char *oldmangled; - - while (success && (**mangled != '\0')) - { - switch (**mangled) - { - case 'Q': - oldmangled = *mangled; - success = demangle_qualified (work, mangled, declp, 1); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - expect_func = 1; - } - break; - - case 'S': - /* Static member function */ - (*mangled)++; - work -> static_type = 1; - break; - - case 'C': - /* a const member function */ - (*mangled)++; - work -> const_type = 1; - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - oldmangled = *mangled; - success = demangle_class (work, mangled, declp); - if (success) - { - remember_type (work, oldmangled, *mangled - oldmangled); - } - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - expect_func = 1; - } - break; - - case 'F': - /* Function */ - /* ARM style demangling includes a specific 'F' character after - the class name. For GNU style, it is just implied. So we can - safely just consume any 'F' at this point and be compatible - with either style. */ - - func_done = 1; - (*mangled)++; - - /* For lucid/cfront style we have to forget any types we might - have remembered up to this point, since they were not argument - types. GNU style considers all types seen as available for - back references. See comment in demangle_args() */ - - if (LUCID_DEMANGLING || CFRONT_DEMANGLING) - { - forget_types (work); - } - success = demangle_args (work, mangled, declp); - break; - - case 't': - /* Template */ - success = demangle_template (work, mangled, declp); - break; - - case '_': - /* At the outermost level, we cannot have a return type specified, - so if we run into another '_' at this point we are dealing with - a mangled name that is either bogus, or has been mangled by - some algorithm we don't know how to deal with. So just - reject the entire demangling. */ - success = 0; - break; - - default: - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* Assume we have stumbled onto the first outermost function - argument token, and start processing args. */ - func_done = 1; - success = demangle_args (work, mangled, declp); - } - else - { - /* Non-GNU demanglers use a specific token to mark the start - of the outermost function argument tokens. Typically 'F', - for ARM-demangling, for example. So if we find something - we are not prepared for, it must be an error. */ - success = 0; - } - break; - } - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - if (success && expect_func) - { - func_done = 1; - success = demangle_args (work, mangled, declp); - } - } - } - if (success && !func_done) - { - if (AUTO_DEMANGLING || GNU_DEMANGLING) - { - /* With GNU style demangling, bar__3foo is 'foo::bar(void)', and - bar__3fooi is 'foo::bar(int)'. We get here when we find the - first case, and need to ensure that the '(void)' gets added to - the current declp. Note that with ARM, the first case - represents the name of a static data member 'foo::bar', - which is in the current declp, so we leave it alone. */ - success = demangle_args (work, mangled, declp); - } - } - if (success && work -> static_type && PRINT_ARG_TYPES) - { - string_append (declp, " static"); - } - if (success && work -> const_type && PRINT_ARG_TYPES) - { - string_append (declp, " const"); - } - return (success); -} - -#if 0 - -static int -demangle_method_args (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int success = 0; - - if (work -> static_type) - { - string_append (declp, *mangled + 1); - *mangled += strlen (*mangled); - success = 1; - } - else - { - success = demangle_args (work, mangled, declp); - } - return (success); -} - -#endif - -static int -demangle_template (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int i; - string tname; - string trawname; - int is_pointer; - int is_real; - int is_integral; - int r; - int need_comma = 0; - int success = 0; - int done; - const char *old_p; - int symbol_len; - string temp; - - (*mangled)++; - string_init (&tname); - string_init (&trawname); - /* get template name */ - if (!get_count (mangled, &r)) - { - return (0); - } - string_appendn (&tname, *mangled, r); - string_appendn (&trawname, *mangled, r); - string_appendn (&trawname, "", 1); - *mangled += r; - string_append (&tname, "<"); - /* get size of template parameter list */ - if (!get_count (mangled, &r)) - { - return (0); - } - for (i = 0; i < r; i++) - { - if (need_comma) - { - string_append (&tname, ", "); - } - /* Z for type parameters */ - if (**mangled == 'Z') - { - (*mangled)++; - success = do_type (work, mangled, &temp); - string_appendn (&temp, "", 1); - if (success) - { - string_append (&tname, temp.b); - } - string_delete(&temp); - if (!success) - { - break; - } - } - else - { - /* otherwise, value parameter */ - old_p = *mangled; - is_pointer = 0; - is_real = 0; - is_integral = 0; - done = 0; - success = do_type (work, mangled, &temp); - string_appendn (&temp, "", 1); - if (success) - { - string_append (&tname, temp.b); - } - string_delete(&temp); - if (!success) - { - break; - } - string_append (&tname, "="); - while (*old_p && !done) - { - switch (*old_p) - { - case 'P': - case 'R': - done = is_pointer = 1; - break; - case 'C': /* const */ - case 'S': /* explicitly signed [char] */ - case 'U': /* unsigned */ - case 'V': /* volatile */ - case 'F': /* function */ - case 'M': /* member function */ - case 'O': /* ??? */ - old_p++; - continue; - case 'Q': /* repetition of following */ - case 'T': /* remembered type */ - abort (); - break; - case 'v': /* void */ - abort (); - break; - case 'x': /* long long */ - case 'l': /* long */ - case 'i': /* int */ - case 's': /* short */ - case 'c': /* char */ - done = is_integral = 1; - break; - case 'r': /* long double */ - case 'd': /* double */ - case 'f': /* float */ - done = is_real = 1; - break; - default: - abort (); - } - } - if (is_integral) - { - if (**mangled == 'm') - { - string_appendn (&tname, "-", 1); - (*mangled)++; - } - while (isdigit (**mangled)) - { - string_appendn (&tname, *mangled, 1); - (*mangled)++; - } - } - else if (is_real) - { - if (**mangled == 'm') - { - string_appendn (&tname, "-", 1); - (*mangled)++; - } - while (isdigit (**mangled)) - { - string_appendn (&tname, *mangled, 1); - (*mangled)++; - } - if (**mangled == '.') /* fraction */ - { - string_appendn (&tname, ".", 1); - (*mangled)++; - while (isdigit (**mangled)) - { - string_appendn (&tname, *mangled, 1); - (*mangled)++; - } - } - if (**mangled == 'e') /* exponent */ - { - string_appendn (&tname, "e", 1); - (*mangled)++; - while (isdigit (**mangled)) - { - string_appendn (&tname, *mangled, 1); - (*mangled)++; - } - } - } - else if (is_pointer) - { - if (!get_count (mangled, &symbol_len)) - { - success = 0; - break; - } - string_appendn (&tname, *mangled, symbol_len); - *mangled += symbol_len; - } - } - need_comma = 1; - } - string_append (&tname, ">::"); - if (work -> destructor) - { - string_append (&tname, "~"); - } - if (work -> constructor || work -> destructor) - { - string_append (&tname, trawname.b); - } - string_delete(&trawname); - - if (!success) - { - string_delete(&tname); - } - else - { - string_prepend (declp, tname.b); - string_delete (&tname); - - if (work -> static_type) - { - string_append (declp, *mangled + 1); - *mangled += strlen (*mangled); - success = 1; - } - else - { - success = demangle_args (work, mangled, declp); - } - } - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_class -- demangle a mangled class sequence - -SYNOPSIS - - static int - demangle_class (struct work_stuff *work, const char **mangled, - strint *declp) - -DESCRIPTION - - DECLP points to the buffer into which demangling is being done. - - *MANGLED points to the current token to be demangled. On input, - it points to a mangled class (I.E. "3foo", "13verylongclass", etc.) - On exit, it points to the next token after the mangled class on - success, or the first unconsumed token on failure. - - If the CONSTRUCTOR or DESTRUCTOR flags are set in WORK, then - we are demangling a constructor or destructor. In this case - we prepend "class::class" or "class::~class" to DECLP. - - Otherwise, we prepend "class::" to the current DECLP. - - Reset the constructor/destructor flags once they have been - "consumed". This allows demangle_class to be called later during - the same demangling, to do normal class demangling. - - Returns 1 if demangling is successful, 0 otherwise. - -*/ - -static int -demangle_class (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int n; - int success = 0; - - n = consume_count (mangled); - if (strlen (*mangled) >= n) - { - if (work -> constructor || work -> destructor) - { - string_prependn (declp, *mangled, n); - if (work -> destructor) - { - string_prepend (declp, "~"); - } - work -> constructor = work -> destructor = 0; - } - string_prepend (declp, "::"); - string_prependn (declp, *mangled, n); - *mangled += n; - success = 1; - } - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_prefix -- consume the mangled name prefix and find signature - -SYNOPSIS - - static int - demangle_prefix (struct work_stuff *work, const char **mangled, - string *declp); - -DESCRIPTION - - Consume and demangle the prefix of the mangled name. - - DECLP points to the string buffer into which demangled output is - placed. On entry, the buffer is empty. On exit it contains - the root function name, the demangled operator name, or in some - special cases either nothing or the completely demangled result. - - MANGLED points to the current pointer into the mangled name. As each - token of the mangled name is consumed, it is updated. Upon entry - the current mangled name pointer points to the first character of - the mangled name. Upon exit, it should point to the first character - of the signature if demangling was successful, or to the first - unconsumed character if demangling of the prefix was unsuccessful. - - Returns 1 on success, 0 otherwise. - */ - -static int -demangle_prefix (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int success = 1; - const char *scan; - int i; - - scan = strstr (*mangled, "__"); - - if (scan != NULL) - { - /* We found a sequence of two or more '_', ensure that we start at - the last pair in the sequence. */ - i = strspn (scan, "_"); - if (i > 2) - { - scan += (i - 2); - } - } - - if (scan == NULL) - { - success = 0; - } - else if (work -> static_type) - { - if (!isdigit (scan[0]) && (scan[0] != 't')) - { - success = 0; - } - } - else if ((scan == *mangled) && (isdigit (scan[2]) || (scan[2] == 'Q'))) - { - /* A GNU style constructor starts with "__" or "__Q". */ - work -> constructor = 1; - *mangled = scan + 2; - } - else if ((scan == *mangled) && !isdigit (scan[2]) && (scan[2] != 't')) - { - /* Mangled name starts with "__". Skip over any leading '_' characters, - then find the next "__" that separates the prefix from the signature. - */ - if (!(CFRONT_DEMANGLING || LUCID_DEMANGLING) - || (cfront_special (work, mangled, declp) == 0)) - { - while (*scan == '_') - { - scan++; - } - if ((scan = strstr (scan, "__")) == NULL || (*(scan + 2) == '\0')) - { - /* No separator (I.E. "__not_mangled"), or empty signature - (I.E. "__not_mangled_either__") */ - success = 0; - } - else - { - demangle_function_name (work, mangled, declp, scan); - } - } - } - else if (*(scan + 2) != '\0') - { - /* Mangled name does not start with "__" but does have one somewhere - in there with non empty stuff after it. Looks like a global - function name. */ - demangle_function_name (work, mangled, declp, scan); - } - else - { - /* Doesn't look like a mangled name */ - success = 0; - } - return (success); -} - -/* - -LOCAL FUNCTION - - gnu_special -- special handling of gnu mangled strings - -SYNOPSIS - - static int - gnu_special (struct work_stuff *work, const char **mangled, - string *declp); - - -DESCRIPTION - - Process some special GNU style mangling forms that don't fit - the normal pattern. For example: - - _$_3foo (destructor for class foo) - _vt$foo (foo virtual table) - _vt$foo$bar (foo::bar virtual table) - _3foo$varname (static data member) - */ - -static int -gnu_special (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int n; - int success = 1; - const char *p; - - if ((*mangled)[0] == '_' - && strchr (cplus_markers, (*mangled)[1]) != NULL - && (*mangled)[2] == '_') - { - /* Found a GNU style destructor, get past "__" */ - (*mangled) += 3; - work -> destructor = 1; - } - else if ((*mangled)[0] == '_' - && (*mangled)[1] == 'v' - && (*mangled)[2] == 't' - && strchr (cplus_markers, (*mangled)[3]) != NULL) - { - /* Found a GNU style virtual table, get past "_vt" - and create the decl. Note that we consume the entire mangled - input string, which means that demangle_signature has no work - to do. */ - (*mangled) += 4; - while (**mangled != '\0') - { - n = strcspn (*mangled, cplus_markers); - string_appendn (declp, *mangled, n); - (*mangled) += n; - if (**mangled != '\0') - { - string_append (declp, "::"); - (*mangled)++; - } - } - string_append (declp, " virtual table"); - } - else if ((*mangled)[0] == '_' - && isdigit ((*mangled)[1]) - && (p = strpbrk (*mangled, cplus_markers)) != NULL) - { - /* static data member, "_3foo$varname" for example */ - (*mangled)++; - p++; - n = consume_count (mangled); - string_appendn (declp, *mangled, n); - string_append (declp, "::"); - n = strlen (p); - string_appendn (declp, p, n); - (*mangled) = p + n; - } - else - { - success = 0; - } - return (success); -} - -/* - -LOCAL FUNCTION - - cfront_special -- special handling of cfront/lucid mangled strings - -SYNOPSIS - - static int - cfront_special (struct work_stuff *work, const char **mangled, - string *declp); - - -DESCRIPTION - - Process some special cfront style mangling forms that don't fit - the normal pattern. For example: - - __vtbl__3foo (foo virtual table) - __vtbl__3foo__3bar (bar::foo virtual table) - - */ - -static int -cfront_special (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - int n; - int i; - int success = 1; - const char *p; - - if (strncmp (*mangled, ARM_VTABLE_STRING, ARM_VTABLE_STRLEN) == 0) - { - /* Found a cfront style virtual table, get past ARM_VTABLE_STRING - and create the decl. Note that we consume the entire mangled - input string, which means that demangle_signature has no work - to do. */ - (*mangled) += ARM_VTABLE_STRLEN; - while (**mangled != '\0') - { - n = consume_count (mangled); - string_prependn (declp, *mangled, n); - (*mangled) += n; - if ((*mangled)[0] == '_' && (*mangled)[1] == '_') - { - string_prepend (declp, "::"); - (*mangled) += 2; - } - } - string_append (declp, " virtual table"); - } - else - { - success = 0; - } - return (success); -} - -/* - -LOCAL FUNCTION - - demangle_qualified -- demangle 'Q' qualified name strings - -SYNOPSIS - - static int - demangle_qualified (struct work_stuff *, const char *mangled, - string *result, int isfuncname); - -DESCRIPTION - - Demangle a qualified name, such as "Q25Outer5Inner" which is - the mangled form of "Outer::Inner". The demangled output is - appended to the result string. - - If isfuncname is nonzero, then the qualified name we are building - is going to be used as a member function name, so if it is a - constructor or destructor function, append an appropriate - constructor or destructor name. I.E. for the above example, - the result for use as a constructor is "Outer::Inner::Inner" - and the result for use as a destructor is "Outer::Inner::~Inner". - -BUGS - - Numeric conversion is ASCII dependent (FIXME). - - */ - -static int -demangle_qualified (work, mangled, result, isfuncname) - struct work_stuff *work; - const char **mangled; - string *result; - int isfuncname; -{ - int qualifiers; - int namelength; - int success = 0; - - qualifiers = (*mangled)[1] - '0'; - if (qualifiers > 0 && qualifiers < 10) - { - /* Assume success until we discover otherwise. Skip over the 'Q', the - qualifier count, and any '_' between the qualifier count and the - first name (cfront qualified names). */ - - success = 1; - if ((*mangled)[2] == '_') - { - (*mangled)++; - } - (*mangled) += 2; - - - /* Pick off the names and append them to the result string as they - are found, separated by '::'. */ - - while (qualifiers-- > 0) - { - namelength = consume_count (mangled); - if (strlen (*mangled) < namelength) - { - /* Simple sanity check failed */ - success = 0; - break; - } - string_appendn (result, *mangled, namelength); - if (qualifiers > 0) - { - string_appendn (result, "::", 2); - } - *mangled += namelength; - } - - /* If we are using the result as a function name, we need to append - the appropriate '::' separated constructor or destructor name. - We do this here because this is the most convenient place, where - we already have a pointer to the name and the length of the name. */ - - if (isfuncname && (work -> constructor || work -> destructor)) - { - string_appendn (result, "::", 2); - if (work -> destructor) - { - string_append (result, "~"); - } - string_appendn (result, (*mangled) - namelength, namelength); - } - } - return (success); -} - -/* - -LOCAL FUNCTION - - get_count -- convert an ascii count to integer, consuming tokens - -SYNOPSIS - - static int - get_count (const char **type, int *count) - -DESCRIPTION - - Return 0 if no conversion is performed, 1 if a string is converted. -*/ - -static int -get_count (type, count) - const char **type; - int *count; -{ - const char *p; - int n; - - if (!isdigit (**type)) - { - return (0); - } - else - { - *count = **type - '0'; - (*type)++; - if (isdigit (**type)) - { - p = *type; - n = *count; - do - { - n *= 10; - n += *p - '0'; - p++; - } - while (isdigit (*p)); - if (*p == '_') - { - *type = p + 1; - *count = n; - } - } - } - return (1); -} - -/* result will be initialised here; it will be freed on failure */ - -static int -do_type (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; -{ - int n; - int done; - int success; - string decl; - const char *remembered_type; - int constp; - int volatilep; - - string_init (&decl); - string_init (result); - - done = 0; - success = 1; - while (success && !done) - { - int member; - switch (**mangled) - { - - /* A pointer type */ - case 'P': - (*mangled)++; - string_prepend (&decl, "*"); - break; - - /* A reference type */ - case 'R': - (*mangled)++; - string_prepend (&decl, "&"); - break; - - /* A back reference to a previously seen type */ - case 'T': - (*mangled)++; - if (!get_count (mangled, &n) || n >= work -> ntypes) - { - success = 0; - } - else - { - remembered_type = work -> typevec[n]; - mangled = &remembered_type; - } - break; - - /* A function */ - case 'F': - (*mangled)++; - if (!STRING_EMPTY (&decl) && decl.b[0] == '*') - { - string_prepend (&decl, "("); - string_append (&decl, ")"); - } - /* After picking off the function args, we expect to either find the - function return type (preceded by an '_') or the end of the - string. */ - if (!demangle_args (work, mangled, &decl) - || (**mangled != '_' && **mangled != '\0')) - { - success = 0; - } - if (success && (**mangled == '_')) - { - (*mangled)++; - } - break; - - case 'M': - case 'O': - { - constp = 0; - volatilep = 0; - - member = **mangled == 'M'; - (*mangled)++; - if (!isdigit (**mangled)) - { - success = 0; - break; - } - n = consume_count (mangled); - if (strlen (*mangled) < n) - { - success = 0; - break; - } - string_append (&decl, ")"); - string_prepend (&decl, "::"); - string_prependn (&decl, *mangled, n); - string_prepend (&decl, "("); - *mangled += n; - if (member) - { - if (**mangled == 'C') - { - (*mangled)++; - constp = 1; - } - if (**mangled == 'V') - { - (*mangled)++; - volatilep = 1; - } - if (*(*mangled)++ != 'F') - { - success = 0; - break; - } - } - if ((member && !demangle_args (work, mangled, &decl)) - || **mangled != '_') - { - success = 0; - break; - } - (*mangled)++; - if (! PRINT_ANSI_QUALIFIERS) - { - break; - } - if (constp) - { - APPEND_BLANK (&decl); - string_append (&decl, "const"); - } - if (volatilep) - { - APPEND_BLANK (&decl); - string_append (&decl, "volatile"); - } - break; - } - - case 'C': - if ((*mangled)[1] == 'P') - { - (*mangled)++; - if (PRINT_ANSI_QUALIFIERS) - { - if (!STRING_EMPTY (&decl)) - { - string_prepend (&decl, " "); - } - string_prepend (&decl, "const"); - } - break; - } - - /* fall through */ - default: - done = 1; - break; - } - } - - switch (**mangled) - { - /* A qualified name, such as "Outer::Inner". */ - case 'Q': - success = demangle_qualified (work, mangled, result, 0); - break; - - default: - success = demangle_fund_type (work, mangled, result); - break; - } - - if (success) - { - if (!STRING_EMPTY (&decl)) - { - string_append (result, " "); - string_appends (result, &decl); - } - } - else - { - string_delete (result); - } - string_delete (&decl); - return (success); -} - -/* Given a pointer to a type string that represents a fundamental type - argument (int, long, unsigned int, etc) in TYPE, a pointer to the - string in which the demangled output is being built in RESULT, and - the WORK structure, decode the types and add them to the result. - - For example: - - "Ci" => "const int" - "Sl" => "signed long" - "CUs" => "const unsigned short" - - */ - -static int -demangle_fund_type (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; -{ - int done = 0; - int success = 1; - int n; - - /* First pick off any type qualifiers. There can be more than one. */ - - while (!done) - { - switch (**mangled) - { - case 'C': - (*mangled)++; - if (PRINT_ANSI_QUALIFIERS) - { - APPEND_BLANK (result); - string_append (result, "const"); - } - break; - case 'U': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "unsigned"); - break; - case 'S': /* signed char only */ - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "signed"); - break; - case 'V': - (*mangled)++; - if (PRINT_ANSI_QUALIFIERS) - { - APPEND_BLANK (result); - string_append (result, "volatile"); - } - break; - default: - done = 1; - break; - } - } - - /* Now pick off the fundamental type. There can be only one. */ - - switch (**mangled) - { - case '\0': - case '_': - break; - case 'v': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "void"); - break; - case 'x': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long long"); - break; - case 'l': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long"); - break; - case 'i': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "int"); - break; - case 's': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "short"); - break; - case 'c': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "char"); - break; - case 'r': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "long double"); - break; - case 'd': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "double"); - break; - case 'f': - (*mangled)++; - APPEND_BLANK (result); - string_append (result, "float"); - break; - case 'G': - (*mangled)++; - if (!isdigit (**mangled)) - { - success = 0; - break; - } - /* fall through */ - /* An explicit type, such as "6mytype" or "7integer" */ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - n = consume_count (mangled); - if (strlen (*mangled) < n) - { - success = 0; - break; - } - APPEND_BLANK (result); - string_appendn (result, *mangled, n); - *mangled += n; - break; - default: - success = 0; - break; - } - - return (success); -} - -/* `result' will be initialized in do_type; it will be freed on failure */ - -static int -do_arg (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; -{ - const char *start = *mangled; - - if (!do_type (work, mangled, result)) - { - return (0); - } - else - { - remember_type (work, start, *mangled - start); - return (1); - } -} - -static void -remember_type (work, start, len) - struct work_stuff *work; - const char *start; - int len; -{ - char *tem; - - if (work -> ntypes >= work -> typevec_size) - { - if (work -> typevec_size == 0) - { - work -> typevec_size = 3; - work -> typevec = - (char **) xmalloc (sizeof (char *) * work -> typevec_size); - } - else - { - work -> typevec_size *= 2; - work -> typevec = - (char **) xrealloc ((char *)work -> typevec, - sizeof (char *) * work -> typevec_size); - } - } - tem = (char *) xmalloc (len + 1); - memcpy (tem, start, len); - tem[len] = '\0'; - work -> typevec[work -> ntypes++] = tem; -} - -/* Forget the remembered types, but not the type vector itself. */ - -static void -forget_types (work) - struct work_stuff *work; -{ - int i; - - while (work -> ntypes > 0) - { - i = --(work -> ntypes); - if (work -> typevec[i] != NULL) - { - free (work -> typevec[i]); - work -> typevec[i] = NULL; - } - } -} - -/* Process the argument list part of the signature, after any class spec - has been consumed, as well as the first 'F' character (if any). For - example: - - "__als__3fooRT0" => process "RT0" - "complexfunc5__FPFPc_PFl_i" => process "PFPc_PFl_i" - - DECLP must be already initialised, usually non-empty. It won't be freed - on failure. - - Note that g++ differs significantly from cfront and lucid style mangling - with regards to references to previously seen types. For example, given - the source fragment: - - class foo { - public: - foo::foo (int, foo &ia, int, foo &ib, int, foo &ic); - }; - - foo::foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; } - void foo (int, foo &ia, int, foo &ib, int, foo &ic) { ia = ib = ic; } - - g++ produces the names: - - __3fooiRT0iT2iT2 - foo__FiR3fooiT1iT1 - - while lcc (and presumably cfront as well) produces: - - foo__FiR3fooT1T2T1T2 - __ct__3fooFiR3fooT1T2T1T2 - - Note that g++ bases it's type numbers starting at zero and counts all - previously seen types, while lucid/cfront bases it's type numbers starting - at one and only considers types after it has seen the 'F' character - indicating the start of the function args. For lucid/cfront style, we - account for this difference by discarding any previously seen types when - we see the 'F' character, and subtracting one from the type number - reference. - - */ - -static int -demangle_args (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; -{ - string arg; - int need_comma = 0; - int r; - int t; - const char *tem; - char temptype; - - if (PRINT_ARG_TYPES) - { - string_append (declp, "("); - if (**mangled == '\0') - { - string_append (declp, "void"); - } - } - - while (**mangled != '_' && **mangled != '\0' && **mangled != 'e') - { - if ((**mangled == 'N') || (**mangled == 'T')) - { - temptype = *(*mangled)++; - - if (temptype == 'N') - { - if (!get_count (mangled, &r)) - { - return (0); - } - } - else - { - r = 1; - } - if (!get_count (mangled, &t)) - { - return (0); - } - if (LUCID_DEMANGLING || CFRONT_DEMANGLING) - { - t--; - } - /* Validate the type index. Protect against illegal indices from - malformed type strings. */ - if ((t < 0) || (t >= work -> ntypes)) - { - return (0); - } - while (--r >= 0) - { - tem = work -> typevec[t]; - if (need_comma && PRINT_ARG_TYPES) - { - string_append (declp, ", "); - } - if (!do_arg (work, &tem, &arg)) - { - return (0); - } - if (PRINT_ARG_TYPES) - { - string_appends (declp, &arg); - } - string_delete (&arg); - need_comma = 1; - } - } - else - { - if (need_comma & PRINT_ARG_TYPES) - { - string_append (declp, ", "); - } - if (!do_arg (work, mangled, &arg)) - { - return (0); - } - if (PRINT_ARG_TYPES) - { - string_appends (declp, &arg); - } - string_delete (&arg); - need_comma = 1; - } - } - - if (**mangled == 'e') - { - (*mangled)++; - if (PRINT_ARG_TYPES) - { - if (need_comma) - { - string_append (declp, ","); - } - string_append (declp, "..."); - } - } - - if (PRINT_ARG_TYPES) - { - string_append (declp, ")"); - } - return (1); -} - -static void -demangle_function_name (work, mangled, declp, scan) - struct work_stuff *work; - const char **mangled; - string *declp; - const char *scan; -{ - int i; - int len; - string type; - const char *tem; - - string_appendn (declp, (*mangled), scan - (*mangled)); - string_need (declp, 1); - *(declp -> p) = '\0'; - - /* Consume the function name, including the "__" separating the name - from the signature. We are guaranteed that SCAN points to the - separator. */ - - (*mangled) = scan + 2; - - if (LUCID_DEMANGLING || CFRONT_DEMANGLING) - { - - /* See if we have an ARM style constructor or destructor operator. - If so, then just record it, clear the decl, and return. - We can't build the actual constructor/destructor decl until later, - when we recover the class name from the signature. */ - - if (strcmp (declp -> b, "__ct") == 0) - { - work -> constructor = 1; - string_clear (declp); - return; - } - else if (strcmp (declp -> b, "__dt") == 0) - { - work -> destructor = 1; - string_clear (declp); - return; - } - } - - if (declp->p - declp->b >= 3 - && declp->b[0] == 'o' - && declp->b[1] == 'p' - && strchr (cplus_markers, declp->b[2]) != NULL) - { - /* see if it's an assignment expression */ - if (declp->p - declp->b >= 10 /* op$assign_ */ - && memcmp (declp->b + 3, "assign_", 7) == 0) - { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - len = declp->p - declp->b - 10; - if (strlen (optable[i].in) == len - && memcmp (optable[i].in, declp->b + 10, len) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - string_append (declp, "="); - break; - } - } - } - else - { - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - int len = declp->p - declp->b - 3; - if (strlen (optable[i].in) == len - && memcmp (optable[i].in, declp->b + 3, len) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - } - else if (declp->p - declp->b >= 5 && memcmp (declp->b, "type$", 5) == 0) - { - /* type conversion operator */ - tem = declp->b + 5; - if (do_type (work, &tem, &type)) - { - string_clear (declp); - string_append (declp, "operator "); - string_appends (declp, &type); - string_delete (&type); - } - } - else if (declp->b[2] == 'o' && declp->b[3] == 'p') - { - /* ANSI. */ - /* type conversion operator. */ - tem = declp->b + 4; - if (do_type (work, &tem, &type)) - { - string_clear (declp); - string_append (declp, "operator "); - string_appends (declp, &type); - string_delete (&type); - } - } - else if (declp->b[0] == '_' && declp->b[1] == '_' - && declp->b[2] >= 'a' && declp->b[2] <= 'z' - && declp->b[3] >= 'a' && declp->b[3] <= 'z') - { - if (declp->b[4] == '\0') - { - /* Operator. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].in) == 2 - && memcmp (optable[i].in, declp->b + 2, 2) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - else - { - if (declp->b[2] == 'a' && declp->b[5] == '\0') - { - /* Assignment. */ - for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++) - { - if (strlen (optable[i].in) == 3 - && memcmp (optable[i].in, declp->b + 2, 3) == 0) - { - string_clear (declp); - string_append (declp, "operator"); - string_append (declp, optable[i].out); - break; - } - } - } - } - } -} - -/* a mini string-handling package */ - -static void -string_need (s, n) - string *s; - int n; -{ - int tem; - - if (s->b == NULL) - { - if (n < 32) - { - n = 32; - } - s->p = s->b = (char *) xmalloc (n); - s->e = s->b + n; - } - else if (s->e - s->p < n) - { - tem = s->p - s->b; - n += tem; - n *= 2; - s->b = (char *) xrealloc (s->b, n); - s->p = s->b + tem; - s->e = s->b + n; - } -} - -static void -string_delete (s) - string *s; -{ - if (s->b != NULL) - { - free (s->b); - s->b = s->e = s->p = NULL; - } -} - -static void -string_init (s) - string *s; -{ - s->b = s->p = s->e = NULL; -} - -static void -string_clear (s) - string *s; -{ - s->p = s->b; -} - -#if 0 - -static int -string_empty (s) - string *s; -{ - return (s->b == s->p); -} - -#endif - -static void -string_append (p, s) - string *p; - const char *s; -{ - int n; - if (s == NULL || *s == '\0') - return; - n = strlen (s); - string_need (p, n); - memcpy (p->p, s, n); - p->p += n; -} - -static void -string_appends (p, s) - string *p, *s; -{ - int n; - - if (s->b != s->p) - { - n = s->p - s->b; - string_need (p, n); - memcpy (p->p, s->b, n); - p->p += n; - } -} - -static void -string_appendn (p, s, n) - string *p; - const char *s; - int n; -{ - if (n != 0) - { - string_need (p, n); - memcpy (p->p, s, n); - p->p += n; - } -} - -static void -string_prepend (p, s) - string *p; - const char *s; -{ - if (s != NULL && *s != '\0') - { - string_prependn (p, s, strlen (s)); - } -} - -#if 0 - -static void -string_prepends (p, s) - string *p, *s; -{ - if (s->b != s->p) - { - string_prependn (p, s->b, s->p - s->b); - } -} - -#endif - -static void -string_prependn (p, s, n) - string *p; - const char *s; - int n; -{ - char *q; - - if (n != 0) - { - string_need (p, n); - for (q = p->p - 1; q >= p->b; q--) - { - q[n] = q[0]; - } - memcpy (p->b, s, n); - p->p += n; - } -} - -/* To generate a standalone demangler program for testing purposes, just - compile and link this file with -DMAIN. When run, it demangles each - command line arg, or each stdin string, and prints the result on stdout. */ - -#ifdef MAIN - -static void -demangle_it (mangled_name) - char *mangled_name; -{ - char *result; - - result = cplus_demangle (mangled_name, DMGL_PARAMS | DMGL_ANSI); - if (result == NULL) - { - printf ("%s\n", mangled_name); - } - else - { - printf ("%s\n", result); - free (result); - } -} - -PTR -xmalloc (size) - long size; -{ - PTR newmem; - - if ((newmem = malloc ((int) size)) == NULL) - { - fprintf (stderr, "\nCan't allocate %u bytes\n", size); - exit (1); - } - return (newmem); -} - -PTR -xrealloc (oldmem, size) - PTR oldmem; - long size; -{ - PTR newmem; - - if ((newmem = realloc ((char *) oldmem, (int) size)) == NULL) - { - fprintf (stderr, "\nCan't reallocate %u bytes\n", size); - exit (1); - } - return (newmem); -} - -#include - -enum demangling_styles current_demangling_style = gnu_demangling; - -main (argc, argv) - int argc; - char **argv; -{ - char mangled_name[128]; - char *result; - int c; - extern char *optarg; - extern int optind; - - while ((c = getopt (argc, argv, "s:?")) != EOF) - { - switch (c) - { - case '?': - fprintf (stderr, "usage: demangle [-s style] [arg1 [arg2]] ...\n"); - fprintf (stderr, "style = { gnu, lucid, cfront }\n"); - fprintf (stderr, "reads args from stdin if none supplied\n"); - exit (0); - break; - case 's': - if (strcmp (optarg, "gnu") == 0) - { - current_demangling_style = gnu_demangling; - } - else if (strcmp (optarg, "lucid") == 0) - { - current_demangling_style = lucid_demangling; - } - else if (strcmp (optarg, "cfront") == 0) - { - current_demangling_style = cfront_demangling; - } - else - { - fprintf (stderr, "unknown demangling style `%s'\n", optarg); - exit (1); - } - break; - } - } - if (optind < argc) - { - for ( ; optind < argc; optind++) - { - demangle_it (argv[optind]); - } - } - else - { - while (gets (mangled_name)) - { - demangle_it (mangled_name); - } - } -} - -#endif /* main */ diff --git a/gdb/demangle.h b/gdb/demangle.h index cc3fc60..e69de29 100644 --- a/gdb/demangle.h +++ b/gdb/demangle.h @@ -1,54 +0,0 @@ -/* Defs for interface to demanglers. - Copyright 1992 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - - -#define DMGL_PARAMS (1 << 0) /* Include function args */ -#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ - -/* Enumeration of possible demangling styles. - - Lucid and cfront styles are still kept logically distinct, even though - they now both behave identically. The resulting style is actual the - union of both. I.E. either style recognizes both "__pt__" and "__rf__" - for operator "->", even though the first is lucid style and the second - is cfront/ARM style. (FIXME?) */ - -extern enum demangling_styles -{ - unknown_demangling = 0, - auto_demangling, - gnu_demangling, - lucid_demangling, - cfront_demangling -} current_demangling_style; - -/* Define string names for the various demangling styles. */ - -#define AUTO_DEMANGLING_STYLE_STRING "auto" -#define GNU_DEMANGLING_STYLE_STRING "gnu" -#define LUCID_DEMANGLING_STYLE_STRING "lucid" -#define CFRONT_DEMANGLING_STYLE_STRING "cfront" - -/* Some macros to test what demangling style is active. */ - -#define AUTO_DEMANGLING (current_demangling_style == auto_demangling) -#define GNU_DEMANGLING (current_demangling_style == gnu_demangling) -#define LUCID_DEMANGLING (current_demangling_style == lucid_demangling) -#define CFRONT_DEMANGLING (current_demangling_style == cfront_demangling) - -extern void -set_demangling_style PARAMS ((char *)); diff --git a/gdb/doc/Makefile b/gdb/doc/Makefile index db880a6..e69de29 100755 --- a/gdb/doc/Makefile +++ b/gdb/doc/Makefile @@ -1,111 +0,0 @@ -##Copyright (C) 1991 Free Software Foundation, Inc. - -# Makefile for GDB documentation. -# This file is part of GDB. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -# main GDB source directory -srcdir = .. - -# Documentation (gdb.dvi) needs either GNU m4 or SysV m4; -# Berkeley/Sun don't have quite enough. -#M4=/usr/5bin/m4 -M4=gm4 - -# where to find texinfo; GDB dist should include a recent one -TEXIDIR=${srcdir}/../texinfo/fsf - -# where to find makeinfo, preferably one designed for texinfo-2 -MAKEINFO=makeinfo - -# 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}/../readline - -# Main GDB manual's source files -SFILES_DOCDIR = \ - gdb.texinfo pretex.m4 none.m4 all.m4 gdbinv-m.m4 gdbinv-s.m4 gdbVN.m4 - -all: gdb.info gdb.dvi refcard.dvi gdb-internals gdbint.dvi - -clean: - rm -f gdb.dvi rdl-apps.texi gdb-all* gdb.info* gdbVN.m4 - rm -f gdb-internals gdbint.?? gdbint.??? - rm -f refcard.ps refcard.dvi rcfonts.tex refcard.log *~ - -# GDB QUICK REFERENCE (TeX dvi file, CM fonts) -refcard.dvi : refcard.tex - rm -f rcfonts.tex; cp rc-cm.tex rcfonts.tex - TEXINPUTS=.:$$TEXINPUTS tex refcard.tex; rm -f refcard.log - rm -f rcfonts.tex - -# GDB QUICK REFERENCE (PostScript output, common PS fonts) -refcard.ps : refcard.tex - rm -f rcfonts.tex; cp rc-ps.tex rcfonts.tex - TEXINPUTS=.:$$TEXINPUTS tex refcard.tex - dvips -t landscape refcard -o; rm -f refcard.dvi refcard.log - rm -f rcfonts.tex - -# Cover file for "Readline" appendices -rdl-apps.texi: ${READLINE_DIR}/inc-readline.texinfo \ - ${READLINE_DIR}/inc-history.texinfo - rm -f rdl-apps.texi - echo "@include ${READLINE_DIR}/inc-readline.texinfo" >rdl-apps.texi - echo "@include ${READLINE_DIR}/inc-history.texinfo" >>rdl-apps.texi - -# File to record current GDB version number (copied from main dir Makefile.in) -gdbVN.m4 : ${srcdir}/Makefile.in - ( VER=`sed <${srcdir}/Makefile.in -n 's/VERSION = //p'` ;\ - echo "_define__(<_GDB_VN__>,$$VER)" > gdbVN.m4 ) - -# GDB MANUAL: texinfo source, created by preprocessing w/m4 -# Be sure to not create a bad gdb-all.texi if ${M4} is missing or aborts... -gdb-all.texi: ${SFILES_DOCDIR} - rm -f foobus.texinfo - ${M4} pretex.m4 none.m4 all.m4 gdb.texinfo >foobus.texinfo - rm -f gdb-all.texi - mv foobus.texinfo gdb-all.texi - -# GDB MANUAL: TeX dvi file -gdb.dvi : gdb-all.texi rdl-apps.texi - TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex gdb-all.texi - texindex gdb-all.?? - TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex gdb-all.texi - mv gdb-all.dvi gdb.dvi - rm -f gdb-all.?? gdb-all.??? - -# 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-all.texi - ${MAKEINFO} gdb-all.texi - -# GDB INTERNALS MANUAL: TeX dvi file -gdbint.dvi : gdbint.texinfo - TEXINPUTS=${TEXIDIR}:.:$$TEXINPUTS tex gdbint.texinfo - texindex gdbint.?? - TEXINPUTS=${TEXIDIR}:.:$$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 - -# GDB INTERNALS MANUAL: info file -gdb-internals : gdbint.texinfo - ${MAKEINFO} gdbint.texinfo - - - - diff --git a/gdb/doc/gdb-all.texi b/gdb/doc/gdb-all.texi index e2162da..e69de29 100755 --- a/gdb/doc/gdb-all.texi +++ b/gdb/doc/gdb-all.texi @@ -1,8437 +0,0 @@ - -\input texinfo @c -*-texinfo-*- -@c Copyright (c) 1988 1989 1990 1991 1992 Free Software Foundation, Inc. -@c %**start of header -@setfilename gdb.info -@settitle Using GDB (v4) -@setchapternewpage odd -@c @smallbook -@c @cropmarks -@c %**end of header - -@finalout -@syncodeindex ky cp - -@c ===> NOTE! <== -@c Determine the edition number in *three* places by hand: -@c 1. First ifinfo section 2. title page 3. top node -@c To find the locations, search for !!set - -@c The following is for Pesch for his RCS system. -@c This revision number *not* the same as the Edition number. -@tex -\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision$} % For use in headers, footers too -@end tex - -@c FOR UPDATES LEADING TO THIS DRAFT, GDB CHANGELOG CONSULTED BETWEEN: -@c Fri Oct 11 23:27:06 1991 John Gilmore (gnu at cygnus.com) -@c Sat Dec 22 02:51:40 1990 John Gilmore (gnu at cygint) - -@c THIS MANUAL REQUIRES TEXINFO-2 macros and info-makers to format properly. - -@ifinfo -@format -START-INFO-DIR-ENTRY -* Gdb: (gdb). The GNU debugger. -END-INFO-DIR-ENTRY -@end format -@end ifinfo -@c -@ifinfo -This file documents the GNU debugger GDB. - -@c !!set edition, date, version -This is Edition 4.01, January 1992, -of @cite{Using GDB: A Guide to the GNU Source-Level Debugger} -for GDB Version 4.4.4. - -Copyright (C) 1988, 1989, 1990, 1991 1992 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' may be -included in a translation approved by the Free Software Foundation -instead of in the original English. -@end ifinfo - -@titlepage -@title Using GDB -@subtitle A Guide to the GNU Source-Level Debugger -@sp 1 -@c !!set edition, date, version -@subtitle Edition 4.01, for GDB version 4.4.4 -@subtitle January 1992 -@author by Richard M. Stallman and Roland H. Pesch -@page -@tex -{\parskip=0pt -\hfill rms\@ai.mit.edu, pesch\@cygnus.com\par -\hfill {\it Using GDB}, \manvers\par -\hfill \TeX{}info \texinfoversion\par -} -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' may be -included in a translation approved by the Free Software Foundation -instead of in the original English. -@end titlepage -@page - -@ifinfo -@node Top, Summary, (dir), (dir) -@top GDB, the GNU symbolic debugger - -This file describes GDB, the GNU symbolic debugger. - -@c !!set edition, date, version -This is Edition 4.01, January 1992, for GDB Version 4.4.4. -@end ifinfo - -@menu -* Summary:: Summary of GDB -* New Features:: New features since GDB version 3.5 -* Sample Session:: A Sample GDB session -* Invocation:: Getting in and out of GDB -* Commands:: GDB commands -* Running:: Running programs under GDB -* Stopping:: Stopping and continuing -* Stack:: Examining the stack -* Source:: Examining source files -* Data:: Examining data -* Languages:: Using GDB with different languages -* Symbols:: Examining the symbol table -* Altering:: Altering execution -* GDB Files:: GDB's files -* Targets:: Specifying a debugging target -* Controlling GDB:: Controlling GDB -* Sequences:: Canned sequences of commands -* Emacs:: Using GDB under GNU Emacs -* GDB Bugs:: Reporting bugs in GDB -* Renamed Commands:: -* Installing GDB:: Installing GDB -* Copying:: GNU GENERAL PUBLIC LICENSE -* Index:: Index - - --- The Detailed Node Listing --- - -Summary of GDB - -* Free Software:: Free Software -* Contributors:: Contributors to GDB - -Getting In and Out of GDB - -* Invoking GDB:: Starting GDB -* Leaving GDB:: Leaving GDB -* Shell Commands:: Shell Commands - -Starting GDB - -* File Options:: Choosing Files -* Mode Options:: Choosing Modes - -GDB Commands - -* Command Syntax:: Command Syntax -* Help:: Getting Help - -Running Programs Under GDB - -* Compilation:: Compiling for Debugging -* Starting:: Starting your Program -* Arguments:: Your Program's Arguments -* Environment:: Your Program's Environment -* Working Directory:: Your Program's Working Directory -* Input/Output:: Your Program's Input and Output -* Attach:: Debugging an Already-Running Process -* Kill Process:: Killing the Child Process - -Stopping and Continuing - -* Breakpoints:: Breakpoints, Watchpoints, and Exceptions -* Continuing and Stepping:: Resuming Execution -* Signals:: Signals - -Breakpoints, Watchpoints, and Exceptions - -* Set Breaks:: Setting Breakpoints -* Set Watchpoints:: Setting Watchpoints -* Exception Handling:: Breakpoints and Exceptions -* Delete Breaks:: Deleting Breakpoints -* Disabling:: Disabling Breakpoints -* Conditions:: Break Conditions -* Break Commands:: Breakpoint Command Lists -* Breakpoint Menus:: Breakpoint Menus -* Error in Breakpoints:: ``Cannot insert breakpoints'' - -Examining the Stack - -* Frames:: Stack Frames -* Backtrace:: Backtraces -* Selection:: Selecting a Frame -* Frame Info:: Information on a Frame - -Examining Source Files - -* List:: Printing Source Lines -* Search:: Searching Source Files -* Source Path:: Specifying Source Directories -* Machine Code:: Source and Machine Code - -Examining Data - -* Expressions:: Expressions -* Variables:: Program Variables -* Arrays:: Artificial Arrays -* Output formats:: Output formats -* Memory:: Examining Memory -* Auto Display:: Automatic Display -* Print Settings:: Print Settings -* Value History:: Value History -* Convenience Vars:: Convenience Variables -* Registers:: Registers -* Floating Point Hardware:: Floating Point Hardware - -Using GDB with Different Languages - -* Setting:: Switching between source languages -* Show:: Displaying the language -* Checks:: Type and Range checks -* Support:: Supported languages - -Switching between source languages - -* Manually:: Setting the working language manually -* Automatically:: Having GDB infer the source language - -Type and range Checking - -* Type Checking:: An overview of type checking -* Range Checking:: An overview of range checking - -Supported Languages - -* C:: C and C++ -* Modula-2:: Modula-2 - -C and C++ - -* C Operators:: C and C++ Operators -* C Constants:: C and C++ Constants -* Cplusplus expressions:: C++ Expressions -* C Defaults:: Default settings for C and C++ -* C Checks:: C and C++ Type and Range Checks -* Debugging C:: GDB and C -* Debugging C plus plus:: Special features for C++ - -Modula-2 - -* M2 Operators:: Built-in operators -* Built-In Func/Proc:: Built-in Functions and Procedures -* M2 Constants:: Modula-2 Constants -* M2 Defaults:: Default settings for Modula-2 -* Deviations:: Deviations from standard Modula-2 -* M2 Checks:: Modula-2 Type and Range Checks -* M2 Scope:: The scope operators @code{::} and @code{.} -* GDB/M2:: GDB and Modula-2 - -Altering Execution - -* Assignment:: Assignment to Variables -* Jumping:: Continuing at a Different Address -* Signaling:: Giving your program a Signal -* Returning:: Returning from a Function -* Calling:: Calling your Program's Functions -* Patching:: Patching your Program - -GDB's Files - -* Files:: Commands to Specify Files -* Symbol Errors:: Errors Reading Symbol Files - -Specifying a Debugging Target - -* Active Targets:: Active Targets -* Target Commands:: Commands for Managing Targets -* Remote:: Remote Debugging - -Remote Debugging - -* i960-Nindy Remote:: GDB with a Remote i960 (Nindy) -* EB29K Remote:: GDB with a Remote EB29K -* VxWorks Remote:: GDB and VxWorks - -GDB with a Remote i960 (Nindy) - -* Nindy Startup:: Startup with Nindy -* Nindy Options:: Options for Nindy -* Nindy reset:: Nindy Reset Command - -GDB with a Remote EB29K - -* Comms (EB29K):: Communications Setup -* gdb-EB29K:: EB29K cross-debugging -* Remote Log:: Remote Log - -GDB and VxWorks - -* VxWorks connection:: Connecting to VxWorks -* VxWorks download:: VxWorks Download -* VxWorks attach:: Running Tasks - -Controlling GDB - -* Prompt:: Prompt -* Editing:: Command Editing -* History:: Command History -* Screen Size:: Screen Size -* Numbers:: Numbers -* Messages/Warnings:: Optional Warnings and Messages - -Canned Sequences of Commands - -* Define:: User-Defined Commands -* Command Files:: Command Files -* Output:: Commands for Controlled Output - -Reporting Bugs in GDB - -* Bug Criteria:: Have You Found a Bug? -* Bug Reporting:: How to Report Bugs - -Installing GDB - -* Separate Objdir:: Compiling GDB in another directory -* Config Names:: Specifying names for hosts and targets -* configure Options:: Summary of options for configure -* Formatting Documentation:: How to format and print GDB documentation -@end menu - -@node Summary, New Features, Top, Top -@unnumbered Summary of GDB - -The purpose of a debugger such as GDB is to allow you to see what is -going on ``inside'' another program while it executes---or what another -program was doing at the moment it crashed. - -GDB can do four main kinds of things (plus other things in support of -these) to help you catch bugs in the act: - -@itemize @bullet -@item -Start your program, specifying anything that might affect its behavior. - -@item -Make your program stop on specified conditions. - -@item -Examine what has happened, when your program has stopped. - -@item -Change things in your program, so you can experiment with correcting the -effects of one bug and go on to learn about another. -@end itemize - -You can use GDB to debug programs written in C, C++, and Modula-2. -Fortran support will be added when a GNU Fortran compiler is ready. - -@menu -* Free Software:: Free Software -* Contributors:: Contributors to GDB -@end menu - -@node Free Software, Contributors, Summary, Summary -@unnumberedsec Free Software - -GDB is @dfn{free software}, protected by the GNU General Public License -(GPL). The GPL gives you the freedom to copy or adapt a licensed -program---but every person getting a copy also gets with it the -freedom to modify that copy (which means that they must get access to -the source code), and the freedom to distribute further copies. -Typical software companies use copyrights to limit your freedoms; the -Free Software Foundation uses the GPL to preserve these freedoms. - -Fundamentally, the General Public License is a license which says that -you have these freedoms and that you cannot take these freedoms away -from anyone else. - -For full details, @pxref{Copying, ,GNU GENERAL PUBLIC LICENSE}. - -@node Contributors, , Free Software, Summary -@unnumberedsec Contributors to GDB - -Richard Stallman was the original author of GDB, and of many other GNU -programs. Many others have contributed to its development. This -section attempts to credit major contributors. One of the virtues of -free software is that everyone is free to contribute to it; with -regret, we cannot actually acknowledge everyone here. The file -@file{ChangeLog} in the GDB distribution approximates a blow-by-blow -account. - -Changes much prior to version 2.0 are lost in the mists of time. - -@quotation -@emph{Plea:} Additions to this section are particularly welcome. If you -or your friends (or enemies; let's be evenhanded) have been unfairly -omitted from this list, we would like to add your names! -@end quotation - -So that they may not regard their long labor as thankless, we -particularly thank those who shepherded GDB through major releases: Stu -Grossman and John Gilmore (release 4.4), John Gilmore (releases 4.3, 4.2, -4.1, 4.0, and 3.9); Jim Kingdon (releases 3.5, 3.4, 3.3); and Randy -Smith (releases 3.2, 3.1, 3.0). As major maintainer of GDB for some -period, each contributed significantly to the structure, stability, and -capabilities of the entire debugger. - -Richard Stallman, assisted at various times by Pete TerMaat, Chris -Hanson, and Richard Mlynarik, handled releases through 2.8. - -Michael Tiemann is the author of most of the GNU C++ support in GDB, -with significant additional contributions from Per Bothner. James -Clark wrote the GNU C++ demangler. Early work on C++ was by Peter -TerMaat (who also did much general update work leading to release 3.0). - -GDB 4 uses the BFD subroutine library to examine multiple -object-file formats; BFD was a joint project of David V. -Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore. - -David Johnson wrote the original COFF support; Pace Willison did -the original support for encapsulated COFF. - -Adam de Boor and Bradley Davis contributed the ISI Optimum V support. -Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS -support. Jean-Daniel Fekete contributed Sun 386i support. Chris -Hanson improved the HP9000 support. Noboyuki Hikichi and Tomoyuki -Hasei contributed Sony/News OS 3 support. David Johnson contributed -Encore Umax support. Jyrki Kuoppala contributed Altos 3068 support. -Keith Packard contributed NS32K support. Doug Rabson contributed -Acorn Risc Machine support. Chris Smith contributed Convex support -(and Fortran debugging). Jonathan Stone contributed Pyramid support. -Michael Tiemann contributed SPARC support. Tim Tucker contributed -support for the Gould NP1 and Gould Powernode. Pace Willison -contributed Intel 386 support. Jay Vosburgh contributed Symmetry -support. - -Rich Schaefer and Peter Schauer helped with support of SunOS shared -libraries. - -Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about -several machine instruction sets. - -Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped -develop remote debugging. Intel Corporation and Wind River Systems -contributed remote debugging modules for their products. - -Brian Fox is the author of the readline libraries providing -command-line editing and command history. - -Andrew Beers of SUNY Buffalo wrote the language-switching code and -the Modula-2 support, and contributed the Languages chapter of this -manual. - -@node New Features, Sample Session, Summary, Top -@unnumbered New Features since GDB version 3.5 - -@table @emph -@item Targets -Using the new command @code{target}, you can select at runtime whether -you are debugging local files, local processes, standalone systems over -a serial port, realtime systems over a TCP/IP connection, etc. The -command @code{load} can download programs into a remote system. Serial -stubs are available for Motorola 680x0 and Intel 80386 remote systems; -GDB also supports debugging realtime processes running under -VxWorks, using SunRPC Remote Procedure Calls over TCP/IP to talk to a -debugger stub on the target system. Internally, GDB now uses a -function vector to mediate access to different targets; if you need to -add your own support for a remote protocol, this makes it much easier. - -@item Watchpoints -GDB now sports watchpoints as well as breakpoints. You can use a -watchpoint to stop execution whenever the value of an expression -changes, without having to predict a particular place in your program -where this may happen. - -@item Wide Output -Commands that issue wide output now insert newlines at places designed -to make the output more readable. - -@item Object Code Formats -GDB uses a new library called the Binary File Descriptor (BFD) -Library to permit it to switch dynamically, without reconfiguration or -recompilation, between different object-file formats. Formats currently -supported are COFF, a.out, and the Intel 960 b.out; files may be read as -.o's, archive libraries, or core dumps. BFD is available as a -subroutine library so that other programs may take advantage of it, and -the other GNU binary utilities are being converted to use it. - -@item Configuration and Ports -Compile-time configuration (to select a particular architecture and -operating system) is much easier. The script @code{configure} now -allows you to configure GDB as either a native debugger or a -cross-debugger. @xref{Installing GDB}, for details on how to -configure and on what architectures are now available. - -@item Interaction -The user interface to GDB's control variables has been simplified -and consolidated in two commands, @code{set} and @code{show}. Output -lines are now broken at readable places, rather than overflowing onto -the next line. You can suppress output of machine-level addresses, -displaying only source language information. - -@item C++ -GDB now supports C++ multiple inheritance (if used with a GCC -version 2 compiler), and also has limited support for C++ exception -handling, with the commands @code{catch} and @code{info catch}: GDB -can break when an exception is raised, before the stack is peeled back -to the exception handler's context. - -@item Modula-2 -GDB now has preliminary support for the GNU Modula-2 compiler, -currently under development at the State University of New York at -Buffalo. Coordinated development of both GDB and the GNU Modula-2 -compiler will continue into 1992. Other Modula-2 compilers are -currently not supported, and attempting to debug programs compiled with -them will likely result in an error as the symbol table of the -executable is read in. - -@item Command Rationalization -Many GDB commands have been renamed to make them easier to remember -and use. In particular, the subcommands of @code{info} and -@code{show}/@code{set} are grouped to make the former refer to the state -of your program, and the latter refer to the state of GDB itself. -@xref{Renamed Commands}, for details on what commands were renamed. - -@item Shared Libraries -GDB 4 can debug programs and core files that use SunOS shared -libraries. - -@item Reference Card -GDB 4 has a reference card. @xref{Formatting Documentation} for -instructions on printing it. - -@item Work in Progress -Kernel debugging for BSD and Mach systems; Tahoe and HPPA architecture -support. -@end table - -@node Sample Session, Invocation, New Features, Top -@chapter A Sample GDB Session - -You can use this manual at your leisure to read all about GDB. -However, a handful of commands are enough to get started using the -debugger. This chapter illustrates these commands. - -@iftex -In this sample session, we emphasize user input like this: @i{input}, -to make it easier to pick out from the surrounding output. -@end iftex - -@c FIXME: this example may not be appropriate for some configs, where -@c FIXME...primary interest is in remote use. - -One of the preliminary versions of GNU @code{m4} (a generic macro -processor) exhibits the following bug: sometimes, when we change its -quote strings from the default, the commands used to capture one macro's -definition in another stop working. In the following short @code{m4} -session, we define a macro @code{foo} which expands to @code{0000}; we -then use the @code{m4} built-in @code{defn} to define @code{bar} as the -same thing. However, when we change the open quote string to -@code{} and the close quote string to @code{}, the same -procedure fails to define a new synonym @code{baz}: - -@smallexample -$ @i{cd gnu/m4} -$ @i{./m4} -@i{define(foo,0000)} - -@i{foo} -0000 -@i{define(bar,defn(`foo'))} - -@i{bar} -0000 -@i{changequote(,)} - -@i{define(baz,defn(foo))} -@i{baz} -@i{C-d} -m4: End of input: 0: fatal error: EOF in string -@end smallexample - -@noindent -Let's use GDB to try to see what's going on. - -@smallexample -$ @i{gdb m4} -@c FIXME: this falsifies the exact text played out, to permit smallbook -@c FIXME... format to come out better. -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 4.4.4, Copyright 1992 Free Software Foundation, Inc... -(gdb) -@end smallexample - -@noindent -GDB reads only enough symbol data to know where to find the rest when -needed; as a result, the first prompt comes up very quickly. We now -tell GDB to use a narrower display width than usual, so that examples -will fit in this manual. - -@smallexample -(gdb) @i{set width 70} -@end smallexample - -@noindent -Let's see how the @code{m4} built-in @code{changequote} works. -Having looked at the source, we know the relevant subroutine is -@code{m4_changequote}, so we set a breakpoint there with GDB's -@code{break} command. - -@smallexample -(gdb) @i{break m4_changequote} -Breakpoint 1 at 0x62f4: file builtin.c, line 879. -@end smallexample - -@noindent -Using the @code{run} command, we start @code{m4} running under GDB -control; as long as control does not reach the @code{m4_changequote} -subroutine, the program runs as usual: - -@smallexample -(gdb) @i{run} -Starting program: /work/Editorial/gdb/gnu/m4/m4 -@i{define(foo,0000)} - -@i{foo} -0000 -@end smallexample - -@noindent -To trigger the breakpoint, we call @code{changequote}. GDB -suspends execution of @code{m4}, displaying information about the -context where it stops. - -@smallexample -@i{changequote(,)} - -Breakpoint 1, m4_changequote (argc=3, argv=0x33c70) - at builtin.c:879 -879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]), argc, 1, 3)) -@end smallexample - -@noindent -Now we use the command @code{n} (@code{next}) to advance execution to -the next line of the current function. - -@smallexample -(gdb) @i{n} -882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1])\ - : nil, -@end smallexample - -@noindent -@code{set_quotes} looks like a promising subroutine. We can go into it -by using the command @code{s} (@code{step}) instead of @code{next}. -@code{step} goes to the next line to be executed in @emph{any} -subroutine, so it steps into @code{set_quotes}. - -@smallexample -(gdb) @i{s} -set_quotes (lq=0x34c78 "", rq=0x34c88 "") - at input.c:530 -530 if (lquote != def_lquote) -@end smallexample - -@noindent -The display that shows the subroutine where @code{m4} is now -suspended (and its arguments) is called a stack frame display. It -shows a summary of the stack. We can use the @code{backtrace} -command (which can also be spelled @code{bt}), to see where we are -in the stack as a whole: the @code{backtrace} command displays a -stack frame for each active subroutine. - -@smallexample -(gdb) @i{bt} -#0 set_quotes (lq=0x34c78 "", rq=0x34c88 "") - at input.c:530 -#1 0x6344 in m4_changequote (argc=3, argv=0x33c70) - at builtin.c:882 -#2 0x8174 in expand_macro (sym=0x33320) at macro.c:242 -#3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30) - at macro.c:71 -#4 0x79dc in expand_input () at macro.c:40 -#5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195 -@end smallexample - -@noindent -Let's step through a few more lines to see what happens. The first two -times, we can use @samp{s}; the next two times we use @code{n} to avoid -falling into the @code{xstrdup} subroutine. - -@smallexample -(gdb) @i{s} -0x3b5c 532 if (rquote != def_rquote) -(gdb) @i{s} -0x3b80 535 lquote = (lq == nil || *lq == '\0') ? \ -def_lquote : xstrdup(lq); -(gdb) @i{n} -536 rquote = (rq == nil || *rq == '\0') ? def_rquote\ - : xstrdup(rq); -(gdb) @i{n} -538 len_lquote = strlen(rquote); -@end smallexample - -@noindent -The last line displayed looks a little odd; let's examine the variables -@code{lquote} and @code{rquote} to see if they are in fact the new left -and right quotes we specified. We can use the command @code{p} -(@code{print}) to see their values. - -@smallexample -(gdb) @i{p lquote} -$1 = 0x35d40 "" -(gdb) @i{p rquote} -$2 = 0x35d50 "" -@end smallexample - -@noindent -@code{lquote} and @code{rquote} are indeed the new left and right quotes. -Let's look at some context; we can display ten lines of source -surrounding the current line, with the @code{l} (@code{list}) command. - -@smallexample -(gdb) @i{l} -533 xfree(rquote); -534 -535 lquote = (lq == nil || *lq == '\0') ? def_lquote\ - : xstrdup (lq); -536 rquote = (rq == nil || *rq == '\0') ? def_rquote\ - : xstrdup (rq); -537 -538 len_lquote = strlen(rquote); -539 len_rquote = strlen(lquote); -540 @} -541 -542 void -@end smallexample - -@noindent -Let's step past the two lines that set @code{len_lquote} and -@code{len_rquote}, and then examine the values of those variables. - -@smallexample -(gdb) @i{n} -539 len_rquote = strlen(lquote); -(gdb) @i{n} -540 @} -(gdb) @i{p len_lquote} -$3 = 9 -(gdb) @i{p len_rquote} -$4 = 7 -@end smallexample - -@noindent -That certainly looks wrong, assuming @code{len_lquote} and -@code{len_rquote} are meant to be the lengths of @code{lquote} and -@code{rquote} respectively. Let's try setting them to better values. -We can use the @code{p} command for this, since it'll print the value of -any expression---and that expression can include subroutine calls and -assignments. - -@smallexample -(gdb) p @i{len_lquote=strlen(lquote)} -$5 = 7 -(gdb) p @i{len_rquote=strlen(rquote)} -$6 = 9 -@end smallexample - -@noindent -Let's see if that fixes the problem of using the new quotes with the -@code{m4} built-in @code{defn}. We can allow @code{m4} to continue -executing with the @code{c} (@code{continue}) command, and then try the -example that caused trouble initially: - -@smallexample -(gdb) @i{c} -Continuing. - -@i{define(baz,defn(foo))} - -baz -0000 -@end smallexample - -@noindent -Success! The new quotes now work just as well as the default ones. The -problem seems to have been just the two typos defining the wrong -lengths. We'll let @code{m4} exit by giving it an EOF as input. - -@smallexample -@i{C-d} -Program exited normally. -@end smallexample - -@noindent -The message @samp{Program exited normally.} is from GDB; it -indicates @code{m4} has finished executing. We can end our GDB -session with the GDB @code{quit} command. - -@smallexample -(gdb) @i{quit} -@end smallexample - -@node Invocation, Commands, Sample Session, Top -@chapter Getting In and Out of GDB - -This chapter discusses how to start GDB, and how to get out of it. -(The essentials: type @samp{gdb} to start GDB, and type @kbd{quit} -or @kbd{C-d} to exit.) - -@menu -* Invoking GDB:: Starting GDB -* Leaving GDB:: Leaving GDB -* Shell Commands:: Shell Commands -@end menu - -@node Invoking GDB, Leaving GDB, Invocation, Invocation -@section Starting GDB - -Start GDB with the shell command @code{gdb}. Once it's running, -GDB reads commands from the terminal until you tell it to exit. - -You can also run @code{gdb} with a variety of arguments and options, -to specify more of your debugging environment at the outset. - -The command-line options described here are designed -to cover a variety of situations; in some environments, some of these -options may effectively be unavailable. - - -The most usual way to start GDB is with one argument or two, -specifying an executable program as the argument: - -@example -gdb @var{program} -@end example - -@noindent -You can also start with both an executable program and a core file -specified: - -@example -gdb @var{program} @var{core} -@end example - -You can, instead, specify a process ID as a second argument, if you want -to debug a running process: - -@example -gdb @var{program} 1234 -@end example - -@noindent -would attach GDB to process @code{1234} (unless you also have a file -named @file{1234}; GDB does check for a core file first). - -Taking advantage of the second command-line argument requires a fairly -complete operating system; when you use GDB as a remote debugger -attached to a bare board, there may not be any notion of ``process'', -and there is often no way to get a core dump. - -@noindent -You can further control how GDB starts up by using command-line -options. GDB itself can remind you of the options available. - -@noindent -Type - -@example -gdb -help -@end example - -@noindent -to display all available options and briefly describe their use -(@samp{gdb -h} is a shorter equivalent). - -All options and command line arguments you give are processed -in sequential order. The order makes a difference when the -@samp{-x} option is used. - -@menu -* File Options:: Choosing Files -* Mode Options:: Choosing Modes -@end menu - -@node File Options, Mode Options, Invoking GDB, Invoking GDB -@subsection Choosing Files - -When GDB starts, it reads any arguments other than options as -specifying an executable file and core file (or process ID). This is -the same as if the arguments were specified by the @samp{-se} and -@samp{-c} options respectively. (GDB reads the first argument -that does not have an associated option flag as equivalent to the -@samp{-se} option followed by that argument; and the second argument -that does not have an associated option flag, if any, as equivalent to -the @samp{-c} option followed by that argument.) - -Many options have both long and short forms; both are shown in the -following list. GDB also recognizes the long forms if you truncate -them, so long as enough of the option is present to be unambiguous. -(If you prefer, you can flag option arguments with @samp{--} rather -than @samp{-}, though we illustrate the more usual convention.) - -@table @code -@item -symbols=@var{file} -@itemx -s @var{file} -Read symbol table from file @var{file}. - -@item -exec=@var{file} -@itemx -e @var{file} -Use file @var{file} as the executable file to execute when -appropriate, and for examining pure data in conjunction with a core -dump. - -@item -se=@var{file} -Read symbol table from file @var{file} and use it as the executable -file. - -@item -core=@var{file} -@itemx -c @var{file} -Use file @var{file} as a core dump to examine. - -@item -command=@var{file} -@itemx -x @var{file} -Execute GDB commands from file @var{file}. @xref{Command Files}. - -@item -directory=@var{directory} -@itemx -d @var{directory} -Add @var{directory} to the path to search for source files. -@end table - -@node Mode Options, , File Options, Invoking GDB -@subsection Choosing Modes - -You can run GDB in various alternative modes---for example, in -batch mode or quiet mode. - -@table @code -@item -nx -@itemx -n -Do not execute commands from any @file{.gdbinit} initialization files. -Normally, the commands in these files are executed after all the -command options and arguments have been processed. -@xref{Command Files}. - -@item -quiet -@itemx -q -``Quiet''. Do not print the introductory and copyright messages. These -messages are also suppressed in batch mode. - -@item -batch -Run in batch mode. Exit with status @code{0} after processing all the command -files specified with @samp{-x} (and @file{.gdbinit}, if not inhibited). -Exit with nonzero status if an error occurs in executing the GDB -commands in the command files. - -Batch mode may be useful for running GDB as a filter, for example to -download and run a program on another computer; in order to make this -more useful, the message - -@example -Program exited normally. -@end example - -@noindent -(which is ordinarily issued whenever a program running under GDB control -terminates) is not issued when running in batch mode. - -@item -cd=@var{directory} -Run GDB using @var{directory} as its working directory, -instead of the current directory. - -@item -fullname -@itemx -f -Emacs sets this option when it runs GDB as a subprocess. It tells GDB -to output the full file name and line number in a standard, -recognizable fashion each time a stack frame is displayed (which -includes each time your program stops). This recognizable format looks -like two @samp{\032} characters, followed by the file name, line number -and character position separated by colons, and a newline. The -Emacs-to-GDB interface program uses the two @samp{\032} characters as -a signal to display the source code for the frame. - -@item -b @var{bps} -Set the line speed (baud rate or bits per second) of any serial -interface used by GDB for remote debugging. - -@item -tty=@var{device} -Run using @var{device} for your program's standard input and output. -@c FIXME: kingdon thinks there is more to -tty. Investigate. -@end table - -@node Leaving GDB, Shell Commands, Invoking GDB, Invocation -@section Leaving GDB -@cindex exiting GDB - -@table @code -@item quit -@kindex quit -@kindex q -To exit GDB, use the @code{quit} command (abbreviated @code{q}), or type -an end-of-file character (usually @kbd{C-d}). -@end table - -@cindex interrupt -An interrupt (often @kbd{C-c}) will not exit from GDB, but rather -will terminate the action of any GDB command that is in progress and -return to GDB command level. It is safe to type the interrupt -character at any time because GDB does not allow it to take effect -until a time when it is safe. - -If you have been using GDB to control an attached process or device, you -can release it with the @code{detach} command; @pxref{Attach, -,Debugging an Already-Running Process}.. - -@node Shell Commands, , Leaving GDB, Invocation -@section Shell Commands - -If you need to execute occasional shell commands during your -debugging session, there is no need to leave or suspend GDB; you can -just use the @code{shell} command. - -@table @code -@item shell @var{command string} -@kindex shell -@cindex shell escape -Directs GDB to invoke an inferior shell to execute @var{command -string}. If it exists, the environment variable @code{SHELL} is used -for the name of the shell to run. Otherwise GDB uses -@code{/bin/sh}. -@end table - -The utility @code{make} is often needed in development environments. -You do not have to use the @code{shell} command for this purpose in GDB: - -@table @code -@item make @var{make-args} -@kindex make -@cindex calling make -Causes GDB to execute an inferior @code{make} program with the specified -arguments. This is equivalent to @samp{shell make @var{make-args}}. -@end table - -@node Commands, Running, Invocation, Top -@chapter GDB Commands - -You can abbreviate GDB command if that abbreviation is unambiguous; -and you can repeat certain GDB commands by typing just @key{RET}. - -@menu -* Command Syntax:: Command Syntax -* Help:: Getting Help -@end menu - -@node Command Syntax, Help, Commands, Commands -@section Command Syntax - -A GDB command is a single line of input. There is no limit on how long -it can be. It starts with a command name, which is followed by arguments -whose meaning depends on the command name. For example, the command -@code{step} accepts an argument which is the number of times to step, -as in @samp{step 5}. You can also use the @code{step} command with -no arguments. Some command names do not allow any arguments. - -@cindex abbreviation -GDB command names may always be truncated if that abbreviation is -unambiguous. Other possible command abbreviations are listed in the -documentation for individual commands. In some cases, even ambiguous -abbreviations are allowed; for example, @code{s} is specially defined as -equivalent to @code{step} even though there are other commands whose -names start with @code{s}. You can test abbreviations by using them as -arguments to the @code{help} command. - -@cindex repeating commands -@kindex RET -A blank line as input to GDB (typing just @key{RET}) means to -repeat the previous command. Certain commands (for example, @code{run}) -will not repeat this way; these are commands for which unintentional -repetition might cause trouble and which you are unlikely to want to -repeat. - -The @code{list} and @code{x} commands, when you repeat them with -@key{RET}, construct new arguments rather than repeating -exactly as typed. This permits easy scanning of source or memory. - -GDB can also use @key{RET} in another way: to partition lengthy -output, in a way similar to the common utility @code{more} -(@pxref{Screen Size}). Since it is easy to press one @key{RET} too many -in this situation, GDB disables command repetition after any command -that generates this sort of display. - -@kindex # -@cindex comment -A line of input starting with @kbd{#} is a comment; it does nothing. -This is useful mainly in command files (@pxref{Command Files}). - -@node Help, , Command Syntax, Commands -@section Getting Help -@cindex online documentation -@kindex help - -You can always ask GDB itself for information on its commands, using the -command @code{help}. - -@table @code -@item help -@itemx h -@kindex h -You can use @code{help} (abbreviated @code{h}) with no arguments to -display a short list of named classes of commands: - -@smallexample -(gdb) help -List of classes of commands: - -running -- Running the program -stack -- Examining the stack -data -- Examining data -breakpoints -- Making program stop at certain points -files -- Specifying and examining files -status -- Status inquiries -support -- Support facilities -user-defined -- User-defined commands -aliases -- Aliases of other commands -obscure -- Obscure features - -Type "help" followed by a class name for a list of -commands in that class. -Type "help" followed by command name for full -documentation. -Command name abbreviations are allowed if unambiguous. -(gdb) -@end smallexample - -@item help @var{class} -Using one of the general help classes as an argument, you can get a -list of the individual commands in that class. For example, here is the -help display for the class @code{status}: - -@smallexample -(gdb) help status -Status inquiries. - -List of commands: - -show -- Generic command for showing things set with "set" -info -- Generic command for printing status - -Type "help" followed by command name for full -documentation. -Command name abbreviations are allowed if unambiguous. -(gdb) -@end smallexample - -@item help @var{command} -With a command name as @code{help} argument, GDB will display a -short paragraph on how to use that command. -@end table - -In addition to @code{help}, you can use the GDB commands @code{info} -and @code{show} to inquire about the state of your program, or the state -of GDB itself. Each command supports many topics of inquiry; this -manual introduces each of them in the appropriate context. The listings -under @code{info} and under @code{show} in the Index point to -all the sub-commands. @xref{Index}. - -@c @group -@table @code -@item info -@kindex info -@kindex i -This command (abbreviated @code{i}) is for describing the state of your -program; for example, it can list the arguments given to your program -(@code{info args}), the registers currently in use (@code{info -registers}), or the breakpoints you have set (@code{info breakpoints}). -You can get a complete list of the @code{info} sub-commands with -@w{@code{help info}}. - -@kindex show -@item show -In contrast, @code{show} is for describing the state of GDB itself. -You can change most of the things you can @code{show}, by using the -related command @code{set}; for example, you can control what number -system is used for displays with @code{set radix}, or simply inquire -which is currently in use with @code{show radix}. - -@kindex info set -To display all the settable parameters and their current -values, you can use @code{show} with no arguments; you may also use -@code{info set}. Both commands produce the same display. -@c FIXME: "info set" violates the rule that "info" is for state of -@c FIXME...program. Ck w/ GNU: "info set" to be called something else, -@c FIXME...or change desc of rule---eg "state of prog and debugging session"? -@end table -@c @end group - -Here are three miscellaneous @code{show} subcommands, all of which are -exceptional in lacking corresponding @code{set} commands: - -@table @code -@kindex show version -@cindex version number -@item show version -Show what version of GDB is running. You should include this -information in GDB bug-reports. If multiple versions of GDB are in -use at your site, you may occasionally want to make sure what version -of GDB you are running; as GDB evolves, new commands are introduced, -and old ones may wither away. The version number is also announced -when you start GDB with no arguments. - -@kindex show copying -@item show copying -Display information about permission for copying GDB. - -@kindex show warranty -@item show warranty -Display the GNU ``NO WARRANTY'' statement. -@end table - -@node Running, Stopping, Commands, Top -@chapter Running Programs Under GDB - -To debug a program, you must run it under GDB. - -@menu -* Compilation:: Compiling for Debugging -* Starting:: Starting your Program -* Arguments:: Your Program's Arguments -* Environment:: Your Program's Environment -* Working Directory:: Your Program's Working Directory -* Input/Output:: Your Program's Input and Output -* Attach:: Debugging an Already-Running Process -* Kill Process:: Killing the Child Process -@end menu - -@node Compilation, Starting, Running, Running -@section Compiling for Debugging - -In order to debug a program effectively, you need to generate -debugging information when you compile it. This debugging information -is stored in the object file; it describes the data type of each -variable or function and the correspondence between source line numbers -and addresses in the executable code. - -To request debugging information, specify the @samp{-g} option when you run -the compiler. - -Many C compilers are unable to handle the @samp{-g} and @samp{-O} -options together. Using those compilers, you cannot generate optimized -executables containing debugging information. - -gcc, the GNU C compiler, supports @samp{-g} with or without -@samp{-O}, making it possible to debug optimized code. We recommend -that you @emph{always} use @samp{-g} whenever you compile a program. -You may think your program is correct, but there is no sense in pushing -your luck. - -Some things do not work as well with @samp{-g -O} as with just -@samp{-g}, particularly on machines with instruction scheduling. If in -doubt, recompile with @samp{-g} alone, and if this fixes the problem, -please report it as a bug (including a test case!). - -Older versions of the GNU C compiler permitted a variant option -@w{@samp{-gg}} for debugging information. GDB no longer supports this -format; if your GNU C compiler has this option, do not use it. - -@ignore -@comment As far as I know, there are no cases in which GDB will -@comment produce strange output in this case. (but no promises). -If your program includes archives made with the @code{ar} program, and -if the object files used as input to @code{ar} were compiled without the -@samp{-g} option and have names longer than 15 characters, GDB will get -confused reading your program's symbol table. No error message will be -given, but GDB may behave strangely. The reason for this problem is a -deficiency in the Unix archive file format, which cannot represent file -names longer than 15 characters. - -To avoid this problem, compile the archive members with the @samp{-g} -option or use shorter file names. Alternatively, use a version of GNU -@code{ar} dated more recently than August 1989. -@end ignore - -@node Starting, Arguments, Compilation, Running -@section Starting your Program -@cindex starting -@cindex running - -@table @code -@item run -@itemx r -@kindex run -Use the @code{run} command to start your program under GDB. You must -first specify the program name -(except on VxWorks) -with an argument to -GDB (@pxref{Invocation, ,Getting In and Out of GDB}), or by using the -@code{file} or @code{exec-file} command (@pxref{Files, ,Commands to -Specify Files}). - -@end table - -If you are running your program in an execution environment that -supports processes, @code{run} creates an inferior process and makes -that process run your program. (In environments without processes, -@code{run} jumps to the start of your program.) - -The execution of a program is affected by certain information it -receives from its superior. GDB provides ways to specify this -information, which you must do @i{before} starting your program. (You -can change it after starting your program, but such changes will only affect -your program the next time you start it.) This information may be -divided into four categories: - -@table @asis -@item The @i{arguments.} -Specify the arguments to give your program as the arguments of the -@code{run} command. If a shell is available on your target, the shell -is used to pass the arguments, so that you may use normal conventions -(such as wildcard expansion or variable substitution) in describing -the arguments. In Unix systems, you can control which shell is used -with the @code{SHELL} environment variable. @xref{Arguments, ,Your -Program's Arguments}. - -@item The @i{environment.} -Your program normally inherits its environment from GDB, but you can -use the GDB commands @code{set environment} and @code{unset -environment} to change parts of the environment that will be given to -your program. @xref{Environment, ,Your Program's Environment}. - -@item The @i{working directory.} -Your program inherits its working directory from GDB. You can set -GDB's working directory with the @code{cd} command in GDB. -@xref{Working Directory, ,Your Program's Working Directory}. - -@item The @i{standard input and output.} -Your program normally uses the same device for standard input and -standard output as GDB is using. You can redirect input and output -in the @code{run} command line, or you can use the @code{tty} command to -set a different device for your program. -@xref{Input/Output, ,Your Program's Input and Output}. - -@cindex pipes -@emph{Warning:} While input and output redirection work, you cannot use -pipes to pass the output of the program you are debugging to another -program; if you attempt this, GDB is likely to wind up debugging the -wrong program. -@end table - -@c FIXME: Rewrite following paragraph, especially its third sentence. -When you issue the @code{run} command, your program begins to execute -immediately. @xref{Stopping, ,Stopping and Continuing}, for -discussion of how to arrange for your program to stop. Once your -program has been started by the @code{run} command (and then stopped), -you may evaluate expressions that involve calls to functions in your -program, using the @code{print} or @code{call} commands. @xref{Data, -,Examining Data}. - -If the modification time of your symbol file has changed since the -last time GDB read its symbols, GDB will discard its symbol table and -re-read it. When it does this, GDB tries to retain your current -breakpoints. - -@node Arguments, Environment, Starting, Running -@section Your Program's Arguments - -@cindex arguments (to your program) -The arguments to your program can be specified by the arguments of the -@code{run} command. They are passed to a shell, which expands wildcard -characters and performs redirection of I/O, and thence to your program. -GDB uses the shell indicated by your environment variable -@code{SHELL} if it exists; otherwise, GDB uses @code{/bin/sh}. - -@code{run} with no arguments uses the same arguments used by the previous -@code{run}, or those set by the @code{set args} command. - -@kindex set args -@table @code -@item set args -Specify the arguments to be used the next time your program is run. If -@code{set args} has no arguments, @code{run} will execute your program -with no arguments. Once you have run your program with arguments, -using @code{set args} before the next @code{run} is the only way to run -it again without arguments. - -@item show args -@kindex show args -Show the arguments to give your program when it is started. -@end table - -@node Environment, Working Directory, Arguments, Running -@section Your Program's Environment - -@cindex environment (of your program) -The @dfn{environment} consists of a set of environment variables and -their values. Environment variables conventionally record such things as -your user name, your home directory, your terminal type, and your search -path for programs to run. Usually you set up environment variables with -the shell and they are inherited by all the other programs you run. When -debugging, it can be useful to try running your program with a modified -environment without having to start GDB over again. - -@table @code -@item path @var{directory} -@kindex path -Add @var{directory} to the front of the @code{PATH} environment variable -(the search path for executables), for both GDB and your program. -You may specify several directory names, separated by @samp{:} or -whitespace. If @var{directory} is already in the path, it is moved to -the front, so it will be searched sooner. - -You can use the string @samp{$cwd} to refer to whatever is the current -working directory at the time GDB searches the path. If you use -@samp{.} instead, it refers to the directory where you executed the -@code{path} command. GDB fills in the current path where needed in -the @var{directory} argument, before adding it to the search path. -@c 'path' is explicitly nonrepeatable, but RMS points out it is silly to -@c document that, since repeating it would be a no-op. - -@item show paths -@kindex show paths -Display the list of search paths for executables (the @code{PATH} -environment variable). - -@item show environment @r{[}@var{varname}@r{]} -@kindex show environment -Print the value of environment variable @var{varname} to be given to -your program when it starts. If you do not supply @var{varname}, -print the names and values of all environment variables to be given to -your program. You can abbreviate @code{environment} as @code{env}. - -@item set environment @var{varname} @r{[}=@r{]} @var{value} -@kindex set environment -Sets environment variable @var{varname} to @var{value}. The value -changes for your program only, not for GDB itself. @var{value} may -be any string; the values of environment variables are just strings, and -any interpretation is supplied by your program itself. The @var{value} -parameter is optional; if it is eliminated, the variable is set to a -null value. -@c "any string" here does not include leading, trailing -@c blanks. Gnu asks: does anyone care? - -For example, this command: - -@example -set env USER = foo -@end example - -@noindent -tells a Unix program, when subsequently run, that its user is named -@samp{foo}. (The spaces around @samp{=} are used for clarity here; they -are not actually required.) - -@item unset environment @var{varname} -@kindex unset environment -Remove variable @var{varname} from the environment to be passed to your -program. This is different from @samp{set env @var{varname} =}; -@code{unset environment} removes the variable from the environment, -rather than assigning it an empty value. -@end table - -@node Working Directory, Input/Output, Environment, Running -@section Your Program's Working Directory - -@cindex working directory (of your program) -Each time you start your program with @code{run}, it inherits its -working directory from the current working directory of GDB. GDB's -working directory is initially whatever it inherited from its parent -process (typically the shell), but you can specify a new working -directory in GDB with the @code{cd} command. - -The GDB working directory also serves as a default for the commands -that specify files for GDB to operate on. @xref{Files, ,Commands to -Specify Files}. - -@table @code -@item cd @var{directory} -@kindex cd -Set GDB's working directory to @var{directory}. - -@item pwd -@kindex pwd -Print GDB's working directory. -@end table - -@node Input/Output, Attach, Working Directory, Running -@section Your Program's Input and Output - -@cindex redirection -@cindex i/o -@cindex terminal -By default, the program you run under GDB does input and output to -the same terminal that GDB uses. GDB switches the terminal to -its own terminal modes to interact with you, but it records the terminal -modes your program was using and switches back to them when you continue -running your program. - -@table @code -@item info terminal -@kindex info terminal -Displays GDB's recorded information about the terminal modes your -program is using. -@end table - -You can redirect your program's input and/or output using shell -redirection with the @code{run} command. For example, - -@example -run > outfile -@end example - -@noindent -starts your program, diverting its output to the file @file{outfile}. - -@kindex tty -@cindex controlling terminal -Another way to specify where your program should do input and output is -with the @code{tty} command. This command accepts a file name as -argument, and causes this file to be the default for future @code{run} -commands. It also resets the controlling terminal for the child -process, for future @code{run} commands. For example, - -@example -tty /dev/ttyb -@end example - -@noindent -directs that processes started with subsequent @code{run} commands -default to do input and output on the terminal @file{/dev/ttyb} and have -that as their controlling terminal. - -An explicit redirection in @code{run} overrides the @code{tty} command's -effect on the input/output device, but not its effect on the controlling -terminal. - -When you use the @code{tty} command or redirect input in the @code{run} -command, only the input @emph{for your program} is affected. The input -for GDB still comes from your terminal. - -@node Attach, Kill Process, Input/Output, Running -@section Debugging an Already-Running Process -@kindex attach -@cindex attach - -@table @code -@item attach @var{process-id} -This command -attaches to a running process---one that was started outside GDB. -(@code{info files} will show your active targets.) The command takes as -argument a process ID. The usual way to find out the process-id of -a Unix process is with the @code{ps} utility, or with the @samp{jobs -l} -shell command. - -@code{attach} will not repeat if you press @key{RET} a second time after -executing the command. -@end table - -To use @code{attach}, you must be debugging in an environment which -supports processes. You must also have permission to send the process a -signal, and it must have the same effective user ID as the GDB -process. - -When using @code{attach}, you should first use the @code{file} command -to specify the program running in the process and load its symbol table. -@xref{Files, ,Commands to Specify Files}. - -The first thing GDB does after arranging to debug the specified -process is to stop it. You can examine and modify an attached process -with all the GDB commands that are ordinarily available when you start -processes with @code{run}. You can insert breakpoints; you can step and -continue; you can modify storage. If you would rather the process -continue running, you may use the @code{continue} command after -attaching GDB to the process. - -@table @code -@item detach -@kindex detach -When you have finished debugging the attached process, you can use the -@code{detach} command to release it from GDB's control. Detaching -the process continues its execution. After the @code{detach} command, -that process and GDB become completely independent once more, and you -are ready to @code{attach} another process or start one with @code{run}. -@code{detach} will not repeat if you press @key{RET} again after -executing the command. -@end table - -If you exit GDB or use the @code{run} command while you have an attached -process, you kill that process. By default, you will be asked for -confirmation if you try to do either of these things; you can control -whether or not you need to confirm by using the @code{set confirm} command -(@pxref{Messages/Warnings, ,Optional Warnings and Messages}). - -@node Kill Process, , Attach, Running -@c @group -@section Killing the Child Process - -@table @code -@item kill -@kindex kill -Kill the child process in which your program is running under GDB. -@end table - -This command is useful if you wish to debug a core dump instead of a -running process. GDB ignores any core dump file while your program -is running. -@c @end group - -On some operating systems, a program cannot be executed outside GDB -while you have breakpoints set on it inside GDB. You can use the -@code{kill} command in this situation to permit running your program -outside the debugger. - -The @code{kill} command is also useful if you wish to recompile and -relink your program, since on many systems it is impossible to modify an -executable file while it is running in a process. In this case, when you -next type @code{run}, GDB will notice that the file has changed, and -will re-read the symbol table (while trying to preserve your current -breakpoint settings). - -@node Stopping, Stack, Running, Top -@chapter Stopping and Continuing - -The principal purpose of using a debugger is so that you can stop your -program before it terminates; or so that, if your program runs into -trouble, you can investigate and find out why. - -Inside GDB, your program may stop for any of several reasons, such -as a signal, a breakpoint, or reaching a new line after a GDB -command such as @code{step}. You may then examine and change -variables, set new breakpoints or remove old ones, and then continue -execution. Usually, the messages shown by GDB provide ample -explanation of the status of your program---but you can also explicitly -request this information at any time. - -@table @code -@item info program -@kindex info program -Display information about the status of your program: whether it is -running or not, what process it is, and why it stopped. -@end table - -@menu -* Breakpoints:: Breakpoints, Watchpoints, and Exceptions -* Continuing and Stepping:: Resuming Execution -* Signals:: Signals -@end menu - -@node Breakpoints, Continuing and Stepping, Stopping, Stopping -@section Breakpoints, Watchpoints, and Exceptions - -@cindex breakpoints -A @dfn{breakpoint} makes your program stop whenever a certain point in -the program is reached. For each breakpoint, you can add various -conditions to control in finer detail whether your program will stop. -You can set breakpoints with the @code{break} command and its variants -(@pxref{Set Breaks, ,Setting Breakpoints}), to specify the place where -your program should stop by line number, function name or exact address -in the program. In languages with exception handling (such as GNU -C++), you can also set breakpoints where an exception is raised -(@pxref{Exception Handling, ,Breakpoints and Exceptions}). - -@cindex watchpoints -A @dfn{watchpoint} is a special breakpoint that stops your program -when the value of an expression changes. You must use a different -command to set watchpoints (@pxref{Set Watchpoints, ,Setting -Watchpoints}), but aside from that, you can manage a watchpoint like -any other breakpoint: you enable, disable, and delete both breakpoints -and watchpoints using the same commands. - -Each breakpoint or watchpoint is assigned a number when it is created; -these numbers are successive integers starting with one. In many of the -commands for controlling various features of breakpoints you use the -breakpoint number to say which breakpoint you want to change. Each -breakpoint may be @dfn{enabled} or @dfn{disabled}; if disabled, it has -no effect on your program until you enable it again. - -@menu -* Set Breaks:: Setting Breakpoints -* Set Watchpoints:: Setting Watchpoints -* Exception Handling:: Breakpoints and Exceptions -* Delete Breaks:: Deleting Breakpoints -* Disabling:: Disabling Breakpoints -* Conditions:: Break Conditions -* Break Commands:: Breakpoint Command Lists -* Breakpoint Menus:: Breakpoint Menus -* Error in Breakpoints:: -@end menu - -@node Set Breaks, Set Watchpoints, Breakpoints, Breakpoints -@subsection Setting Breakpoints - -@c FIXME LMB what does GDB do if no code on line of breakpt? -@c consider in particular declaration with/without initialization. -@c -@c FIXME 2 is there stuff on this already? break at fun start, already init? - -@kindex break -@kindex b -Breakpoints are set with the @code{break} command (abbreviated @code{b}). - -You have several ways to say where the breakpoint should go. - -@table @code -@item break @var{function} -Set a breakpoint at entry to function @var{function}. When using source -languages that permit overloading of symbols, such as C++, -@var{function} may refer to more than one possible place to break. -@xref{Breakpoint Menus}, for a discussion of that situation. - -@item break +@var{offset} -@itemx break -@var{offset} -Set a breakpoint some number of lines forward or back from the position -at which execution stopped in the currently selected frame. - -@item break @var{linenum} -Set a breakpoint at line @var{linenum} in the current source file. -That file is the last file whose source text was printed. This -breakpoint will stop your program just before it executes any of the -code on that line. - -@item break @var{filename}:@var{linenum} -Set a breakpoint at line @var{linenum} in source file @var{filename}. - -@item break @var{filename}:@var{function} -Set a breakpoint at entry to function @var{function} found in file -@var{filename}. Specifying a file name as well as a function name is -superfluous except when multiple files contain similarly named -functions. - -@item break *@var{address} -Set a breakpoint at address @var{address}. You can use this to set -breakpoints in parts of your program which do not have debugging -information or source files. - -@item break -When called without any arguments, @code{break} sets a breakpoint at -the next instruction to be executed in the selected stack frame -(@pxref{Stack, ,Examining the Stack}). In any selected frame but the -innermost, this will cause your program to stop as soon as control -returns to that frame. This is similar to the effect of a -@code{finish} command in the frame inside the selected frame---except -that @code{finish} does not leave an active breakpoint. If you use -@code{break} without an argument in the innermost frame, GDB will stop -the next time it reaches the current location; this may be useful -inside loops. - -GDB normally ignores breakpoints when it resumes execution, until at -least one instruction has been executed. If it did not do this, you -would be unable to proceed past a breakpoint without first disabling the -breakpoint. This rule applies whether or not the breakpoint already -existed when your program stopped. - -@item break @dots{} if @var{cond} -Set a breakpoint with condition @var{cond}; evaluate the expression -@var{cond} each time the breakpoint is reached, and stop only if the -value is nonzero---that is, if @var{cond} evaluates as true. -@samp{@dots{}} stands for one of the possible arguments described -above (or no argument) specifying where to break. @xref{Conditions, -,Break Conditions}, for more information on breakpoint conditions. - -@item tbreak @var{args} -@kindex tbreak -Set a breakpoint enabled only for one stop. @var{args} are the -same as for the @code{break} command, and the breakpoint is set in the same -way, but the breakpoint is automatically disabled after the first time your -program stops there. @xref{Disabling, ,Disabling Breakpoints}. - -@item rbreak @var{regex} -@kindex rbreak -@cindex regular expression -@c FIXME what kind of regexp? -Set breakpoints on all functions matching the regular expression -@var{regex}. This command -sets an unconditional breakpoint on all matches, printing a list of all -breakpoints it set. Once these breakpoints are set, they are treated -just like the breakpoints set with the @code{break} command. They can -be deleted, disabled, made conditional, etc., in the standard ways. - -When debugging C++ programs, @code{rbreak} is useful for setting -breakpoints on overloaded functions that are not members of any special -classes. - -@kindex info breakpoints -@cindex @code{$_} and @code{info breakpoints} -@item info breakpoints @r{[}@var{n}@r{]} -@item info break @r{[}@var{n}@r{]} -Print a list of all breakpoints (but not watchpoints) set and not -deleted, showing their numbers, where in your program they are, and any -special features in use for them. Disabled breakpoints are included in -the list, but marked as disabled. @code{info break} with a breakpoint -number @var{n} as argument lists only that breakpoint. The -convenience variable @code{$_} and the default examining-address for -the @code{x} command are set to the address of the last breakpoint -listed (@pxref{Memory, ,Examining Memory}). The equivalent command -for watchpoints is @code{info watch}. -@end table - -GDB allows you to set any number of breakpoints at the same place in -your program. There is nothing silly or meaningless about this. When -the breakpoints are conditional, this is even useful -(@pxref{Conditions, ,Break Conditions}). - -@node Set Watchpoints, Exception Handling, Set Breaks, Breakpoints -@subsection Setting Watchpoints -@cindex setting watchpoints - -You can use a watchpoint to stop execution whenever the value of an -expression changes, without having to predict a particular place -where this may happen. - -Watchpoints currently execute two orders of magnitude more slowly than -other breakpoints, but this can well be worth it to catch errors where -you have no clue what part of your program is the culprit. Some -processors provide special hardware to support watchpoint evaluation; future -releases of GDB will use such hardware if it is available. - -@table @code -@kindex watch -@item watch @var{expr} -Set a watchpoint for an expression. - -@kindex info watchpoints -@item info watchpoints -This command prints a list of watchpoints; it is otherwise similar to -@code{info break}. -@end table - -@node Exception Handling, Delete Breaks, Set Watchpoints, Breakpoints -@subsection Breakpoints and Exceptions -@cindex exception handlers - -Some languages, such as GNU C++, implement exception handling. You can -use GDB to examine what caused your program to raise an exception, -and to list the exceptions your program is prepared to handle at a -given point in time. - -@table @code -@item catch @var{exceptions} -@kindex catch -You can set breakpoints at active exception handlers by using the -@code{catch} command. @var{exceptions} is a list of names of exceptions -to catch. -@end table - -You can use @code{info catch} to list active exception handlers. -@xref{Frame Info, ,Information About a Frame}. - -There are currently some limitations to exception handling in GDB. -These will be corrected in a future release. - -@itemize @bullet -@item -If you call a function interactively, GDB normally returns -control to you when the function has finished executing. If the call -raises an exception, however, the call may bypass the mechanism that -returns control to you and cause your program to simply continue -running until it hits a breakpoint, catches a signal that GDB is -listening for, or exits. -@item -You cannot raise an exception interactively. -@item -You cannot interactively install an exception handler. -@end itemize - -@cindex raise exceptions -Sometimes @code{catch} is not the best way to debug exception handling: -if you need to know exactly where an exception is raised, it is better to -stop @emph{before} the exception handler is called, since that way you -can see the stack before any unwinding takes place. If you set a -breakpoint in an exception handler instead, it may not be easy to find -out where the exception was raised. - -To stop just before an exception handler is called, you need some -knowledge of the implementation. In the case of GNU C++, exceptions are -raised by calling a library function named @code{__raise_exception} -which has the following ANSI C interface: - -@example - /* @var{addr} is where the exception identifier is stored. - ID is the exception identifier. */ - void __raise_exception (void **@var{addr}, void *@var{id}); -@end example - -@noindent -To make the debugger catch all exceptions before any stack -unwinding takes place, set a breakpoint on @code{__raise_exception} -(@pxref{Breakpoints, ,Breakpoints Watchpoints and Exceptions}). - -With a conditional breakpoint (@pxref{Conditions, ,Break Conditions}) -that depends on the value of @var{id}, you can stop your program when -a specific exception is raised. You can use multiple conditional -breakpoints to stop your program when any of a number of exceptions are -raised. - -@node Delete Breaks, Disabling, Exception Handling, Breakpoints -@subsection Deleting Breakpoints - -@cindex clearing breakpoints, watchpoints -@cindex deleting breakpoints, watchpoints -It is often necessary to eliminate a breakpoint or watchpoint once it -has done its job and you no longer want your program to stop there. This -is called @dfn{deleting} the breakpoint. A breakpoint that has been -deleted no longer exists; it is forgotten. - -With the @code{clear} command you can delete breakpoints according to -where they are in your program. With the @code{delete} command you can -delete individual breakpoints or watchpoints by specifying their -breakpoint numbers. - -It is not necessary to delete a breakpoint to proceed past it. GDB -automatically ignores breakpoints on the first instruction to be executed -when you continue execution without changing the execution address. - -@table @code -@item clear -@kindex clear -Delete any breakpoints at the next instruction to be executed in the -selected stack frame (@pxref{Selection, ,Selecting a Frame}). When -the innermost frame is selected, this is a good way to delete a -breakpoint where your program just stopped. - -@item clear @var{function} -@itemx clear @var{filename}:@var{function} -Delete any breakpoints set at entry to the function @var{function}. - -@item clear @var{linenum} -@itemx clear @var{filename}:@var{linenum} -Delete any breakpoints set at or within the code of the specified line. - -@item delete @r{[}breakpoints@r{]} @r{[}@var{bnums}@dots{}@r{]} -@cindex delete breakpoints -@kindex delete -@kindex d -Delete the breakpoints or watchpoints of the numbers specified as -arguments. If no argument is specified, delete all breakpoints (GDB -asks confirmation, unless you have @code{set confirm off}). You -can abbreviate this command as @code{d}. -@end table - -@node Disabling, Conditions, Delete Breaks, Breakpoints -@subsection Disabling Breakpoints - -@cindex disabled breakpoints -@cindex enabled breakpoints -Rather than deleting a breakpoint or watchpoint, you might prefer to -@dfn{disable} it. This makes the breakpoint inoperative as if it had -been deleted, but remembers the information on the breakpoint so that -you can @dfn{enable} it again later. - -You disable and enable breakpoints and watchpoints with the -@code{enable} and @code{disable} commands, optionally specifying one or -more breakpoint numbers as arguments. Use @code{info break} or -@code{info watch} to print a list of breakpoints or watchpoints if you -do not know which numbers to use. - -A breakpoint or watchpoint can have any of four different states of -enablement: - -@itemize @bullet -@item -Enabled. The breakpoint will stop your program. A breakpoint set -with the @code{break} command starts out in this state. -@item -Disabled. The breakpoint has no effect on your program. -@item -Enabled once. The breakpoint will stop your program, but -when it does so it will become disabled. A breakpoint set -with the @code{tbreak} command starts out in this state. -@item -Enabled for deletion. The breakpoint will stop your program, but -immediately after it does so it will be deleted permanently. -@end itemize - -You can use the following commands to enable or disable breakpoints and -watchpoints: - -@table @code -@item disable @r{[}breakpoints@r{]} @r{[}@var{bnums}@dots{}@r{]} -@kindex disable breakpoints -@kindex disable -@kindex dis -Disable the specified breakpoints---or all breakpoints, if none are -listed. A disabled breakpoint has no effect but is not forgotten. All -options such as ignore-counts, conditions and commands are remembered in -case the breakpoint is enabled again later. You may abbreviate -@code{disable} as @code{dis}. - -@item enable @r{[}breakpoints@r{]} @r{[}@var{bnums}@dots{}@r{]} -@kindex enable breakpoints -@kindex enable -Enable the specified breakpoints (or all defined breakpoints). They -become effective once again in stopping your program. - -@item enable @r{[}breakpoints@r{]} once @var{bnums}@dots{} -Enable the specified breakpoints temporarily. Each will be disabled -again the next time it stops your program. - -@item enable @r{[}breakpoints@r{]} delete @var{bnums}@dots{} -Enable the specified breakpoints to work once and then die. Each of -the breakpoints will be deleted the next time it stops your program. -@end table - -Save for a breakpoint set with @code{tbreak} (@pxref{Set Breaks, -,Setting Breakpoints}), breakpoints that you set are initially -enabled; subsequently, they become disabled or enabled only when you -use one of the commands above. (The command @code{until} can set and -delete a breakpoint of its own, but it will not change the state of -your other breakpoints; see @ref{Continuing and Stepping, ,Continuing and Stepping}.) - -@node Conditions, Break Commands, Disabling, Breakpoints -@subsection Break Conditions -@cindex conditional breakpoints -@cindex breakpoint conditions - -@c FIXME what is scope of break condition expr? Context where wanted? -@c in particular for a watchpoint? -The simplest sort of breakpoint breaks every time your program reaches a -specified place. You can also specify a @dfn{condition} for a -breakpoint. A condition is just a Boolean expression in your -programming language (@pxref{Expressions, ,Expressions}). A breakpoint with -a condition evaluates the expression each time your program reaches it, -and your program stops only if the condition is @emph{true}. - -This is the converse of using assertions for program validation; in that -situation, you want to stop when the assertion is violated---that is, -when the condition is false. In C, if you want to test an assertion expressed -by the condition @var{assert}, you should set the condition -@samp{! @var{assert}} on the appropriate breakpoint. - -Conditions are also accepted for watchpoints; you may not need them, -since a watchpoint is inspecting the value of an expression anyhow---but -it might be simpler, say, to just set a watchpoint on a variable name, -and specify a condition that tests whether the new value is an interesting -one. - -Break conditions can have side effects, and may even call functions in -your program. This can be useful, for example, to activate functions -that log program progress, or to use your own print functions to -format special data structures. The effects are completely predictable -unless there is another enabled breakpoint at the same address. (In -that case, GDB might see the other breakpoint first and stop your -program without checking the condition of this one.) Note that -breakpoint commands are usually more convenient and flexible for the -purpose of performing side effects when a breakpoint is reached -(@pxref{Break Commands, ,Breakpoint Command Lists}). - -Break conditions can be specified when a breakpoint is set, by using -@samp{if} in the arguments to the @code{break} command. @xref{Set -Breaks, ,Setting Breakpoints}. They can also be changed at any time -with the @code{condition} command. The @code{watch} command does not -recognize the @code{if} keyword; @code{condition} is the only way to -impose a further condition on a watchpoint. - -@table @code -@item condition @var{bnum} @var{expression} -@kindex condition -Specify @var{expression} as the break condition for breakpoint or -watchpoint number @var{bnum}. From now on, this breakpoint will stop -your program only if the value of @var{expression} is true (nonzero, in -C). When you use @code{condition}, GDB checks @var{expression} -immediately for syntactic correctness, and to determine whether symbols -in it have referents in the context of your breakpoint. -@c FIXME so what does GDB do if there is no referent? Moreover, what -@c about watchpoints? -GDB does -not actually evaluate @var{expression} at the time the @code{condition} -command is given, however. @xref{Expressions, ,Expressions}. - -@item condition @var{bnum} -Remove the condition from breakpoint number @var{bnum}. It becomes -an ordinary unconditional breakpoint. -@end table - -@cindex ignore count (of breakpoint) -A special case of a breakpoint condition is to stop only when the -breakpoint has been reached a certain number of times. This is so -useful that there is a special way to do it, using the @dfn{ignore -count} of the breakpoint. Every breakpoint has an ignore count, which -is an integer. Most of the time, the ignore count is zero, and -therefore has no effect. But if your program reaches a breakpoint whose -ignore count is positive, then instead of stopping, it just decrements -the ignore count by one and continues. As a result, if the ignore count -value is @var{n}, the breakpoint will not stop the next @var{n} times it -is reached. - -@table @code -@item ignore @var{bnum} @var{count} -@kindex ignore -Set the ignore count of breakpoint number @var{bnum} to @var{count}. -The next @var{count} times the breakpoint is reached, your program's -execution will not stop; other than to decrement the ignore count, GDB -takes no action. - -To make the breakpoint stop the next time it is reached, specify -a count of zero. - -@item continue @var{count} -@itemx c @var{count} -@itemx fg @var{count} -@kindex continue @var{count} -Continue execution of your program, setting the ignore count of the -breakpoint where your program stopped to @var{count} minus one. -Thus, your program will not stop at this breakpoint until the -@var{count}'th time it is reached. - -An argument to this command is meaningful only when your program stopped -due to a breakpoint. At other times, the argument to @code{continue} is -ignored. - -The synonym @code{fg} is provided purely for convenience, and has -exactly the same behavior as other forms of the command. -@end table - -If a breakpoint has a positive ignore count and a condition, the condition -is not checked. Once the ignore count reaches zero, the condition will -be checked. - -You could achieve the effect of the ignore count with a condition such -as @w{@samp{$foo-- <= 0}} using a debugger convenience variable that -is decremented each time. @xref{Convenience Vars, ,Convenience -Variables}. - -@node Break Commands, Breakpoint Menus, Conditions, Breakpoints -@subsection Breakpoint Command Lists - -@cindex breakpoint commands -You can give any breakpoint (or watchpoint) a series of commands to -execute when your program stops due to that breakpoint. For example, you -might want to print the values of certain expressions, or enable other -breakpoints. - -@table @code -@item commands @r{[}@var{bnum}@r{]} -@itemx @dots{} @var{command-list} @dots{} -@itemx end -@kindex commands -@kindex end -Specify a list of commands for breakpoint number @var{bnum}. The commands -themselves appear on the following lines. Type a line containing just -@code{end} to terminate the commands. - -To remove all commands from a breakpoint, type @code{commands} and -follow it immediately with @code{end}; that is, give no commands. - -With no @var{bnum} argument, @code{commands} refers to the last -breakpoint or watchpoint set (not to the breakpoint most recently -encountered). -@end table - -Pressing @key{RET} as a means of repeating the last GDB command is -disabled within a @var{command-list}. - -You can use breakpoint commands to start your program up again. Simply -use the @code{continue} command, or @code{step}, or any other command -that resumes execution. Subsequent commands in the command list are -ignored. - -@kindex silent -If the first command specified is @code{silent}, the usual message about -stopping at a breakpoint is not printed. This may be desirable for -breakpoints that are to print a specific message and then continue. -If the remaining commands too print nothing, you will see no sign that -the breakpoint was reached at all. @code{silent} is meaningful only -at the beginning of a breakpoint command list. - -The commands @code{echo} and @code{output} that allow you to print -precisely controlled output are often useful in silent breakpoints. -@xref{Output, ,Commands for Controlled Output}. - -For example, here is how you could use breakpoint commands to print the -value of @code{x} at entry to @code{foo} whenever @code{x} is positive. - -@example -break foo if x>0 -commands -silent -echo x is\040 -output x -echo \n -cont -end -@end example - -One application for breakpoint commands is to compensate for one bug so -you can test for another. Put a breakpoint just after the erroneous line -of code, give it a condition to detect the case in which something -erroneous has been done, and give it commands to assign correct values -to any variables that need them. End with the @code{continue} command -so that your program does not stop, and start with the @code{silent} -command so that no output is produced. Here is an example: - -@example -break 403 -commands -silent -set x = y + 4 -cont -end -@end example - -@cindex lost output -One deficiency in the operation of automatically continuing breakpoints -under Unix appears when your program uses raw mode for the terminal. -GDB switches back to its own terminal modes (not raw) before executing -commands, and then must switch back to raw mode when your program is -continued. This causes any pending terminal input to be lost. -@c FIXME: revisit below when GNU sys avail. -@c In the GNU system, this will be fixed by changing the behavior of -@c terminal modes. - -Under Unix, you can get around this problem by writing actions into -the breakpoint condition rather than in commands. For example - -@example -condition 5 (x = y + 4), 0 -@end example - -@noindent -specifies a condition expression (@pxref{Expressions, ,Expressions}) that will -change @code{x} as needed, then always have the value zero so your -program will not stop. No input is lost here, because GDB evaluates -break conditions without changing the terminal modes. When you want -to have nontrivial conditions for performing the side effects, the -operators @samp{&&}, @samp{||} and @samp{?@dots{}:} may be useful. - -@node Breakpoint Menus, Error in Breakpoints, Break Commands, Breakpoints -@subsection Breakpoint Menus -@cindex overloading -@cindex symbol overloading - -Some programming languages (notably C++) permit a single function name -to be defined several times, for application in different contexts. -This is called @dfn{overloading}. When a function name is overloaded, -@samp{break @var{function}} is not enough to tell GDB where you -want a breakpoint. GDB offers you a menu of numbered choices for -different possible breakpoints, and waits for your selection with the -prompt @samp{>}. The first two options are always @samp{[0] cancel} -and @samp{[1] all}. Typing @kbd{1} sets a breakpoint at each -definition of @var{function}, and typing @kbd{0} aborts the -@code{break} command without setting any new breakpoints. - -For example, the following session excerpt shows an attempt to set a -breakpoint at the overloaded symbol @code{String::after}. -We choose three particular definitions of that function name: - -@example -(gdb) b String::after -[0] cancel -[1] all -[2] file:String.cc; line number:867 -[3] file:String.cc; line number:860 -[4] file:String.cc; line number:875 -[5] file:String.cc; line number:853 -[6] file:String.cc; line number:846 -[7] file:String.cc; line number:735 -> 2 4 6 -Breakpoint 1 at 0xb26c: file String.cc, line 867. -Breakpoint 2 at 0xb344: file String.cc, line 875. -Breakpoint 3 at 0xafcc: file String.cc, line 846. -Multiple breakpoints were set. -Use the "delete" command to delete unwanted breakpoints. -(gdb) -@end example - -@node Error in Breakpoints, , Breakpoint Menus, Breakpoints -@subsection ``Cannot Insert Breakpoints'' - -@c FIXME: "cannot insert breakpoints" error, v unclear. -@c Q in pending mail to Gilmore. ---pesch@cygnus.com, 26mar91 -@c some light may be shed by looking at instances of -@c ONE_PROCESS_WRITETEXT. But error seems possible otherwise -@c too. pesch, 20sep91 -Under some operating systems, breakpoints cannot be used in a program if -any other process is running that program. In this situation, -attempting to run or continue a program with a breakpoint causes GDB -to stop the other process. - -When this happens, you have three ways to proceed: - -@enumerate -@item -Remove or disable the breakpoints, then continue. - -@item -Suspend GDB, and copy the file containing your program to a new name. -Resume GDB and use the @code{exec-file} command to specify that GDB -should run your program under that name. Then start your program again. - -@c FIXME: RMS commented here "Show example". Maybe when someone -@c explains the first FIXME: in this section... - -@item -Relink your program so that the text segment is nonsharable, using the -linker option @samp{-N}. The operating system limitation may not apply -to nonsharable executables. -@end enumerate - -@node Continuing and Stepping, Signals, Breakpoints, Stopping -@section Continuing and Stepping - -@cindex stepping -@cindex continuing -@cindex resuming execution -@dfn{Continuing} means resuming program execution until your program -completes normally. In contrast, @dfn{stepping} means executing just -one more ``step'' of your program, where ``step'' may mean either one -line of source code, or one machine instruction (depending on what -particular command you use). Either when continuing -or when stepping, your program may stop even sooner, due to a breakpoint -or to a signal. (If due to a signal, you may want to use @code{handle}, -or use @samp{signal 0} to resume execution. @xref{Signals, ,Signals}.) - -@table @code -@item continue @r{[}@var{ignore-count}@r{]} -@kindex continue -Resume program execution, at the address where your program last stopped; -any breakpoints set at that address are bypassed. The optional argument -@var{ignore-count} allows you to specify a further number of times to -ignore a breakpoint at this location; its effect is like that of -@code{ignore} (@pxref{Conditions, ,Break Conditions}). - -To resume execution at a different place, you can use @code{return} -(@pxref{Returning, ,Returning from a Function}) to go back to the -calling function; or @code{jump} (@pxref{Jumping, ,Continuing at a -Different Address}) to go to an arbitrary location in your program. -@end table - -A typical technique for using stepping is to set a breakpoint -(@pxref{Breakpoints, ,Breakpoints Watchpoints and Exceptions}) at the -beginning of the function or the section of your program where a -problem is believed to lie, run your program until it stops at that -breakpoint, and then step through the suspect area, examining the -variables that are interesting, until you see the problem happen. - -@table @code -@item step -@kindex step -@kindex s -Continue running your program until control reaches a different source -line, then stop it and return control to GDB. This command is -abbreviated @code{s}. - -@quotation -@emph{Warning:} If you use the @code{step} command while control is -within a function that was compiled without debugging information, -execution will proceed until control reaches another function. -@end quotation - -@item step @var{count} -Continue running as in @code{step}, but do so @var{count} times. If a -breakpoint is reached or a signal not related to stepping occurs before -@var{count} steps, stepping stops right away. - -@item next @r{[}@var{count}@r{]} -@kindex next -@kindex n -Continue to the next source line in the current (innermost) stack frame. -Similar to @code{step}, but any function calls appearing within the line -of code are executed without stopping. Execution stops when control -reaches a different line of code at the stack level which was executing -when the @code{next} command was given. This command is abbreviated -@code{n}. - -An argument @var{count} is a repeat count, as for @code{step}. - -@code{next} within a function that lacks debugging information acts like -@code{step}, but any function calls appearing within the code of the -function are executed without stopping. - -@item finish -@kindex finish -Continue running until just after function in the selected stack frame -returns. Print the returned value (if any). - -Contrast this with the @code{return} command (@pxref{Returning, -,Returning from a Function}). - -@item until -@kindex until -@item u -@kindex u -Continue running until a source line past the current line, in the -current stack frame, is reached. This command is used to avoid single -stepping through a loop more than once. It is like the @code{next} -command, except that when @code{until} encounters a jump, it -automatically continues execution until the program counter is greater -than the address of the jump. - -This means that when you reach the end of a loop after single stepping -though it, @code{until} will cause your program to continue execution -until the loop is exited. In contrast, a @code{next} command at the end -of a loop will simply step back to the beginning of the loop, which -would force you to step through the next iteration. - -@code{until} always stops your program if it attempts to exit the current -stack frame. - -@code{until} may produce somewhat counterintuitive results if the order -of machine code does not match the order of the source lines. For -example, in the following excerpt from a debugging session, the @code{f} -(@code{frame}) command shows that execution is stopped at line -@code{206}; yet when we use @code{until}, we get to line @code{195}: - -@example -(gdb) f -#0 main (argc=4, argv=0xf7fffae8) at m4.c:206 -206 expand_input(); -(gdb) until -195 for ( ; argc > 0; NEXTARG) @{ -@end example - -This happened because, for execution efficiency, the compiler had -generated code for the loop closure test at the end, rather than the -start, of the loop---even though the test in a C @code{for}-loop is -written before the body of the loop. The @code{until} command appeared -to step back to the beginning of the loop when it advanced to this -expression; however, it has not really gone to an earlier -statement---not in terms of the actual machine code. - -@code{until} with no argument works by means of single -instruction stepping, and hence is slower than @code{until} with an -argument. - -@item until @var{location} -@item u @var{location} -Continue running your program until either the specified location is -reached, or the current stack frame returns. @var{location} is any of -the forms of argument acceptable to @code{break} (@pxref{Set Breaks, -,Setting Breakpoints}). This form of the command uses breakpoints, -and hence is quicker than @code{until} without an argument. - -@item stepi -@itemx si -@kindex stepi -@kindex si -Execute one machine instruction, then stop and return to the debugger. - -It is often useful to do @samp{display/i $pc} when stepping by machine -instructions. This will cause the next instruction to be executed to -be displayed automatically at each stop. @xref{Auto Display, -,Automatic Display}. - -An argument is a repeat count, as in @code{step}. - -@item nexti -@itemx ni -@kindex nexti -@kindex ni -Execute one machine instruction, but if it is a function call, -proceed until the function returns. - -An argument is a repeat count, as in @code{next}. -@end table - -@node Signals, , Continuing and Stepping, Stopping -@section Signals -@cindex signals - -A signal is an asynchronous event that can happen in a program. The -operating system defines the possible kinds of signals, and gives each -kind a name and a number. For example, in Unix @code{SIGINT} is the -signal a program gets when you type an interrupt (often @kbd{C-c}); -@code{SIGSEGV} is the signal a program gets from referencing a place in -memory far away from all the areas in use; @code{SIGALRM} occurs when -the alarm clock timer goes off (which happens only if your program has -requested an alarm). - -@cindex fatal signals -Some signals, including @code{SIGALRM}, are a normal part of the -functioning of your program. Others, such as @code{SIGSEGV}, indicate -errors; these signals are @dfn{fatal} (kill your program immediately) if the -program has not specified in advance some other way to handle the signal. -@code{SIGINT} does not indicate an error in your program, but it is normally -fatal so it can carry out the purpose of the interrupt: to kill the program. - -GDB has the ability to detect any occurrence of a signal in your -program. You can tell GDB in advance what to do for each kind of -signal. - -@cindex handling signals -Normally, GDB is set up to ignore non-erroneous signals like @code{SIGALRM} -(so as not to interfere with their role in the functioning of your program) -but to stop your program immediately whenever an error signal happens. -You can change these settings with the @code{handle} command. - -@table @code -@item info signals -@kindex info signals -Print a table of all the kinds of signals and how GDB has been told to -handle each one. You can use this to see the signal numbers of all -the defined types of signals. - -@item handle @var{signal} @var{keywords}@dots{} -@kindex handle -Change the way GDB handles signal @var{signal}. @var{signal} can be the -number of a signal or its name (with or without the @samp{SIG} at the -beginning). The @var{keywords} say what change to make. -@end table - -@c @group -The keywords allowed by the @code{handle} command can be abbreviated. -Their full names are: - -@table @code -@item nostop -GDB should not stop your program when this signal happens. It may -still print a message telling you that the signal has come in. - -@item stop -GDB should stop your program when this signal happens. This implies -the @code{print} keyword as well. - -@item print -GDB should print a message when this signal happens. - -@item noprint -GDB should not mention the occurrence of the signal at all. This -implies the @code{nostop} keyword as well. - -@item pass -GDB should allow your program to see this signal; your program will be -able to handle the signal, or may be terminated if the signal is fatal -and not handled. - -@item nopass -GDB should not allow your program to see this signal. -@end table -@c @end group - -When a signal has been set to stop your program, your program cannot see the -signal until you continue. It will see the signal then, if @code{pass} is -in effect for the signal in question @i{at that time}. In other words, -after GDB reports a signal, you can use the @code{handle} command with -@code{pass} or @code{nopass} to control whether that signal will be seen by -your program when you later continue it. - -You can also use the @code{signal} command to prevent your program from -seeing a signal, or cause it to see a signal it normally would not see, -or to give it any signal at any time. For example, if your program stopped -due to some sort of memory reference error, you might store correct -values into the erroneous variables and continue, hoping to see more -execution; but your program would probably terminate immediately as -a result of the fatal signal once it saw the signal. To prevent this, -you can continue with @samp{signal 0}. @xref{Signaling, ,Giving your -Program a Signal}. - -@node Stack, Source, Stopping, Top -@chapter Examining the Stack - -When your program has stopped, the first thing you need to know is where it -stopped and how it got there. - -@cindex call stack -Each time your program performs a function call, the information about -where in your program the call was made from is saved in a block of data -called a @dfn{stack frame}. The frame also contains the arguments of the -call and the local variables of the function that was called. All the -stack frames are allocated in a region of memory called the @dfn{call -stack}. - -When your program stops, the GDB commands for examining the stack allow you -to see all of this information. - -@cindex selected frame -One of the stack frames is @dfn{selected} by GDB and many GDB commands -refer implicitly to the selected frame. In particular, whenever you ask -GDB for the value of a variable in your program, the value is found in the -selected frame. There are special GDB commands to select whichever frame -you are interested in. - -When your program stops, GDB automatically selects the currently executing -frame and describes it briefly as the @code{frame} command does -(@pxref{Frame Info, ,Information About a Frame}). - -@menu -* Frames:: Stack Frames -* Backtrace:: Backtraces -* Selection:: Selecting a Frame -* Frame Info:: Information on a Frame -@end menu - -@node Frames, Backtrace, Stack, Stack -@section Stack Frames - -@cindex frame -@cindex stack frame -The call stack is divided up into contiguous pieces called @dfn{stack -frames}, or @dfn{frames} for short; each frame is the data associated -with one call to one function. The frame contains the arguments given -to the function, the function's local variables, and the address at -which the function is executing. - -@cindex initial frame -@cindex outermost frame -@cindex innermost frame -When your program is started, the stack has only one frame, that of the -function @code{main}. This is called the @dfn{initial} frame or the -@dfn{outermost} frame. Each time a function is called, a new frame is -made. Each time a function returns, the frame for that function invocation -is eliminated. If a function is recursive, there can be many frames for -the same function. The frame for the function in which execution is -actually occurring is called the @dfn{innermost} frame. This is the most -recently created of all the stack frames that still exist. - -@cindex frame pointer -Inside your program, stack frames are identified by their addresses. A -stack frame consists of many bytes, each of which has its own address; each -kind of computer has a convention for choosing one of those bytes whose -address serves as the address of the frame. Usually this address is kept -in a register called the @dfn{frame pointer register} while execution is -going on in that frame. - -@cindex frame number -GDB assigns numbers to all existing stack frames, starting with -zero for the innermost frame, one for the frame that called it, -and so on upward. These numbers do not really exist in your program; -they are assigned by GDB to give you a way of designating stack -frames in GDB commands. - -@cindex frameless execution -Some compilers allow functions to be compiled so that they operate -without stack frames. (For example, the @code{gcc} option -@samp{-fomit-frame-pointer} will generate functions without a frame.) -This is occasionally done with heavily used library functions to save -the frame setup time. GDB has limited facilities for dealing with -these function invocations. If the innermost function invocation has no -stack frame, GDB will nevertheless regard it as though it had a -separate frame, which is numbered zero as usual, allowing correct -tracing of the function call chain. However, GDB has no provision -for frameless functions elsewhere in the stack. - -@node Backtrace, Selection, Frames, Stack -@section Backtraces - -A backtrace is a summary of how your program got where it is. It shows one -line per frame, for many frames, starting with the currently executing -frame (frame zero), followed by its caller (frame one), and on up the -stack. - -@table @code -@item backtrace -@itemx bt -@kindex backtrace -@kindex bt -Print a backtrace of the entire stack: one line per frame for all -frames in the stack. - -You can stop the backtrace at any time by typing the system interrupt -character, normally @kbd{C-c}. - -@item backtrace @var{n} -@itemx bt @var{n} -Similar, but print only the innermost @var{n} frames. - -@item backtrace -@var{n} -@itemx bt -@var{n} -Similar, but print only the outermost @var{n} frames. -@end table - -@kindex where -@kindex info stack -@kindex info s -The names @code{where} and @code{info stack} (abbreviated @code{info s}) -are additional aliases for @code{backtrace}. - -Each line in the backtrace shows the frame number and the function name. -The program counter value is also shown---unless you use @code{set -print address off}. The backtrace also shows the source file name and -line number, as well as the arguments to the function. The program -counter value is omitted if it is at the beginning of the code for that -line number. - -Here is an example of a backtrace. It was made with the command -@samp{bt 3}, so it shows the innermost three frames. - -@smallexample -@group -#0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) - at builtin.c:993 -#1 0x6e38 in expand_macro (sym=0x2b600) at macro.c:242 -#2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08) - at macro.c:71 -(More stack frames follow...) -@end group -@end smallexample - -@noindent -The display for frame zero does not begin with a program counter -value, indicating that your program has stopped at the beginning of the -code for line @code{993} of @code{builtin.c}. - -@node Selection, Frame Info, Backtrace, Stack -@section Selecting a Frame - -Most commands for examining the stack and other data in your program work on -whichever stack frame is selected at the moment. Here are the commands for -selecting a stack frame; all of them finish by printing a brief description -of the stack frame just selected. - -@table @code -@item frame @var{n} -@itemx f @var{n} -@kindex frame -@kindex f -Select frame number @var{n}. Recall that frame zero is the innermost -(currently executing) frame, frame one is the frame that called the -innermost one, and so on. The highest-numbered frame is @code{main}'s -frame. - -@item frame @var{addr} -@itemx f @var{addr} -Select the frame at address @var{addr}. This is useful mainly if the -chaining of stack frames has been damaged by a bug, making it -impossible for GDB to assign numbers properly to all frames. In -addition, this can be useful when your program has multiple stacks and -switches between them. - -On the SPARC architecture, @code{frame} needs two addresses to -select an arbitrary frame: a frame pointer and a stack pointer. -@c note to future updaters: this is conditioned on a flag -@c FRAME_SPECIFICATION_DYADIC in the tm-*.h files, currently only used -@c by SPARC, hence the specific attribution. Generalize or list all -@c possibilities if more supported machines start doing this. - -@item up @var{n} -@kindex up -Move @var{n} frames up the stack. For positive numbers @var{n}, this -advances toward the outermost frame, to higher frame numbers, to frames -that have existed longer. @var{n} defaults to one. - -@item down @var{n} -@kindex down -@kindex do -Move @var{n} frames down the stack. For positive numbers @var{n}, this -advances toward the innermost frame, to lower frame numbers, to frames -that were created more recently. @var{n} defaults to one. You may -abbreviate @code{down} as @code{do}. -@end table - -All of these commands end by printing two lines of output describing the -frame. The first line shows the frame number, the function name, the -arguments, and the source file and line number of execution in that -frame. The second line shows the text of that source line. For -example: - -@smallexample -@group -(gdb) up -#1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc) - at env.c:10 -10 read_input_file (argv[i]); -@end group -@end smallexample - -After such a printout, the @code{list} command with no arguments will -print ten lines centered on the point of execution in the frame. -@xref{List, ,Printing Source Lines}. - -@table @code -@item up-silently @var{n} -@itemx down-silently @var{n} -@kindex down-silently -@kindex up-silently -These two commands are variants of @code{up} and @code{down}, -respectively; they differ in that they do their work silently, without -causing display of the new frame. They are intended primarily for use -in GDB command scripts, where the output might be unnecessary and -distracting. -@end table - -@node Frame Info, , Selection, Stack -@section Information About a Frame - -There are several other commands to print information about the selected -stack frame. - -@table @code -@item frame -@itemx f -When used without any argument, this command does not change which -frame is selected, but prints a brief description of the currently -selected stack frame. It can be abbreviated @code{f}. With an -argument, this command is used to select a stack frame -(@pxref{Selection, ,Selecting a Frame}). - -@item info frame -@itemx info f -@kindex info frame -@kindex info f -This command prints a verbose description of the selected stack frame, -including the address of the frame, the addresses of the next frame down -(called by this frame) and the next frame up (caller of this frame), the -language that the source code corresponding to this frame was written in, -the address of the frame's arguments, the program counter saved in it -(the address of execution in the caller frame), and which registers -were saved in the frame. The verbose description is useful when -something has gone wrong that has made the stack format fail to fit -the usual conventions. - -@item info frame @var{addr} -@itemx info f @var{addr} -Print a verbose description of the frame at address @var{addr}, -without selecting that frame. The selected frame remains unchanged by -this command. - -@item info args -@kindex info args -Print the arguments of the selected frame, each on a separate line. - -@item info locals -@kindex info locals -Print the local variables of the selected frame, each on a separate -line. These are all variables declared static or automatic within all -program blocks that execution in this frame is currently inside of. - -@item info catch -@kindex info catch -@cindex catch exceptions -@cindex exception handlers -Print a list of all the exception handlers that are active in the -current stack frame at the current point of execution. To see other -exception handlers, visit the associated frame (using the @code{up}, -@code{down}, or @code{frame} commands); then type @code{info catch}. -@xref{Exception Handling, ,Breakpoints and Exceptions}. -@end table - -@node Source, Data, Stack, Top -@chapter Examining Source Files - -GDB can print parts of your program's source, since the debugging -information recorded in your program tells GDB what source files were -used to build it. When your program stops, GDB spontaneously prints -the line where it stopped. Likewise, when you select a stack frame -(@pxref{Selection, ,Selecting a Frame}), GDB prints the line where -execution in that frame has stopped. You can print other portions of -source files by explicit command. - -If you use GDB through its GNU Emacs interface, you may prefer to use -Emacs facilities to view source; @pxref{Emacs, ,Using GDB under GNU -Emacs}. - -@menu -* List:: Printing Source Lines -* Search:: Searching Source Files -* Source Path:: Specifying Source Directories -* Machine Code:: Source and Machine Code -@end menu - -@node List, Search, Source, Source -@section Printing Source Lines - -@kindex list -@kindex l -To print lines from a source file, use the @code{list} command -(abbreviated @code{l}). There are several ways to specify what part -of the file you want to print. - -Here are the forms of the @code{list} command most commonly used: - -@table @code -@item list @var{linenum} -Print lines centered around line number @var{linenum} in the -current source file. - -@item list @var{function} -Print lines centered around the beginning of function -@var{function}. - -@item list -Print more lines. If the last lines printed were printed with a -@code{list} command, this prints lines following the last lines -printed; however, if the last line printed was a solitary line printed -as part of displaying a stack frame (@pxref{Stack, ,Examining the -Stack}), this prints lines centered around that line. - -@item list - -Print lines just before the lines last printed. -@end table - -By default, GDB prints ten source lines with any of these forms of -the @code{list} command. You can change this using @code{set listsize}: - -@table @code -@item set listsize @var{count} -@kindex set listsize -Make the @code{list} command display @var{count} source lines (unless -the @code{list} argument explicitly specifies some other number). - -@item show listsize -@kindex show listsize -Display the number of lines that @code{list} will currently display by -default. -@end table - -Repeating a @code{list} command with @key{RET} discards the argument, -so it is equivalent to typing just @code{list}. This is more useful -than listing the same lines again. An exception is made for an -argument of @samp{-}; that argument is preserved in repetition so that -each repetition moves up in the source file. - -@cindex linespec -In general, the @code{list} command expects you to supply zero, one or two -@dfn{linespecs}. Linespecs specify source lines; there are several ways -of writing them but the effect is always to specify some source line. -Here is a complete description of the possible arguments for @code{list}: - -@table @code -@item list @var{linespec} -Print lines centered around the line specified by @var{linespec}. - -@item list @var{first},@var{last} -Print lines from @var{first} to @var{last}. Both arguments are -linespecs. - -@item list ,@var{last} -Print lines ending with @var{last}. - -@item list @var{first}, -Print lines starting with @var{first}. - -@item list + -Print lines just after the lines last printed. - -@item list - -Print lines just before the lines last printed. - -@item list -As described in the preceding table. -@end table - -Here are the ways of specifying a single source line---all the -kinds of linespec. - -@table @code -@item @var{number} -Specifies line @var{number} of the current source file. -When a @code{list} command has two linespecs, this refers to -the same source file as the first linespec. - -@item +@var{offset} -Specifies the line @var{offset} lines after the last line printed. -When used as the second linespec in a @code{list} command that has -two, this specifies the line @var{offset} lines down from the -first linespec. - -@item -@var{offset} -Specifies the line @var{offset} lines before the last line printed. - -@item @var{filename}:@var{number} -Specifies line @var{number} in the source file @var{filename}. - -@item @var{function} -@c FIXME: "of the open-brace" is C-centric. When we add other langs... -Specifies the line of the open-brace that begins the body of the -function @var{function}. - -@item @var{filename}:@var{function} -Specifies the line of the open-brace that begins the body of the -function @var{function} in the file @var{filename}. You only need the -file name with a function name to avoid ambiguity when there are -identically named functions in different source files. - -@item *@var{address} -Specifies the line containing the program address @var{address}. -@var{address} may be any expression. -@end table - -@node Search, Source Path, List, Source -@section Searching Source Files -@cindex searching -@kindex reverse-search - -There are two commands for searching through the current source file for a -regular expression. - -@table @code -@item forward-search @var{regexp} -@itemx search @var{regexp} -@kindex search -@kindex forward-search -The command @samp{forward-search @var{regexp}} checks each line, -starting with the one following the last line listed, for a match for -@var{regexp}. It lists the line that is found. You can use -synonym @samp{search @var{regexp}} or abbreviate the command name as -@code{fo}. - -@item reverse-search @var{regexp} -The command @samp{reverse-search @var{regexp}} checks each line, starting -with the one before the last line listed and going backward, for a match -for @var{regexp}. It lists the line that is found. You can abbreviate -this command as @code{rev}. -@end table - -@node Source Path, Machine Code, Search, Source -@section Specifying Source Directories - -@cindex source path -@cindex directories for source files -Executable programs sometimes do not record the directories of the source -files from which they were compiled, just the names. Even when they do, -the directories could be moved between the compilation and your debugging -session. GDB has a list of directories to search for source files; -this is called the @dfn{source path}. Each time GDB wants a source file, -it tries all the directories in the list, in the order they are present -in the list, until it finds a file with the desired name. Note that -the executable search path is @emph{not} used for this purpose. Neither is -the current working directory, unless it happens to be in the source -path. - -If GDB cannot find a source file in the source path, and the object -program records a directory, GDB tries that directory too. If the -source path is empty, and there is no record of the compilation -directory, GDB will, as a last resort, look in the current -directory. - -Whenever you reset or rearrange the source path, GDB will clear out -any information it has cached about where source files are found, where -each line is in the file, etc. - -@kindex directory -When you start GDB, its source path is empty. -To add other directories, use the @code{directory} command. - -@table @code -@item directory @var{dirname} @dots{} -Add directory @var{dirname} to the front of the source path. Several -directory names may be given to this command, separated by @samp{:} or -whitespace. You may specify a directory that is already in the source -path; this moves it forward, so it will be searched sooner. - -You can use the string @samp{$cdir} to refer to the compilation -directory (if one is recorded), and @samp{$cwd} to refer to the current -working directory. @samp{$cwd} is not the same as @samp{.}---the former -tracks the current working directory as it changes during your GDB -session, while the latter is immediately expanded to the current -directory at the time you add an entry to the source path. - -@item directory -Reset the source path to empty again. This requires confirmation. - -@c RET-repeat for @code{directory} is explicitly disabled, but since -@c repeating it would be a no-op we do not say that. (thanks to RMS) - -@item show directories -@kindex show directories -Print the source path: show which directories it contains. -@end table - -If your source path is cluttered with directories that are no longer of -interest, GDB may sometimes cause confusion by finding the wrong -versions of source. You can correct the situation as follows: - -@enumerate -@item -Use @code{directory} with no argument to reset the source path to empty. - -@item -Use @code{directory} with suitable arguments to reinstall the -directories you want in the source path. You can add all the -directories in one command. -@end enumerate - -@node Machine Code, , Source Path, Source -@section Source and Machine Code - -You can use the command @code{info line} to map source lines to program -addresses (and viceversa), and the command @code{disassemble} to display -a range of addresses as machine instructions. - -@table @code -@item info line @var{linespec} -@kindex info line -Print the starting and ending addresses of the compiled code for -source line @var{linespec}. You can specify source lines in any of -the ways understood by the @code{list} command (@pxref{List, ,Printing -Source Lines}). -@end table - -For example, we can use @code{info line} to discover the location of -the object code for the first line of function -@code{m4_changequote}: - -@smallexample -(gdb) info line m4_changecom -Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350. -@end smallexample - -@noindent -We can also inquire (using @code{*@var{addr}} as the form for -@var{linespec}) what source line covers a particular address: -@smallexample -(gdb) info line *0x63ff -Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404. -@end smallexample - -@cindex @code{$_} and @code{info line} -After @code{info line}, the default address for the @code{x} command -is changed to the starting address of the line, so that @samp{x/i} is -sufficient to begin examining the machine code (@pxref{Memory, -,Examining Memory}). Also, this address is saved as the value of the -convenience variable @code{$_} (@pxref{Convenience Vars, ,Convenience -Variables}). - -@table @code -@kindex disassemble -@item disassemble -This specialized command dumps a range of memory as machine -instructions. The default memory range is the function surrounding the -program counter of the selected frame. A single argument to this -command is a program counter value; the function surrounding this value -will be dumped. Two arguments specify a range of addresses (first -inclusive, second exclusive) to dump. -@end table - -We can use @code{disassemble} to inspect the object code -range shown in the last @code{info line} example: - -@smallexample -(gdb) disas 0x63e4 0x6404 -Dump of assembler code from 0x63e4 to 0x6404: -0x63e4 builtin_init+5340: ble 0x63f8 builtin_init+5360 -0x63e8 builtin_init+5344: sethi %hi(0x4c00), %o0 -0x63ec builtin_init+5348: ld [%i1+4], %o0 -0x63f0 builtin_init+5352: b 0x63fc builtin_init+5364 -0x63f4 builtin_init+5356: ld [%o0+4], %o0 -0x63f8 builtin_init+5360: or %o0, 0x1a4, %o0 -0x63fc builtin_init+5364: call 0x9288 path_search -0x6400 builtin_init+5368: nop -End of assembler dump. -@end smallexample - -@node Data, Languages, Source, Top -@chapter Examining Data - -@cindex printing data -@cindex examining data -@kindex print -@kindex inspect -@c "inspect" is not quite a synonym if you are using Epoch, which we do not -@c document because it is nonstandard... Under Epoch it displays in a -@c different window or something like that. -The usual way to examine data in your program is with the @code{print} -command (abbreviated @code{p}), or its synonym @code{inspect}. It -evaluates and prints the value of an expression of the language your -program is written in (@pxref{Languages, ,Using GDB with Different -Languages}). - -@table @code -@item print @var{exp} -@itemx print /@var{f} @var{exp} -@var{exp} is an expression (in the source language). By default -the value of @var{exp} is printed in a format appropriate to its data -type; you can choose a different format by specifying @samp{/@var{f}}, -where @var{f} is a letter specifying the format; @pxref{Output formats}. - -@item print -@itemx print /@var{f} -If you omit @var{exp}, GDB displays the last value again (from the -@dfn{value history}; @pxref{Value History, ,Value History}). This allows you to -conveniently inspect the same value in an alternative format. -@end table - -A more low-level way of examining data is with the @code{x} command. -It examines data in memory at a specified address and prints it in a -specified format. @xref{Memory, ,Examining Memory}. - -If you are interested in information about types, or about how the fields -of a struct or class are declared, use the @code{ptype @var{exp}} -command rather than @code{print}. @xref{Symbols, ,Examining the Symbol Table}. - -@menu -* Expressions:: Expressions -* Variables:: Program Variables -* Arrays:: Artificial Arrays -* Output formats:: Output formats -* Memory:: Examining Memory -* Auto Display:: Automatic Display -* Print Settings:: Print Settings -* Value History:: Value History -* Convenience Vars:: Convenience Variables -* Registers:: Registers -* Floating Point Hardware:: Floating Point Hardware -@end menu - -@node Expressions, Variables, Data, Data -@section Expressions - -@cindex expressions -@code{print} and many other GDB commands accept an expression and -compute its value. Any kind of constant, variable or operator defined -by the programming language you are using is legal in an expression in -GDB. This includes conditional expressions, function calls, casts -and string constants. It unfortunately does not include symbols defined -by preprocessor @code{#define} commands. - -Because C is so widespread, most of the expressions shown in examples in -this manual are in C. @xref{Languages, , Using GDB with Different -Languages}, for information on how to use expressions in other -languages. - -In this section, we discuss operators that you can use in GDB -expressions regardless of your programming language. - -Casts are supported in all languages, not just in C, because it is so -useful to cast a number into a pointer so as to examine a structure -at that address in memory. -@c FIXME: casts supported---Mod2 true? - -GDB supports these operators in addition to those of programming -languages: - -@table @code -@item @@ -@samp{@@} is a binary operator for treating parts of memory as arrays. -@xref{Arrays, ,Artificial Arrays}, for more information. - -@item :: -@samp{::} allows you to specify a variable in terms of the file or -function where it is defined. @xref{Variables, ,Program Variables}. - -@item @{@var{type}@} @var{addr} -Refers to an object of type @var{type} stored at address @var{addr} in -memory. @var{addr} may be any expression whose value is an integer or -pointer (but parentheses are required around binary operators, just as in -a cast). This construct is allowed regardless of what kind of data is -normally supposed to reside at @var{addr}. -@end table - -@node Variables, Arrays, Expressions, Data -@section Program Variables - -The most common kind of expression to use is the name of a variable -in your program. - -Variables in expressions are understood in the selected stack frame -(@pxref{Selection, ,Selecting a Frame}); they must either be global -(or static) or be visible according to the scope rules of the -programming language from the point of execution in that frame. This -means that in the function - -@example -foo (a) - int a; -@{ - bar (a); - @{ - int b = test (); - bar (b); - @} -@} -@end example - -@noindent -the variable @code{a} is usable whenever your program is executing -within the function @code{foo}, but the variable @code{b} is visible -only while your program is executing inside the block in which @code{b} -is declared. - -@cindex variable name conflict -There is an exception: you can refer to a variable or function whose -scope is a single source file even if the current execution point is not -in this file. But it is possible to have more than one such variable or -function with the same name (in different source files). If that happens, -referring to that name has unpredictable effects. If you wish, you can -specify a variable in a particular file, using the colon-colon notation: - -@cindex colon-colon -@iftex -@c info cannot cope with a :: index entry, but why deprive hard copy readers? -@kindex :: -@end iftex -@example -@var{file}::@var{variable} -@end example - -@noindent -Here @var{file} is the name of the source file whose variable you want. - -@cindex C++ scope resolution -This use of @samp{::} is very rarely in conflict with the very similar -use of the same notation in C++. GDB also supports use of the C++ -scope resolution operator in GDB expressions. - -@cindex wrong values -@cindex variable values, wrong -@quotation -@emph{Warning:} Occasionally, a local variable may appear to have the -wrong value at certain points in a function---just after entry to the -function, and just before exit. You may see this problem when you are -stepping by machine instructions. This is because on most machines, it -takes more than one instruction to set up a stack frame (including local -variable definitions); if you are stepping by machine instructions, -variables may appear to have the wrong values until the stack frame is -completely built. On function exit, it usually also takes more than one -machine instruction to destroy a stack frame; after you begin stepping -through that group of instructions, local variable definitions may be -gone. -@end quotation - -@node Arrays, Output formats, Variables, Data -@section Artificial Arrays - -@cindex artificial array -@kindex @@ -It is often useful to print out several successive objects of the -same type in memory; a section of an array, or an array of -dynamically determined size for which only a pointer exists in the -program. - -This can be done by constructing an @dfn{artificial array} with the -binary operator @samp{@@}. The left operand of @samp{@@} should be -the first element of the desired array, as an individual object. -The right operand should be the desired length of the array. The result is -an array value whose elements are all of the type of the left argument. -The first element is actually the left argument; the second element -comes from bytes of memory immediately following those that hold the -first element, and so on. Here is an example. If a program says - -@example -int *array = (int *) malloc (len * sizeof (int)); -@end example - -@noindent -you can print the contents of @code{array} with - -@example -p *array@@len -@end example - -The left operand of @samp{@@} must reside in memory. Array values made -with @samp{@@} in this way behave just like other arrays in terms of -subscripting, and are coerced to pointers when used in expressions. -Artificial arrays most often appear in expressions via the value history -(@pxref{Value History, ,Value History}), after printing one out.) - -Sometimes the artificial array mechanism is not quite enough; in -moderately complex data structures, the elements of interest may not -actually be adjacent---for example, if you are interested in the values -of pointers in an array. One useful work-around in this situation is -to use a convenience variable (@pxref{Convenience Vars, ,Convenience -Variables}) as a counter in an expression that prints the first -interesting value, and then repeat that expression via @key{RET}. For -instance, suppose you have an array @code{dtab} of pointers to -structures, and you are interested in the values of a field @code{fv} -in each structure. Here is an example of what you might type: - -@example -set $i = 0 -p dtab[$i++]->fv -@key{RET} -@key{RET} -@dots{} -@end example - -@node Output formats, Memory, Arrays, Data -@section Output formats - -@cindex formatted output -@cindex output formats -By default, GDB prints a value according to its data type. Sometimes -this is not what you want. For example, you might want to print a number -in hex, or a pointer in decimal. Or you might want to view data in memory -at a certain address as a character string or as an instruction. To do -these things, specify an @dfn{output format} when you print a value. - -The simplest use of output formats is to say how to print a value -already computed. This is done by starting the arguments of the -@code{print} command with a slash and a format letter. The format -letters supported are: - -@table @code -@item x -Regard the bits of the value as an integer, and print the integer in -hexadecimal. - -@item d -Print as integer in signed decimal. - -@item u -Print as integer in unsigned decimal. - -@item o -Print as integer in octal. - -@item t -Print as integer in binary. The letter @samp{t} stands for ``two''. - -@item a -Print as an address, both absolute in hex and as an offset from the -nearest preceding symbol. This format can be used to discover where (in -what function) an unknown address is located: - -@example -(gdb) p/a 0x54320 -$3 = 0x54320 <_initialize_vx+396> -@end example - -@item c -Regard as an integer and print it as a character constant. - -@item f -Regard the bits of the value as a floating point number and print -using typical floating point syntax. -@end table - -For example, to print the program counter in hex (@pxref{Registers}), type - -@example -p/x $pc -@end example - -@noindent -Note that no space is required before the slash; this is because command -names in GDB cannot contain a slash. - -To reprint the last value in the value history with a different format, -you can use the @code{print} command with just a format and no -expression. For example, @samp{p/x} reprints the last value in hex. - -@node Memory, Auto Display, Output formats, Data -@section Examining Memory - -You can use the command @code{x} (for ``examine'') to examine memory in -any of several formats, independently of your program's data types. - -@cindex examining memory -@table @code -@kindex x -@item x/@var{nfu} @var{addr} -@itemx x @var{addr} -@itemx x -Use the command @code{x} to examine memory. -@end table - -@var{n}, @var{f}, and @var{u} are all optional parameters that specify how -much memory to display and how to format it; @var{addr} is an -expression giving the address where you want to start displaying memory. -If you use defaults for @var{nfu}, you need not type the slash @samp{/}. -Several commands set convenient defaults for @var{addr}. - -@table @r -@item @var{n}, the repeat count -The repeat count is a decimal integer; the default is 1. It specifies -how much memory (counting by units @var{u}) to display. -@c This really is **decimal**; unaffected by 'set radix' as of GDB -@c 4.1.2. - -@item @var{f}, the display format -The display format is one of the formats used by @code{print}, -or @samp{s} (null-terminated string) or @samp{i} (machine instruction). -The default is @samp{x} (hexadecimal) initially, or the format from the -last time you used either @code{x} or @code{print}. - -@item @var{u}, the unit size -The unit size is any of -@table @code -@item b -Bytes. -@item h -Halfwords (two bytes). -@item w -Words (four bytes). This is the initial default. -@item g -Giant words (eight bytes). -@end table - -Each time you specify a unit size with @code{x}, that size becomes the -default unit the next time you use @code{x}. (For the @samp{s} and -@samp{i} formats, the unit size is ignored and is normally not written.) - -@item @var{addr}, starting display address -@var{addr} is the address where you want GDB to begin displaying -memory. The expression need not have a pointer value (though it may); -it is always interpreted as an integer address of a byte of memory. -@xref{Expressions, ,Expressions}, for more information on expressions. The default for -@var{addr} is usually just after the last address examined---but several -other commands also set the default address: @code{info breakpoints} (to -the address of the last breakpoint listed), @code{info line} (to the -starting address of a line), and @code{print} (if you use it to display -a value from memory). -@end table - -For example, @samp{x/3uh 0x54320} is a request to display three halfwords -(@code{h}) of memory, formatted as unsigned decimal integers (@samp{u}), -starting at address @code{0x54320}. @samp{x/4xw $sp} prints the four -words (@samp{w}) of memory above the stack pointer (here, @samp{$sp}; -@pxref{Registers}) in hexadecimal (@samp{x}). - -Since the letters indicating unit sizes are all distinct from the -letters specifying output formats, you do not have to remember whether -unit size or format comes first; either order will work. The output -specifications @samp{4xw} and @samp{4wx} mean exactly the same thing. -(However, the count @var{n} must come first; @samp{wx4} will not work.) - -Even though the unit size @var{u} is ignored for the formats @samp{s} -and @samp{i}, you might still want to use a count @var{n}; for example, -@samp{3i} specifies that you want to see three machine instructions, -including any operands. The command @code{disassemble} gives an -alternative way of inspecting machine instructions; @pxref{Machine -Code}. - -All the defaults for the arguments to @code{x} are designed to make it -easy to continue scanning memory with minimal specifications each time -you use @code{x}. For example, after you have inspected three machine -instructions with @samp{x/3i @var{addr}}, you can inspect the next seven -with just @samp{x/7}. If you use @key{RET} to repeat the @code{x} command, -the repeat count @var{n} is used again; the other arguments default as -for successive uses of @code{x}. - -@cindex @code{$_}, @code{$__}, and value history -The addresses and contents printed by the @code{x} command are not saved -in the value history because there is often too much of them and they -would get in the way. Instead, GDB makes these values available for -subsequent use in expressions as values of the convenience variables -@code{$_} and @code{$__}. After an @code{x} command, the last address -examined is available for use in expressions in the convenience variable -@code{$_}. The contents of that address, as examined, are available in -the convenience variable @code{$__}. - -If the @code{x} command has a repeat count, the address and contents saved -are from the last memory unit printed; this is not the same as the last -address printed if several units were printed on the last line of output. - -@node Auto Display, Print Settings, Memory, Data -@section Automatic Display -@cindex automatic display -@cindex display of expressions - -If you find that you want to print the value of an expression frequently -(to see how it changes), you might want to add it to the @dfn{automatic -display list} so that GDB will print its value each time your program stops. -Each expression added to the list is given a number to identify it; -to remove an expression from the list, you specify that number. -The automatic display looks like this: - -@example -2: foo = 38 -3: bar[5] = (struct hack *) 0x3804 -@end example - -@noindent -showing item numbers, expressions and their current values. As with -displays you request manually using @code{x} or @code{print}, you can -specify the output format you prefer; in fact, @code{display} decides -whether to use @code{print} or @code{x} depending on how elaborate your -format specification is---it uses @code{x} if you specify a unit size, -or one of the two formats (@samp{i} and @samp{s}) that are only -supported by @code{x}; otherwise it uses @code{print}. - -@table @code -@item display @var{exp} -@kindex display -Add the expression @var{exp} to the list of expressions to display -each time your program stops. @xref{Expressions, ,Expressions}. - -@code{display} will not repeat if you press @key{RET} again after using it. - -@item display/@var{fmt} @var{exp} -For @var{fmt} specifying only a display format and not a size or -count, add the expression @var{exp} to the auto-display list but -arranges to display it each time in the specified format @var{fmt}. -@xref{Output formats}. - -@item display/@var{fmt} @var{addr} -For @var{fmt} @samp{i} or @samp{s}, or including a unit-size or a -number of units, add the expression @var{addr} as a memory address to -be examined each time your program stops. Examining means in effect -doing @samp{x/@var{fmt} @var{addr}}. @xref{Memory, ,Examining Memory}. -@end table - -For example, @samp{display/i $pc} can be helpful, to see the machine -instruction about to be executed each time execution stops (@samp{$pc} -is a common name for the program counter; @pxref{Registers}). - -@table @code -@item undisplay @var{dnums}@dots{} -@itemx delete display @var{dnums}@dots{} -@kindex delete display -@kindex undisplay -Remove item numbers @var{dnums} from the list of expressions to display. - -@code{undisplay} will not repeat if you press @key{RET} after using it. -(Otherwise you would just get the error @samp{No display number @dots{}}.) - -@item disable display @var{dnums}@dots{} -@kindex disable display -Disable the display of item numbers @var{dnums}. A disabled display -item is not printed automatically, but is not forgotten. It may be -enabled again later. - -@item enable display @var{dnums}@dots{} -@kindex enable display -Enable display of item numbers @var{dnums}. It becomes effective once -again in auto display of its expression, until you specify otherwise. - -@item display -Display the current values of the expressions on the list, just as is -done when your program stops. - -@item info display -@kindex info display -Print the list of expressions previously set up to display -automatically, each one with its item number, but without showing the -values. This includes disabled expressions, which are marked as such. -It also includes expressions which would not be displayed right now -because they refer to automatic variables not currently available. -@end table - -If a display expression refers to local variables, then it does not make -sense outside the lexical context for which it was set up. Such an -expression is disabled when execution enters a context where one of its -variables is not defined. For example, if you give the command -@code{display last_char} while inside a function with an argument -@code{last_char}, then this argument will be displayed while your program -continues to stop inside that function. When it stops elsewhere---where -there is no variable @code{last_char}---display is disabled. The next time -your program stops where @code{last_char} is meaningful, you can enable the -display expression once again. - -@node Print Settings, Value History, Auto Display, Data -@section Print Settings - -@cindex format options -@cindex print settings -GDB provides the following ways to control how arrays, structures, -and symbols are printed. - -@noindent -These settings are useful for debugging programs in any language: - -@table @code -@item set print address -@item set print address on -@kindex set print address -GDB will print memory addresses showing the location of stack -traces, structure values, pointer values, breakpoints, and so forth, -even when it also displays the contents of those addresses. The default -is on. For example, this is what a stack frame display looks like, with -@code{set print address on}: - -@smallexample -@group -(gdb) f -#0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>") - at input.c:530 -530 if (lquote != def_lquote) -@end group -@end smallexample - -@item set print address off -Do not print addresses when displaying their contents. For example, -this is the same stack frame displayed with @code{set print address off}: - -@example -@group -(gdb) set print addr off -(gdb) f -#0 set_quotes (lq="<<", rq=">>") at input.c:530 -530 if (lquote != def_lquote) -@end group -@end example - -@item show print address -@kindex show print address -Show whether or not addresses are to be printed. - -@item set print array -@itemx set print array on -@kindex set print array -GDB will pretty print arrays. This format is more convenient to read, -but uses more space. The default is off. - -@item set print array off. -Return to compressed format for arrays. - -@item show print array -@kindex show print array -Show whether compressed or pretty format is selected for displaying -arrays. - -@item set print elements @var{number-of-elements} -@kindex set print elements -If GDB is printing a large array, it will stop printing after it has -printed the number of elements set by the @code{set print elements} command. -This limit also applies to the display of strings. - -@item show print elements -@kindex show print elements -Display the number of elements of a large array that GDB will print -before losing patience. - -@item set print pretty on -@kindex set print pretty -Cause GDB to print structures in an indented format with one member per -line, like this: - -@example -@group -$1 = @{ - next = 0x0, - flags = @{ - sweet = 1, - sour = 1 - @}, - meat = 0x54 "Pork" -@} -@end group -@end example - -@item set print pretty off -Cause GDB to print structures in a compact format, like this: - -@smallexample -@group -$1 = @{next = 0x0, flags = @{sweet = 1, sour = 1@}, meat \ -= 0x54 "Pork"@} -@end group -@end smallexample - -@noindent -This is the default format. - -@item show print pretty -@kindex show print pretty -Show which format GDB will use to print structures. - -@item set print sevenbit-strings on -@kindex set print sevenbit-strings -Print using only seven-bit characters; if this option is set, -GDB will display any eight-bit characters (in strings or character -values) using the notation @code{\}@var{nnn}. For example, @kbd{M-a} is -displayed as @code{\341}. - -@item set print sevenbit-strings off -Print using either seven-bit or eight-bit characters, as required. This -is the default. - -@item show print sevenbit-strings -@kindex show print sevenbit-strings -Show whether or not GDB will print only seven-bit characters. - -@item set print union on -@kindex set print union -Tell GDB to print unions which are contained in structures. This is the -default setting. - -@item set print union off -Tell GDB not to print unions which are contained in structures. - -@item show print union -@kindex show print union -Ask GDB whether or not it will print unions which are contained in -structures. - -For example, given the declarations - -@smallexample -typedef enum @{Tree, Bug@} Species; -typedef enum @{Big_tree, Acorn, Seedling@} Tree_forms; -typedef enum @{Caterpillar, Cocoon, Butterfly@} - Bug_forms; - -struct thing @{ - Species it; - union @{ - Tree_forms tree; - Bug_forms bug; - @} form; -@}; - -struct thing foo = @{Tree, @{Acorn@}@}; -@end smallexample - -@noindent -with @code{set print union on} in effect @samp{p foo} would print - -@smallexample -$1 = @{it = Tree, form = @{tree = Acorn, bug = Cocoon@}@} -@end smallexample - -@noindent -and with @code{set print union off} in effect it would print - -@smallexample -$1 = @{it = Tree, form = @{...@}@} -@end smallexample -@end table - -@noindent -These settings are of interest when debugging C++ programs: - -@table @code -@item set print demangle -@itemx set print demangle on -@kindex set print demangle -Print C++ names in their source form rather than in the mangled form -in which they are passed to the assembler and linker for type-safe linkage. -The default is on. - -@item show print demangle -@kindex show print demangle -Show whether C++ names will be printed in mangled or demangled form. - -@item set print asm-demangle -@itemx set print asm-demangle on -@kindex set print asm-demangle -Print C++ names in their source form rather than their mangled form, even -in assembler code printouts such as instruction disassemblies. -The default is off. - -@item show print asm-demangle -@kindex show print asm-demangle -Show whether C++ names in assembly listings will be printed in mangled -or demangled form. - -@item set print object -@itemx set print object on -@kindex set print object -When displaying a pointer to an object, identify the @emph{actual} -(derived) type of the object rather than the @emph{declared} type, using -the virtual function table. - -@item set print object off -Display only the declared type of objects, without reference to the -virtual function table. This is the default setting. - -@item show print object -@kindex show print object -Show whether actual, or declared, object types will be displayed. - -@item set print vtbl -@itemx set print vtbl on -@kindex set print vtbl -Pretty print C++ virtual function tables. The default is off. - -@item set print vtbl off -Do not pretty print C++ virtual function tables. - -@item show print vtbl -@kindex show print vtbl -Show whether C++ virtual function tables are pretty printed, or not. -@end table - -@node Value History, Convenience Vars, Print Settings, Data -@section Value History - -@cindex value history -Values printed by the @code{print} command are saved in GDB's @dfn{value -history} so that you can refer to them in other expressions. Values are -kept until the symbol table is re-read or discarded (for example with -the @code{file} or @code{symbol-file} commands). When the symbol table -changes, the value history is discarded, since the values may contain -pointers back to the types defined in the symbol table. - -@cindex @code{$} -@cindex @code{$$} -@cindex history number -The values printed are given @dfn{history numbers} for you to refer to them -by. These are successive integers starting with one. @code{print} shows you -the history number assigned to a value by printing @samp{$@var{num} = } -before the value; here @var{num} is the history number. - -To refer to any previous value, use @samp{$} followed by the value's -history number. The way @code{print} labels its output is designed to -remind you of this. Just @code{$} refers to the most recent value in -the history, and @code{$$} refers to the value before that. -@code{$$@var{n}} refers to the @var{n}th value from the end; @code{$$2} -is the value just prior to @code{$$}, @code{$$1} is equivalent to -@code{$$}, and @code{$$0} is equivalent to @code{$}. - -For example, suppose you have just printed a pointer to a structure and -want to see the contents of the structure. It suffices to type - -@example -p *$ -@end example - -If you have a chain of structures where the component @code{next} points -to the next one, you can print the contents of the next one with this: - -@example -p *$.next -@end example - -@noindent -You can print successive links in the chain by repeating this -command---which you can do by just typing @key{RET}. - -Note that the history records values, not expressions. If the value of -@code{x} is 4 and you type these commands: - -@example -print x -set x=5 -@end example - -@noindent -then the value recorded in the value history by the @code{print} command -remains 4 even though the value of @code{x} has changed. - -@table @code -@kindex show values -@item show values -Print the last ten values in the value history, with their item numbers. -This is like @samp{p@ $$9} repeated ten times, except that @code{show -values} does not change the history. - -@item show values @var{n} -Print ten history values centered on history item number @var{n}. - -@item show values + -Print ten history values just after the values last printed. If no more -values are available, produces no display. -@end table - -Pressing @key{RET} to repeat @code{show values @var{n}} has exactly the -same effect as @samp{show values +}. - -@node Convenience Vars, Registers, Value History, Data -@section Convenience Variables - -@cindex convenience variables -GDB provides @dfn{convenience variables} that you can use within -GDB to hold on to a value and refer to it later. These variables -exist entirely within GDB; they are not part of your program, and -setting a convenience variable has no direct effect on further execution -of your program. That is why you can use them freely. - -Convenience variables are prefixed with @samp{$}. Any name preceded by -@samp{$} can be used for a convenience variable, unless it is one of -the predefined machine-specific register names (@pxref{Registers}). -(Value history references, in contrast, are @emph{numbers} preceded -by @samp{$}. @xref{Value History, ,Value History}.) - -You can save a value in a convenience variable with an assignment -expression, just as you would set a variable in your program. Example: - -@example -set $foo = *object_ptr -@end example - -@noindent -would save in @code{$foo} the value contained in the object pointed to by -@code{object_ptr}. - -Using a convenience variable for the first time creates it; but its value -is @code{void} until you assign a new value. You can alter the value with -another assignment at any time. - -Convenience variables have no fixed types. You can assign a convenience -variable any type of value, including structures and arrays, even if -that variable already has a value of a different type. The convenience -variable, when used as an expression, has the type of its current value. - -@table @code -@item show convenience -@kindex show convenience -Print a list of convenience variables used so far, and their values. -Abbreviated @code{show con}. -@end table - -One of the ways to use a convenience variable is as a counter to be -incremented or a pointer to be advanced. For example, to print -a field from successive elements of an array of structures: - -@example -set $i = 0 -print bar[$i++]->contents -@i{@dots{} repeat that command by typing @key{RET}.} -@end example - -Some convenience variables are created automatically by GDB and given -values likely to be useful. - -@table @code -@item $_ -@kindex $_ -The variable @code{$_} is automatically set by the @code{x} command to -the last address examined (@pxref{Memory, ,Examining Memory}). Other -commands which provide a default address for @code{x} to examine also -set @code{$_} to that address; these commands include @code{info line} -and @code{info breakpoint}. The type of @code{$_} is @code{void *} -except when set by the @code{x} command, in which case it is a pointer -to the type of @code{$__}. - -@item $__ -@kindex $__ -The variable @code{$__} is automatically set by the @code{x} command -to the value found in the last address examined. Its type is chosen -to match the format in which the data was printed. -@end table - -@node Registers, Floating Point Hardware, Convenience Vars, Data -@section Registers - -@cindex registers -You can refer to machine register contents, in expressions, as variables -with names starting with @samp{$}. The names of registers are different -for each machine; use @code{info registers} to see the names used on -your machine. - -@table @code -@item info registers -@kindex info registers -Print the names and values of all registers except floating-point -registers (in the selected stack frame). - -@item info all-registers -@kindex info all-registers -@cindex floating point registers -Print the names and values of all registers, including floating-point -registers. - -@item info registers @var{regname} -Print the relativized value of register @var{regname}. @var{regname} -may be any register name valid on the machine you are using, with -or without the initial @samp{$}. -@end table - -GDB has four ``standard'' register names that are available (in -expressions) on most machines---whenever they do not conflict with an -architecture's canonical mnemonics for registers. The register names -@code{$pc} and @code{$sp} are used for the program counter register and -the stack pointer. @code{$fp} is used for a register that contains a -pointer to the current stack frame, and @code{$ps} is used for a -register that contains the processor status. For example, -you could print the program counter in hex with - -@example -p/x $pc -@end example - -@noindent -or print the instruction to be executed next with - -@example -x/i $pc -@end example - -@noindent -or add four to the stack pointer @footnote{This is a way of removing -one word from the stack, on machines where stacks grow downward in -memory (most machines, nowadays). This assumes that the innermost -stack frame is selected; setting @code{$sp} is not allowed when other -stack frames are selected. To pop entire frames off the stack, -regardless of machine architecture, use @code{return}; -@pxref{Returning, ,Returning from a Function}.} with - -@example -set $sp += 4 -@end example - -Whenever possible, these four standard register names are available on -your machine even though the machine has different canonical mnemonics, -so long as there is no conflict. The @code{info registers} command -shows the canonical names. For example, on the SPARC, @code{info -registers} displays the processor status register as @code{$psr} but you -can also refer to it as @code{$ps}. - -GDB always considers the contents of an ordinary register as an -integer when the register is examined in this way. Some machines have -special registers which can hold nothing but floating point; these -registers are considered to have floating point values. There is no way -to refer to the contents of an ordinary register as floating point value -(although you can @emph{print} it as a floating point value with -@samp{print/f $@var{regname}}). - -Some registers have distinct ``raw'' and ``virtual'' data formats. This -means that the data format in which the register contents are saved by -the operating system is not the same one that your program normally -sees. For example, the registers of the 68881 floating point -coprocessor are always saved in ``extended'' (raw) format, but all C -programs expect to work with ``double'' (virtual) format. In such -cases, GDB normally works with the virtual format only (the format that -makes sense for your program), but the @code{info registers} command -prints the data in both formats. - -Normally, register values are relative to the selected stack frame -(@pxref{Selection, ,Selecting a Frame}). This means that you get the -value that the register would contain if all stack frames farther in -were exited and their saved registers restored. In order to see the -true contents of hardware registers, you must select the innermost -frame (with @samp{frame 0}). - -However, GDB must deduce where registers are saved, from the machine -code generated by your compiler. If some registers are not saved, or if -GDB is unable to locate the saved registers, the selected stack -frame will make no difference. - -@node Floating Point Hardware, , Registers, Data -@section Floating Point Hardware -@cindex floating point - -Depending on the host machine architecture, GDB may be able to give -you more information about the status of the floating point hardware. - -@table @code -@item info float -@kindex info float -If available, provides hardware-dependent information about the floating -point unit. The exact contents and layout vary depending on the -floating point chip. -@end table -@c FIXME: this is a cop-out. Try to get examples, explanations. Only -@c FIXME...supported currently on arm's and 386's. Mark properly with -@c FIXME... m4 macros to isolate general statements from hardware-dep, -@c FIXME... at that point. - -@node Languages, Symbols, Data, Top -@chapter Using GDB with Different Languages -@cindex languages - -Although programming languages generally have common aspects, they are -rarely expressed in the same manner. For instance, in ANSI C, -dereferencing a pointer @code{p} is accomplished by @code{*p}, but in -Modula-2, it is accomplished by @code{p^}. Values can also be -represented (and displayed) differently. Hex numbers in C are written -like @samp{0x1ae}, while in Modula-2 they appear as @samp{1AEH}. - -@cindex working language -Language-specific information is built into GDB for some languages, -allowing you to express operations like the above in your program's -native language, and allowing GDB to output values in a manner -consistent with the syntax of your program's native language. The -language you use to build expressions, called the @dfn{working -language}, can be selected manually, or GDB can set it -automatically. - -@menu -* Setting:: Switching between source languages -* Show:: Displaying the language -* Checks:: Type and Range checks -* Support:: Supported languages -@end menu - -@node Setting, Show, Languages, Languages -@section Switching between source languages - -There are two ways to control the working language---either have GDB -set it automatically, or select it manually yourself. You can use the -@code{set language} command for either purpose. On startup, GDB -defaults to setting the language automatically. - -@menu -* Manually:: Setting the working language manually -* Automatically:: Having GDB infer the source language -@end menu - -@node Manually, Automatically, Setting, Setting -@subsection Setting the working language - -@kindex set language -To set the language, issue the command @samp{set language @var{lang}}, -where @var{lang} is the name of a language: @code{c} or @code{modula-2}. -For a list of the supported languages, type @samp{set language}. - -Setting the language manually prevents GDB from updating the working -language automatically. This can lead to confusion if you try -to debug a program when the working language is not the same as the -source language, when an expression is acceptable to both -languages---but means different things. For instance, if the current -source file were written in C, and GDB was parsing Modula-2, a -command such as: - -@example -print a = b + c -@end example - -@noindent -might not have the effect you intended. In C, this means to add -@code{b} and @code{c} and place the result in @code{a}. The result -printed would be the value of @code{a}. In Modula-2, this means to compare -@code{a} to the result of @code{b+c}, yielding a @code{BOOLEAN} value. - -If you allow GDB to set the language automatically, then -you can count on expressions evaluating the same way in your debugging -session and in your program. - -@node Automatically, , Manually, Setting -@subsection Having GDB infer the source language - -To have GDB set the working language automatically, use @samp{set -language local} or @samp{set language auto}. GDB then infers the -language that a program was written in by looking at the name of its -source files, and examining their extensions: - -@table @file -@item *.mod -Modula-2 source file - -@item *.c -@itemx *.cc -C or C++ source file. -@end table - -This information is recorded for each function or procedure in a source -file. When your program stops in a frame (usually by encountering a -breakpoint), GDB sets the working language to the language recorded -for the function in that frame. If the language for a frame is unknown -(that is, if the function or block corresponding to the frame was -defined in a source file that does not have a recognized extension), the -current working language is not changed, and GDB issues a warning. - -This may not seem necessary for most programs, which are written -entirely in one source language. However, program modules and libraries -written in one source language can be used by a main program written in -a different source language. Using @samp{set language auto} in this -case frees you from having to set the working language manually. - -@node Show, Checks, Setting, Languages -@section Displaying the language - -The following commands will help you find out which language is the -working language, and also what language source files were written in. - -@kindex show language -@kindex info frame -@kindex info source -@table @code -@item show language -Display the current working language. This is the -language you can use with commands such as @code{print} to -build and compute expressions that may involve variables in your program. - -@item info frame -Among the other information listed here (@pxref{Frame Info, ,Information -about a Frame}) is the source language for this frame. This is the -language that will become the working language if you ever use an -identifier that is in this frame. - -@item info source -Among the other information listed here (@pxref{Symbols, ,Examining the -Symbol Table}) is the source language of this source file. -@end table - -@node Checks, Support, Show, Languages -@section Type and range Checking - -@quotation -@emph{Warning:} In this release, the GDB commands for type and range -checking are included, but they do not yet have any effect. This -section documents the intended facilities. -@end quotation -@c FIXME remove warning when type/range code added - -Some languages are designed to guard you against making seemingly common -errors through a series of compile- and run-time checks. These include -checking the type of arguments to functions and operators, and making -sure mathematical overflows are caught at run time. Checks such as -these help to ensure a program's correctness once it has been compiled -by eliminating type mismatches, and providing active checks for range -errors when your program is running. - -GDB can check for conditions like the above if you wish. -Although GDB will not check the statements in your program, it -can check expressions entered directly into GDB for evaluation via -the @code{print} command, for example. As with the working language, -GDB can also decide whether or not to check automatically based on -your program's source language. @xref{Support, ,Supported Languages}, -for the default settings of supported languages. - -@menu -* Type Checking:: An overview of type checking -* Range Checking:: An overview of range checking -@end menu - -@cindex type checking -@cindex checks, type -@node Type Checking, Range Checking, Checks, Checks -@subsection An overview of type checking - -Some languages, such as Modula-2, are strongly typed, meaning that the -arguments to operators and functions have to be of the correct type, -otherwise an error occurs. These checks prevent type mismatch -errors from ever causing any run-time problems. For example, - -@example -1 + 2 @result{} 3 -@exdent but -@error{} 1 + 2.3 -@end example - -The second example fails because the @code{CARDINAL} 1 is not -type-compatible with the @code{REAL} 2.3. - -For expressions you use in GDB commands, you can tell the GDB -type checker to skip checking; to treat any mismatches as errors and -abandon the expression; or only issue warnings when type mismatches -occur, but evaluate the expression anyway. When you choose the last of -these, GDB evaluates expressions like the second example above, but -also issues a warning. - -Even though you may turn type checking off, other type-based reasons may -prevent GDB from evaluating an expression. For instance, GDB does not -know how to add an @code{int} and a @code{struct foo}. These particular -type errors have nothing to do with the language in use, and usually -arise from expressions, such as the one described above, which make -little sense to evaluate anyway. - -Each language defines to what degree it is strict about type. For -instance, both Modula-2 and C require the arguments to arithmetical -operators to be numbers. In C, enumerated types and pointers can be -represented as numbers, so that they are valid arguments to mathematical -operators. @xref{Support, ,Supported Languages}, for further -details on specific languages. - -GDB provides some additional commands for controlling the type checker: - -@kindex set check -@kindex set check type -@kindex show check type -@table @code -@item set check type auto -Set type checking on or off based on the current working language. -@xref{Support, ,Supported Languages}, for the default settings for -each language. - -@item set check type on -@itemx set check type off -Set type checking on or off, overriding the default setting for the -current working language. Issue a warning if the setting does not -match the language's default. If any type mismatches occur in -evaluating an expression while typechecking is on, GDB prints a -message and aborts evaluation of the expression. - -@item set check type warn -Cause the type checker to issue warnings, but to always attempt to -evaluate the expression. Evaluating the expression may still -be impossible for other reasons. For example, GDB cannot add -numbers and structures. - -@item show type -Show the current setting of the type checker, and whether or not GDB is -setting it automatically. -@end table - -@cindex range checking -@cindex checks, range -@node Range Checking, , Type Checking, Checks -@subsection An overview of Range Checking - -In some languages (such as Modula-2), it is an error to exceed the -bounds of a type; this is enforced with run-time checks. Such range -checking is meant to ensure program correctness by making sure -computations do not overflow, or indices on an array element access do -not exceed the bounds of the array. - -For expressions you use in GDB commands, you can tell GDB to -ignore range errors; to always treat them as errors and abandon the -expression; or to issue warnings when a range error occurs but evaluate -the expression anyway. - -A range error can result from numerical overflow, from exceeding an -array index bound, or when you type in a constant that is not a member -of any type. Some languages, however, do not treat overflows as an -error. In many implementations of C, mathematical overflow causes the -result to ``wrap around'' to lower values---for example, if @var{m} is -the largest integer value, and @var{s} is the smallest, then - -@example -@var{m} + 1 @result{} @var{s} -@end example - -This, too, is specific to individual languages, and in some cases -specific to individual compilers or machines. @xref{Support, , -Supported Languages}, for further details on specific languages. - -GDB provides some additional commands for controlling the range checker: - -@kindex set check -@kindex set check range -@kindex show check range -@table @code -@item set check range auto -Set range checking on or off based on the current working language. -@xref{Support, ,Supported Languages}, for the default settings for -each language. - -@item set check range on -@itemx set check range off -Set range checking on or off, overriding the default setting for the -current working language. A warning is issued if the setting does not -match the language's default. If a range error occurs, then a message -is printed and evaluation of the expression is aborted. - -@item set check range warn -Output messages when the GDB range checker detects a range error, -but attempt to evaluate the expression anyway. Evaluating the -expression may still be impossible for other reasons, such as accessing -memory that the process does not own (a typical example from many UNIX -systems). - -@item show range -Show the current setting of the range checker, and whether or not it is -being set automatically by GDB. -@end table - -@node Support, , Checks, Languages -@section Supported Languages - -GDB 4 supports C, C++, and Modula-2. The syntax for C and C++ is so -closely related that GDB does not distinguish the two. Some GDB -features may be used in expressions regardless of the language you -use: the GDB @code{@@} and @code{::} operators, and the -@samp{@{type@}addr} construct (@pxref{Expressions, ,Expressions}) can be -used with the constructs of any of the supported languages. - -The following sections detail to what degree each of these -source languages is supported by GDB. These sections are -not meant to be language tutorials or references, but serve only as a -reference guide to what the GDB expression parser will accept, and -what input and output formats should look like for different languages. -There are many good books written on each of these languages; please -look to these for a language reference or tutorial. - -@menu -* C:: C and C++ -* Modula-2:: Modula-2 -@end menu - -@node C, Modula-2, Support, Support -@subsection C and C++ -@cindex C and C++ - -@cindex expressions in C or C++ -Since C and C++ are so closely related, GDB does not distinguish -between them when interpreting the expressions recognized in GDB -commands. - -@cindex C++ -@kindex g++ -@cindex GNU C++ -The C++ debugging facilities are jointly implemented by the GNU C++ -compiler and GDB. Therefore, to debug your C++ code effectively, -you must compile your C++ programs with the GNU C++ compiler, -@code{g++}. - -@menu -* C Operators:: C and C++ Operators -* C Constants:: C and C++ Constants -* Cplusplus expressions:: C++ Expressions -* C Defaults:: Default settings for C and C++ -* C Checks:: C and C++ Type and Range Checks -* Debugging C:: GDB and C -* Debugging C plus plus:: Special features for C++ -@end menu - -@cindex C and C++ operators -@node C Operators, C Constants, C, C -@subsubsection C and C++ Operators - -Operators must be defined on values of specific types. For instance, -@code{+} is defined on numbers, but not on structures. Operators are -often defined on groups of types. For the purposes of C and C++, the -following definitions hold: - -@itemize @bullet -@item -@emph{Integral types} include @code{int} with any of its storage-class -specifiers, @code{char}, and @code{enum}s. - -@item -@emph{Floating-point types} include @code{float} and @code{double}. - -@item -@emph{Pointer types} include all types defined as @code{(@var{type} -*)}. - -@item -@emph{Scalar types} include all of the above. -@end itemize - -@noindent -The following operators are supported. They are listed here -in order of increasing precedence: - -@table @code -@item , -The comma or sequencing operator. Expressions in a comma-separated list -are evaluated from left to right, with the result of the entire -expression being the last expression evaluated. - -@item = -Assignment. The value of an assignment expression is the value -assigned. Defined on scalar types. - -@item @var{op}= -Used in an expression of the form @w{@code{@var{a} @var{op}= @var{b}}}, -and translated to @w{@code{@var{a} = @var{a op b}}}. -@w{@code{@var{op}=}} and @code{=} have the same precendence. -@var{op} is any one of the operators @code{|}, @code{^}, @code{&}, -@code{<<}, @code{>>}, @code{+}, @code{-}, @code{*}, @code{/}, @code{%}. - -@item ?: -The ternary operator. @code{@var{a} ? @var{b} : @var{c}} can be thought -of as: if @var{a} then @var{b} else @var{c}. @var{a} should be of an -integral type. - -@item || -Logical @sc{or}. Defined on integral types. - -@item && -Logical @sc{and}. Defined on integral types. - -@item | -Bitwise @sc{or}. Defined on integral types. - -@item ^ -Bitwise exclusive-@sc{or}. Defined on integral types. - -@item & -Bitwise @sc{and}. Defined on integral types. - -@item ==@r{, }!= -Equality and inequality. Defined on scalar types. The value of these -expressions is 0 for false and non-zero for true. - -@item <@r{, }>@r{, }<=@r{, }>= -Less than, greater than, less than or equal, greater than or equal. -Defined on scalar types. The value of these expressions is 0 for false -and non-zero for true. - -@item <<@r{, }>> -left shift, and right shift. Defined on integral types. - -@item @@ -The GDB ``artificial array'' operator (@pxref{Expressions, ,Expressions}). - -@item +@r{, }- -Addition and subtraction. Defined on integral types, floating-point types and -pointer types. - -@item *@r{, }/@r{, }% -Multiplication, division, and modulus. Multiplication and division are -defined on integral and floating-point types. Modulus is defined on -integral types. - -@item ++@r{, }-- -Increment and decrement. When appearing before a variable, the -operation is performed before the variable is used in an expression; -when appearing after it, the variable's value is used before the -operation takes place. - -@item * -Pointer dereferencing. Defined on pointer types. Same precedence as -@code{++}. - -@item & -Address operator. Defined on variables. Same precedence as @code{++}. - -@item - -Negative. Defined on integral and floating-point types. Same -precedence as @code{++}. - -@item ! -Logical negation. Defined on integral types. Same precedence as -@code{++}. - -@item ~ -Bitwise complement operator. Defined on integral types. Same precedence as -@code{++}. - -@item .@r{, }-> -Structure member, and pointer-to-structure member. For convenience, -GDB regards the two as equivalent, choosing whether to dereference a -pointer based on the stored type information. -Defined on @code{struct}s and @code{union}s. - -@item [] -Array indexing. @code{@var{a}[@var{i}]} is defined as -@code{*(@var{a}+@var{i})}. Same precedence as @code{->}. - -@item () -Function parameter list. Same precedence as @code{->}. - -@item :: -C++ scope resolution operator. Defined on -@code{struct}, @code{union}, and @code{class} types. - -@item :: -The GDB scope operator (@pxref{Expressions, ,Expressions}). Same precedence as -@code{::}, above. -@end table - -@cindex C and C++ constants -@node C Constants, Cplusplus expressions, C Operators, C -@subsubsection C and C++ Constants - -GDB allows you to express the constants of C and C++ in the -following ways: - -@itemize @bullet -@item -Integer constants are a sequence of digits. Octal constants are -specified by a leading @samp{0} (ie. zero), and hexadecimal constants by -a leading @samp{0x} or @samp{0X}. Constants may also end with a letter -@samp{l}, specifying that the constant should be treated as a -@code{long} value. - -@item -Floating point constants are a sequence of digits, followed by a decimal -point, followed by a sequence of digits, and optionally followed by an -exponent. An exponent is of the form: -@samp{@w{e@r{[[}+@r{]|}-@r{]}@var{nnn}}}, where @var{nnn} is another -sequence of digits. The @samp{+} is optional for positive exponents. - -@item -Enumerated constants consist of enumerated identifiers, or their -integral equivalents. - -@item -Character constants are a single character surrounded by single quotes -(@code{'}), or a number---the ordinal value of the corresponding character -(usually its @sc{ASCII} value). Within quotes, the single character may -be represented by a letter or by @dfn{escape sequences}, which are of -the form @samp{\@var{nnn}}, where @var{nnn} is the octal representation -of the character's ordinal value; or of the form @samp{\@var{x}}, where -@samp{@var{x}} is a predefined special character---for example, -@samp{\n} for newline. - -@item -String constants are a sequence of character constants surrounded -by double quotes (@code{"}). - -@item -Pointer constants are an integral value. -@end itemize - -@node Cplusplus expressions, C Defaults, C Constants, C -@subsubsection C++ Expressions - -@cindex expressions in C++ -GDB's expression handling has the following extensions to -interpret a significant subset of C++ expressions: - -@enumerate - -@cindex member functions -@item -Member function calls are allowed; you can use expressions like - -@example -count = aml->GetOriginal(x, y) -@end example - -@kindex this -@cindex namespace in C++ -@item -While a member function is active (in the selected stack frame), your -expressions have the same namespace available as the member function; -that is, GDB allows implicit references to the class instance -pointer @code{this} following the same rules as C++. - -@cindex call overloaded functions -@cindex type conversions in C++ -@item -You can call overloaded functions; GDB will resolve the function -call to the right definition, with one restriction---you must use -arguments of the type required by the function that you want to call. -GDB will not perform conversions requiring constructors or -user-defined type operators. - -@cindex reference declarations -@item -GDB understands variables declared as C++ references; you can use them in -expressions just as you do in C++ source---they are automatically -dereferenced. - -In the parameter list shown when GDB displays a frame, the values of -reference variables are not displayed (unlike other variables); this -avoids clutter, since references are often used for large structures. -The @emph{address} of a reference variable is always shown, unless -you have specified @samp{set print address off}. - -@item -GDB supports the C++ name resolution operator @code{::}---your -expressions can use it just as expressions in your program do. Since -one scope may be defined in another, you can use @code{::} repeatedly if -necessary, for example in an expression like -@samp{@var{scope1}::@var{scope2}::@var{name}}. GDB also allows -resolving name scope by reference to source files, in both C and C++ -debugging (@pxref{Variables, ,Program Variables}). -@end enumerate - -@node C Defaults, C Checks, Cplusplus expressions, C -@subsubsection C and C++ Defaults -@cindex C and C++ defaults - -If you allow GDB to set type and range checking automatically, they -both default to @code{off} whenever the working language changes to -C/C++. This happens regardless of whether you, or GDB, -selected the working language. - -If you allow GDB to set the language automatically, it sets the -working language to C/C++ on entering code compiled from a source file -whose name ends with @file{.c} or @file{.cc}. -@xref{Automatically, ,Having GDB infer the source language}, for -further details. - -@node C Checks, Debugging C, C Defaults, C -@subsubsection C and C++ Type and Range Checks -@cindex C and C++ checks - -@quotation -@emph{Warning:} in this release, GDB does not yet perform type or -range checking. -@end quotation -@c FIXME remove warning when type/range checks added - -By default, when GDB parses C or C++ expressions, type checking -is not used. However, if you turn type checking on, GDB will -consider two variables type equivalent if: - -@itemize @bullet -@item -The two variables are structured and have the same structure, union, or -enumerated tag. - -@item -Two two variables have the same type name, or types that have been -declared equivalent through @code{typedef}. - -@ignore -@c leaving this out because neither J Gilmore nor R Pesch understand it. -@c FIXME--beers? -@item -The two @code{struct}, @code{union}, or @code{enum} variables are -declared in the same declaration. (Note: this may not be true for all C -compilers.) -@end ignore -@end itemize - -Range checking, if turned on, is done on mathematical operations. Array -indices are not checked, since they are often used to index a pointer -that is not itself an array. - -@node Debugging C, Debugging C plus plus, C Checks, C -@subsubsection GDB and C - -The @code{set print union} and @code{show print union} commands apply to -the @code{union} type. When set to @samp{on}, any @code{union} that is -inside a @code{struct} or @code{class} will also be printed. -Otherwise, it will appear as @samp{@{...@}}. - -The @code{@@} operator aids in the debugging of dynamic arrays, formed -with pointers and a memory allocation function. (@pxref{Expressions, ,Expressions}) - -@node Debugging C plus plus, , Debugging C, C -@subsubsection GDB Commands for C++ - -@cindex commands for C++ -Some GDB commands are particularly useful with C++, and some are -designed specifically for use with C++. Here is a summary: - -@table @code -@cindex break in overloaded functions -@item @r{breakpoint menus} -When you want a breakpoint in a function whose name is overloaded, -GDB's breakpoint menus help you specify which function definition -you want. @xref{Breakpoint Menus}. - -@cindex overloading in C++ -@item rbreak @var{regex} -Setting breakpoints using regular expressions is helpful for setting -breakpoints on overloaded functions that are not members of any special -classes. -@xref{Set Breaks, ,Setting Breakpoints}. - -@cindex C++ exception handling -@item catch @var{exceptions} -@itemx info catch -Debug C++ exception handling using these commands. @xref{Exception -Handling, ,Breakpoints and Exceptions}. - -@cindex inheritance -@item ptype @var{typename} -Print inheritance relationships as well as other information for type -@var{typename}. -@xref{Symbols, ,Examining the Symbol Table}. - -@cindex C++ symbol display -@item set print demangle -@itemx show print demangle -@itemx set print asm-demangle -@itemx show print asm-demangle -Control whether C++ symbols display in their source form, both when -displaying code as C++ source and when displaying disassemblies. -@xref{Print Settings, ,Print Settings}. - -@item set print object -@itemx show print object -Choose whether to print derived (actual) or declared types of objects. -@xref{Print Settings, ,Print Settings}. - -@item set print vtbl -@itemx show print vtbl -Control the format for printing virtual function tables. -@xref{Print Settings, ,Print Settings}. -@end table - -@node Modula-2, , C, Support -@subsection Modula-2 -@cindex Modula-2 - -The extensions made to GDB to support Modula-2 support output -from the GNU Modula-2 compiler (which is currently being developed). -Other Modula-2 compilers are not currently supported, and attempting to -debug executables produced by them will most likely result in an error -as GDB reads in the executable's symbol table. - -@cindex expressions in Modula-2 -@menu -* M2 Operators:: Built-in operators -* Built-In Func/Proc:: Built-in Functions and Procedures -* M2 Constants:: Modula-2 Constants -* M2 Defaults:: Default settings for Modula-2 -* Deviations:: Deviations from standard Modula-2 -* M2 Checks:: Modula-2 Type and Range Checks -* M2 Scope:: The scope operators @code{::} and @code{.} -* GDB/M2:: GDB and Modula-2 -@end menu - -@node M2 Operators, Built-In Func/Proc, Modula-2, Modula-2 -@subsubsection Operators -@cindex Modula-2 operators - -Operators must be defined on values of specific types. For instance, -@code{+} is defined on numbers, but not on structures. Operators are -often defined on groups of types. For the purposes of Modula-2, the -following definitions hold: - -@itemize @bullet - -@item -@emph{Integral types} consist of @code{INTEGER}, @code{CARDINAL}, and -their subranges. - -@item -@emph{Character types} consist of @code{CHAR} and its subranges. - -@item -@emph{Floating-point types} consist of @code{REAL}. - -@item -@emph{Pointer types} consist of anything declared as @code{POINTER TO -@var{type}}. - -@item -@emph{Scalar types} consist of all of the above. - -@item -@emph{Set types} consist of @code{SET}s and @code{BITSET}s. - -@item -@emph{Boolean types} consist of @code{BOOLEAN}. -@end itemize - -@noindent -The following operators are supported, and appear in order of -increasing precedence: - -@table @code -@item , -Function argument or array index separator. - -@item := -Assignment. The value of @var{var} @code{:=} @var{value} is -@var{value}. - -@item <@r{, }> -Less than, greater than on integral, floating-point, or enumerated -types. - -@item <=@r{, }>= -Less than, greater than, less than or equal to, greater than or equal to -on integral, floating-point and enumerated types, or set inclusion on -set types. Same precedence as @code{<}. - -@item =@r{, }<>@r{, }# -Equality and two ways of expressing inequality, valid on scalar types. -Same precedence as @code{<}. In GDB scripts, only @code{<>} is -available for inequality, since @code{#} conflicts with the script -comment character. - -@item IN -Set membership. Defined on set types and the types of their members. -Same precedence as @code{<}. - -@item OR -Boolean disjunction. Defined on boolean types. - -@item AND@r{, }& -Boolean conjuction. Defined on boolean types. - -@item @@ -The GDB ``artificial array'' operator (@pxref{Expressions, ,Expressions}). - -@item +@r{, }- -Addition and subtraction on integral and floating-point types, or union -and difference on set types. - -@item * -Multiplication on integral and floating-point types, or set intersection -on set types. - -@item / -Division on floating-point types, or symmetric set difference on set -types. Same precedence as @code{*}. - -@item DIV@r{, }MOD -Integer division and remainder. Defined on integral types. Same -precedence as @code{*}. - -@item - -Negative. Defined on @code{INTEGER}s and @code{REAL}s. - -@item ^ -Pointer dereferencing. Defined on pointer types. - -@item NOT -Boolean negation. Defined on boolean types. Same precedence as -@code{^}. - -@item . -@code{RECORD} field selector. Defined on @code{RECORD}s. Same -precedence as @code{^}. - -@item [] -Array indexing. Defined on @code{ARRAY}s. Same precedence as @code{^}. - -@item () -Procedure argument list. Defined on @code{PROCEDURE}s. Same precedence -as @code{^}. - -@item ::@r{, }. -GDB and Modula-2 scope operators. -@end table - -@quotation -@emph{Warning:} Sets and their operations are not yet supported, so GDB -will treat the use of the operator @code{IN}, or the use of operators -@code{+}, @code{-}, @code{*}, @code{/}, @code{=}, , @code{<>}, @code{#}, -@code{<=}, and @code{>=} on sets as an error. -@end quotation - -@cindex Modula-2 built-ins -@node Built-In Func/Proc, M2 Constants, M2 Operators, Modula-2 -@subsubsection Built-in Functions and Procedures - -Modula-2 also makes available several built-in procedures and functions. -In describing these, the following metavariables are used: - -@table @var - -@item a -represents an @code{ARRAY} variable. - -@item c -represents a @code{CHAR} constant or variable. - -@item i -represents a variable or constant of integral type. - -@item m -represents an identifier that belongs to a set. Generally used in the -same function with the metavariable @var{s}. The type of @var{s} should -be @code{SET OF @var{mtype}} (where @var{mtype} is the type of @var{m}. - -@item n -represents a variable or constant of integral or floating-point type. - -@item r -represents a variable or constant of floating-point type. - -@item t -represents a type. - -@item v -represents a variable. - -@item x -represents a variable or constant of one of many types. See the -explanation of the function for details. -@end table - -All Modula-2 built-in procedures also return a result, described below. - -@table @code -@item ABS(@var{n}) -Returns the absolute value of @var{n}. - -@item CAP(@var{c}) -If @var{c} is a lower case letter, it returns its upper case -equivalent, otherwise it returns its argument - -@item CHR(@var{i}) -Returns the character whose ordinal value is @var{i}. - -@item DEC(@var{v}) -Decrements the value in the variable @var{v}. Returns the new value. - -@item DEC(@var{v},@var{i}) -Decrements the value in the variable @var{v} by @var{i}. Returns the -new value. - -@item EXCL(@var{m},@var{s}) -Removes the element @var{m} from the set @var{s}. Returns the new -set. - -@item FLOAT(@var{i}) -Returns the floating point equivalent of the integer @var{i}. - -@item HIGH(@var{a}) -Returns the index of the last member of @var{a}. - -@item INC(@var{v}) -Increments the value in the variable @var{v}. Returns the new value. - -@item INC(@var{v},@var{i}) -Increments the value in the variable @var{v} by @var{i}. Returns the -new value. - -@item INCL(@var{m},@var{s}) -Adds the element @var{m} to the set @var{s} if it is not already -there. Returns the new set. - -@item MAX(@var{t}) -Returns the maximum value of the type @var{t}. - -@item MIN(@var{t}) -Returns the minimum value of the type @var{t}. - -@item ODD(@var{i}) -Returns boolean TRUE if @var{i} is an odd number. - -@item ORD(@var{x}) -Returns the ordinal value of its argument. For example, the ordinal -value of a character is its ASCII value (on machines supporting the -ASCII character set). @var{x} must be of an ordered type, which include -integral, character and enumerated types. - -@item SIZE(@var{x}) -Returns the size of its argument. @var{x} can be a variable or a type. - -@item TRUNC(@var{r}) -Returns the integral part of @var{r}. - -@item VAL(@var{t},@var{i}) -Returns the member of the type @var{t} whose ordinal value is @var{i}. -@end table - -@quotation -@emph{Warning:} Sets and their operations are not yet supported, so -GDB will treat the use of procedures @code{INCL} and @code{EXCL} as -an error. -@end quotation - -@cindex Modula-2 constants -@node M2 Constants, M2 Defaults, Built-In Func/Proc, Modula-2 -@subsubsection Constants - -GDB allows you to express the constants of Modula-2 in the following -ways: - -@itemize @bullet - -@item -Integer constants are simply a sequence of digits. When used in an -expression, a constant is interpreted to be type-compatible with the -rest of the expression. Hexadecimal integers are specified by a -trailing @samp{H}, and octal integers by a trailing @samp{B}. - -@item -Floating point constants appear as a sequence of digits, followed by a -decimal point and another sequence of digits. An optional exponent can -then be specified, in the form @samp{E@r{[}+@r{|}-@r{]}@var{nnn}}, where -@samp{@r{[}+@r{|}-@r{]}@var{nnn}} is the desired exponent. All of the -digits of the floating point constant must be valid decimal (base 10) -digits. - -@item -Character constants consist of a single character enclosed by a pair of -like quotes, either single (@code{'}) or double (@code{"}). They may -also be expressed by their ordinal value (their ASCII value, usually) -followed by a @samp{C}. - -@item -String constants consist of a sequence of characters enclosed by a -pair of like quotes, either single (@code{'}) or double (@code{"}). -Escape sequences in the style of C are also allowed. @xref{C -Constants, ,C and C++ Constants}, for a brief explanation of escape -sequences. - -@item -Enumerated constants consist of an enumerated identifier. - -@item -Boolean constants consist of the identifiers @code{TRUE} and -@code{FALSE}. - -@item -Pointer constants consist of integral values only. - -@item -Set constants are not yet supported. -@end itemize - -@node M2 Defaults, Deviations, M2 Constants, Modula-2 -@subsubsection Modula-2 Defaults -@cindex Modula-2 defaults - -If type and range checking are set automatically by GDB, they -both default to @code{on} whenever the working language changes to -Modula-2. This happens regardless of whether you, or GDB, -selected the working language. - -If you allow GDB to set the language automatically, then entering -code compiled from a file whose name ends with @file{.mod} will set the -working language to Modula-2. @xref{Automatically, ,Having GDB set -the language automatically}, for further details. - -@node Deviations, M2 Checks, M2 Defaults, Modula-2 -@subsubsection Deviations from Standard Modula-2 -@cindex Modula-2, deviations from - -A few changes have been made to make Modula-2 programs easier to debug. -This is done primarily via loosening its type strictness: - -@itemize @bullet -@item -Unlike in standard Modula-2, pointer constants can be formed by -integers. This allows you to modify pointer variables during -debugging. (In standard Modula-2, the actual address contained in a -pointer variable is hidden from you; it can only be modified -through direct assignment to another pointer variable or expression that -returned a pointer.) - -@item -C escape sequences can be used in strings and characters to represent -non-printable characters. GDB will print out strings with these -escape sequences embedded. Single non-printable characters are -printed using the @samp{CHR(@var{nnn})} format. - -@item -The assignment operator (@code{:=}) returns the value of its right-hand -argument. - -@item -All built-in procedures both modify @emph{and} return their argument. -@end itemize - -@node M2 Checks, M2 Scope, Deviations, Modula-2 -@subsubsection Modula-2 Type and Range Checks -@cindex Modula-2 checks - -@quotation -@emph{Warning:} in this release, GDB does not yet perform type or -range checking. -@end quotation -@c FIXME remove warning when type/range checks added - -GDB considers two Modula-2 variables type equivalent if: - -@itemize @bullet -@item -They are of types that have been declared equivalent via a @code{TYPE -@var{t1} = @var{t2}} statement - -@item -They have been declared on the same line. (Note: This is true of the -GNU Modula-2 compiler, but it may not be true of other compilers.) -@end itemize - -As long as type checking is enabled, any attempt to combine variables -whose types are not equivalent is an error. - -Range checking is done on all mathematical operations, assignment, array -index bounds, and all built-in functions and procedures. - -@node M2 Scope, GDB/M2, M2 Checks, Modula-2 -@subsubsection The scope operators @code{::} and @code{.} -@cindex scope -@kindex . -@cindex colon, doubled as scope operator -@ifinfo -@kindex colon-colon -@c Info cannot handoe :: but TeX can. -@end ifinfo -@iftex -@kindex :: -@end iftex - -There are a few subtle differences between the Modula-2 scope operator -(@code{.}) and the GDB scope operator (@code{::}). The two have -similar syntax: - -@example - -@var{module} . @var{id} -@var{scope} :: @var{id} -@end example - -@noindent -where @var{scope} is the name of a module or a procedure, -@var{module} the name of a module, and @var{id} is any declared -identifier within your program, except another module. - -Using the @code{::} operator makes GDB search the scope -specified by @var{scope} for the identifier @var{id}. If it is not -found in the specified scope, then GDB will search all scopes -enclosing the one specified by @var{scope}. - -Using the @code{.} operator makes GDB search the current scope for -the identifier specified by @var{id} that was imported from the -definition module specified by @var{module}. With this operator, it is -an error if the identifier @var{id} was not imported from definition -module @var{module}, or if @var{id} is not an identifier in -@var{module}. - -@node GDB/M2, , M2 Scope, Modula-2 -@subsubsection GDB and Modula-2 - -Some GDB commands have little use when debugging Modula-2 programs. -Five subcommands of @code{set print} and @code{show print} apply -specifically to C and C++: @samp{vtbl}, @samp{demangle}, -@samp{asm-demangle}, @samp{object}, and @samp{union}. The first four -apply to C++, and the last to C's @code{union} type, which has no direct -analogue in Modula-2. - -The @code{@@} operator (@pxref{Expressions, ,Expressions}), while available -while using any language, is not useful with Modula-2. Its -intent is to aid the debugging of @dfn{dynamic arrays}, which cannot be -created in Modula-2 as they can in C or C++. However, because an -address can be specified by an integral constant, the construct -@samp{@{@var{type}@}@var{adrexp}} is still useful. (@pxref{Expressions, ,Expressions}) - -@cindex @code{#} in Modula-2 -In GDB scripts, the Modula-2 inequality operator @code{#} is -interpreted as the beginning of a comment. Use @code{<>} instead. - -@node Symbols, Altering, Languages, Top -@chapter Examining the Symbol Table - -The commands described in this section allow you to inquire about the -symbols (names of variables, functions and types) defined in your -program. This information is inherent in the text of your program and -does not change as your program executes. GDB finds it in your -program's symbol table, in the file indicated when you started GDB -(@pxref{File Options, ,Choosing Files}), or by one of the -file-management commands (@pxref{Files, ,Commands to Specify Files}). - -@table @code -@item info address @var{symbol} -@kindex info address -Describe where the data for @var{symbol} is stored. For a register -variable, this says which register it is kept in. For a non-register -local variable, this prints the stack-frame offset at which the variable -is always stored. - -Note the contrast with @samp{print &@var{symbol}}, which does not work -at all for a register variables, and for a stack local variable prints -the exact address of the current instantiation of the variable. - -@item whatis @var{exp} -@kindex whatis -Print the data type of expression @var{exp}. @var{exp} is not -actually evaluated, and any side-effecting operations (such as -assignments or function calls) inside it do not take place. -@xref{Expressions, ,Expressions}. - -@item whatis -Print the data type of @code{$}, the last value in the value history. - -@item ptype @var{typename} -@kindex ptype -Print a description of data type @var{typename}. @var{typename} may be -the name of a type, or for C code it may have the form -@samp{struct @var{struct-tag}}, @samp{union @var{union-tag}} or -@samp{enum @var{enum-tag}}. - -@item ptype @var{exp} -@itemx ptype -Print a description of the type of expression @var{exp}. @code{ptype} -differs from @code{whatis} by printing a detailed description, instead -of just the name of the type. For example, if your program declares a -variable as - -@example -struct complex @{double real; double imag;@} v; -@end example - -@noindent -compare the output of the two commands: - -@example -@group -(gdb) whatis v -type = struct complex -(gdb) ptype v -type = struct complex @{ - double real; - double imag; -@} -@end group -@end example - -@noindent -As with @code{whatis}, using @code{ptype} without an argument refers to -the type of @code{$}, the last value in the value history. - -@item info types @var{regexp} -@itemx info types -@kindex info types -Print a brief description of all types whose name matches @var{regexp} -(or all types in your program, if you supply no argument). Each -complete typename is matched as though it were a complete line; thus, -@samp{i type value} gives information on all types in your program whose -name includes the string @code{value}, but @samp{i type ^value$} gives -information only on types whose complete name is @code{value}. - -This command differs from @code{ptype} in two ways: first, like -@code{whatis}, it does not print a detailed description; second, it -lists all source files where a type is defined. - -@item info source -@kindex info source -Show the name of the current source file---that is, the source file for -the function containing the current point of execution---and the language -it was written in. - -@item info sources -@kindex info sources -Print the names of all source files in your program for which there is -debugging information, organized into two lists: files whose symbols -have already been read, and files whose symbols will be read when needed. - -@item info functions -@kindex info functions -Print the names and data types of all defined functions. - -@item info functions @var{regexp} -Print the names and data types of all defined functions -whose names contain a match for regular expression @var{regexp}. -Thus, @samp{info fun step} finds all functions whose names -include @code{step}; @samp{info fun ^step} finds those whose names -start with @code{step}. - -@item info variables -@kindex info variables -Print the names and data types of all variables that are declared -outside of functions (i.e., excluding local variables). - -@item info variables @var{regexp} -Print the names and data types of all variables (except for local -variables) whose names contain a match for regular expression -@var{regexp}. - -@ignore -This was never implemented. -@item info methods -@itemx info methods @var{regexp} -@kindex info methods -The @code{info methods} command permits the user to examine all defined -methods within C++ program, or (with the @var{regexp} argument) a -specific set of methods found in the various C++ classes. Many -C++ classes provide a large number of methods. Thus, the output -from the @code{ptype} command can be overwhelming and hard to use. The -@code{info-methods} command filters the methods, printing only those -which match the regular-expression @var{regexp}. -@end ignore - -@item printsyms @var{filename} -@itemx printpsyms @var{filename} -@kindex printsyms -@cindex symbol dump -@kindex printsyms -@cindex partial symbol dump -Write a dump of debugging symbol data into the file @var{filename}. -These commands are used to debug the GDB symbol-reading code. Only -symbols with debugging data are included. If you use @code{printsyms}, -GDB includes all the symbols for which it has already collected full -details: that is, @var{filename} reflects symbols for only those files -whose symbols GDB has read. You can use the command @code{info -sources} to find out which files these are. If you use -@code{printpsyms}, the dump also shows information about symbols that -GDB only knows partially---that is, symbols defined in files that -GDB has skimmed, but not yet read completely. The description of -@code{symbol-file} describes how GDB reads symbols; both commands -are described under @ref{Files, ,Commands to Specify Files}. -@end table - -@node Altering, GDB Files, Symbols, Top -@chapter Altering Execution - -Once you think you have found an error in your program, you might want to -find out for certain whether correcting the apparent error would lead to -correct results in the rest of the run. You can find the answer by -experiment, using the GDB features for altering execution of the -program. - -For example, you can store new values into variables or memory -locations, give your program a signal, restart it at a different address, -or even return prematurely from a function to its caller. - -@menu -* Assignment:: Assignment to Variables -* Jumping:: Continuing at a Different Address -* Signaling:: Giving your program a Signal -* Returning:: Returning from a Function -* Calling:: Calling your Program's Functions -* Patching:: Patching your Program -@end menu - -@node Assignment, Jumping, Altering, Altering -@section Assignment to Variables - -@cindex assignment -@cindex setting variables -To alter the value of a variable, evaluate an assignment expression. -@xref{Expressions, ,Expressions}. For example, - -@example -print x=4 -@end example - -@noindent -stores the value 4 into the variable @code{x}, and then prints the -value of the assignment expression (which is 4). @xref{Languages, -,Using GDB with Different Languages}, for more information on -operators in supported languages. - -@kindex set variable -@cindex variables, setting -If you are not interested in seeing the value of the assignment, use the -@code{set} command instead of the @code{print} command. @code{set} is -really the same as @code{print} except that the expression's value is not -printed and is not put in the value history (@pxref{Value History, ,Value History}). The -expression is evaluated only for its effects. - -If the beginning of the argument string of the @code{set} command -appears identical to a @code{set} subcommand, use the @code{set -variable} command instead of just @code{set}. This command is identical -to @code{set} except for its lack of subcommands. For example, a -program might well have a variable @code{width}---which leads to -an error if we try to set a new value with just @samp{set width=13}, as -we might if @code{set width} did not happen to be a GDB command: - -@example -(gdb) whatis width -type = double -(gdb) p width -$4 = 13 -(gdb) set width=47 -Invalid syntax in expression. -@end example - -@noindent -The invalid expression, of course, is @samp{=47}. What we can do in -order to actually set our program's variable @code{width} is - -@example -(gdb) set var width=47 -@end example - -GDB allows more implicit conversions in assignments than C; you can -freely store an integer value into a pointer variable or vice versa, -and any structure can be converted to any other structure that is the -same length or shorter. -@comment FIXME: how do structs align/pad in these conversions? -@comment /pesch@cygnus.com 18dec1990 - -To store values into arbitrary places in memory, use the @samp{@{@dots{}@}} -construct to generate a value of specified type at a specified address -(@pxref{Expressions, ,Expressions}). For example, @code{@{int@}0x83040} refers -to memory location @code{0x83040} as an integer (which implies a certain size -and representation in memory), and - -@example -set @{int@}0x83040 = 4 -@end example - -@noindent -stores the value 4 into that memory location. - -@node Jumping, Signaling, Assignment, Altering -@section Continuing at a Different Address - -Ordinarily, when you continue your program, you do so at the place where -it stopped, with the @code{continue} command. You can instead continue at -an address of your own choosing, with the following commands: - -@table @code -@item jump @var{linespec} -@kindex jump -Resume execution at line @var{linespec}. Execution will stop -immediately if there is a breakpoint there. @xref{List, ,Printing -Source Lines}, for a description of the different forms of -@var{linespec}. - -The @code{jump} command does not change the current stack frame, or -the stack pointer, or the contents of any memory location or any -register other than the program counter. If line @var{linespec} is in -a different function from the one currently executing, the results may -be bizarre if the two functions expect different patterns of arguments or -of local variables. For this reason, the @code{jump} command requests -confirmation if the specified line is not in the function currently -executing. However, even bizarre results are predictable if you are -well acquainted with the machine-language code of your program. - -@item jump *@var{address} -Resume execution at the instruction at address @var{address}. -@end table - -You can get much the same effect as the @code{jump} command by storing a -new value into the register @code{$pc}. The difference is that this -does not start your program running; it only changes the address where it -@emph{will} run when it is continued. For example, - -@example -set $pc = 0x485 -@end example - -@noindent -causes the next @code{continue} command or stepping command to execute at -address @code{0x485}, rather than at the address where your program stopped. -@xref{Continuing and Stepping, ,Continuing and Stepping}. - -The most common occasion to use the @code{jump} command is to back up, -perhaps with more breakpoints set, over a portion of a program that has -already executed, in order to examine its execution in more detail. - -@node Signaling, Returning, Jumping, Altering -@c @group -@section Giving your program a Signal - -@table @code -@item signal @var{signalnum} -@kindex signal -Resume execution where your program stopped, but give it immediately the -signal number @var{signalnum}. - -Alternatively, if @var{signalnum} is zero, continue execution without -giving a signal. This is useful when your program stopped on account of -a signal and would ordinary see the signal when resumed with the -@code{continue} command; @samp{signal 0} causes it to resume without a -signal. - -@code{signal} does not repeat when you press @key{RET} a second time -after executing the command. -@end table -@c @end group - -@node Returning, Calling, Signaling, Altering -@section Returning from a Function - -@table @code -@item return -@itemx return @var{expression} -@cindex returning from a function -@kindex return -You can cancel execution of a function call with the @code{return} -command. If you give an -@var{expression} argument, its value is used as the function's return -value. -@end table - -When you use @code{return}, GDB discards the selected stack frame -(and all frames within it). You can think of this as making the -discarded frame return prematurely. If you wish to specify a value to -be returned, give that value as the argument to @code{return}. - -This pops the selected stack frame (@pxref{Selection, ,Selecting a -Frame}), and any other frames inside of it, leaving its caller as the -innermost remaining frame. That frame becomes selected. The -specified value is stored in the registers used for returning values -of functions. - -The @code{return} command does not resume execution; it leaves the -program stopped in the state that would exist if the function had just -returned. In contrast, the @code{finish} command (@pxref{Continuing -and Stepping, ,Continuing and Stepping}) resumes execution until the -selected stack frame returns naturally. - -@node Calling, Patching, Returning, Altering -@section Calling your Program's Functions - -@cindex calling functions -@kindex call -@table @code -@item call @var{expr} -Evaluate the expression @var{expr} without displaying @code{void} -returned values. -@end table - -You can use this variant of the @code{print} command if you want to -execute a function from your program, but without cluttering the output -with @code{void} returned values. The result is printed and saved in -the value history, if it is not void. - -@node Patching, , Calling, Altering -@section Patching your Program -@cindex patching binaries -@cindex writing into executables -@cindex writing into corefiles - -By default, GDB opens the file containing your program's executable -code (or the corefile) read-only. This prevents accidental alterations -to machine code; but it also prevents you from intentionally patching -your program's binary. - -If you'd like to be able to patch the binary, you can specify that -explicitly with the @code{set write} command. For example, you might -want to turn on internal debugging flags, or even to make emergency -repairs. - -@table @code -@item set write on -@itemx set write off -@kindex set write -If you specify @samp{set write on}, GDB will open executable and -core files for both reading and writing; if you specify @samp{set write -off} (the default), GDB will open them read-only. - -If you have already loaded a file, you must load it -again (using the @code{exec-file} or @code{core-file} command) after -changing @code{set write}, for your new setting to take effect. - -@item show write -@kindex show write -Display whether executable files and core files will be opened for -writing as well as reading. -@end table - -@node GDB Files, Targets, Altering, Top -@chapter GDB's Files - -GDB needs to know the file name of the program to be debugged, both in -order to read its symbol table and in order to start your program. To -debug a core dump of a previous run, GDB must be told the file name of -the core dump. - -@menu -* Files:: Commands to Specify Files -* Symbol Errors:: Errors Reading Symbol Files -@end menu - -@node Files, Symbol Errors, GDB Files, GDB Files -@section Commands to Specify Files -@cindex core dump file -@cindex symbol table - -The usual way to specify executable and core dump file names is with -the command arguments given when you start GDB, (@pxref{Invocation, -,Getting In and Out of GDB}. - -Occasionally it is necessary to change to a different file during a -GDB session. Or you may run GDB and forget to specify the files you -want to use. In these situations the GDB commands to specify new files -are useful. - -@table @code -@item file @var{filename} -@cindex executable file -@kindex file -Use @var{filename} as the program to be debugged. It is read for its -symbols and for the contents of pure memory. It is also the program -executed when you use the @code{run} command. If you do not specify a -directory and the file is not found in GDB's working directory, GDB -uses the environment variable @code{PATH} as a list of directories to -search, just as the shell does when looking for a program to run. You -can change the value of this variable, for both GDB and your program, -using the @code{path} command. - -@item file -@code{file} with no argument makes GDB discard any information it -has on both executable file and the symbol table. - -@item exec-file @r{[} @var{filename} @r{]} -@kindex exec-file -Specify that the program to be run (but not the symbol table) is found -in @var{filename}. GDB will search the environment variable @code{PATH} -if necessary to locate your program. Omitting @var{filename} means to -discard information on the executable file. - -@item symbol-file @r{[} @var{filename} @r{]} -@kindex symbol-file -Read symbol table information from file @var{filename}. @code{PATH} is -searched when necessary. Use the @code{file} command to get both symbol -table and program to run from the same file. - -@code{symbol-file} with no argument clears out GDB's information on your -program's symbol table. - -The @code{symbol-file} command causes GDB to forget the contents of its -convenience variables, the value history, and all breakpoints and -auto-display expressions. This is because they may contain pointers to -the internal data recording symbols and data types, which are part of -the old symbol table data being discarded inside GDB. - -@code{symbol-file} will not repeat if you press @key{RET} again after -executing it once. - -On some kinds of object files, the @code{symbol-file} command does not -actually read the symbol table in full right away. Instead, it scans -the symbol table quickly to find which source files and which symbols -are present. The details are read later, one source file at a time, -as they are needed. - -The purpose of this two-stage reading strategy is to make GDB start up -faster. For the most part, it is invisible except for occasional -pauses while the symbol table details for a particular source file are -being read. (The @code{set verbose} command can turn these pauses -into messages if desired. @xref{Messages/Warnings, ,Optional Warnings -and Messages}.) - -When the symbol table is stored in COFF format, @code{symbol-file} does -read the symbol table data in full right away. We have not implemented -the two-stage strategy for COFF yet. - -When GDB is configured for a particular environment, it will -understand debugging information in whatever format is the standard -generated for that environment; you may use either a GNU compiler, or -other compilers that adhere to the local conventions. Best results are -usually obtained from GNU compilers; for example, using @code{gcc} -you can generate debugging information for optimized code. - -@item core-file @r{[} @var{filename} @r{]} -@kindex core -@kindex core-file -Specify the whereabouts of a core dump file to be used as the ``contents -of memory''. Traditionally, core files contain only some parts of the -address space of the process that generated them; GDB can access the -executable file itself for other parts. - -@code{core-file} with no argument specifies that no core file is -to be used. - -Note that the core file is ignored when your program is actually running -under GDB. So, if you have been running your program and you wish to -debug a core file instead, you must kill the subprocess in which the -program is running. To do this, use the @code{kill} command -(@pxref{Kill Process, ,Killing the Child Process}). - -@item load @var{filename} -@kindex load -Depending on what remote debugging facilities are configured into -GDB, the @code{load} command may be available. Where it exists, it -is meant to make @var{filename} (an executable) available for debugging -on the remote system---by downloading, or dynamic linking, for example. -@code{load} also records @var{filename}'s symbol table in GDB, like -the @code{add-symbol-file} command. - -If @code{load} is not available on your GDB, attempting to execute -it gets the error message ``@code{You can't do that when your target is -@dots{}}'' - -On VxWorks, @code{load} will dynamically link @var{filename} on the -current target system as well as adding its symbols in GDB. - -@cindex download to Nindy-960 -With the Nindy interface to an Intel 960 board, @code{load} will -download @var{filename} to the 960 as well as adding its symbols in -GDB. - - -@code{load} will not repeat if you press @key{RET} again after using it. - -@item add-symbol-file @var{filename} @var{address} -@kindex add-symbol-file -@cindex dynamic linking -The @code{add-symbol-file} command reads additional symbol table information -from the file @var{filename}. You would use this command when @var{filename} -has been dynamically loaded (by some other means) into the program that -is running. @var{address} should be the memory address at which the -file has been loaded; GDB cannot figure this out for itself. - -The symbol table of the file @var{filename} is added to the symbol table -originally read with the @code{symbol-file} command. You can use the -@code{add-symbol-file} command any number of times; the new symbol data thus -read keeps adding to the old. To discard all old symbol data instead, -use the @code{symbol-file} command. - -@code{add-symbol-file} will not repeat if you press @key{RET} after using it. - -@item info files -@itemx info target -@kindex info files -@kindex info target -@code{info files} and @code{info target} are synonymous; both print -the current targets (@pxref{Targets, ,Specifying a Debugging Target}), -including the names of the executable and core dump files currently in -use by GDB, and the files from which symbols were loaded. The command -@code{help targets} lists all possible targets rather than current -ones. - -@end table - -All file-specifying commands allow both absolute and relative file names -as arguments. GDB always converts the file name to an absolute path -name and remembers it that way. - -@cindex shared libraries - -GDB supports the SunOS shared library format. GDB automatically -loads symbol definitions from shared libraries when you use the -@code{run} command, or when you examine a core file. (Before you issue -the @code{run} command, GDB will not understand references to a -function in a shared library, however---unless you are debugging a core -file). -@c FIXME: next GDB release should permit some refs to undef -@c FIXME...symbols---eg in a break cmd---assuming they are from a shared lib - -@table @code -@item info share -@itemx info sharedlibrary -@kindex info sharedlibrary -@kindex info share -Print the names of the shared libraries which are currently loaded. - -@item sharedlibrary @var{regex} -@itemx share @var{regex} -@kindex sharedlibrary -@kindex share -This is an obsolescent command; you can use it to explicitly -load shared object library symbols for files matching a UNIX regular -expression, but as with files loaded automatically, it will only load -shared libraries required by your program for a core file or after -typing @code{run}. If @var{regex} is omitted all shared libraries -required by your program are loaded. -@end table - -@node Symbol Errors, , Files, GDB Files -@section Errors Reading Symbol Files - -While reading a symbol file, GDB will occasionally encounter problems, -such as symbol types it does not recognize, or known bugs in compiler -output. By default, GDB does not notify you of such problems, since -they are relatively common and primarily of interest to people -debugging compilers. If you are interested in seeing information -about ill-constructed symbol tables, you can either ask GDB to print -only one message about each such type of problem, no matter how many -times the problem occurs; or you can ask GDB to print more messages, -to see how many times the problems occur, with the @code{set -complaints} command (@pxref{Messages/Warnings, ,Optional Warnings and -Messages}). - -The messages currently printed, and their meanings, are: - -@table @code -@item inner block not inside outer block in @var{symbol} - -The symbol information shows where symbol scopes begin and end -(such as at the start of a function or a block of statements). This -error indicates that an inner scope block is not fully contained -in its outer scope blocks. - -GDB circumvents the problem by treating the inner block as if it had -the same scope as the outer block. In the error message, @var{symbol} -may be shown as ``@code{(don't know)}'' if the outer block is not a -function. - -@item block at @var{address} out of order - -The symbol information for symbol scope blocks should occur in -order of increasing addresses. This error indicates that it does not -do so. - -GDB does not circumvent this problem, and will have trouble locating -symbols in the source file whose symbols being read. (You can often -determine what source file is affected by specifying @code{set verbose -on}. @xref{Messages/Warnings, ,Optional Warnings and Messages}.) - -@item bad block start address patched - -The symbol information for a symbol scope block has a start address -smaller than the address of the preceding source line. This is known -to occur in the SunOS 4.1.1 (and earlier) C compiler. - -GDB circumvents the problem by treating the symbol scope block as -starting on the previous source line. - -@item bad string table offset in symbol @var{n} - -@cindex foo -Symbol number @var{n} contains a pointer into the string table which is -larger than the size of the string table. - -GDB circumvents the problem by considering the symbol to have the -name @code{foo}, which may cause other problems if many symbols end up -with this name. - -@item unknown symbol type @code{0x@var{nn}} - -The symbol information contains new data types that GDB does not yet -know how to read. @code{0x@var{nn}} is the symbol type of the misunderstood -information, in hexadecimal. - -GDB circumvents the error by ignoring this symbol information. This -will usually allow your program to be debugged, though certain symbols -will not be accessible. If you encounter such a problem and feel like -debugging it, you can debug @code{gdb} with itself, breakpoint on -@code{complain}, then go up to the function @code{read_dbx_symtab} and -examine @code{*bufp} to see the symbol. - -@item stub type has NULL name -GDB could not find the full definition for a struct or class. - -@item const/volatile indicator missing (ok if using g++ v1.x), got@dots{} - -The symbol information for a C++ member function is missing some -information that recent versions of the compiler should have output -for it. - -@item info mismatch between compiler and debugger - -GDB could not parse a type specification output by the compiler. -@end table - -@node Targets, Controlling GDB, GDB Files, Top -@chapter Specifying a Debugging Target -@cindex debugging target -@kindex target - -A @dfn{target} is the execution environment occupied by your program. -Often, GDB runs in the same host environment as your program; in -that case, the debugging target is specified as a side effect when you -use the @code{file} or @code{core} commands. When you need more -flexibility---for example, running GDB on a physically separate -host, or controlling a standalone system over a serial port or a -realtime system over a TCP/IP connection---you can use the @code{target} -command to specify one of the target types configured for GDB -(@pxref{Target Commands, ,Commands for Managing Targets}). - -@menu -* Active Targets:: Active Targets -* Target Commands:: Commands for Managing Targets -* Remote:: Remote Debugging -@end menu - -@node Active Targets, Target Commands, Targets, Targets -@section Active Targets -@cindex stacking targets -@cindex active targets -@cindex multiple targets - -There are three classes of targets: processes, core files, and -executable files. GDB can work concurrently on up to three active -targets, one in each class. This allows you to (for example) start a -process and inspect its activity without abandoning your work on a core -file. - -If, for example, you execute @samp{gdb a.out}, then the executable file -@code{a.out} is the only active target. If you designate a core file as -well---presumably from a prior run that crashed and coredumped---then -GDB has two active targets and will use them in tandem, looking -first in the corefile target, then in the executable file, to satisfy -requests for memory addresses. (Typically, these two classes of target -are complementary, since core files contain only a program's -read-write memory---variables and so on---plus machine status, while -executable files contain only the program text and initialized data.) - -When you type @code{run}, your executable file becomes an active process -target as well. When a process target is active, all GDB commands -requesting memory addresses refer to that target; addresses in an active -core file or executable file target are obscured while the process -target is active. - -Use the @code{core-file} and @code{exec-file} commands to select a -new core file or executable target (@pxref{Files, ,Commands to Specify -Files}). To specify as a target a process that is already running, use -the @code{attach} command (@pxref{Attach, ,Debugging an -Already-Running Process}.). - -@node Target Commands, Remote, Active Targets, Targets -@section Commands for Managing Targets - -@table @code -@item target @var{type} @var{parameters} -Connects the GDB host environment to a target machine or process. A -target is typically a protocol for talking to debugging facilities. You -use the argument @var{type} to specify the type or protocol of the -target machine. - -Further @var{parameters} are interpreted by the target protocol, but -typically include things like device names or host names to connect -with, process numbers, and baud rates. - -The @code{target} command will not repeat if you press @key{RET} again -after executing the command. - -@item help target -@kindex help target -Displays the names of all targets available. To display targets -currently selected, use either @code{info target} or @code{info files} -(@pxref{Files, ,Commands to Specify Files}). - -@item help target @var{name} -Describe a particular target, including any parameters necessary to -select it. -@end table - -Here are some common targets (available, or not, depending on the GDB -configuration): - -@table @code -@item target exec @var{prog} -@kindex target exec -An executable file. @samp{target exec @var{prog}} is the same as -@samp{exec-file @var{prog}}. - -@item target core @var{filename} -@kindex target core -A core dump file. @samp{target core @var{filename}} is the same as -@samp{core-file @var{filename}}. - -@item target remote @var{dev} -@kindex target remote -Remote serial target in GDB-specific protocol. The argument @var{dev} -specifies what serial device to use for the connection (e.g. -@file{/dev/ttya}). @xref{Remote, ,Remote Debugging}. - -@item target amd-eb @var{dev} @var{speed} @var{PROG} -@kindex target amd-eb -@cindex AMD EB29K -Remote PC-resident AMD EB29K board, attached over serial lines. -@var{dev} is the serial device, as for @code{target remote}; -@var{speed} allows you to specify the linespeed; and @var{PROG} is the -name of the program to be debugged, as it appears to DOS on the PC. -@xref{EB29K Remote, ,GDB with a Remote EB29K}. - -@item target nindy @var{devicename} -@kindex target nindy -An Intel 960 board controlled by a Nindy Monitor. @var{devicename} is -the name of the serial device to use for the connection, e.g. -@file{/dev/ttya}. @xref{i960-Nindy Remote, ,GDB with a Remote i960 (Nindy)}. - -@item target vxworks @var{machinename} -@kindex target vxworks -A VxWorks system, attached via TCP/IP. The argument @var{machinename} -is the target system's machine name or IP address. -@xref{VxWorks Remote, ,GDB and VxWorks}. -@end table - -Different targets are available on different configurations of GDB; your -configuration may have more or fewer targets. - -@node Remote, , Target Commands, Targets -@section Remote Debugging -@cindex remote debugging - -If you are trying to debug a program running on a machine that cannot run -GDB in the usual way, it is often useful to use remote debugging. For -example, you might use remote debugging on an operating system kernel, or on -a small system which does not have a general purpose operating system -powerful enough to run a full-featured debugger. - -Some configurations of GDB have special serial or TCP/IP interfaces -to make this work with particular debugging targets. In addition, -GDB comes with a generic serial protocol (specific to GDB, but -not specific to any particular target system) which you can use if you -write the remote stubs---the code that will run on the remote system to -communicate with GDB. - -To use the GDB remote serial protocol, the program to be debugged on -the remote machine needs to contain a debugging stub which talks to -GDB over the serial line. Several working remote stubs are -distributed with GDB; see the @file{README} file in the GDB -distribution for more information. - -For details of this communication protocol, see the comments in the -GDB source file @file{remote.c}. - -To start remote debugging, first run GDB and specify as an executable file -the program that is running in the remote machine. This tells GDB how -to find your program's symbols and the contents of its pure text. Then -establish communication using the @code{target remote} command with a device -name as an argument. For example: - -@example -target remote /dev/ttyb -@end example - -@noindent -if the serial line is connected to the device named @file{/dev/ttyb}. This -will stop the remote machine if it is not already stopped. - -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. - -Other remote targets may be available in your -configuration of GDB; use @code{help targets} to list them. - -@menu -* i960-Nindy Remote:: GDB with a Remote i960 (Nindy) -* EB29K Remote:: GDB with a Remote EB29K -* VxWorks Remote:: GDB and VxWorks - -@end menu -@node i960-Nindy Remote, EB29K Remote, Remote, Remote -@subsection GDB with a Remote i960 (Nindy) - -@cindex Nindy -@cindex i960 -@dfn{Nindy} is a ROM Monitor program for Intel 960 target systems. When -GDB is configured to control a remote Intel 960 using Nindy, you can -tell GDB 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 GDB -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, Nindy Options, i960-Nindy Remote, i960-Nindy Remote -@subsubsection Startup with Nindy - -If you simply start @code{gdb} without using any command-line -options, you are prompted for what serial port to use, @emph{before} you -reach the ordinary GDB 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, Nindy reset, Nindy Startup, i960-Nindy Remote -@subsubsection Options for Nindy - -These are the startup options for beginning your GDB 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 GDB 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 GDB should use -the ``old'' Nindy monitor protocol to connect to the target system. -This option is only available when GDB 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. GDB will repeatedly -attempt to reconnect at several different line speeds. You can abort -this process with an interrupt. -@end quotation - -@item -brk -Specify that GDB 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, , Nindy Options, i960-Nindy Remote -@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 - -@node EB29K Remote, VxWorks Remote, i960-Nindy Remote, Remote -@subsection GDB with a Remote EB29K - -@cindex EB29K board -@cindex running 29K programs - -To use GDB 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), gdb-EB29K, EB29K Remote, EB29K Remote -@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 GDB 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; GDB will @emph{not} download it over the -serial line. - -@node gdb-EB29K, Remote Log, Comms (EB29K), EB29K Remote -@subsubsection EB29K cross-debugging - -Finally, @code{cd} to the directory containing an image of your 29K -program on the Unix system, and start GDB---specifying as argument the -name of your 29K program: - -@example -cd /usr/joe/work29k -gdb 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 GDB command -@code{run}. - -To stop debugging the remote program, use the GDB @code{detach} -command. - -To return control of the PC to its console, use @code{tip} or @code{cu} -once again, after your GDB 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, , gdb-EB29K, EB29K Remote -@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. - -@node VxWorks Remote, , EB29K Remote, Remote -@subsection GDB and VxWorks -@cindex VxWorks - -GDB 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. GDB uses code that runs on -both the UNIX host and on the VxWorks target. The program -@code{gdb} 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. - -Once you have included the RDB interface in your VxWorks system image -and set your Unix execution search path to find GDB, you are ready -to run GDB. From your UNIX host, type: - -@smallexample -% gdb -@end smallexample - -GDB will come up showing the prompt: - -@smallexample -(gdb) -@end smallexample - -@menu -* VxWorks connection:: Connecting to VxWorks -* VxWorks download:: VxWorks Download -* VxWorks attach:: Running Tasks -@end menu - -@node VxWorks connection, VxWorks download, VxWorks Remote, VxWorks Remote -@subsubsection Connecting to VxWorks - -The GDB 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 -(gdb) target vxworks tt -@end smallexample - -GDB will display a message similar to the following: - -@smallexample -Attaching remote machine across net... Success! -@end smallexample - -GDB will then attempt to read the symbol tables of any object modules -loaded into the VxWorks target since it was last booted. GDB 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 -GDB command @code{path}, and execute the @code{target} command -again. - -@node VxWorks download, VxWorks attach, VxWorks connection, VxWorks Remote -@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 GDB @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 GDB 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 GDB type: - -@smallexample -(gdb) cd wherever/vw/demo/rdb -(gdb) load prog.o -@end smallexample - -GDB 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 GDB 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, , VxWorks download, VxWorks Remote -@subsubsection Running Tasks - -@cindex running VxWorks tasks -You can also attach to an existing task using the @code{attach} command as -follows: - -@smallexample -(gdb) 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. - - -@node Controlling GDB, Sequences, Targets, Top -@chapter Controlling GDB - -You can alter many aspects of GDB's interaction with you by using -the @code{set} command. For commands controlling how GDB displays -data, @pxref{Print Settings, ,Print Settings}; other settings are described here. - -@menu -* Prompt:: Prompt -* Editing:: Command Editing -* History:: Command History -* Screen Size:: Screen Size -* Numbers:: Numbers -* Messages/Warnings:: Optional Warnings and Messages -@end menu - -@node Prompt, Editing, Controlling GDB, Controlling GDB -@section Prompt -@cindex prompt - -GDB indicates its readiness to read a command by printing a string -called the @dfn{prompt}. This string is normally @samp{(gdb)}. You -can change the prompt string with the @code{set prompt} command. For -instance, when debugging GDB with GDB, it is useful to change -the prompt in one of the GDBs so that you can always tell which -one you are talking to. - -@table @code -@item set prompt @var{newprompt} -@kindex set prompt -Directs GDB to use @var{newprompt} as its prompt string henceforth. -@kindex show prompt -@item show prompt -Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}} -@end table - -@node Editing, History, Prompt, Controlling GDB -@section Command Editing -@cindex readline -@cindex command line editing - -GDB reads its input commands via the @dfn{readline} interface. This -GNU library provides consistent behavior for programs which provide a -command line interface to the user. Advantages are @code{emacs}-style -or @code{vi}-style inline editing of commands, @code{csh}-like history -substitution, and a storage and recall of command history across -debugging sessions. - -You may control the behavior of command line editing in GDB with the -command @code{set}. - -@table @code -@kindex set editing -@cindex editing -@item set editing -@itemx set editing on -Enable command line editing (enabled by default). - -@item set editing off -Disable command line editing. - -@kindex show editing -@item show editing -Show whether command line editing is enabled. -@end table - -@node History, Screen Size, Editing, Controlling GDB -@section Command History - -@table @code -@cindex history substitution -@cindex history file -@kindex set history filename -@item set history filename @var{fname} -Set the name of the GDB command history file to @var{fname}. This is -the file from which GDB will read an initial command history -list or to which it will write this list when it exits. This list is -accessed through history expansion or through the history -command editing characters listed below. This file defaults to the -value of the environment variable @code{GDBHISTFILE}, or to -@file{./.gdb_history} if this variable is not set. - -@cindex history save -@kindex set history save -@item set history save -@itemx set history save on -Record command history in a file, whose name may be specified with the -@code{set history filename} command. By default, this option is disabled. - -@item set history save off -Stop recording command history in a file. - -@cindex history size -@kindex set history size -@item set history size @var{size} -Set the number of commands which GDB will keep in its history list. -This defaults to the value of the environment variable -@code{HISTSIZE}, or to 256 if this variable is not set. -@end table - -@cindex history expansion -History expansion assigns special meaning to the character @kbd{!}. -@iftex -@xref{Event Designators}. -@end iftex -Since @kbd{!} is also the logical not operator in C, history expansion -is off by default. If you decide to enable history expansion with the -@code{set history expansion on} command, you may sometimes need to -follow @kbd{!} (when it is used as logical not, in an expression) with -a space or a tab to prevent it from being expanded. The readline -history facilities will not attempt substitution on the strings -@kbd{!=} and @kbd{!(}, even when history expansion is enabled. - -The commands to control history expansion are: - -@table @code - -@kindex set history expansion -@item set history expansion on -@itemx set history expansion -Enable history expansion. History expansion is off by default. - -@item set history expansion off -Disable history expansion. - -The readline code comes with more complete documentation of -editing and history expansion features. Users unfamiliar with @code{emacs} -or @code{vi} may wish to read it. -@iftex -@xref{Command Line Editing}. -@end iftex - -@c @group -@kindex show history -@item show history -@itemx show history filename -@itemx show history save -@itemx show history size -@itemx show history expansion -These commands display the state of the GDB history parameters. -@code{show history} by itself displays all four states. -@c @end group -@end table - -@table @code -@kindex show commands -@item show commands -Display the last ten commands in the command history. - -@item show commands @var{n} -Print ten commands centered on command number @var{n}. - -@item show commands + -Print ten commands just after the commands last printed. -@end table - -@node Screen Size, Numbers, History, Controlling GDB -@section Screen Size -@cindex size of screen -@cindex pauses in output - -Certain commands to GDB may produce large amounts of information -output to the screen. To help you read all of it, GDB pauses and -asks you for input at the end of each page of output. Type @key{RET} -when you want to continue the output. GDB also uses the screen -width setting to determine when to wrap lines of output. Depending on -what is being printed, it tries to break the line at a readable place, -rather than simply letting it overflow onto the following line. - -Normally GDB knows the size of the screen from the termcap data base -together with the value of the @code{TERM} environment variable and the -@code{stty rows} and @code{stty cols} settings. If this is not correct, -you can override it with the @code{set height} and @code{set -width} commands: - -@table @code -@item set height @var{lpp} -@itemx show height -@itemx set width @var{cpl} -@itemx show width -@kindex set height -@kindex set width -@kindex show width -@kindex show height -These @code{set} commands specify a screen height of @var{lpp} lines and -a screen width of @var{cpl} characters. The associated @code{show} -commands display the current settings. - -If you specify a height of zero lines, GDB will not pause during output -no matter how long the output is. This is useful if output is to a file -or to an editor buffer. -@end table - -@node Numbers, Messages/Warnings, Screen Size, Controlling GDB -@section Numbers -@cindex number representation -@cindex entering numbers - -You can always enter numbers in octal, decimal, or hexadecimal in GDB by -the usual conventions: octal numbers begin with @samp{0}, decimal -numbers end with @samp{.}, and hexadecimal numbers begin with @samp{0x}. -Numbers that begin with none of these are, by default, entered in base -10; likewise, the default display for numbers---when no particular -format is specified---is base 10. You can change the default base for -both input and output with the @code{set radix} command. - -@table @code -@kindex set radix -@item set radix @var{base} -Set the default base for numeric input and display. Supported choices -for @var{base} are decimal 2, 8, 10, 16. @var{base} must itself be -specified either unambiguously or using the current default radix; for -example, any of - -@example -set radix 1010 -set radix 012 -set radix 10. -set radix 0xa -@end example - -@noindent -will set the base to decimal. On the other hand, @samp{set radix 10} -will leave the radix unchanged no matter what it was. - -@kindex show radix -@item show radix -Display the current default base for numeric input and display. -@end table - -@node Messages/Warnings, , Numbers, Controlling GDB -@section Optional Warnings and Messages - -By default, GDB is silent about its inner workings. If you are running -on a slow machine, you may want to use the @code{set verbose} command. -It will make GDB tell you when it does a lengthy internal operation, so -you will not think it has crashed. - -Currently, the messages controlled by @code{set verbose} are those -which announce that the symbol table for a source file is being read -(@pxref{Files, ,Commands to Specify Files}, in the description of the -command @code{symbol-file}). -@c The following is the right way to do it, but emacs 18.55 does not support -@c @ref, and neither the emacs lisp manual version of texinfmt or makeinfo -@c is released. -@ignore -see @code{symbol-file} in @ref{Files, ,Commands to Specify Files}). -@end ignore - -@table @code -@kindex set verbose -@item set verbose on -Enables GDB's output of certain informational messages. - -@item set verbose off -Disables GDB's output of certain informational messages. - -@kindex show verbose -@item show verbose -Displays whether @code{set verbose} is on or off. -@end table - -By default, if GDB encounters bugs in the symbol table of an object -file, it is silent; but if you are debugging a compiler, you may find -this information useful (@pxref{Symbol Errors, ,Errors Reading Symbol Files}). - -@table @code -@kindex set complaints -@item set complaints @var{limit} -Permits GDB to output @var{limit} complaints about each type of unusual -symbols before becoming silent about the problem. Set @var{limit} to -zero to suppress all complaints; set it to a large number to prevent -complaints from being suppressed. - -@kindex show complaints -@item show complaints -Displays how many symbol complaints GDB is permitted to produce. -@end table - -By default, GDB is cautious, and asks what sometimes seem to be a -lot of stupid questions to confirm certain commands. For example, if -you try to run a program which is already running: - -@example -(gdb) run -The program being debugged has been started already. -Start it from the beginning? (y or n) -@end example - -If you are willing to unflinchingly face the consequences of your own -commands, you can disable this ``feature'': - -@table @code -@kindex set confirm -@cindex flinching -@cindex confirmation -@cindex stupid questions -@item set confirm off -Disables confirmation requests. - -@item set confirm on -Enables confirmation requests (the default). - -@item show confirm -@kindex show confirm -Displays state of confirmation requests. -@end table - -@c FIXME this does not really belong here. But where *does* it belong? -@cindex reloading symbols -Some systems allow individual object files that make up your program to -be replaced without stopping and restarting your program. -For example, in VxWorks you can simply recompile a defective object file -and keep on running. -If you are running on one of these systems, you can allow GDB to -reload the symbols for automatically relinked modules: - -@table @code -@kindex set symbol-reloading -@item set symbol-reloading on -Replace symbol definitions for the corresponding source file when an -object file with a particular name is seen again. - -@item set symbol-reloading off -Do not replace symbol definitions when re-encountering object files of -the same name. This is the default state; if you are not running on a -system that permits automatically relinking modules, you should leave -@code{symbol-reloading} off, since otherwise GDB may discard symbols -when linking large programs, that may contain several modules (from -different directories or libraries) with the same name. - -@item show symbol-reloading -Show the current @code{on} or @code{off} setting. -@end table - -@node Sequences, Emacs, Controlling GDB, Top -@chapter Canned Sequences of Commands - -Aside from breakpoint commands (@pxref{Break Commands, ,Breakpoint -Command Lists}), GDB provides two ways to store sequences of commands -for execution as a unit: user-defined commands and command files. - -@menu -* Define:: User-Defined Commands -* Command Files:: Command Files -* Output:: Commands for Controlled Output -@end menu - -@node Define, Command Files, Sequences, Sequences -@section User-Defined Commands - -@cindex user-defined command -A @dfn{user-defined command} is a sequence of GDB commands to which you -assign a new name as a command. This is done with the @code{define} -command. - -@table @code -@item define @var{commandname} -@kindex define -Define a command named @var{commandname}. If there is already a command -by that name, you are asked to confirm that you want to redefine it. - -The definition of the command is made up of other GDB command lines, -which are given following the @code{define} command. The end of these -commands is marked by a line containing @code{end}. - -@item document @var{commandname} -@kindex document -Give documentation to the user-defined command @var{commandname}. The -command @var{commandname} must already be defined. This command reads -lines of documentation just as @code{define} reads the lines of the -command definition, ending with @code{end}. After the @code{document} -command is finished, @code{help} on command @var{commandname} will print -the documentation you have specified. - -You may use the @code{document} command again to change the -documentation of a command. Redefining the command with @code{define} -does not change the documentation. - -@item help user-defined -@kindex help user-defined -List all user-defined commands, with the first line of the documentation -(if any) for each. - -@item info user -@itemx info user @var{commandname} -@kindex info user -Display the GDB commands used to define @var{commandname} (but not its -documentation). If no @var{commandname} is given, display the -definitions for all user-defined commands. -@end table - -User-defined commands do not take arguments. When they are executed, the -commands of the definition are not printed. An error in any command -stops execution of the user-defined command. - -Commands that would ask for confirmation if used interactively proceed -without asking when used inside a user-defined command. Many GDB commands -that normally print messages to say what they are doing omit the messages -when used in a user-defined command. - -@node Command Files, Output, Define, Sequences -@section Command Files - -@cindex command files -A command file for GDB is a file of lines that are GDB commands. Comments -(lines starting with @kbd{#}) may also be included. An empty line in a -command file does nothing; it does not mean to repeat the last command, as -it would from the terminal. - -@cindex init file -@cindex @file{.gdbinit} -When you start GDB, it automatically executes commands from its -@dfn{init files}. These are files named @file{.gdbinit}. GDB reads -the init file (if any) in your home directory and then the init file -(if any) in the current working directory. (The init files are not -executed if you use the @samp{-nx} option; @pxref{Mode Options, -,Choosing Modes}.) You can also request the execution of a command -file with the @code{source} command: - -@table @code -@item source @var{filename} -@kindex source -Execute the command file @var{filename}. -@end table - -The lines in a command file are executed sequentially. They are not -printed as they are executed. An error in any command terminates execution -of the command file. - -Commands that would ask for confirmation if used interactively proceed -without asking when used in a command file. Many GDB commands that -normally print messages to say what they are doing omit the messages -when called from command files. - -@node Output, , Command Files, Sequences -@section Commands for Controlled Output - -During the execution of a command file or a user-defined command, normal -GDB output is suppressed; the only output that appears is what is -explicitly printed by the commands in the definition. This section -describes three commands useful for generating exactly the output you -want. - -@table @code -@item echo @var{text} -@kindex echo -@c I do not consider backslash-space a standard C escape sequence -@c because it is not in ANSI. -Print @var{text}. Nonprinting characters can be included in -@var{text} using C escape sequences, such as @samp{\n} to print a -newline. @strong{No newline will be printed unless you specify one.} -In addition to the standard C escape sequences, a backslash followed -by a space stands for a space. This is useful for outputting a -string with spaces at the beginning or the end, since leading and -trailing spaces are otherwise trimmed from all arguments. -To print @samp{@w{ }and foo =@w{ }}, use the command -@samp{echo \@w{ }and foo = \@w{ }}. - -A backslash at the end of @var{text} can be used, as in C, to continue -the command onto subsequent lines. For example, - -@example -echo This is some text\n\ -which is continued\n\ -onto several lines.\n -@end example - -produces the same output as - -@example -echo This is some text\n -echo which is continued\n -echo onto several lines.\n -@end example - -@item output @var{expression} -@kindex output -Print the value of @var{expression} and nothing but that value: no -newlines, no @samp{$@var{nn} = }. The value is not entered in the -value history either. @xref{Expressions, ,Expressions}, for more information on -expressions. - -@item output/@var{fmt} @var{expression} -Print the value of @var{expression} in format @var{fmt}. You can use -the same formats as for @code{print}; @pxref{Output formats}, for more -information. - -@item printf @var{string}, @var{expressions}@dots{} -@kindex printf -Print the values of the @var{expressions} under the control of -@var{string}. The @var{expressions} are separated by commas and may -be either numbers or pointers. Their values are printed as specified -by @var{string}, exactly as if your program were to execute - -@example -printf (@var{string}, @var{expressions}@dots{}); -@end example - -For example, you can print two values in hex like this: - -@example -printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo -@end example - -The only backslash-escape sequences that you can use in the format -string are the simple ones that consist of backslash followed by a -letter. -@end table - -@node Emacs, GDB Bugs, Sequences, Top -@chapter Using GDB under GNU Emacs - -@cindex emacs -A special interface allows you to use GNU Emacs to view (and -edit) the source files for the program you are debugging with -GDB. - -To use this interface, use the command @kbd{M-x gdb} in Emacs. Give the -executable file you want to debug as an argument. This command starts -GDB as a subprocess of Emacs, with input and output through a newly -created Emacs buffer. - -Using GDB under Emacs is just like using GDB normally except for two -things: - -@itemize @bullet -@item -All ``terminal'' input and output goes through the Emacs buffer. -@end itemize - -This applies both to GDB commands and their output, and to the input -and output done by the program you are debugging. - -This is useful because it means that you can copy the text of previous -commands and input them again; you can even use parts of the output -in this way. - -All the facilities of Emacs' Shell mode are available for interacting -with your program. In particular, you can send signals the usual -way---for example, @kbd{C-c C-c} for an interrupt, @kbd{C-c C-z} for a -stop. - -@itemize @bullet -@item -GDB displays source code through Emacs. -@end itemize - -Each time GDB displays a stack frame, Emacs automatically finds the -source file for that frame and puts an arrow (@samp{=>}) at the -left margin of the current line. Emacs uses a separate buffer for -source display, and splits the window to show both your GDB session -and the source. - -Explicit GDB @code{list} or search commands still produce output as -usual, but you probably will have no reason to use them. - -@quotation -@emph{Warning:} If the directory where your program resides is not your -current directory, it can be easy to confuse Emacs about the location of -the source files, in which case the auxiliary display buffer will not -appear to show your source. GDB can find programs by searching your -environment's @code{PATH} variable, so the GDB input and output -session will proceed normally; but Emacs does not get enough information -back from GDB to locate the source files in this situation. To -avoid this problem, either start GDB mode from the directory where -your program resides, or specify a full path name when prompted for the -@kbd{M-x gdb} argument. - -A similar confusion can result if you use the GDB @code{file} command to -switch to debugging a program in some other location, from an existing -GDB buffer in Emacs. -@end quotation - -By default, @kbd{M-x gdb} calls the program called @file{gdb}. If -you need to call GDB by a different name (for example, if you keep -several configurations around, with different names) you can set the -Emacs variable @code{gdb-command-name}; for example, - -@example -(setq gdb-command-name "mygdb") -@end example - -@noindent -(preceded by @kbd{ESC ESC}, or typed in the @code{*scratch*} buffer, or -in your @file{.emacs} file) will make Emacs call the program named -``@code{mygdb}'' instead. - -In the GDB I/O buffer, you can use these special Emacs commands in -addition to the standard Shell mode commands: - -@table @kbd -@item C-h m -Describe the features of Emacs' GDB Mode. - -@item M-s -Execute to another source line, like the GDB @code{step} command; also -update the display window to show the current file and location. - -@item M-n -Execute to next source line in this function, skipping all function -calls, like the GDB @code{next} command. Then update the display window -to show the current file and location. - -@item M-i -Execute one instruction, like the GDB @code{stepi} command; update -display window accordingly. - -@item M-x gdb-nexti -Execute to next instruction, using the GDB @code{nexti} command; update -display window accordingly. - -@item C-c C-f -Execute until exit from the selected stack frame, like the GDB -@code{finish} command. - -@item M-c -Continue execution of your program, like the GDB @code{continue} -command. - -@emph{Warning:} In Emacs v19, this command is @kbd{C-c C-p}. - -@item M-u -Go up the number of frames indicated by the numeric argument -(@pxref{Arguments, , Numeric Arguments, emacs, The GNU Emacs Manual}), -like the GDB @code{up} command. - -@emph{Warning:} In Emacs v19, this command is @kbd{C-c C-u}. - -@item M-d -Go down the number of frames indicated by the numeric argument, like the -GDB @code{down} command. - -@emph{Warning:} In Emacs v19, this command is @kbd{C-c C-d}. - -@item C-x & -Read the number where the cursor is positioned, and insert it at the end -of the GDB I/O buffer. For example, if you wish to disassemble code -around an address that was displayed earlier, type @kbd{disassemble}; -then move the cursor to the address display, and pick up the -argument for @code{disassemble} by typing @kbd{C-x &}. - -You can customize this further on the fly by defining elements of the list -@code{gdb-print-command}; once it is defined, you can format or -otherwise process numbers picked up by @kbd{C-x &} before they are -inserted. A numeric argument to @kbd{C-x &} will both indicate that you -wish special formatting, and act as an index to pick an element of the -list. If the list element is a string, the number to be inserted is -formatted using the Emacs function @code{format}; otherwise the number -is passed as an argument to the corresponding list element. -@end table - -In any source file, the Emacs command @kbd{C-x SPC} (@code{gdb-break}) -tells GDB to set a breakpoint on the source line point is on. - -If you accidentally delete the source-display buffer, an easy way to get -it back is to type the command @code{f} in the GDB buffer, to -request a frame display; when you run under Emacs, this will recreate -the source buffer if necessary to show you the context of the current -frame. - -The source files displayed in Emacs are in ordinary Emacs buffers -which are visiting the source files in the usual way. You can edit -the files with these buffers if you wish; but keep in mind that GDB -communicates with Emacs in terms of line numbers. If you add or -delete lines from the text, the line numbers that GDB knows will cease -to correspond properly to the code. - -@c The following dropped because Epoch is nonstandard. Reactivate -@c if/when v19 does something similar. ---pesch@cygnus.com 19dec1990 -@ignore -@kindex emacs epoch environment -@kindex epoch -@kindex inspect - -Version 18 of Emacs has a built-in window system called the @code{epoch} -environment. Users of this environment can use a new command, -@code{inspect} which performs identically to @code{print} except that -each value is printed in its own window. -@end ignore - -@node GDB Bugs, Renamed Commands, Emacs, Top -@chapter Reporting Bugs in GDB -@cindex Bugs in GDB -@cindex Reporting Bugs in GDB - -Your bug reports play an essential role in making GDB reliable. - -Reporting a bug may help you by bringing a solution to your problem, or it -may not. But in any case the principal function of a bug report is to help -the entire community by making the next version of GDB work better. Bug -reports are your contribution to the maintenance of GDB. - -In order for a bug report to serve its purpose, you must include the -information that enables us to fix the bug. - -@menu -* Bug Criteria:: Have You Found a Bug? -* Bug Reporting:: How to Report Bugs -@end menu - -@node Bug Criteria, Bug Reporting, GDB Bugs, GDB Bugs -@section Have You Found a Bug? -@cindex Bug Criteria - -If you are not sure whether you have found a bug, here are some guidelines: - -@itemize @bullet -@item -@cindex Fatal Signal -@cindex Core Dump -If the debugger gets a fatal signal, for any input whatever, that is a -GDB bug. Reliable debuggers never crash. - -@item -@cindex error on Valid Input -If GDB produces an error message for valid input, that is a bug. - -@item -@cindex Invalid Input -If GDB does not produce an error message for invalid input, -that is a bug. However, you should note that your idea of -``invalid input'' might be our idea of ``an extension'' or ``support -for traditional practice''. - -@item -If you are an experienced user of debugging tools, your suggestions -for improvement of GDB are welcome in any case. -@end itemize - -@node Bug Reporting, , Bug Criteria, GDB Bugs -@section How to Report Bugs -@cindex Bug Reports -@cindex GDB Bugs, Reporting - -A number of companies and individuals offer support for GNU products. -If you obtained GDB from a support organization, we recommend you -contact that organization first. - -Contact information for many support companies and individuals is -available in the file @file{etc/SERVICE} in the GNU Emacs distribution. - -In any event, we also recommend that you send bug reports for GDB to one -of these addresses: - -@example -bug-gdb@@prep.ai.mit.edu -@{ucbvax|mit-eddie|uunet@}!prep.ai.mit.edu!bug-gdb -@end example - -@strong{Do not send bug reports to @samp{info-gdb}, or to -@samp{help-gdb}, or to any newsgroups.} Most users of GDB do not want to -receive bug reports. Those that do, have arranged to receive @samp{bug-gdb}. - -The mailing list @samp{bug-gdb} has a newsgroup @samp{gnu.gdb.bug} which -serves as a repeater. The mailing list and the newsgroup carry exactly -the same messages. Often people think of posting bug reports to the -newsgroup instead of mailing them. This appears to work, but it has one -problem which can be crucial: a newsgroup posting often lacks a mail -path back to the sender. Thus, if we need to ask for more information, -we may be unable to reach you. For this reason, it is better to send -bug reports to the mailing list. - -As a last resort, send bug reports on paper to: - -@example -GNU Debugger Bugs -Free Software Foundation -545 Tech Square -Cambridge, MA 02139 -@end example - -The fundamental principle of reporting bugs usefully is this: -@strong{report all the facts}. If you are not sure whether to state a -fact or leave it out, state it! - -Often people omit facts because they think they know what causes the -problem and assume that some details do not matter. Thus, you might -assume that the name of the variable you use in an example does not matter. -Well, probably it does not, but one cannot be sure. Perhaps the bug is a -stray memory reference which happens to fetch from the location where that -name is stored in memory; perhaps, if the name were different, the contents -of that location would fool the debugger into doing the right thing despite -the bug. Play it safe and give a specific, complete example. That is the -easiest thing for you to do, and the most helpful. - -Keep in mind that the purpose of a bug report is to enable us to fix -the bug if it is new to us. It is not as important as what happens if -the bug is already known. Therefore, always write your bug reports on -the assumption that the bug has not been reported previously. - -Sometimes people give a few sketchy facts and ask, ``Does this ring a -bell?'' Those bug reports are useless, and we urge everyone to -@emph{refuse to respond to them} except to chide the sender to report -bugs properly. - -To enable us to fix the bug, you should include all these things: - -@itemize @bullet -@item -The version of GDB. GDB announces it if you start with no -arguments; you can also print it at any time using @code{show version}. - -Without this, we will not know whether there is any point in looking for -the bug in the current version of GDB. - -@item -The type of machine you are using, and the operating system name and -version number. - -@item -What compiler (and its version) was used to compile GDB---e.g. -``gcc-2.0''. - -@item -What compiler (and its version) was used to compile the program you -are debugging---e.g. ``gcc-2.0''. - -@item -The command arguments you gave the compiler to compile your example and -observe the bug. For example, did you use @samp{-O}? To guarantee -you will not omit something important, list them all. A copy of the -Makefile (or the output from make) is sufficient. - -If we were to try to guess the arguments, we would probably guess wrong -and then we might not encounter the bug. - -@item -A complete input script, and all necessary source files, that will -reproduce the bug. - -@item -A description of what behavior you observe that you believe is -incorrect. For example, ``It gets a fatal signal.'' - -Of course, if the bug is that GDB gets a fatal signal, then we will -certainly notice it. But if the bug is incorrect output, we might not -notice unless it is glaringly wrong. We are human, after all. You -might as well not give us a chance to make a mistake. - -Even if the problem you experience is a fatal signal, you should still -say so explicitly. Suppose something strange is going on, such as, -your copy of GDB is out of synch, or you have encountered a -bug in the C library on your system. (This has happened!) Your copy -might crash and ours would not. If you told us to expect a crash, -then when ours fails to crash, we would know that the bug was not -happening for us. If you had not told us to expect a crash, then we -would not be able to draw any conclusion from our observations. - -@item -If you wish to suggest changes to the GDB source, send us context -diffs. If you even discuss something in the GDB source, refer to -it by context, not by line number. - -The line numbers in our development sources will not match those in your -sources. Your line numbers would convey no useful information to us. -@end itemize - -Here are some things that are not necessary: - -@itemize @bullet -@item -A description of the envelope of the bug. - -Often people who encounter a bug spend a lot of time investigating -which changes to the input file will make the bug go away and which -changes will not affect it. - -This is often time consuming and not very useful, because the way we -will find the bug is by running a single example under the debugger -with breakpoints, not by pure deduction from a series of examples. -We recommend that you save your time for something else. - -Of course, if you can find a simpler example to report @emph{instead} -of the original one, that is a convenience for us. Errors in the -output will be easier to spot, running under the debugger will take -less time, etc. - -However, simplification is not vital; if you do not want to do this, -report the bug anyway and send us the entire test case you used. - -@item -A patch for the bug. - -A patch for the bug does help us if it is a good one. But do not omit -the necessary information, such as the test case, on the assumption that -a patch is all we need. We might see problems with your patch and decide -to fix the problem another way, or we might not understand it at all. - -Sometimes with a program as complicated as GDB it is very hard to -construct an example that will make the program follow a certain path -through the code. If you do not send us the example, we will not be able -to construct one, so we will not be able to verify that the bug is fixed. - -And if we cannot understand what bug you are trying to fix, or why your -patch should be an improvement, we will not install it. A test case will -help us to understand. - -@item -A guess about what the bug is or what it depends on. - -Such guesses are usually wrong. Even we cannot guess right about such -things without first using the debugger to find the facts. -@end itemize - -@c Note: no need to update nodes for rdl-apps.texi since it appears -@c *only* in the TeX version of the manual. -@c Note: eventually, make a cross reference to the readline Info nodes. -@iftex -@c appendices describing GNU readline. Distributed with readline code. -@include rluser.texinfo -@include inc-hist.texi -@end iftex - -@node Renamed Commands, Installing GDB, GDB Bugs, Top -@appendix Renamed Commands - -The following commands were renamed in GDB 4, in order to make the -command set as a whole more consistent and easier to use and remember: - -@kindex add-syms -@kindex delete environment -@kindex info copying -@kindex info convenience -@kindex info directories -@kindex info editing -@kindex info history -@kindex info targets -@kindex info values -@kindex info version -@kindex info warranty -@kindex set addressprint -@kindex set arrayprint -@kindex set prettyprint -@kindex set screen-height -@kindex set screen-width -@kindex set unionprint -@kindex set vtblprint -@kindex set demangle -@kindex set asm-demangle -@kindex set sevenbit-strings -@kindex set array-max -@kindex set caution -@kindex set history write -@kindex show addressprint -@kindex show arrayprint -@kindex show prettyprint -@kindex show screen-height -@kindex show screen-width -@kindex show unionprint -@kindex show vtblprint -@kindex show demangle -@kindex show asm-demangle -@kindex show sevenbit-strings -@kindex show array-max -@kindex show caution -@kindex show history write -@kindex unset - -@c TEXI2ROFF-KILL -@ifinfo -@c END TEXI2ROFF-KILL -@example -OLD COMMAND NEW COMMAND -@c TEXI2ROFF-KILL ---------------- ------------------------------- -@c END TEXI2ROFF-KILL -add-syms add-symbol-file -delete environment unset environment -info convenience show convenience -info copying show copying -info directories show directories -info editing show commands -info history show values -info targets help target -info values show values -info version show version -info warranty show warranty -set/show addressprint set/show print address -set/show array-max set/show print elements -set/show arrayprint set/show print array -set/show asm-demangle set/show print asm-demangle -set/show caution set/show confirm -set/show demangle set/show print demangle -set/show history write set/show history save -set/show prettyprint set/show print pretty -set/show screen-height set/show height -set/show screen-width set/show width -set/show sevenbit-strings set/show print sevenbit-strings -set/show unionprint set/show print union -set/show vtblprint set/show print vtbl - -unset [No longer an alias for delete] -@end example -@c TEXI2ROFF-KILL -@end ifinfo - -@tex -\vskip \parskip\vskip \baselineskip -\halign{\tt #\hfil &\qquad#&\tt #\hfil\cr -{\bf Old Command} &&{\bf New Command}\cr -add-syms &&add-symbol-file\cr -delete environment &&unset environment\cr -info convenience &&show convenience\cr -info copying &&show copying\cr -info directories &&show directories \cr -info editing &&show commands\cr -info history &&show values\cr -info targets &&help target\cr -info values &&show values\cr -info version &&show version\cr -info warranty &&show warranty\cr -set{\rm / }show addressprint &&set{\rm / }show print address\cr -set{\rm / }show array-max &&set{\rm / }show print elements\cr -set{\rm / }show arrayprint &&set{\rm / }show print array\cr -set{\rm / }show asm-demangle &&set{\rm / }show print asm-demangle\cr -set{\rm / }show caution &&set{\rm / }show confirm\cr -set{\rm / }show demangle &&set{\rm / }show print demangle\cr -set{\rm / }show history write &&set{\rm / }show history save\cr -set{\rm / }show prettyprint &&set{\rm / }show print pretty\cr -set{\rm / }show screen-height &&set{\rm / }show height\cr -set{\rm / }show screen-width &&set{\rm / }show width\cr -set{\rm / }show sevenbit-strings &&set{\rm / }show print sevenbit-strings\cr -set{\rm / }show unionprint &&set{\rm / }show print union\cr -set{\rm / }show vtblprint &&set{\rm / }show print vtbl\cr -\cr -unset &&\rm(No longer an alias for delete)\cr -} -@end tex -@c END TEXI2ROFF-KILL - -@node Installing GDB, Copying, Renamed Commands, Top -@appendix Installing GDB -@cindex configuring GDB -@cindex installation - -@iftex -@c irrelevant in info file; it's as current as the code it lives with. -@quotation -@emph{Warning:} These installation instructions are current as of -GDB version 4.4.4. If you're installing a more recent release -of GDB, we may have improved the installation procedures since -printing this manual; see the @file{README} file included in your -release for the most recent instructions. -@end quotation -@end iftex - -GDB comes with a @code{configure} script that automates the process -of preparing GDB for installation; you can then use @code{make} to -build the program. - -The GDB distribution includes all the source code you need for GDB in -a single directory, whose name is usually composed by appending the -version number to @samp{gdb}. - -For example, the GDB version 4.4.4 distribution is in the @file{gdb-4.4.4} -directory. That directory contains: - -@table @code -@item gdb-4.4.4/configure @r{(and supporting files)} -script for configuring GDB and all its supporting libraries. - -@item gdb-4.4.4/gdb -the source specific to GDB itself - -@item gdb-4.4.4/bfd -source for the Binary File Descriptor Library - -@item gdb-4.4.4/include -GNU include files - -@item gdb-4.4.4/libiberty -source for the @samp{-liberty} free software library - -@item gdb-4.4.4/readline -source for the GNU command-line interface -@end table - -The simplest way to configure and build GDB is to run @code{configure} -from the @file{gdb-@var{version-number}} source directory, which in -this example is the @file{gdb-4.4.4} directory. - -First switch to the @file{gdb-@var{version-number}} source directory -if you are not already in it; then run @code{configure}. Pass the -identifier for the platform on which GDB will run as an -argument. - -For example: - -@example -cd gdb-4.4.4 -./configure @var{host} -make -@end example - -@noindent -where @var{host} is an identifier such as @samp{sun4} or -@samp{decstation}, that identifies the platform where GDB will run. - -These @code{configure} and @code{make} commands build the three libraries @file{bfd}, -@file{readline}, and @file{libiberty}, then @code{gdb} itself. The -configured source files, and the binaries, are left in the -corresponding source directories. - -@code{configure} is a Bourne-shell (@code{/bin/sh}) script; if your -system does not recognize this automatically when you run a different -shell, you may need to run @code{sh} on it explicitly: - -@example -sh configure @var{host} -@end example - -If you run @code{configure} from a directory that contains source -directories for multiple libraries or programs, such as the -@file{gdb-4.4.4} source directory for version 4.4.4, @code{configure} -creates configuration files for every directory level underneath (unless -you tell it not to, with the @samp{--norecursion} option). - -You can run the @code{configure} script from any of the -subordinate directories in the GDB distribution, if you only want to -configure that subdirectory; but be sure to specify a path to it. - -For example, with version 4.4.4, type the following to configure only -the @code{bfd} subdirectory: - -@example -@group -cd gdb-4.4.4/bfd -../configure @var{host} -@end group -@end example - -You can install @code{gdb} anywhere; it has no hardwired paths. -However, you should make sure that the shell on your path (named by -the @samp{SHELL} environment variable) is publicly readable. Remember -that GDB uses the shell to start your program---some systems refuse to -let GDB debug child processes whose programs are not readable. - -@menu -* Separate Objdir:: Compiling GDB in another directory -* Config Names:: Specifying names for hosts and targets -* configure Options:: Summary of options for configure -* Formatting Documentation:: How to format and print GDB documentation -@end menu - -@node Separate Objdir, Config Names, Installing GDB, Installing GDB -@section Compiling GDB in Another Directory - -If you want to run GDB versions for several host or target machines, -you'll need a different @code{gdb} compiled for each combination of -host and target. @code{configure} is designed to make this easy by -allowing you to generate each configuration in a separate subdirectory, -rather than in the source directory. If your @code{make} program -handles the @samp{VPATH} feature (GNU @code{make} does), running -@code{make} in each of these directories then builds the @code{gdb} -program specified there. - -To build @code{gdb} in a separate directory, run @code{configure} -with the @samp{--srcdir} option to specify where to find the source. -(Remember, you'll also need to specify a path to find @code{configure} -itself from your working directory.) - -For example, with version 4.4.4, you can build GDB in a separate -directory for a Sun 4 like this: - -@example -@group -cd gdb-4.4.4 -mkdir ../gdb-sun4 -cd ../gdb-sun4 -../gdb-4.4.4/configure --srcdir=../gdb-4.4.4 sun4 -make -@end group -@end example - -When @code{configure} builds a configuration using a remote source -directory, it creates a tree for the binaries with the same structure -(and using the same names) as the tree under the source directory. In -the example, you'd find the Sun 4 library @file{libiberty.a} in the -directory @file{gdb-sun4/libiberty}, and GDB itself in -@file{gdb-sun4/gdb}. - -One popular use for building several GDB configurations in separate -directories is to configure GDB for cross-compiling (where GDB -runs on one machine---the host---while debugging programs that run on -another machine---the target). You specify a cross-debugging target by -giving the @samp{--target=@var{target}} option to @code{configure}. - -When you run @code{make} to build a program or library, you must run -it in a configured directory---whatever directory you were in when you -called @code{configure} (or one of its subdirectories). - -The @code{Makefile} generated by @code{configure} for each source -directory also runs recursively. If you type @code{make} in a source -directory such as @file{gdb-4.4.4} (or in a separate configured -directory configured with @samp{--srcdir=@var{path}/gdb-4.4.4}), you -will build all the required libraries, then build GDB. - -When you have multiple hosts or targets configured in separate -directories, you can run @code{make} on them in parallel (for example, -if they are NFS-mounted on each of the hosts); they will not interfere -with each other. - -@node Config Names, configure Options, Separate Objdir, Installing GDB -@section Specifying Names for Hosts and Targets - -The specifications used for hosts and targets in the @code{configure} -script are based on a three-part naming scheme, but some short predefined -aliases are also supported. The full naming scheme encodes three pieces -of information in the following pattern: - -@example -@var{architecture}-@var{vendor}-@var{os} -@end example - -For example, you can use the alias @code{sun4} as a @var{host} argument -or in a @code{--target=@var{target}} option, but the equivalent full name -is @samp{sparc-sun-sunos4}. - -The following table shows all the architectures, hosts, and OS -prefixes that @code{configure} recognizes in GDB version 4.4.4. Entries -in the ``OS prefix'' column ending in a @samp{*} may be followed by a -release number. - -@c FIXME! Update for gdb 4.4 -@c TEXI2ROFF-KILL -@ifinfo -@c END TEXI2ROFF-KILL -@example - -ARCHITECTURE VENDOR OS prefix -@c TEXI2ROFF-KILL -------------+--------------------------+--------------------------- -@c END TEXI2ROFF-KILL - | | - 580 | altos hp | aix* msdos* - a29k | amd ibm | amigados newsos* - alliant | amdahl intel | aout nindy* - arm | aout isi | bout osf* - c1 | apollo little | bsd* sco* - c2 | att mips | coff sunos* - cray2 | bcs motorola | ctix* svr4 - h8300 | bout ncr | dgux* sym* - i386 | bull next | dynix* sysv* - i860 | cbm nyu | ebmon ultrix* - i960 | coff sco | esix* unicos* - m68000 | convergent sequent | hds unos* - m68k | convex sgi | hpux* uts - m88k | cray sony | irix* v88r* - mips | dec sun | isc* vms* - ns32k | encore unicom | kern vxworks* - pyramid | gould utek | mach* - romp | hitachi wrs | - rs6000 | | - sparc | | - tahoe | | - tron | | - vax | | - xmp | | - ymp | | -@end example - -@c TEXI2ROFF-KILL -@end ifinfo -@tex -%\vskip\parskip -\vskip \baselineskip -\hfil\vbox{\offinterlineskip -\halign{\strut\tt #\hfil\ &\vrule#&\strut\ \tt #\hfil\ &\strut\ \tt #\hfil -\ &\vrule#&\strut\ \tt #\hfil\ &\strut\ \tt #\hfil \cr -{\bf Architecture} &&{\bf Vendor} &&&{\bf OS prefix}\cr -\multispan7\hrulefill\cr - 580 && altos & hp && aix* & msdos* \cr - a29k && amd & ibm && amigados & newsos* \cr - alliant && amdahl & intel && aout & nindy* \cr - arm && aout & isi && bout & osf* \cr - c1 && apollo & little && bsd* & sco* \cr - c2 && att & mips && coff & sunos* \cr - cray2 && bcs & motorola && ctix* & svr4 \cr - h8300 && bout & ncr && dgux* & sym* \cr - i386 && bull & next && dynix* & sysv* \cr - i860 && cbm & nyu && ebmon & ultrix* \cr - i960 && coff & sco && esix* & unicos* \cr - m68000 && convergent& sequent && hds & unos* \cr - m68k && convex & sgi && hpux* & uts \cr - m88k && cray & sony && irix* & v88r* \cr - mips && dec & sun && isc* & vms* \cr - ns32k && encore & unicom && kern & vxworks* \cr - pyramid && gould & utek && mach* & \cr - romp && hitachi & wrs && & \cr - rs6000 && & && & \cr - sparc && & && & \cr - tahoe && & && & \cr - tron && & && & \cr - vax && & && & \cr - xmp && & && & \cr - ymp && & && & \cr -}\hfil} -@end tex -@c END TEXI2ROFF-KILL - -@quotation -@emph{Warning:} @code{configure} can represent a very large number of -combinations of architecture, vendor, and OS. There is by no means -support available for all possible combinations! -@end quotation - -The @code{configure} script accompanying GDB does not provide -any query facility to list all supported host and target names or -aliases. @code{configure} calls the Bourne shell script -@code{config.sub} to map abbreviations to full names; you can read the -script, if you wish, or you can use it to test your guesses on -abbreviations---for example: - -@example -% sh config.sub sun4 -sparc-sun-sunos4 -% sh config.sub sun3 -m68k-sun-sunos4 -% sh config.sub decstation -mips-dec-ultrix -% sh config.sub hp300bsd -m68k-hp-bsd -% sh config.sub i386v -i386-none-sysv -% sh config.sub i786v -*** Configuration "i786v" not recognized -@end example - -@noindent -@code{config.sub} is also distributed in the GDB source -directory (@file{gdb-4.4.4}, for version 4.4.4). - -@node configure Options, Formatting Documentation, Config Names, Installing GDB -@section @code{configure} Options - -Here is a summary of all the @code{configure} options and arguments that -you might use for building GDB: - -@example -configure @r{[}--destdir=@var{dir}@r{]} @r{[}--srcdir=@var{path}@r{]} - @r{[}--norecursion@r{]} @r{[}--rm@r{]} - @r{[}--target=@var{target}@r{]} @var{host} -@end example - -@noindent -You may introduce options with a single @samp{-} rather than -@samp{--} if you prefer; but you may abbreviate option names if you use -@samp{--}. - -@table @code -@item --destdir=@var{dir} -@var{dir} is an installation directory @emph{path prefix}. After you -configure with this option, @code{make install} will install GDB as -@file{@var{dir}/bin/gdb}, and the libraries in @file{@var{dir}/lib}. -If you specify @samp{--destdir=/usr/local}, for example, @code{make -install} creates @file{/usr/local/bin/gdb}. - -@item --srcdir=@var{path} -Use this option to make configurations in directories separate from the -GDB source directories. Among other things, you can use this to -build (or maintain) several configurations simultaneously, in separate -directories. @code{configure} writes configuration specific files in -the current directory, but arranges for them to use the source in the -directory @var{path}. @code{configure} will create directories under -the working directory in parallel to the source directories below -@var{path}. - -@item --norecursion -Configure only the directory level where @code{configure} is executed; do not -propagate configuration to subdirectories. - -@item --rm -Remove the configuration that the other arguments specify. - -@c This does not work (yet if ever). FIXME. -@c @item --parse=@var{lang} @dots{} -@c Configure the GDB expression parser to parse the listed languages. -@c @samp{all} configures GDB for all supported languages. To get a -@c list of all supported languages, omit the argument. Without this -@c option, GDB is configured to parse all supported languages. - -@item --target=@var{target} -Configure GDB for cross-debugging programs running on the specified -@var{target}. Without this option, GDB is configured to debug -programs that run on the same machine (@var{host}) as GDB itself. - -There is no convenient way to generate a list of all available targets. - -@item @var{host} @dots{} -Configure GDB to run on the specified @var{host}. - -There is no convenient way to generate a list of all available hosts. -@end table - -@noindent -@code{configure} accepts other options, for compatibility with -configuring other GNU tools recursively; but these are the only -options that affect GDB or its supporting libraries. - -@node Formatting Documentation, , configure Options, Installing GDB -@section Formatting the Documentation - -All the documentation for GDB, including this manual, comes as part of -the distribution. The documentation is written in Texinfo format, -which is a documentation system that uses a single source file to -produce both on-line information and a printed manual. You can use -one of the Info formatting commands to create the on-line version of -the documentation and @TeX{} (or @code{texi2roff}) to typeset the -printed version. - -GDB includes an already formatted copy of the on-line Info version of -this manual in the @file{gdb} subdirectory. The main Info file is -@file{gdb-@var{version-number}/gdb/gdb.info}, and it refers to -subordinate files matching @samp{gdb.info*} in the same directory. - -If you want to format these Info files yourself, you need one of the -Info formatting programs, such as @code{texinfo-format-buffer} or -@code{makeinfo}. - -If you have @code{makeinfo} installed, and are in the top level GDB -source directory (@file{gdb-4.4.4}, in the case of version 4.4.4), you can -make the Info file by typing: - -@example -cd gdb -make gdb.info -@end example - -If you want to typeset and print copies of this manual, you need -@TeX{}, a printing program such as @code{lpr}, and @file{texinfo.tex}, -the Texinfo definitions file. - -@TeX{} is typesetting program; it does not print files directly, but -produces output files called @sc{dvi} files. To print a typeset -document, you need a program to print @sc{dvi} files. If your system -has @TeX{} installed, chances are it has such a program. The precise -command to use depends on your system; @kbd{lpr -d} is common; another -is @kbd{dvips}. The @sc{dvi} print command may require a file name -without any extension or a @samp{.dvi} extension. - -@TeX{} also requires a macro definitions file called -@file{texinfo.tex}. This file tells @TeX{} how to typeset a document -written in Texinfo format. On its own, @TeX{} cannot read, much less -typeset a Texinfo file. @file{texinfo.tex} is distributed with GDB -and is located in the @file{gdb-@var{version-number}/texinfo} -directory. - -If you have @TeX{} and a @sc{dvi} printer program installed, you can -typeset and print this manual. First switch to the the @file{gdb} -subdirectory of the main source directory (for example, to -@file{gdb-4.4.4/gdb}) and then type: - -@example -make gdb.dvi -@end example - -@cindex GDB reference card -@cindex reference card -In addition to the manual, the GDB 4 release includes a three-column -reference card. Format the GDB reference card by typing: - -@example -make refcard.dvi -@end example - -The GDB reference card is designed to print in landscape mode on US -``letter'' size paper; that is, on a sheet 11 inches wide by 8.5 inches -high. You will need to specify this form of printing as an option to -your @sc{dvi} output program. - -The GDB 4 release includes an already-formatted reference card, ready -for printing on a PostScript or GhostScript printer, in the @file{gdb} -subdirectory of the main source directory---in -@file{gdb-4.2/gdb/refcard.ps} of the version 4.2 release. If you have -a PostScript or GhostScript printer, you can print the reference card -by just sending @file{refcard.ps} to the printer. - -@node Copying, Index, Installing GDB, Top -@unnumbered GNU GENERAL PUBLIC LICENSE -@center Version 2, June 1991 - -@display -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. -675 Mass Ave, Cambridge, MA 02139, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@unnumberedsec Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software---to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - -@iftex -@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end iftex -@ifinfo -@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end ifinfo - -@enumerate -@item -This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The ``Program'', below, -refers to any such program or work, and a ``work based on the Program'' -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term ``modification''.) Each licensee is addressed as ``you''. - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - -@item -You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -@item -You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - -@enumerate a -@item -You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. - -@item -You must cause any work that you distribute or publish, that in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. - -@item -If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based on -the Program is not required to print an announcement.) -@end enumerate - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - -@item -You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - -@enumerate a -@item -Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; or, - -@item -Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, - -@item -Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) -@end enumerate - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - -@item -You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - -@item -You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -@item -Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - -@item -If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -@item -If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -@item -The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and ``any -later version'', you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -@item -If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - -@iftex -@heading NO WARRANTY -@end iftex -@ifinfo -@center NO WARRANTY -@end ifinfo - -@item -BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - -@item -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. -@end enumerate - -@iftex -@heading END OF TERMS AND CONDITIONS -@end iftex -@ifinfo -@center END OF TERMS AND CONDITIONS -@end ifinfo - -@page -@unnumberedsec Applying These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the ``copyright'' line and a pointer to where the full notice is found. - -@smallexample -@var{one line to give the program's name and an idea of what it does.} -Copyright (C) 19@var{yy} @var{name of author} - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the -Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. -@end smallexample - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -@smallexample -Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details -type `show w'. This is free software, and you are welcome -to redistribute it under certain conditions; type `show c' -for details. -@end smallexample - -The hypothetical commands @samp{show w} and @samp{show c} should show -the appropriate parts of the General Public License. Of course, the -commands you use may be called something other than @samp{show w} and -@samp{show c}; they could even be mouse-clicks or menu items---whatever -suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a ``copyright disclaimer'' for the program, if -necessary. Here is a sample; alter the names: - -@example -Yoyodyne, Inc., hereby disclaims all copyright -interest in the program `Gnomovision' -(which makes passes at compilers) written -by James Hacker. - -@var{signature of Ty Coon}, 1 April 1989 -Ty Coon, President of Vice -@end example - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - -@node Index, , Copying, Top -@unnumbered Index - -@printindex cp - -@tex -% I think something like @colophon should be in texinfo. In the -% meantime: -\long\def\colophon{\hbox to0pt{}\vfill -\centerline{The body of this manual is set in} -\centerline{\fontname\tenrm,} -\centerline{with headings in {\bf\fontname\tenbf}} -\centerline{and examples in {\tt\fontname\tentt}.} -\centerline{{\it\fontname\tenit\/},} -\centerline{{\bf\fontname\tenbf}, and} -\centerline{{\sl\fontname\tensl\/}} -\centerline{are used for emphasis.}\vfill} -\page\colophon -% Blame: pesch@cygnus.com, 1991. -@end tex - -@contents -@bye diff --git a/gdb/doc/gdb.alter-m4 b/gdb/doc/gdb.alter-m4 index 56007dd..e69de29 100755 --- a/gdb/doc/gdb.alter-m4 +++ b/gdb/doc/gdb.alter-m4 @@ -1,205 +0,0 @@ -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Altering, _GDBN__ Files, Symbols, Top -@chapter Altering Execution - -Once you think you have found an error in the program, you might want to -find out for certain whether correcting the apparent error would lead to -correct results in the rest of the run. You can find the answer by -experiment, using the _GDBN__ features for altering execution of the -program. - -For example, you can store new values into variables or memory -locations, give the program a signal, restart it at a different address, -or even return prematurely from a function to its caller. - -@menu -* Assignment:: Assignment to Variables -* Jumping:: Continuing at a Different Address -* Signaling:: Giving the Program a Signal -* Returning:: Returning from a Function -* Calling:: Calling your Program's Functions -@end menu - -@node Assignment, Jumping, Altering, Altering -@section Assignment to Variables - -@cindex assignment -@cindex setting variables -To alter the value of a variable, evaluate an assignment expression. -@xref{Expressions}. For example, - -@example -print x=4 -@end example - -@noindent -would store the value 4 into the variable @code{x}, and then print the -value of the assignment expression (which is 4). All the assignment -operators of C are supported, including the increment operators -@samp{++} and @samp{--}, and combining assignments such as @samp{+=} and -_0__@samp{<<=}_1__. - -@kindex set -@kindex set variable -@cindex variables, setting -If you are not interested in seeing the value of the assignment, use the -@code{set} command instead of the @code{print} command. @code{set} is -really the same as @code{print} except that the expression's value is not -printed and is not put in the value history (@pxref{Value History}). The -expression is evaluated only for its effects. - -If the beginning of the argument string of the @code{set} command -appears identical to a @code{set} subcommand, use the @code{set -variable} command instead of just @code{set}. This command is identical -to @code{set} except for its lack of subcommands. For example, a -program might well have a variable @code{width}---which leads to -an error if we try to set a new value with just @samp{set width=13}, as -we might if @code{set width} didn't happen to be a _GDBN__ command: -@example -(_GDBP__) whatis width -type = double -(_GDBP__) p width -$4 = 13 -(_GDBP__) set width=47 -Invalid syntax in expression. -@end example -@noindent -The invalid expression, of course, is @samp{=47}. What we can do in -order to actually set our program's variable @code{width} is -@example -(_GDBP__) set var width=47 -@end example - -_GDBN__ allows more implicit conversions in assignments than C does; you can -freely store an integer value into a pointer variable or vice versa, and -any structure can be converted to any other structure that is the same -length or shorter. -@comment FIXME: how do structs align/pad in these conversions? -@comment /pesch@cygnus.com 18dec1990 - -To store values into arbitrary places in memory, use the @samp{@{@dots{}@}} -construct to generate a value of specified type at a specified address -(@pxref{Expressions}). For example, @code{@{int@}0x83040} refers -to memory location @code{0x83040} as an integer (which implies a certain size -and representation in memory), and - -@example -set @{int@}0x83040 = 4 -@end example - -@noindent -stores the value 4 into that memory location. - -@node Jumping, Signaling, Assignment, Altering -@section Continuing at a Different Address - -Ordinarily, when you continue the program, you do so at the place where -it stopped, with the @code{continue} command. You can instead continue at -an address of your own choosing, with the following commands: - -@table @code -@item jump @var{linespec} -@kindex jump -Resume execution at line @var{linespec}. Execution will stop -immediately if there is a breakpoint there. @xref{List} for a -description of the different forms of @var{linespec}. - -The @code{jump} command does not change the current stack frame, or -the stack pointer, or the contents of any memory location or any -register other than the program counter. If line @var{linespec} is in -a different function from the one currently executing, the results may -be bizarre if the two functions expect different patterns of arguments or -of local variables. For this reason, the @code{jump} command requests -confirmation if the specified line is not in the function currently -executing. However, even bizarre results are predictable if you are -well acquainted with the machine-language code of the program. - -@item jump *@var{address} -Resume execution at the instruction at address @var{address}. -@end table - -You can get much the same effect as the @code{jump} command by storing a -new value into the register @code{$pc}. The difference is that this -does not start the program running; it only changes the address where it -@emph{will} run when it is continued. For example, - -@example -set $pc = 0x485 -@end example - -@noindent -causes the next @code{continue} command or stepping command to execute at -address 0x485, rather than at the address where the program stopped. -@xref{Stepping}. - -The most common occasion to use the @code{jump} command is to back up, -perhaps with more breakpoints set, over a portion of a program that has -already executed, in order to examine its execution in more detail. - -@node Signaling, Returning, Jumping, Altering -@c @group -@section Giving the Program a Signal - -@table @code -@item signal @var{signalnum} -@kindex signal -Resume execution where the program stopped, but give it immediately the -signal number @var{signalnum}. - -Alternatively, if @var{signalnum} is zero, continue execution without -giving a signal. This is useful when the program stopped on account of -a signal and would ordinary see the signal when resumed with the -@code{continue} command; @samp{signal 0} causes it to resume without a -signal. - -@code{signal} does not repeat when you press @key{RET} a second time -after executing the command. -@end table -@c @end group - -@node Returning, Calling, Signaling, Altering -@section Returning from a Function - -@table @code -@item return -@itemx return @var{expression} -@cindex returning from a function -@kindex return -You can cancel execution of a function call with the @code{return} -command. If you give an -@var{expression} argument, its value is used as the function's return -value. -@end table - -When you use @code{return}, _GDBN__ discards the selected stack frame -(and all frames within it). You can think of this as making the -discarded frame return prematurely. If you wish to specify a value to -be returned, give that value as the argument to @code{return}. - -This pops the selected stack frame (@pxref{Selection}), and any other -frames inside of it, leaving its caller as the innermost remaining -frame. That frame becomes selected. The specified value is stored in -the registers used for returning values of functions. - -The @code{return} command does not resume execution; it leaves the -program stopped in the state that would exist if the function had just -returned. In contrast, the @code{finish} command (@pxref{Stepping}) -resumes execution until the selected stack frame returns naturally. - -@node Calling, , Returning, Altering -@section Calling your Program's Functions - -@cindex calling functions -@kindex call -@table @code -@item call @var{expr} -Evaluate the expression @var{expr} without displaying @code{void} -returned values. -@end table - -You can use this variant of the @code{print} command if you want to -execute a function from your program, but without cluttering the output -with @code{void} returned values. The result is printed and saved in -the value history, if it is not void. diff --git a/gdb/doc/gdb.bugs-m4 b/gdb/doc/gdb.bugs-m4 index 9647926..e69de29 100755 --- a/gdb/doc/gdb.bugs-m4 +++ b/gdb/doc/gdb.bugs-m4 @@ -1,221 +0,0 @@ -_dnl__ Copyright (c) 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node _GDBN__ Bugs, Renamed Commands, Emacs, Top -@chapter Reporting Bugs in _GDBN__ -@cindex Bugs in _GDBN__ -@cindex Reporting Bugs in _GDBN__ - -Your bug reports play an essential role in making _GDBN__ reliable. - -Reporting a bug may help you by bringing a solution to your problem, or it -may not. But in any case the principal function of a bug report is to help -the entire community by making the next version of _GDBN__ work better. Bug -reports are your contribution to the maintenance of _GDBN__. - -In order for a bug report to serve its purpose, you must include the -information that enables us to fix the bug. - -@menu -* Bug Criteria:: Have You Found a Bug? -* Bug Reporting:: How to Report Bugs -@end menu - -@node Bug Criteria, Bug Reporting, _GDBN__ Bugs, _GDBN__ Bugs -@section Have You Found a Bug? -@cindex Bug Criteria - -If you are not sure whether you have found a bug, here are some guidelines: - -@itemize @bullet -@item -@cindex Fatal Signal -@cindex Core Dump -If the debugger gets a fatal signal, for any input whatever, that is a -_GDBN__ bug. Reliable debuggers never crash. - -@item -@cindex error on Valid Input -If _GDBN__ produces an error message for valid input, that is a bug. - -@item -@cindex Invalid Input -If _GDBN__ does not produce an error message for invalid input, -that is a bug. However, you should note that your idea of -``invalid input'' might be our idea of ``an extension'' or ``support -for traditional practice''. - -@item -If you are an experienced user of debugging tools, your suggestions -for improvement of _GDBN__ are welcome in any case. -@end itemize - -@node Bug Reporting, , Bug Criteria, _GDBN__ Bugs -@section How to Report Bugs -@cindex Bug Reports -@cindex Compiler Bugs, Reporting - -A number of companies and individuals offer support for GNU products. -If you obtained _GDBN__ from a support organization, we recommend you -contact that organization first. - -Contact information for many support companies and individuals is -available in the file @file{etc/SERVICE} in the GNU Emacs distribution. - -In any event, we also recommend that you send bug reports for _GDBN__ to one -of these addresses: - -@example -bug-gdb@@prep.ai.mit.edu -@{ucbvax|mit-eddie|uunet@}!prep.ai.mit.edu!bug-gdb -@end example - -@strong{Do not send bug reports to @samp{info-gdb}, or to -@samp{help-gdb}, or to any newsgroups.} Most users of _GDBN__ do not want to -receive bug reports. Those that do, have arranged to receive @samp{bug-gdb}. - -The mailing list @samp{bug-gdb} has a newsgroup which serves as a -repeater. The mailing list and the newsgroup carry exactly the same -messages. Often people think of posting bug reports to the newsgroup -instead of mailing them. This appears to work, but it has one problem -which can be crucial: a newsgroup posting often lacks a mail path -back to the sender. Thus, if we need to ask for more information, we -may be unable to reach you. For this reason, it is better to send bug -reports to the mailing list. - -As a last resort, send bug reports on paper to: - -@example -GNU Debugger Bugs -545 Tech Square -Cambridge, MA 02139 -@end example - -The fundamental principle of reporting bugs usefully is this: -@strong{report all the facts}. If you are not sure whether to state a -fact or leave it out, state it! - -Often people omit facts because they think they know what causes the -problem and assume that some details don't matter. Thus, you might -assume that the name of the variable you use in an example does not matter. -Well, probably it doesn't, but one cannot be sure. Perhaps the bug is a -stray memory reference which happens to fetch from the location where that -name is stored in memory; perhaps, if the name were different, the contents -of that location would fool the debugger into doing the right thing despite -the bug. Play it safe and give a specific, complete example. That is the -easiest thing for you to do, and the most helpful. - -Keep in mind that the purpose of a bug report is to enable us to fix -the bug if it is new to us. It isn't as important what happens if -the bug is already known. Therefore, always write your bug reports on -the assumption that the bug has not been reported previously. - -Sometimes people give a few sketchy facts and ask, ``Does this ring a -bell?'' Those bug reports are useless, and we urge everyone to -@emph{refuse to respond to them} except to chide the sender to report -bugs properly. - -To enable us to fix the bug, you should include all these things: - -@itemize @bullet -@item -The version of _GDBN__. _GDBN__ announces it if you start with no -arguments; you can also print it at any time using @code{show version}. - -Without this, we won't know whether there is any point in looking for -the bug in the current version of _GDBN__. - -@item -A complete input script, and all necessary source files, that will -reproduce the bug. - -@item -What compiler (and its version) was used to compile _GDBN__---e.g. -``_GCC__-1.37.1''. - -@item -The command arguments you gave the compiler to compile your example and -observe the bug. For example, did you use @samp{-O}? To guarantee -you won't omit something important, list them all. - -If we were to try to guess the arguments, we would probably guess wrong -and then we might not encounter the bug. - -@item -The type of machine you are using, and the operating system name and -version number. - -@item -A description of what behavior you observe that you believe is -incorrect. For example, ``It gets a fatal signal.'' - -Of course, if the bug is that _GDBN__ gets a fatal signal, then we will -certainly notice it. But if the bug is incorrect output, we might not -notice unless it is glaringly wrong. We are human, after all. You -might as well not give us a chance to make a mistake. - -Even if the problem you experience is a fatal signal, you should still -say so explicitly. Suppose something strange is going on, such as, -your copy of _GDBN__ is out of synch, or you have encountered a -bug in the C library on your system. (This has happened!) Your copy -might crash and ours would not. If you told us to expect a crash, -then when ours fails to crash, we would know that the bug was not -happening for us. If you had not told us to expect a crash, then we -would not be able to draw any conclusion from our observations. - -@item -If you wish to suggest changes to the _GDBN__ source, send us context -diffs. If you even discuss something in the _GDBN__ source, refer to -it by context, not by line number. - -The line numbers in our development sources won't match those in your -sources. Your line numbers would convey no useful information to us. - -@end itemize - -Here are some things that are not necessary: - -@itemize @bullet -@item -A description of the envelope of the bug. - -Often people who encounter a bug spend a lot of time investigating -which changes to the input file will make the bug go away and which -changes will not affect it. - -This is often time consuming and not very useful, because the way we -will find the bug is by running a single example under the debugger -with breakpoints, not by pure deduction from a series of examples. -We recommend that you save your time for something else. - -Of course, if you can find a simpler example to report @emph{instead} -of the original one, that is a convenience for us. Errors in the -output will be easier to spot, running under the debugger will take -less time, etc. - -However, simplification is not vital; if you don't want to do this, -report the bug anyway and send us the entire test case you used. - -@item -A patch for the bug. - -A patch for the bug does help us if it is a good one. But don't omit -the necessary information, such as the test case, on the assumption that -a patch is all we need. We might see problems with your patch and decide -to fix the problem another way, or we might not understand it at all. - -Sometimes with a program as complicated as _GDBN__ it is very hard to -construct an example that will make the program follow a certain path -through the code. If you don't send us the example, we won't be able -to construct one, so we won't be able to verify that the bug is fixed. - -And if we can't understand what bug you are trying to fix, or why your -patch should be an improvement, we won't install it. A test case will -help us to understand. - -@item -A guess about what the bug is or what it depends on. - -Such guesses are usually wrong. Even we can't guess right about such -things without first using the debugger to find the facts. -@end itemize diff --git a/gdb/doc/gdb.canned-m4 b/gdb/doc/gdb.canned-m4 index 4cbb8f4..e69de29 100755 --- a/gdb/doc/gdb.canned-m4 +++ b/gdb/doc/gdb.canned-m4 @@ -1,178 +0,0 @@ -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Sequences, Emacs, Controlling _GDBN__, Top -@chapter Canned Sequences of Commands - -Aside from breakpoint commands (@pxref{Break Commands}), _GDBN__ provides two -ways to store sequences of commands for execution as a unit: -user-defined commands and command files. - -@menu -* Define:: User-Defined Commands -* Command Files:: Command Files -* Output:: Commands for Controlled Output -@end menu - -@node Define, Command Files, Sequences, Sequences -@section User-Defined Commands - -@cindex user-defined command -A @dfn{user-defined command} is a sequence of _GDBN__ commands to which you -assign a new name as a command. This is done with the @code{define} -command. - -@table @code -@item define @var{commandname} -@kindex define -Define a command named @var{commandname}. If there is already a command -by that name, you are asked to confirm that you want to redefine it. - -The definition of the command is made up of other _GDBN__ command lines, -which are given following the @code{define} command. The end of these -commands is marked by a line containing @code{end}. - -@item document @var{commandname} -@kindex document -Give documentation to the user-defined command @var{commandname}. The -command @var{commandname} must already be defined. This command reads -lines of documentation just as @code{define} reads the lines of the -command definition, ending with @code{end}. After the @code{document} -command is finished, @code{help} on command @var{commandname} will print -the documentation you have specified. - -You may use the @code{document} command again to change the -documentation of a command. Redefining the command with @code{define} -does not change the documentation. - -@item help user-defined -@kindex help user-defined -List all user-defined commands, with the first line of the documentation -(if any) for each. - -@item info user -@itemx info user @var{commandname} -@kindex info user -Display the _GDBN__ commands used to define @var{commandname} (but not its -documentation). If no @var{commandname} is given, display the -definitions for all user-defined commands. -@end table - -User-defined commands do not take arguments. When they are executed, the -commands of the definition are not printed. An error in any command -stops execution of the user-defined command. - -Commands that would ask for confirmation if used interactively proceed -without asking when used inside a user-defined command. Many _GDBN__ commands -that normally print messages to say what they are doing omit the messages -when used in a user-defined command. - -@node Command Files, Output, Define, Sequences -@section Command Files - -@cindex command files -A command file for _GDBN__ is a file of lines that are _GDBN__ commands. Comments -(lines starting with @kbd{#}) may also be included. An empty line in a -command file does nothing; it does not mean to repeat the last command, as -it would from the terminal. - -@cindex init file -@cindex @file{_GDBINIT__} -When you start _GDBN__, it automatically executes commands from its -@dfn{init files}. These are files named @file{_GDBINIT__}. _GDBN__ -reads the init file (if any) in your home directory and then the init -file (if any) in the current working directory. (The init files are not -executed if you use the @samp{-nx} option; @pxref{Mode Options}.) You -can also request the execution of a command file with the @code{source} -command: - -@table @code -@item source @var{filename} -@kindex source -Execute the command file @var{filename}. -@end table - -The lines in a command file are executed sequentially. They are not -printed as they are executed. An error in any command terminates execution -of the command file. - -Commands that would ask for confirmation if used interactively proceed -without asking when used in a command file. Many _GDBN__ commands that -normally print messages to say what they are doing omit the messages -when called from command files. - -@node Output, , Command Files, Sequences -@section Commands for Controlled Output - -During the execution of a command file or a user-defined command, normal -_GDBN__ output is suppressed; the only output that appears is what is -explicitly printed by the commands in the definition. This section -describes three commands useful for generating exactly the output you -want. - -@table @code -@item echo @var{text} -@kindex echo -@c I don't consider backslash-space a standard C escape sequence -@c because it's not in ANSI. -Print @var{text}. Nonprinting characters can be included in @var{text} -using C escape sequences, such as @samp{\n} to print a newline. @b{No -newline will be printed unless you specify one.} In addition to the -standard C escape sequences, a backslash followed by a space stands for a -space. This is useful for outputting a string with spaces at the -beginning or the end, since leading and trailing spaces are otherwise -trimmed from all arguments. Thus, to print @samp{@ and foo =@ }, use the -command @samp{echo \@ and foo = \@ }. -@c FIXME: verify hard copy actually issues enspaces for '@ '! Will this -@c confuse texinfo? - -A backslash at the end of @var{text} can be used, as in C, to continue -the command onto subsequent lines. For example, - -@example -echo This is some text\n\ -which is continued\n\ -onto several lines.\n -@end example - -produces the same output as - -@example -echo This is some text\n -echo which is continued\n -echo onto several lines.\n -@end example - -@item output @var{expression} -@kindex output -Print the value of @var{expression} and nothing but that value: no -newlines, no @samp{$@var{nn} = }. The value is not entered in the -value history either. @xref{Expressions} for more information on -expressions. - -@item output/@var{fmt} @var{expression} -Print the value of @var{expression} in format @var{fmt}. You can use -the same formats as for @code{print}; @pxref{Output formats}, for more -information. - -@item printf @var{string}, @var{expressions}@dots{} -@kindex printf -Print the values of the @var{expressions} under the control of -@var{string}. The @var{expressions} are separated by commas and may -be either numbers or pointers. Their values are printed as specified -by @var{string}, exactly as if the program were to execute - -@example -printf (@var{string}, @var{expressions}@dots{}); -@end example - -For example, you can print two values in hex like this: - -@example -printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo -@end example - -The only backslash-escape sequences that you can use in the format -string are the simple ones that consist of backslash followed by a -letter. -@end table diff --git a/gdb/doc/gdb.cmds-m4 b/gdb/doc/gdb.cmds-m4 index 1020258..e69de29 100755 --- a/gdb/doc/gdb.cmds-m4 +++ b/gdb/doc/gdb.cmds-m4 @@ -1,160 +0,0 @@ -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Commands, Running, Invocation, Top -@chapter _GDBN__ Commands - -@menu -* Command Syntax:: Command Syntax -* Help:: Getting Help -@end menu - -@node Command Syntax, Help, Commands, Commands -@section Command Syntax -A _GDBN__ command is a single line of input. There is no limit on how long -it can be. It starts with a command name, which is followed by arguments -whose meaning depends on the command name. For example, the command -@code{step} accepts an argument which is the number of times to step, -as in @samp{step 5}. You can also use the @code{step} command with -no arguments. Some command names do not allow any arguments. - -@cindex abbreviation -_GDBN__ command names may always be truncated if that abbreviation is -unambiguous. Other possible command abbreviations are listed in the -documentation for individual commands. Sometimes even ambiguous -abbreviations are allowed; for example, @code{s} is specially defined as -equivalent to @code{step} even though there are other commands whose -names start with @code{s}. - -@cindex repeating commands -A blank line as input to _GDBN__ means to repeat the previous command. -Certain commands (for example, @code{run}) will not repeat this way; -these are commands for which unintentional repetition might cause -trouble and which you are unlikely to want to repeat. - -The @code{list} and @code{x} commands construct new arguments when -repeated, rather than repeating exactly as typed, to permit easy -scanning of source or memory. - -@kindex # -@cindex comment -A line of input starting with @kbd{#} is a comment; it does nothing. -This is useful mainly in command files (@xref{Command Files}). - -@node Help, , Command Syntax, Commands -@section Getting Help -@cindex online documentation -@kindex help -You can always ask _GDBN__ itself for information on its commands, using the -command @code{help}. - -@table @code -@item help -@itemx h -@kindex h -You can use @code{help} (abbreviated @code{h}) with no arguments to -display a short list of named categories of commands: -@smallexample -(_GDBP__) help -List of classes of commands: - -running -- Running the program -stack -- Examining the stack -data -- Examining data -breakpoints -- Making program stop at certain points -files -- Specifying and examining files -status -- Status inquiries -support -- Support facilities -user-defined -- User-defined commands -aliases -- Aliases of other commands -obscure -- Obscure features - -Type "help" followed by a class name for a list of commands in that class. -Type "help" followed by command name for full documentation. -Command name abbreviations are allowed if unambiguous. -(_GDBP__) -@end smallexample - -@item help @var{category} -Using one of the general help categories as an argument, you can get a -list of the individual commands in a category. For example, here is the -help display for category @code{status}: -@smallexample -(_GDBP__) help status -Status inquiries. - -List of commands: - -show -- Generic command for showing things set with "set" -info -- Generic command for printing status - -Type "help" followed by command name for full documentation. -Command name abbreviations are allowed if unambiguous. -(_GDBP__) -@end smallexample - -@item help @var{command} -With a command name as @code{help} argument, _GDBN__ will display a -short paragraph on how to use that command. -@end table - -In addition to @code{help}, you can use the _GDBN__ commands @code{info} -and @code{show} to inquire about the state of your program, or the state -of _GDBN__ itself. Both commands support many topics of inquiry; this -manual introduces each of them in the appropriate context. The listings -under @code{info} and under @code{show} in the Index point to -all the sub-commands. -@c FIXME: @pxref{Index} used to be here, but even though it shows up in -@c FIXME...the 'aux' file with a pageno the xref can't find it. - -@c @group -@table @code -@item info -@kindex info -@kindex i -This command (abbreviated @code{i}) is for describing the state of your -program; for example, it can list the arguments given to your program -(@code{info args}), the registers currently in use (@code{info -registers}), or the breakpoints you've set (@code{info breakpoints}). -You can get a complete list of the @code{info} sub-commands with -@w{@code{help info}}. - -@kindex show -@item show -In contrast, @code{show} is for describing the state of _GDBN__ itself. -You can change most of the things you can @code{show}, by using the -related command @code{set}; for example, you can control what number -system is used for displays with @code{set radix}, or simply inquire -which is currently in use with @code{show radix}. - -@kindex info set -To display all the settable parameters and their current -values, you can use @code{show} with no arguments; you may also use -@code{info set}. Both commands produce the same display. -@c FIXME: "info set" violates the rule that "info" is for state of -@c FIXME...program. Ck w/ GNU: "info set" to be called something else, -@c FIXME...or change desc of rule---eg "state of prog and debugging session"? -@end table -@c @end group - -Here are three miscellaneous @code{show} subcommands, all of which are -exceptional in lacking corresponding @code{set} commands: - -@table @code -@kindex show version -@item show version -Show what version of _GDBN__ is running. You should include this -information in _GDBN__ bug-reports. If multiple versions of _GDBN__ are -in use at your site, you may occasionally want to make sure what version -of _GDBN__ you're running; as _GDBN__ evolves, new commands are -introduced, and old ones may wither away. The version number is also -announced when you start _GDBN__ with no arguments. - -@kindex show copying -@item show copying -Display information about permission for copying _GDBN__. - -@kindex show warranty -@item show warranty -Display the GNU ``NO WARRANTY'' statement. -@end table diff --git a/gdb/doc/gdb.ctl-m4 b/gdb/doc/gdb.ctl-m4 index 4ff4a16..e69de29 100755 --- a/gdb/doc/gdb.ctl-m4 +++ b/gdb/doc/gdb.ctl-m4 @@ -1,306 +0,0 @@ -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Controlling _GDBN__, Sequences, Targets, Top -@chapter Controlling _GDBN__ - -You can alter many aspects of _GDBN__'s interaction with you by using -the @code{set} command. For commands controlling how _GDBN__ displays -data, @pxref{Print Settings}; other settings are described here. - -@menu -* Prompt:: Prompt -* Editing:: Command Editing -* History:: Command History -* Screen Size:: Screen Size -* Numbers:: Numbers -* Messages/Warnings:: Optional Warnings and Messages -@end menu - -@node Prompt, Editing, Controlling _GDBN__, Controlling _GDBN__ -@section Prompt -@cindex prompt -_GDBN__ indicates its readiness to read a command by printing a string -called the @dfn{prompt}. This string is normally @samp{(_GDBP__)}. You -can change the prompt string with the @code{set prompt} command. For -instance, when debugging _GDBN__ with _GDBN__, it is useful to change -the prompt in one of the _GDBN__<>s so that you can always tell which -one you are talking to. - -@table @code -@item set prompt @var{newprompt} -@kindex set prompt -Directs _GDBN__ to use @var{newprompt} as its prompt string henceforth. -@kindex show prompt -@item show prompt -Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}} -@end table - -@node Editing, History, Prompt, Controlling _GDBN__ -@section Command Editing -@cindex readline -@cindex command line editing -_GDBN__ reads its input commands via the @dfn{readline} interface. This -GNU library provides consistent behavior for programs which provide a -command line interface to the user. Advantages are @code{emacs}-style -or @code{vi}-style inline editing of commands, @code{csh}-like history -substitution, and a storage and recall of command history across -debugging sessions. - -You may control the behavior of command line editing in _GDBN__ with the -command @code{set}. - -@table @code -@kindex set editing -@cindex editing -@item set editing -@itemx set editing on -Enable command line editing (enabled by default). - -@item set editing off -Disable command line editing. - -@kindex show editing -@item show editing -Show whether command line editing is enabled. -@end table - -@node History, Screen Size, Editing, Controlling _GDBN__ -@section Command History -@table @code -@cindex history substitution -@cindex history file -@kindex set history filename -@item set history filename @var{fname} -Set the name of the _GDBN__ command history file to @var{fname}. This is -the file from which _GDBN__ will read an initial command history -list or to which it will write this list when it exits. This list is -accessed through history expansion or through the history -command editing characters listed below. This file defaults to the -value of the environment variable @code{GDBHISTFILE}, or to -@file{./.gdb_history} if this variable is not set. - -@cindex history save -@kindex set history save -@item set history save -@itemx set history save on -Record command history in a file, whose name may be specified with the -@code{set history filename} command. By default, this option is disabled. - -@item set history save off -Stop recording command history in a file. - -@cindex history size -@kindex set history size -@item set history size @var{size} -Set the number of commands which _GDBN__ will keep in its history list. -This defaults to the value of the environment variable -@code{HISTSIZE}, or to 256 if this variable is not set. -@end table - -@cindex history expansion -History expansion assigns special meaning to the character @kbd{!}. -@iftex -(@xref{Event Designators}.) -@end iftex -Since @kbd{!} is also the logical not operator in C, history expansion -is off by default. If you decide to enable history expansion with the -@code{set history expansion on} command, you may sometimes need to -follow @kbd{!} (when it is used as logical not, in an expression) with -a space or a tab to prevent it from being expanded. The readline -history facilities will not attempt substitution on the strings -@kbd{!=} and @kbd{!(}, even when history expansion is enabled. - -The commands to control history expansion are: - -@table @code - -@kindex set history expansion -@item set history expansion on -@itemx set history expansion -Enable history expansion. History expansion is off by default. - -@item set history expansion off -Disable history expansion. - -The readline code comes with more complete documentation of -editing and history expansion features. Users unfamiliar with @code{emacs} -or @code{vi} may wish to read it. -@iftex -@xref{Command Line Editing}. -@end iftex - -@c @group -@kindex show history -@item show history -@itemx show history filename -@itemx show history save -@itemx show history size -@itemx show history expansion -These commands display the state of the _GDBN__ history parameters. -@code{show history} by itself displays all four states. -@c @end group - -@end table - -@table @code -@kindex show commands -@item show commands -Display the last ten commands in the command history. - -@item show commands @var{n} -Print ten commands centered on command number @var{n}. - -@item show commands + -Print ten commands just after the commands last printed. - -@end table - -@node Screen Size, Numbers, History, Controlling _GDBN__ -@section Screen Size -@cindex size of screen -@cindex pauses in output -Certain commands to _GDBN__ may produce large amounts of information -output to the screen. To help you read all of it, _GDBN__ pauses and -asks you for input at the end of each page of output. Type @key{RET} -when you want to continue the output. _GDBN__ also uses the screen -width setting to determine when to wrap lines of output. Depending on -what is being printed, it tries to break the line at a readable place, -rather than simply letting it overflow onto the following line. - -Normally _GDBN__ knows the size of the screen from the termcap data base -together with the value of the @code{TERM} environment variable and the -@code{stty rows} and @code{stty cols} settings. If this is not correct, -you can override it with the @code{set height} and @code{set -width} commands: - -@table @code -@item set height @var{lpp} -@itemx show height -@itemx set width @var{cpl} -@itemx show width -@kindex set height -@kindex set width -@kindex show width -@kindex show height -These @code{set} commands specify a screen height of @var{lpp} lines and -a screen width of @var{cpl} characters. The associated @code{show} -commands display the current settings. - -If you specify a height of zero lines, _GDBN__ will not pause during output -no matter how long the output is. This is useful if output is to a file -or to an editor buffer. -@end table - -@node Numbers, Messages/Warnings, Screen Size, Controlling _GDBN__ -@section Numbers -@cindex number representation -@cindex entering numbers -You can always enter numbers in octal, decimal, or hexadecimal in _GDBN__ by -the usual conventions: octal numbers begin with @samp{0}, decimal -numbers end with @samp{.}, and hexadecimal numbers begin with @samp{0x}. -Numbers that begin with none of these are, by default, entered in base -10; likewise, the default display for numbers---when no particular -format is specified---is base 10. You can change the default base for -both input and output with the @code{set radix} command. - -@table @code -@kindex set radix -@item set radix @var{base} -Set the default base for numeric input and display. Supported choices -for @var{base} are decimal 8, 10, 16. @var{base} must itself be -specified either unambiguously or using the current default radix; for -example, any of - -@example -set radix 012 -set radix 10. -set radix 0xa -@end example - -@noindent -will set the base to decimal. On the other hand, @samp{set radix 10} -will leave the radix unchanged no matter what it was. - -@kindex show radix -@item show radix -Display the current default base for numeric input and display. - -@end table - -@node Messages/Warnings, , Numbers, Controlling _GDBN__ -@section Optional Warnings and Messages -By default, _GDBN__ is silent about its inner workings. If you are running -on a slow machine, you may want to use the @code{set verbose} command. -It will make _GDBN__ tell you when it does a lengthy internal operation, so -you won't think it has crashed. - -Currently, the messages controlled by @code{set verbose} are those which -announce that the symbol table for a source file is being read -(@pxref{Files}, in the description of the command -@code{symbol-file}). -@c The following is the right way to do it, but emacs 18.55 doesn't support -@c @ref, and neither the emacs lisp manual version of texinfmt or makeinfo -@c is released. -@ignore -see @code{symbol-file} in @ref{Files}). -@end ignore - -@table @code -@kindex set verbose -@item set verbose on -Enables _GDBN__'s output of certain informational messages. - -@item set verbose off -Disables _GDBN__'s output of certain informational messages. - -@kindex show verbose -@item show verbose -Displays whether @code{set verbose} is on or off. -@end table - -By default, if _GDBN__ encounters bugs in the symbol table of an object file, -it prints a single message about each type of problem it finds, then -shuts up (@pxref{Symbol Errors}). You can suppress these messages, or allow more than one such -message to be printed if you want to see how frequent the problems are. - -@table @code -@kindex set complaints -@item set complaints @var{limit} -Permits _GDBN__ to output @var{limit} complaints about each type of unusual -symbols before becoming silent about the problem. Set @var{limit} to -zero to suppress all complaints; set it to a large number to prevent -complaints from being suppressed. - -@kindex show complaints -@item show complaints -Displays how many symbol complaints _GDBN__ is permitted to produce. -@end table - -By default, _GDBN__ is cautious, and asks what sometimes seem to be a -lot of stupid questions to confirm certain commands. For example, if -you try to run a program which is already running: -@example -(_GDBP__) run -The program being debugged has been started already. -Start it from the beginning? (y or n) -@end example - -If you're willing to unflinchingly face the consequences of your own -commands, you can disable this ``feature'': - -@table @code -@kindex set confirm -@cindex flinching -@cindex confirmation -@cindex stupid questions -@item set confirm off -Disables confirmation requests. - -@item set confirm on -Enables confirmation requests (the default). - -@item show confirm -@kindex show confirm -Displays state of confirmation requests. -@end table diff --git a/gdb/doc/gdb.data-m4 b/gdb/doc/gdb.data-m4 index 9c74f60..e69de29 100755 --- a/gdb/doc/gdb.data-m4 +++ b/gdb/doc/gdb.data-m4 @@ -1,926 +0,0 @@ -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Data, Symbols, Source, Top -@chapter Examining Data - -@cindex printing data -@cindex examining data -@kindex print -@kindex inspect -@c "inspect" isn't quite a synonym if you're using Epoch, which we don't -@c document because it's nonstandard... Under Epoch it displays in a -@c different window or something like that. -The usual way to examine data in your program is with the @code{print} -command (abbreviated @code{p}), or its synonym @code{inspect}. It -evaluates and prints the value of any valid expression of the language -the program is written in (for now, C or C++). You type - -@example -print @var{exp} -@end example - -@noindent -where @var{exp} is any valid expression (in the source language), and -the value of @var{exp} is printed in a format appropriate to its data -type. - -A more low-level way of examining data is with the @code{x} command. -It examines data in memory at a specified address and prints it in a -specified format. @xref{Memory}. - -@menu -* Expressions:: Expressions -* Variables:: Program Variables -* Arrays:: Artificial Arrays -* Output formats:: Output formats -* Memory:: Examining Memory -* Auto Display:: Automatic Display -* Print Settings:: Print Settings -* Value History:: Value History -* Convenience Vars:: Convenience Variables -* Registers:: Registers -* Floating Point Hardware:: Floating Point Hardware -@end menu - -@node Expressions, Variables, Data, Data -@section Expressions - -@cindex expressions -@code{print} and many other _GDBN__ commands accept an expression and -compute its value. Any kind of constant, variable or operator defined -by the programming language you are using is legal in an expression in -_GDBN__. This includes conditional expressions, function calls, casts -and string constants. It unfortunately does not include symbols defined -by preprocessor @code{#define} commands, or C++ expressions involving -@samp{::}, the name resolution operator. -@c FIXME: actually C++ a::b works except in obscure circumstances where it -@c FIXME...can conflict with GDB's own name scope resolution. - -Casts are supported in all languages, not just in C, because it is so -useful to cast a number into a pointer so as to examine a structure -at that address in memory. - -_GDBN__ supports three kinds of operator in addition to those of programming -languages: - -@table @code -@item @@ -@samp{@@} is a binary operator for treating parts of memory as arrays. -@xref{Arrays}, for more information. - -@item :: -@samp{::} allows you to specify a variable in terms of the file or -function where it is defined. @xref{Variables}. - -@item @{@var{type}@} @var{addr} -Refers to an object of type @var{type} stored at address @var{addr} in -memory. @var{addr} may be any expression whose value is an integer or -pointer (but parentheses are required around binary operators, just as in -a cast). This construct is allowed regardless of what kind of data is -normally supposed to reside at @var{addr}.@refill -@end table - -@node Variables, Arrays, Expressions, Data -@section Program Variables - -The most common kind of expression to use is the name of a variable -in your program. - -Variables in expressions are understood in the selected stack frame -(@pxref{Selection}); they must either be global (or static) or be visible -according to the scope rules of the programming language from the point of -execution in that frame. This means that in the function - -@example -foo (a) - int a; -@{ - bar (a); - @{ - int b = test (); - bar (b); - @} -@} -@end example - -@noindent -the variable @code{a} is usable whenever the program is executing -within the function @code{foo}, but the variable @code{b} is visible -only while the program is executing inside the block in which @code{b} -is declared. - -@cindex variable name conflict -There is an exception: you can refer to a variable or function whose -scope is a single source file even if the current execution point is not -in this file. But it is possible to have more than one such variable or -function with the same name (in different source files). If that happens, -referring to that name has unpredictable effects. If you wish, you can -specify a variable in a particular file, using the colon-colon notation: - -@cindex colon-colon -@kindex :: -@example -@var{file}::@var{variable} -@end example - -@noindent -Here @var{file} is the name of the source file whose variable you want. - -@cindex C++ name resolution -This use of @samp{::} is very rarely in conflict with the very similar -use of the same notation in C++. _GDBN__ also supports use of the C++ -name resolution operator in _GDBN__ expressions. - -@node Arrays, Output formats, Variables, Data -@section Artificial Arrays - -@cindex artificial array -@kindex @@ -It is often useful to print out several successive objects of the -same type in memory; a section of an array, or an array of -dynamically determined size for which only a pointer exists in the -program. - -This can be done by constructing an @dfn{artificial array} with the -binary operator @samp{@@}. The left operand of @samp{@@} should be -the first element of the desired array, as an individual object. -The right operand should be the desired length of the array. The result is -an array value whose elements are all of the type of the left argument. -The first element is actually the left argument; the second element -comes from bytes of memory immediately following those that hold the -first element, and so on. Here is an example. If a program says - -@example -int *array = (int *) malloc (len * sizeof (int)); -@end example - -@noindent -you can print the contents of @code{array} with - -@example -p *array@@len -@end example - -The left operand of @samp{@@} must reside in memory. Array values made -with @samp{@@} in this way behave just like other arrays in terms of -subscripting, and are coerced to pointers when used in expressions. -Artificial arrays most often appear in expressions via the value history -(@pxref{Value History}), after printing one out.) - -@node Output formats, Memory, Arrays, Data -@section Output formats - -@cindex formatted output -@cindex output formats -By default, _GDBN__ prints a value according to its data type. Sometimes -this is not what you want. For example, you might want to print a number -in hex, or a pointer in decimal. Or you might want to view data in memory -at a certain address as a character string or as an instruction. To do -these things, specify an @dfn{output format} when you print a value. - -The simplest use of output formats is to say how to print a value -already computed. This is done by starting the arguments of the -@code{print} command with a slash and a format letter. The format -letters supported are: - -@table @code -@item x -Regard the bits of the value as an integer, and print the integer in -hexadecimal. - -@item d -Print as integer in signed decimal. - -@item u -Print as integer in unsigned decimal. - -@item o -Print as integer in octal. - -@item t -Print as integer in binary. The letter @samp{t} stands for ``two''. - -@item a -Print as an address, both absolute in hex and as an offset from the -nearest preceding symbol. This format can be used to discover where (in -what function) an unknown address is located: -@example -(_GDBP__) p/a 0x54320 -_0__$3 = 0x54320 <_initialize_vx+396>_1__ -@end example - - -@item c -Regard as an integer and print it as a character constant. - -@item f -Regard the bits of the value as a floating point number and print -using typical floating point syntax. -@end table - -For example, to print the program counter in hex (@pxref{Registers}), type - -@example -p/x $pc -@end example - -@noindent -Note that no space is required before the slash; this is because command -names in _GDBN__ cannot contain a slash. - -To reprint the last value in the value history with a different format, -you can use the @code{print} command with just a format and no -expression. For example, @samp{p/x} reprints the last value in hex. - -@node Memory, Auto Display, Output formats, Data -@section Examining Memory - -@cindex examining memory -@table @code -@kindex x -@item x/@var{nfu} @var{expr} -The command @code{x} (for `examine') can be used to examine memory -without being constrained by your program's data types. You can specify -the unit size @var{u} of memory to inspect, and a repeat count @var{n} of how -many of those units to display. @code{x} understands the formats -@var{f} used by @code{print}; two additional formats, @samp{s} (string) -and @samp{i} (machine instruction) can be used without specifying a unit -size. -@end table - -For example, @samp{x/3uh 0x54320} is a request to display three halfwords -(@code{h}) of memory, formatted as unsigned decimal integers (@samp{u}), -starting at address @code{0x54320}. @samp{x/4xw $sp} prints the four -words (@samp{w}) of memory above the stack pointer (here, @samp{$sp}; -@pxref{Registers}) in hexadecimal (@samp{x}). - -Since the letters indicating unit sizes are all distinct from the -letters specifying output formats, you don't have to remember whether -unit size or format comes first; either order will work. The output -specifications @samp{4xw} and @samp{4wx} mean exactly the same thing. - -After the format specification, you supply an expression for the address -where _GDBN__ is to begin reading from memory. The expression need not -have a pointer value (though it may); it is always interpreted as an -integer address of a byte of memory. @xref{Expressions} for more -information on expressions. - -These are the memory units @var{u} you can specify with the @code{x} -command: - -@table @code -@item b -Examine individual bytes. - -@item h -Examine halfwords (two bytes each). - -@item w -Examine words (four bytes each). - -@cindex word -Many assemblers and cpu designers still use `word' for a 16-bit quantity, -as a holdover from specific predecessor machines of the 1970's that really -did use two-byte words. But more generally the term `word' has always -referred to the size of quantity that a machine normally operates on and -stores in its registers. This is 32 bits for all the machines that _GDBN__ -runs on. - -@item g -Examine giant words (8 bytes). -@end table - -You can combine these unit specifications with any of the formats -described for @code{print}. @xref{Output formats}. - -@code{x} has two additional output specifications which derive the unit -size from the data inspected: - -@table @code -@item s -Print a null-terminated string of characters. Any explicitly specified -unit size is ignored; instead, the unit is however many bytes it takes -to reach a null character (including the null character). - -@item i -Print a machine instruction in assembler syntax (or nearly). Any -specified unit size is ignored; the number of bytes in an instruction -varies depending on the type of machine, the opcode and the addressing -modes used. The command @code{disassemble} gives an alternative way of -inspecting machine instructions. @xref{Machine Code}. -@end table - -If you omit either the format @var{f} or the unit size @var{u}, @code{x} -will use the same one that was used last. If you don't use any letters -or digits after the slash, you can omit the slash as well. - -You can also omit the address to examine. Then the address used is just -after the last unit examined. This is why string and instruction -formats actually compute a unit-size based on the data: so that the next -string or instruction examined will start in the right place. - -When the @code{print} command shows a value that resides in memory, -@code{print} also sets the default address for the @code{x} command. -@code{info line} also sets the default for @code{x}, to the address of -the start of the machine code for the specified line (@pxref{Machine -Code}), and @code{info breakpoints} sets it to the address of the last -breakpoint listed (@pxref{Set Breaks}). - -When you use @key{RET} to repeat an @code{x} command, the address -specified previously (if any) is ignored, so that the repeated command -examines the successive locations in memory rather than the same ones. - -You can examine several consecutive units of memory with one command by -writing a repeat-count after the slash (before the format letters, if -any). Omitting the repeat count @var{n} displays one unit of the -appropriate size. The repeat count must be a decimal integer. It has -the same effect as repeating the @code{x} command @var{n} times except -that the output may be more compact, with several units per line. For -example, - -@example -x/10i $pc -@end example - -@noindent -prints ten instructions starting with the one to be executed next in the -selected frame. After doing this, you could print a further seven -instructions with - -@example -x/7 -@end example - -@noindent ----where the format and address are allowed to default. - -@kindex $_ -@kindex $__ -The addresses and contents printed by the @code{x} command are not put -in the value history because there is often too much of them and they -would get in the way. Instead, _GDBN__ makes these values available for -subsequent use in expressions as values of the convenience variables -@code{$_} and @code{$__}. After an @code{x} command, the last address -examined is available for use in expressions in the convenience variable -@code{$_}. The contents of that address, as examined, are available in -the convenience variable @code{$__}. - -If the @code{x} command has a repeat count, the address and contents saved -are from the last memory unit printed; this is not the same as the last -address printed if several units were printed on the last line of output. - -@node Auto Display, Print Settings, Memory, Data -@section Automatic Display -@cindex automatic display -@cindex display of expressions - -If you find that you want to print the value of an expression frequently -(to see how it changes), you might want to add it to the @dfn{automatic -display list} so that _GDBN__ will print its value each time the program stops. -Each expression added to the list is given a number to identify it; -to remove an expression from the list, you specify that number. -The automatic display looks like this: - -@example -2: foo = 38 -3: bar[5] = (struct hack *) 0x3804 -@end example - -@noindent -showing item numbers, expressions and their current values. As with -displays you request manually using @code{x} or @code{print}, you can -specify the output format you prefer; in fact, @code{display} decides -whether to use @code{print} or @code{x} depending on how elaborate your -format specification is---it uses @code{x} if you specify a unit size, -or one of the two formats (@samp{i} and @samp{s}) that are only -supported by @code{x}; otherwise it uses @code{print}. - -@table @code -@item display @var{exp} -@kindex display -Add the expression @var{exp} to the list of expressions to display -each time the program stops. @xref{Expressions}. - -@code{display} will not repeat if you press @key{RET} again after using it. - -@item display/@var{fmt} @var{exp} -For @var{fmt} specifying only a display format and not a size or -count, add the expression @var{exp} to the auto-display list but -arranges to display it each time in the specified format @var{fmt}. -@xref{Output formats}. - -@item display/@var{fmt} @var{addr} -For @var{fmt} @samp{i} or @samp{s}, or including a unit-size or a -number of units, add the expression @var{addr} as a memory address to -be examined each time the program stops. Examining means in effect -doing @samp{x/@var{fmt} @var{addr}}. @xref{Memory}. -@end table - -For example, @samp{display/i $pc} can be helpful, to see the machine -instruction about to be executed each time execution stops (@samp{$pc} -is a common name for the program counter; @pxref{Registers}). - -@table @code -@item undisplay @var{dnums}@dots{} -@itemx delete display @var{dnums}@dots{} -@kindex delete display -@kindex undisplay -Remove item numbers @var{dnums} from the list of expressions to display. - -@code{undisplay} will not repeat if you press @key{RET} after using it. -(Otherwise you would just get the error @samp{No display number @dots{}}.) - -@item disable display @var{dnums}@dots{} -@kindex disable display -Disable the display of item numbers @var{dnums}. A disabled display -item is not printed automatically, but is not forgotten. It may be -enabled again later. - -@item enable display @var{dnums}@dots{} -@kindex enable display -Enable display of item numbers @var{dnums}. It becomes effective once -again in auto display of its expression, until you specify otherwise. - -@item display -Display the current values of the expressions on the list, just as is -done when the program stops. - -@item info display -@kindex info display -Print the list of expressions previously set up to display -automatically, each one with its item number, but without showing the -values. This includes disabled expressions, which are marked as such. -It also includes expressions which would not be displayed right now -because they refer to automatic variables not currently available. -@end table - -If a display expression refers to local variables, then it does not make -sense outside the lexical context for which it was set up. Such an -expression is disabled when execution enters a context where one of its -variables is not defined. For example, if you give the command -@code{display last_char} while inside a function with an argument -@code{last_char}, then this argument will be displayed while the program -continues to stop inside that function. When it stops elsewhere---where -there is no variable @code{last_char}---display is disabled. The next time -your program stops where @code{last_char} is meaningful, you can enable the -display expression once again. - -@node Print Settings, Value History, Auto Display, Data -@section Print Settings - -@cindex format options -@cindex print settings -_GDBN__ provides the following ways to control how arrays, structures, -and symbols are printed. - -@noindent -These settings are useful for debugging programs in any language: - -@table @code -@item set print address -@item set print address on -@kindex set print address -_GDBN__ will print memory addresses showing the location of stack -traces, structure values, pointer values, breakpoints, and so forth, -even when it also displays the contents of those addresses. The default -is on. For example, this is what a stack frame display looks like, with -@code{set print address on}: -@smallexample -(_GDBP__) f -#0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>") - at input.c:530 -530 if (lquote != def_lquote) -@end smallexample - -@item set print address off -Do not print addresses when displaying their contents. For example, -this is the same stack frame displayed with @code{set print address off}: -@example -(_GDBP__) set print addr off -(_GDBP__) f -#0 set_quotes (lq="<<", rq=">>") at input.c:530 -530 if (lquote != def_lquote) -@end example - -@item show print address -@kindex show print address -Show whether or not addresses are to be printed. - -@item set print array -@itemx set print array on -@kindex set print array -_GDBN__ will pretty print arrays. This format is more convenient to read, -but uses more space. The default is off. - -@item set print array off. -Return to compressed format for arrays. - -@item show print array -@kindex show print array -Show whether compressed or pretty format is selected for displaying -arrays. - -@item set print elements @var{number-of-elements} -@kindex set print elements -If _GDBN__ is printing a large array, it will stop printing after it has -printed the number of elements set by the @code{set print elements} command. -This limit also applies to the display of strings. - -@item show print elements -@kindex show print elements -Display the number of elements of a large array that _GDBN__ will print -before losing patience. - -@item set print pretty on -@kindex set print pretty -Cause _GDBN__ to print structures in an indented format with one member per -line, like this: - -@example -$1 = @{ - next = 0x0, - flags = @{ - sweet = 1, - sour = 1 - @}, - meat = 0x54 "Pork" -@} -@end example - -@item set print pretty off -Cause _GDBN__ to print structures in a compact format, like this: - -@smallexample -$1 = @{next = 0x0, flags = @{sweet = 1, sour = 1@}, meat \ -= 0x54 "Pork"@} -@end smallexample - -@noindent -This is the default format. - -@item show print pretty -@kindex show print pretty -Show which format _GDBN__ will use to print structures. - -@item set print sevenbit-strings on -Print using only seven-bit characters; if this option is set, -_GDBN__ will display any eight-bit characters (in strings or character -values) using the notation @code{\}@var{nnn}. For example, @kbd{M-a} is -displayed as @code{\341}. - -@item set print sevenbit-strings off -Print using either seven-bit or eight-bit characters, as required. This -is the default. - -@item show print sevenbit-strings -Show whether or not _GDBN__ will print only seven-bit characters. - -@item set print union on -@kindex set print union -Tell _GDBN__ to print unions which are contained in structures. This is the -default setting. - -@item set print union off -Tell _GDBN__ not to print unions which are contained in structures. - -@item show print union -@kindex show print union -Ask _GDBN__ whether or not it will print unions which are contained in -structures. - -For example, given the declarations - -@smallexample -typedef enum @{Tree, Bug@} Species; -typedef enum @{Big_tree, Acorn, Seedling@} Tree_forms; -typedef enum @{Caterpillar, Cocoon, Butterfly@} Bug_forms; - -struct thing @{ - Species it; - union @{ - Tree_forms tree; - Bug_forms bug; - @} form; -@}; - -struct thing foo = @{Tree, @{Acorn@}@}; -@end smallexample - -@noindent -with @code{set print union on} in effect @samp{p foo} would print - -@smallexample -$1 = @{it = Tree, form = @{tree = Acorn, bug = Cocoon@}@} -@end smallexample - -@noindent -and with @code{set print union off} in effect it would print - -@smallexample -$1 = @{it = Tree, form = @{...@}@} -@end smallexample -@end table - -@noindent -These settings are of interest when debugging C++ programs: - -@table @code -@item set print demangle -@itemx set print demangle on -@kindex set print demangle -Print C++ names in their source form rather than in the mangled form -in which they are passed to the assembler and linker for type-safe linkage. -The default is on. - -@item show print demangle -@kindex show print demangle -Show whether C++ names will be printed in mangled or demangled form. - -@item set print asm-demangle -@itemx set print asm-demangle on -@kindex set print asm-demangle -Print C++ names in their source form rather than their mangled form, even -in assembler code printouts such as instruction disassemblies. -The default is off. - -@item show print asm-demangle -@kindex show print asm-demangle -Show whether C++ names in assembly listings will be printed in mangled -or demangled form. - -@item set print object -@itemx set print object on -@kindex set print object -When displaying a pointer to an object, identify the @emph{actual} -(derived) type of the object rather than the @emph{declared} type, using -the virtual function table. - -@item set print object off -Display only the declared type of objects, without reference to the -virtual function table. This is the default setting. - -@item show print object -@kindex show print object -Show whether actual, or declared, object types will be displayed. - -@item set print vtbl -@itemx set print vtbl on -@kindex set print vtbl -Pretty print C++ virtual function tables. The default is off. - -@item set print vtbl off -Do not pretty print C++ virtual function tables. - -@item show print vtbl -@kindex show print vtbl -Show whether C++ virtual function tables are pretty printed, or not. - -@end table - -@node Value History, Convenience Vars, Print Settings, Data -@section Value History - -@cindex value history -Values printed by the @code{print} command are saved in _GDBN__'s @dfn{value -history} so that you can refer to them in other expressions. Values are -kept until the symbol table is re-read or discarded (for example with -the @code{file} or @code{symbol-file} commands). When the symbol table -changes, the value history is discarded, since the values may contain -pointers back to the types defined in the symbol table. - -@cindex @code{$} -@cindex @code{$$} -@cindex history number -The values printed are given @dfn{history numbers} for you to refer to them -by. These are successive integers starting with one. @code{print} shows you -the history number assigned to a value by printing @samp{$@var{num} = } -before the value; here @var{num} is the history number. - -To refer to any previous value, use @samp{$} followed by the value's -history number. The way @code{print} labels its output is designed to -remind you of this. Just @code{$} refers to the most recent value in -the history, and @code{$$} refers to the value before that. -@code{$$@var{n}} refers to the @var{n}th value from the end; @code{$$2} -is the value just prior to @code{$$}, @code{$$1} is equivalent to -@code{$$}, and @code{$$0} is equivalent to @code{$}. - -For example, suppose you have just printed a pointer to a structure and -want to see the contents of the structure. It suffices to type - -@example -p *$ -@end example - -If you have a chain of structures where the component @code{next} points -to the next one, you can print the contents of the next one with this: - -@example -p *$.next -@end example - -@noindent -You can print successive links in the chain by repeating this -command---which you can do by just typing @key{RET}. - -Note that the history records values, not expressions. If the value of -@code{x} is 4 and you type these commands: - -@example -print x -set x=5 -@end example - -@noindent -then the value recorded in the value history by the @code{print} command -remains 4 even though the value of @code{x} has changed. - -@table @code -@kindex show values -@item show values -Print the last ten values in the value history, with their item numbers. -This is like @samp{p@ $$9} repeated ten times, except that @code{show -values} does not change the history. - -@item show values @var{n} -Print ten history values centered on history item number @var{n}. - -@item show values + -Print ten history values just after the values last printed. If no more -values are available, produces no display. -@end table - -Pressing @key{RET} to repeat @code{show values @var{n}} has exactly the -same effect as @samp{show values +}. - -@node Convenience Vars, Registers, Value History, Data -@section Convenience Variables - -@cindex convenience variables -_GDBN__ provides @dfn{convenience variables} that you can use within -_GDBN__ to hold on to a value and refer to it later. These variables -exist entirely within _GDBN__; they are not part of your program, and -setting a convenience variable has no direct effect on further execution -of your program. That's why you can use them freely. - -Convenience variables are prefixed with @samp{$}. Any name preceded by -@samp{$} can be used for a convenience variable, unless it is one of -the predefined machine-specific register names (@pxref{Registers}). -(Value history references, in contrast, are @emph{numbers} preceded -by @samp{$}. @xref{Value History}.) - -You can save a value in a convenience variable with an assignment -expression, just as you would set a variable in your program. Example: - -@example -set $foo = *object_ptr -@end example - -@noindent -would save in @code{$foo} the value contained in the object pointed to by -@code{object_ptr}. - -Using a convenience variable for the first time creates it; but its value -is @code{void} until you assign a new value. You can alter the value with -another assignment at any time. - -Convenience variables have no fixed types. You can assign a convenience -variable any type of value, including structures and arrays, even if -that variable already has a value of a different type. The convenience -variable, when used as an expression, has the type of its current value. - -@table @code -@item show convenience -@kindex show convenience -Print a list of convenience variables used so far, and their values. -Abbreviated @code{show con}. -@end table - -One of the ways to use a convenience variable is as a counter to be -incremented or a pointer to be advanced. For example, to print -a field from successive elements of an array of structures: - -_0__@example -set $i = 0 -print bar[$i++]->contents -@i{@dots{} repeat that command by typing @key{RET}.} -_1__@end example - -Some convenience variables are created automatically by _GDBN__ and given -values likely to be useful. - -@table @code -@item $_ -The variable @code{$_} is automatically set by the @code{x} command to -the last address examined (@pxref{Memory}). Other commands which -provide a default address for @code{x} to examine also set @code{$_} -to that address; these commands include @code{info line} and @code{info -breakpoint}. - -@item $__ -The variable @code{$__} is automatically set by the @code{x} command -to the value found in the last address examined. -@end table - -@node Registers, Floating Point Hardware, Convenience Vars, Data -@section Registers - -@cindex registers -Machine register contents can be referred to in expressions as variables -with names starting with @samp{$}. The names of registers are different -for each machine; use @code{info registers} to see the names used on -your machine. - -@table @code -@item info registers -@kindex info registers -Print the names and values of all registers (in the selected stack frame). - -@item info registers @var{regname} -Print the relativized value of register @var{regname}. @var{regname} -may be any register name valid on the machine you are using, with -or without the initial @samp{$}. -@end table - -The register names @code{$pc} and @code{$sp} are used on most machines -for the program counter register and the stack pointer. For example, -you could print the program counter in hex with -@example -p/x $pc -@end example - -@noindent -or print the instruction to be executed next with -@example -x/i $pc -@end example - -@noindent -or add four to the stack pointer with -@example -set $sp += 4 -@end example - -@noindent -The last is a way of removing one word from the stack, on machines where -stacks grow downward in memory (most machines, nowadays). This assumes -that the innermost stack frame is selected; setting @code{$sp} is -not allowed when other stack frames are selected. (To pop entire frames -off the stack, regardless of machine architecture, use @code{return}; -@pxref{Returning}.) - -Often @code{$fp} is used for a register that contains a pointer to the -current stack frame, and @code{$ps} is sometimes used for a register -that contains the processor status. These standard register names may -be available on your machine even though the @code{info registers} -command shows other names. For example, on the SPARC, @code{info -registers} displays the processor status register as @code{$psr} but you -can also refer to it as @code{$ps}. - -_GDBN__ always considers the contents of an ordinary register as an -integer when the register is examined in this way. Some machines have -special registers which can hold nothing but floating point; these -registers are considered to have floating point values. There is no way -to refer to the contents of an ordinary register as floating point value -(although you can @emph{print} it as a floating point value with -@samp{print/f $@var{regname}}). - -Some registers have distinct ``raw'' and ``virtual'' data formats. This -means that the data format in which the register contents are saved by -the operating system is not the same one that your program normally -sees. For example, the registers of the 68881 floating point -coprocessor are always saved in ``extended'' (raw) format, but all C -programs expect to work with ``double'' (virtual) format. In such -cases, _GDBN__ normally works with the virtual format only (the format that -makes sense for your program), but the @code{info registers} command -prints the data in both formats. - -Normally, register values are relative to the selected stack frame -(@pxref{Selection}). This means that you get the value that the -register would contain if all stack frames farther in were exited and -their saved registers restored. In order to see the true contents of -hardware registers, you must select the innermost frame (with -@samp{frame 0}). - -However, _GDBN__ must deduce where registers are saved, from the machine -code generated by your compiler. If some registers are not saved, or if -_GDBN__ is unable to locate the saved registers, the selected stack -frame will make no difference. - -@node Floating Point Hardware, , Registers, Data -@section Floating Point Hardware -@cindex floating point -Depending on the host machine architecture, _GDBN__ may be able to give -you more information about the status of the floating point hardware. - -@table @code -@item info float -@kindex info float -If available, provides hardware-dependent information about the floating -point unit. The exact contents and layout vary depending on the -floating point chip. -@end table -@c FIXME: this is a cop-out. Try to get examples, explanations. Only -@c FIXME...supported currently on arm's and 386's. Mark properly with -@c FIXME... m4 macros to isolate general statements from hardware-dep, -@c FIXME... at that point. diff --git a/gdb/doc/gdb.emacs-m4 b/gdb/doc/gdb.emacs-m4 index 855371e..e69de29 100755 --- a/gdb/doc/gdb.emacs-m4 +++ b/gdb/doc/gdb.emacs-m4 @@ -1,166 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Emacs, _GDBN__ Bugs, Sequences, Top -@chapter Using _GDBN__ under GNU Emacs - -@cindex emacs -A special interface allows you to use GNU Emacs to view (and -edit) the source files for the program you are debugging with -_GDBN__. - -To use this interface, use the command @kbd{M-x gdb} in Emacs. Give the -executable file you want to debug as an argument. This command starts -_GDBN__ as a subprocess of Emacs, with input and output through a newly -created Emacs buffer. - -Using _GDBN__ under Emacs is just like using _GDBN__ normally except for two -things: - -@itemize @bullet -@item -All ``terminal'' input and output goes through the Emacs buffer. -@end itemize - -This applies both to _GDBN__ commands and their output, and to the input -and output done by the program you are debugging. - -This is useful because it means that you can copy the text of previous -commands and input them again; you can even use parts of the output -in this way. - -All the facilities of Emacs' Shell mode are available for this purpose. - -@itemize @bullet -@item -_GDBN__ displays source code through Emacs. -@end itemize - -Each time _GDBN__ displays a stack frame, Emacs automatically finds the -source file for that frame and puts an arrow (_0__@samp{=>}_1__) at the -left margin of the current line. Emacs uses a separate buffer for -source display, and splits the window to show both your _GDBN__ session -and the source. - -Explicit _GDBN__ @code{list} or search commands still produce output as -usual, but you probably will have no reason to use them. - -@quotation -@emph{Warning:} If the directory where your program resides is not your -current directory, it can be easy to confuse Emacs about the location of -the source files, in which case the auxiliary display buffer will not -appear to show your source. _GDBN__ can find programs by searching your -environment's @code{PATH} variable, so the _GDBN__ input and output -session will proceed normally; but Emacs doesn't get enough information -back from _GDBN__ to locate the source files in this situation. To -avoid this problem, either start _GDBN__ mode from the directory where -your program resides, or specify a full path name when prompted for the -@kbd{M-x gdb} argument. - -A similar confusion can result if you use the _GDBN__ @code{file} command to -switch to debugging a program in some other location, from an existing -_GDBN__ buffer in Emacs. -@end quotation - -By default, @kbd{M-x gdb} calls the program called @file{gdb}. If -you need to call _GDBN__ by a different name (for example, if you keep -several configurations around, with different names) you can set the -Emacs variable @code{gdb-command-name}; for example, -@example -(setq gdb-command-name "mygdb") -@end example -@noindent -(preceded by @kbd{ESC ESC}, or typed in the @code{*scratch*} buffer, or -in your @file{.emacs} file) will make Emacs call the program named -``@code{mygdb}'' instead. - -In the _GDBN__ I/O buffer, you can use these special Emacs commands in -addition to the standard Shell mode commands: - -@table @kbd -@item C-h m -Describe the features of Emacs' _GDBN__ Mode. - -@item M-s -Execute to another source line, like the _GDBN__ @code{step} command; also -update the display window to show the current file and location. - -@item M-n -Execute to next source line in this function, skipping all function -calls, like the _GDBN__ @code{next} command. Then update the display window -to show the current file and location. - -@item M-i -Execute one instruction, like the _GDBN__ @code{stepi} command; update -display window accordingly. - -@item M-x gdb-nexti -Execute to next instruction, using the _GDBN__ @code{nexti} command; update -display window accordingly. - -@item C-c C-f -Execute until exit from the selected stack frame, like the _GDBN__ -@code{finish} command. - -@item M-c -Continue execution of the program, like the _GDBN__ @code{continue} -command. @emph{Warning:} In Emacs v19, this command is @kbd{C-c C-p}. - -@item M-u -Go up the number of frames indicated by the numeric argument -(@pxref{Arguments, , Numeric Arguments, emacs, The GNU Emacs Manual}), -like the _GDBN__ @code{up} command. @emph{Warning:} In Emacs v19, this -command is @kbd{C-c C-u}.@refill - -@item M-d -Go down the number of frames indicated by the numeric argument, like the -_GDBN__ @code{down} command. @emph{Warning:} In Emacs v19, this command -is @kbd{C-c C-d}. - -@item C-x & -Read the number where the cursor is positioned, and insert it at the end -of the _GDBN__ I/O buffer. For example, if you wish to disassemble code -around an address that was displayed earlier, type @kbd{disassemble}; -then move the cursor to the address display, and pick up the -argument for @code{disassemble} by typing @kbd{C-x &}. - -You can customize this further on the fly by defining elements of the list -@code{gdb-print-command}; once it is defined, you can format or -otherwise process numbers picked up by @kbd{C-x &} before they are -inserted. A numeric argument to @kbd{C-x &} will both flag that you -wish special formatting, and act as an index to pick an element of the -list. If the list element is a string, the number to be inserted is -formatted using the Emacs function @code{format}; otherwise the number -is passed as an argument to the corresponding list element. - -@end table - -In any source file, the Emacs command @kbd{C-x SPC} (@code{gdb-break}) -tells _GDBN__ to set a breakpoint on the source line point is on. - -If you accidentally delete the source-display buffer, an easy way to get -it back is to type the command @code{f} in the _GDBN__ buffer, to -request a frame display; when you run under Emacs, this will recreate -the source buffer if necessary to show you the context of the current -frame. - -The source files displayed in Emacs are in ordinary Emacs buffers -which are visiting the source files in the usual way. You can edit -the files with these buffers if you wish; but keep in mind that _GDBN__ -communicates with Emacs in terms of line numbers. If you add or -delete lines from the text, the line numbers that _GDBN__ knows will cease -to correspond properly to the code. - -@c The following dropped because Epoch is nonstandard. Reactivate -@c if/when v19 does something similar. ---pesch@cygnus.com 19dec1990 -@ignore -@kindex emacs epoch environment -@kindex epoch -@kindex inspect - -Version 18 of Emacs has a built-in window system called the @code{epoch} -environment. Users of this environment can use a new command, -@code{inspect} which performs identically to @code{print} except that -each value is printed in its own window. -@end ignore diff --git a/gdb/doc/gdb.files-m4 b/gdb/doc/gdb.files-m4 index c71a315..e69de29 100755 --- a/gdb/doc/gdb.files-m4 +++ b/gdb/doc/gdb.files-m4 @@ -1,300 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node _GDBN__ Files, Targets, Altering, Top -@chapter _GDBN__'s Files - -@menu -* Files:: Commands to Specify Files -* Symbol Errors:: Errors Reading Symbol Files -@end menu - -@node Files, Symbol Errors, _GDBN__ Files, _GDBN__ Files -@section Commands to Specify Files -@cindex core dump file -@cindex symbol table -_GDBN__ needs to know the file name of the program to be debugged, both in -order to read its symbol table and in order to start the program. To -debug a core dump of a previous run, _GDBN__ must be told the file name of -the core dump. - -The usual way to specify the executable and core dump file names is with -the command arguments given when you start _GDBN__, as discussed in -@pxref{Invocation}. - -Occasionally it is necessary to change to a different file during a -_GDBN__ session. Or you may run _GDBN__ and forget to specify the files you -want to use. In these situations the _GDBN__ commands to specify new files -are useful. - -@table @code -@item file @var{filename} -@cindex executable file -@kindex file -Use @var{filename} as the program to be debugged. It is read for its -symbols and for the contents of pure memory. It is also the program -executed when you use the @code{run} command. If you do not specify a -directory and the file is not found in _GDBN__'s working directory, - -_GDBN__ uses the environment variable @code{PATH} as a list of -directories to search, just as the shell does when looking for a program -to run. You can change the value of this variable, for both _GDBN__ and -your program, using the @code{path} command. - -@code{file} with no argument makes _GDBN__ discard any information it -has on both executable file and the symbol table. - -@item exec-file @var{filename} -@kindex exec-file -Specify that the program to be run (but not the symbol table) is found -in @var{filename}. _GDBN__ will search the environment variable @code{PATH} -if necessary to locate the program. - -@item symbol-file @var{filename} -@kindex symbol-file -Read symbol table information from file @var{filename}. @code{PATH} is -searched when necessary. Use the @code{file} command to get both symbol -table and program to run from the same file. - -@code{symbol-file} with no argument clears out _GDBN__'s information on your -program's symbol table. - -The @code{symbol-file} command causes _GDBN__ to forget the contents of its -convenience variables, the value history, and all breakpoints and -auto-display expressions. This is because they may contain pointers to -the internal data recording symbols and data types, which are part of -the old symbol table data being discarded inside _GDBN__. - -@code{symbol-file} will not repeat if you press @key{RET} again after -executing it once. - -On some kinds of object files, the @code{symbol-file} command does not -actually read the symbol table in full right away. Instead, it scans -the symbol table quickly to find which source files and which symbols -are present. The details are read later, one source file at a time, -when they are needed. - -The purpose of this two-stage reading strategy is to make _GDBN__ start up -faster. For the most part, it is invisible except for occasional pauses -while the symbol table details for a particular source file are being -read. (The @code{set verbose} command can turn these pauses into -messages if desired. @xref{Messages/Warnings}). - -When the symbol table is stored in COFF format, @code{symbol-file} does -read the symbol table data in full right away. We haven't implemented -the two-stage strategy for COFF yet. - -When _GDBN__ is configured for a particular environment, it will -understand debugging information in whatever format is the standard -generated for that environment; you may use either a GNU compiler, or -other compilers that adhere to the local conventions. Best results are -usually obtained from GNU compilers; for example, using @code{_GCC__} -you can generate debugging information for optimized code. - -@item core-file @var{filename} -@itemx core @var{filename} -@kindex core -@kindex core-file -Specify the whereabouts of a core dump file to be used as the ``contents -of memory''. Traditionally, core files contain only some parts of the -address space of the process that generated them; _GDBN__ can access the -executable file itself for other parts. - -@code{core-file} with no argument specifies that no core file is -to be used. - -Note that the core file is ignored when your program is actually running -under _GDBN__. So, if you have been running the program and you wish to -debug a core file instead, you must kill the subprocess in which the -program is running. To do this, use the @code{kill} command -(@pxref{Kill Process}). - -@item load @var{filename} -@kindex load -_if__(_GENERIC__) -Depending on what remote debugging facilities are configured into -_GDBN__, the @code{load} command may be available. Where it exists, it -is meant to make @var{filename} (an executable) available for debugging -on the remote system---by downloading, or dynamic linking, for example. -@code{load} also records @var{filename}'s symbol table in _GDBN__, like -the @code{add-symbol-file} command. - -If @code{load} is not available on your _GDBN__, attempting to execute -it gets the error message ``@code{You can't do that when your target is -@dots{}}'' -_fi__(_GENERIC__) - -_if__(_VXWORKS__) -On VxWorks, @code{load} will dynamically link @var{filename} on the -current target system as well as adding its symbols in _GDBN__. -_fi__(_VXWORKS__) - -_if__(_I960__) -@cindex download to Nindy-960 -With the Nindy interface to an Intel 960 board, @code{load} will -download @var{filename} to the 960 as well as adding its symbols in -_GDBN__. -_fi__(_I960__) - -@code{load} will not repeat if you press @key{RET} again after using it. - -@item add-symbol-file @var{filename} @var{address} -@kindex add-symbol-file -@cindex dynamic linking -The @code{add-symbol-file} command reads additional symbol table information -from the file @var{filename}. You would use this command when that file -has been dynamically loaded (by some other means) into the program that -is running. @var{address} should be the memory address at which the -file has been loaded; _GDBN__ cannot figure this out for itself. - -The symbol table of the file @var{filename} is added to the symbol table -originally read with the @code{symbol-file} command. You can use the -@code{add-symbol-file} command any number of times; the new symbol data thus -read keeps adding to the old. To discard all old symbol data instead, -use the @code{symbol-file} command. - -@code{add-symbol-file} will not repeat if you press @key{RET} after using it. - -@item info files -@itemx info target -@kindex info files -@kindex info target -@code{info files} and @code{info target} are synonymous; both print the -current targets (@pxref{Targets}), including the names of the executable -and core dump files currently in use by _GDBN__, and the files from -which symbols were loaded. The command @code{help targets} lists all -possible targets rather than current ones. - -@end table - -All file-specifying commands allow both absolute and relative file names -as arguments. _GDBN__ always converts the file name to an absolute path -name and remembers it that way. - -@kindex sharedlibrary -@kindex share -@cindex shared libraries - -_GDBN__ supports the SunOS shared library format. Symbols from a shared -library cannot be referenced before the shared library has been linked -with the program. (That is to say, until after you type @code{run} and -the function @code{main} has been entered; or when examining core -files.) Once the shared library has been linked in, you can use the -following commands: - -@table @code -@item sharedlibrary @var{regex} -@itemx share @var{regex} -Load shared object library symbols for files matching a UNIX regular -expression. - -@item share -@itemx sharedlibrary -Load symbols for all shared libraries. - -@item info share -@itemx info sharedlibrary -@kindex info sharedlibrary -@kindex info share -Print the names of the shared libraries which you have loaded with the -@code{sharedlibrary} command. -@end table - -@code{sharedlibrary} does not repeat automatically when you press -@key{RET} after using it once. - -@node Symbol Errors, , Files, _GDBN__ Files -@section Errors Reading Symbol Files -While a symbol file is being read, _GDBN__ will occasionally encounter -problems, such as symbol types it does not recognize, or known bugs in -compiler output. By default, it prints one message about each such -type of problem, no matter how many times the problem occurs. You can -ask it to print more messages, to see how many times the problems occur, -or can shut the messages off entirely, with the @code{set -complaints} command (@xref{Messages/Warnings}). - -The messages currently printed, and their meanings, are: - -@table @code -@item inner block not inside outer block in @var{symbol} - -The symbol information shows where symbol scopes begin and end -(such as at the start of a function or a block of statements). This -error indicates that an inner scope block is not fully contained -in its outer scope blocks. - -_GDBN__ circumvents the problem by treating the inner block as if it had -the same scope as the outer block. In the error message, @var{symbol} -may be shown as ``@code{(don't know)}'' if the outer block is not a -function. - -@item block at @var{address} out of order - -The symbol information for symbol scope blocks should occur in -order of increasing addresses. This error indicates that it does not -do so. - -_GDBN__ does not circumvent this problem, and will have trouble locating -symbols in the source file whose symbols being read. (You can often -determine what source file is affected by specifying @code{set verbose -on}. @xref{Messages/Warnings}.) - -@item bad block start address patched - -The symbol information for a symbol scope block has a start address -smaller than the address of the preceding source line. This is known -to occur in the SunOS 4.1.1 (and earlier) C compiler. - -_GDBN__ circumvents the problem by treating the symbol scope block as -starting on the previous source line. - -@c @item{encountered DBX-style class variable debugging information. -@c You seem to have compiled your program with "g++ -g0" instead of "g++ -g". -@c Therefore _GDBN__ will not know about your class variables} -@c -@c This error indicates that the symbol information produced for a C++ -@c program includes zero-size fields, which indicated static fields in -@c a previous release of the G++ compiler. This message is probably -@c obsolete. -@c -@item bad string table offset in symbol @var{n} - -@cindex foo -Symbol number @var{n} contains a pointer into the string table which is -larger than the size of the string table. - -_GDBN__ circumvents the problem by considering the symbol to have the -name @code{foo}, which may cause other problems if many symbols end up -with this name. - -@item unknown symbol type @code{0x@var{nn}} - -The symbol information contains new data types that _GDBN__ does not yet -know how to read. @code{0x@var{nn}} is the symbol type of the misunderstood -information, in hexadecimal. - -_GDBN__ circumvents the error by ignoring this symbol information. This -will usually allow the program to be debugged, though certain symbols -will not be accessible. If you encounter such a problem and feel like -debugging it, you can debug @code{_GDBP__} with itself, breakpoint on -@code{complain}, then go up to the function @code{read_dbx_symtab} and -examine @code{*bufp} to see the symbol. - -@item stub type has NULL name -_GDBN__ could not find the full definition for a struct or class. - -@ignore -@c this is #if 0'd in dbxread.c as of (at least!) 17 may 1991 -@item const/volatile indicator missing, got '@var{X}' - -The symbol information for a C++ member function is missing some -information that the compiler should have output for it. -@end ignore - -@item C++ type mismatch between compiler and debugger - -The debugger could not parse a type specification output by the compiler -for some C++ object. - -@end table diff --git a/gdb/doc/gdb.gpl-m4 b/gdb/doc/gdb.gpl-m4 index 9925f83..e69de29 100755 --- a/gdb/doc/gdb.gpl-m4 +++ b/gdb/doc/gdb.gpl-m4 @@ -1,308 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Copying, Index, Installing _GDBN__, Top -@appendix Copying GDB -@c this is an attempt to kluge around what may be a bug in texinfo; -@c @xrefs to this node came out pointing several pages further down when -@c the @node was immediately followed by @unnumbered. -@c While we're at it, might as well give an Appendix heading that -@c matches RMS' preferred nodename "Copying". - -@unnumbered GNU GENERAL PUBLIC LICENSE -@center Version 1, February 1989 - -@display -Copyright @copyright{} 1989 Free Software Foundation, Inc. -675 Mass Ave, Cambridge, MA 02139, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@unnumberedsec Preamble - - The license agreements of most software companies try to keep users -at the mercy of those companies. By contrast, our General Public -License is intended to guarantee your freedom to share and change free -software---to make sure the software is free for all its users. The -General Public License applies to the Free Software Foundation's -software and to any other program whose authors commit to using it. -You can use it for your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Specifically, the General Public License is designed to make -sure that you have the freedom to give away or sell copies of free -software, that you receive source code or can get it if you want it, -that you can change the software or use pieces of it in new free -programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of a such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must tell them their rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - The precise terms and conditions for copying, distribution and -modification follow. - -@iftex -@unnumberedsec TERMS AND CONDITIONS -@end iftex -@ifinfo -@center TERMS AND CONDITIONS -@end ifinfo - -@enumerate -@item -This License Agreement applies to any program or other work which -contains a notice placed by the copyright holder saying it may be -distributed under the terms of this General Public License. The -``Program'', below, refers to any such program or work, and a ``work based -on the Program'' means either the Program or any work containing the -Program or a portion of it, either verbatim or with modifications. Each -licensee is addressed as ``you''. - -@item -You may copy and distribute verbatim copies of the Program's source -code as you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this -General Public License and to the absence of any warranty; and give any -other recipients of the Program a copy of this General Public License -along with the Program. You may charge a fee for the physical act of -transferring a copy. - -@item -You may modify your copy or copies of the Program or any portion of -it, and copy and distribute such modifications under the terms of Paragraph -1 above, provided that you also do the following: - -@itemize @bullet -@item -cause the modified files to carry prominent notices stating that -you changed the files and the date of any change; and - -@item -cause the whole of any work that you distribute or publish, that -in whole or in part contains the Program or any part thereof, either -with or without modifications, to be licensed at no charge to all -third parties under the terms of this General Public License (except -that you may choose to grant warranty protection to some or all -third parties, at your option). - -@item -If the modified program normally reads commands interactively when -run, you must cause it, when started running for such interactive use -in the simplest and most usual way, to print or display an -announcement including an appropriate copyright notice and a notice -that there is no warranty (or else, saying that you provide a -warranty) and that users may redistribute the program under these -conditions, and telling the user how to view a copy of this General -Public License. - -@item -You may charge a fee for the physical act of transferring a -copy, and you may at your option offer warranty protection in -exchange for a fee. -@end itemize - -Mere aggregation of another independent work with the Program (or its -derivative) on a volume of a storage or distribution medium does not bring -the other work under the scope of these terms. - -@item -You may copy and distribute the Program (or a portion or derivative of -it, under Paragraph 2) in object code or executable form under the terms of -Paragraphs 1 and 2 above provided that you also do one of the following: - -@itemize @bullet -@item -accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of -Paragraphs 1 and 2 above; or, - -@item -accompany it with a written offer, valid for at least three -years, to give any third party free (except for a nominal charge -for the cost of distribution) a complete machine-readable copy of the -corresponding source code, to be distributed under the terms of -Paragraphs 1 and 2 above; or, - -@item -accompany it with the information you received as to where the -corresponding source code may be obtained. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form alone.) -@end itemize - -Source code for a work means the preferred form of the work for making -modifications to it. For an executable file, complete source code means -all the source code for all modules it contains; but, as a special -exception, it need not include source code for modules which are standard -libraries that accompany the operating system on which the executable -file runs, or for standard header files or definitions files that -accompany that operating system. - -@item -You may not copy, modify, sublicense, distribute or transfer the -Program except as expressly provided under this General Public License. -Any attempt otherwise to copy, modify, sublicense, distribute or transfer -the Program is void, and will automatically terminate your rights to use -the Program under this License. However, parties who have received -copies, or rights to use copies, from you under this General Public -License will not have their licenses terminated so long as such parties -remain in full compliance. - -@item -By copying, distributing or modifying the Program (or any work based -on the Program) you indicate your acceptance of this license to do so, -and all its terms and conditions. - -@item -Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the original -licensor to copy, distribute or modify the Program subject to these -terms and conditions. You may not impose any further restrictions on the -recipients' exercise of the rights granted herein. - -@item -The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of the license which applies to it and ``any -later version'', you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -the license, you may choose any version ever published by the Free Software -Foundation. - -@item -If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - -@iftex -@heading NO WARRANTY -@end iftex -@ifinfo -@center NO WARRANTY -@end ifinfo - -@item -BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - -@item -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT -LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES -SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE -WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN -ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -@end enumerate - -@iftex -@heading END OF TERMS AND CONDITIONS -@end iftex -@ifinfo -@center END OF TERMS AND CONDITIONS -@end ifinfo - -@page -@unnumberedsec Applying These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to humanity, the best way to achieve this is to make it -free software which everyone can redistribute and change under these -terms. - - To do so, attach the following notices to the program. It is safest to -attach them to the start of each source file to most effectively convey -the exclusion of warranty; and each file should have at least the -``copyright'' line and a pointer to where the full notice is found. - -@smallexample -@var{one line to give the program's name and a brief idea of what it does.} -Copyright (C) 19@var{yy} @var{name of author} - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -@end smallexample - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -@smallexample -Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. -@end smallexample - -The hypothetical commands `show w' and `show c' should show the -appropriate parts of the General Public License. Of course, the -commands you use may be called something other than `show w' and `show -c'; they could even be mouse-clicks or menu items---whatever suits your -program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a ``copyright disclaimer'' for the program, if -necessary. Here is a sample; alter the names: - -@smallexample -Yoyodyne, Inc., hereby disclaims all copyright interest in the -program `Gnomovision' (a program to direct compilers to make passes -at assemblers) written by James Hacker. - -@var{signature of Ty Coon}, 1 April 1989 -Ty Coon, President of Vice -@end smallexample - -That's all there is to it! diff --git a/gdb/doc/gdb.install-m4 b/gdb/doc/gdb.install-m4 index 651c8d0..e69de29 100755 --- a/gdb/doc/gdb.install-m4 +++ b/gdb/doc/gdb.install-m4 @@ -1,57 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Installing _GDBN__, Copying, Renamed Commands, Top -@appendix Installing _GDBN__ -@cindex configuring _GDBN__ -@cindex installation - -The script @code{config.gdb} automates the process of preparing _GDBN__ -for installation; you can then use @code{make} to actually build it. -The best way to build _GDBN__ is in a subdirectory that records the -configuration options used; this gives you a clean way of building -_GDBN__ binaries with several different configuration options. -@code{config.gdb} doesn't depend on this---it's just a good habit. For -example, assuming the _GDBN__ source is in a directory called -``@code{gdb-4.0}'': - -@example -cd gdb-4.0 -mkdir =sun3os4 -cd =sun3os4 -../config.gdb sun3os4 -make -@end example - -@noindent -will install _GDBN__ on a Sun 3 running SunOS 4. - -@table @code -@kindex config.gdb -@item config.gdb @var{machine} -@itemx config.gdb -srcdir=@var{dir} @var{machine} -This is the most usual way of configuring _GDBN__; to debug programs running -on the same machine as _GDBN__ itself. If you wish to build the _GDBN__ binaries -in a completely different directory from the sources, specify a path to -the source directory using the @samp{-srcdir} option. - -@item config.gdb -host -@cindex host environments -Display a list of supported host environments for _GDBN__. - -@item config.gdb @var{host} @var{target} -@itemx config.gdb -srcdir=@var{dir} @var{host} @var{target} -@cindex cross-debugging -_GDBN__ can also be used as a cross-debugger, running on a machine of one -type while debugging a program running on a machine of another type. -You configure it this way by specifying first the @var{host}, then the -@var{target} environment on the @code{config.gdb} argument list; the -@var{host} is where _GDBN__ runs, and the @var{target} is where your program -runs. @xref{Remote}. Again, you can use @samp{-srcdir} to specify a -path to the _GDBN__ source. - -@item config.gdb -target -@cindex target environments -Display a list of supported target environments for _GDBN__. -@end table diff --git a/gdb/doc/gdb.invoc-m4 b/gdb/doc/gdb.invoc-m4 index 1ff32de..e69de29 100755 --- a/gdb/doc/gdb.invoc-m4 +++ b/gdb/doc/gdb.invoc-m4 @@ -1,207 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Invocation, Commands, Sample Session, Top -@chapter Getting In and Out of _GDBN__ - -@menu -* Starting _GDBN__:: Starting _GDBN__ -* Leaving _GDBN__:: Leaving _GDBN__ -* Shell Commands:: Shell Commands -@end menu - -@node Starting _GDBN__, Leaving _GDBN__, Invocation, Invocation -@section Starting _GDBN__ - -_GDBN__ is invoked with the shell command @code{_GDBP__}. Once started, -it reads commands from the terminal until you tell it to exit. - -You can run @code{_GDBP__} with no arguments or options; but the most -usual way to start _GDBN__ is with one argument or two, specifying an -executable program as the argument: -@example -_GDBP__ program -@end example -@noindent -You can also start with both an executable program and a core file specified: -@example -_GDBP__ program core -@end example - -@noindent -You can further control how _GDBN__ starts up by using command-line -options. _GDBN__ itself can remind you of the options available: -@example -_GDBP__ -help -@end example -@noindent -will display all available options and briefly describe their use -(@samp{_GDBP__ -h} is a shorter equivalent). - -All options and command line arguments you give are processed -in sequential order. The order makes a difference when the -@samp{-x} option is used. - -@menu -* File Options:: Choosing Files -* Mode Options:: Choosing Modes -_if__(!_GENERIC__) -_include__(gdb.inv.m-m4)_dnl__ -_fi__(!_GENERIC__) -@end menu - -@node File Options, Mode Options, Starting _GDBN__, Starting _GDBN__ -@subsection Choosing Files - -As shown above, any arguments other than options specify an executable -file and core file; that is, the first argument encountered with no -associated option flag is equivalent to a @samp{-se} option, and the -second, if any, is equivalent to a @samp{-c} option. Many options have -both long and short forms; both are shown here. The long forms are also -recognized if you truncate them, so long as enough of the option is -present to be unambiguous. (If you prefer, you can flag option -arguments with @samp{+} rather than @samp{-}, though we illustrate the -more usual convention.) - -@table @code -@item -symbols=@var{file} -@itemx -s @var{file} -Read symbol table from file @var{file}. - -@item -exec=@var{file} -@itemx -e @var{file} -Use file @var{file} as the executable file to execute when -appropriate, and for examining pure data in conjunction with a core -dump. - -@item -se @var{file} -Read symbol table from file @var{file} and use it as the executable -file. - -@item -core=@var{file} -@itemx -c @var{file} -Use file @var{file} as a core dump to examine. - -@item -command=@var{file} -@itemx -x @var{file} -Execute _GDBN__ commands from file @var{file}. @xref{Command Files}. - -@item -directory=@var{directory} -@itemx -d @var{directory} -Add @var{directory} to the path to search for source files. -@end table - -_if__(!_GENERIC__) -@node Mode Options, i960-Nindy Remote, File Options, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node Mode Options, , File Options, Starting _GDBN__ -_fi__(_GENERIC__) -@subsection Choosing Modes - -@table @code -@item -nx -@itemx -n -Do not execute commands from any @file{_GDBINIT__} initialization files. -Normally, the commands in these files are executed after all the -command options and arguments have been processed. @xref{Command -Files}. - -@item -quiet -@itemx -q -``Quiet''. Do not print the introductory and copyright messages. These -messages are also suppressed in batch mode, or if an executable file name is -specified on the _GDBN__ command line. - -@item -batch -Run in batch mode. Exit with status @code{0} after processing all the command -files specified with @samp{-x} (and @file{_GDBINIT__}, if not inhibited). -Exit with nonzero status if an error occurs in executing the _GDBN__ -commands in the command files. - -Batch mode may be useful for running _GDBN__ as a filter, for example to -download and run a program on another computer; in order to make this -more useful, the message -@example -Program exited normally. -@end example -@noindent -(which is ordinarily issued whenever a program running under _GDBN__ control -terminates) is not issued when running in batch mode. - -@item -cd @var{directory} -Run _GDBN__ using @var{directory} as its working directory, -instead of the current directory. - -@item -fullname -@itemx -f -This option is used when Emacs runs _GDBN__ as a subprocess. It tells _GDBN__ -to output the full file name and line number in a standard, -recognizable fashion each time a stack frame is displayed (which -includes each time the program stops). This recognizable format looks -like two @samp{\032} characters, followed by the file name, line number -and character position separated by colons, and a newline. The -Emacs-to-_GDBN__ interface program uses the two @samp{\032} characters as -a signal to display the source code for the frame. - -@item -b @var{bps} -Set the line speed (baud rate or bits per second) of any serial -interface used by _GDBN__ for remote debugging. - -@item -tty @var{device} -Run using @var{device} for your program's standard input and output. -@c FIXME: kingdon thinks there's more to -tty. Investigate. -@end table - -_if__(!_GENERIC__) -_include__(gdb.inv.s-m4) -_fi__(!_GENERIC__) - -@node Leaving _GDBN__, Shell Commands, Starting _GDBN__, Invocation -@section Leaving _GDBN__ -@cindex exiting _GDBN__ -@table @code -@item quit -@kindex quit -@kindex q -To exit _GDBN__, use the @code{quit} command (abbreviated @code{q}), or type -an end-of-file character (usually @kbd{C-d}). -@end table - -@cindex interrupt -An interrupt (often @kbd{C-c}) will not exit from _GDBN__, but rather -will terminate the action of any _GDBN__ command that is in progress and -return to _GDBN__ command level. It is safe to type the interrupt -character at any time because _GDBN__ does not allow it to take effect -until a time when it is safe. - -If you've been using _GDBN__ to control an attached process or device, -you can release it with the @code{detach} command; @pxref{Attach}. - -@node Shell Commands, , Leaving _GDBN__, Invocation -@section Shell Commands -If you just need to execute occasional shell commands during your -debugging session, there's no need to leave or suspend _GDBN__; you can -just use the @code{shell} command. - -@table @code -@item shell @var{command string} -@kindex shell -@cindex shell escape -Directs _GDBN__ to invoke an inferior shell to execute @var{command -string}. If it exists, the environment variable @code{SHELL} is used -for the name of the shell to run. Otherwise _GDBN__ uses -@code{/bin/sh}. -@end table - -The utility @code{make} is often needed in development environments. -You don't have to use the @code{shell} command for this purpose in _GDBN__: - -@table @code -@item make @var{make-args} -@kindex make -@cindex calling make -Causes _GDBN__ to execute an inferior @code{make} program with the specified -arguments. This is equivalent to @samp{shell make @var{make-args}}. -@end table diff --git a/gdb/doc/gdb.rdln-m4 b/gdb/doc/gdb.rdln-m4 index 7248efa..e69de29 100755 --- a/gdb/doc/gdb.rdln-m4 +++ b/gdb/doc/gdb.rdln-m4 @@ -1,7 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@iftex -@include rdl-apps.texinfo -@end iftex diff --git a/gdb/doc/gdb.rename-m4 b/gdb/doc/gdb.rename-m4 index 7731a41..e69de29 100755 --- a/gdb/doc/gdb.rename-m4 +++ b/gdb/doc/gdb.rename-m4 @@ -1,112 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Renamed Commands, Installing _GDBN__, _GDBN__ Bugs, Top -@appendix Renamed Commands - -The following commands were renamed in _GDBN__ 4.0, in order to make the -command set as a whole more consistent and easier to use and remember: - -@kindex add-syms -@kindex delete environment -@kindex info copying -@kindex info convenience -@kindex info directories -@kindex info editing -@kindex info history -@kindex info targets -@kindex info values -@kindex info version -@kindex info warranty -@kindex set addressprint -@kindex set arrayprint -@kindex set prettyprint -@kindex set screen-height -@kindex set screen-width -@kindex set unionprint -@kindex set vtblprint -@kindex set demangle -@kindex set asm-demangle -@kindex set sevenbit-strings -@kindex set array-max -@kindex set caution -@kindex set history write -@kindex show addressprint -@kindex show arrayprint -@kindex show prettyprint -@kindex show screen-height -@kindex show screen-width -@kindex show unionprint -@kindex show vtblprint -@kindex show demangle -@kindex show asm-demangle -@kindex show sevenbit-strings -@kindex show array-max -@kindex show caution -@kindex show history write -@kindex unset - -@ifinfo -OLD COMMAND NEW COMMAND ---------------- ---------------------------------- -add-syms add-symbol-file -delete environment unset environment -info convenience show convenience -info copying show copying -info directories show directories -info editing show commands -info history show values -info targets help target -info values show values -info version show version -info warranty show warranty -set/show addressprint set/show print address -set/show array-max set/show print elements -set/show arrayprint set/show print array -set/show asm-demangle set/show print asm-demangle -set/show caution set/show confirm -set/show demangle set/show print demangle -set/show history write set/show history save -set/show prettyprint set/show print pretty -set/show screen-height set/show height -set/show screen-width set/show width -set/show sevenbit-strings set/show print sevenbit-strings -set/show unionprint set/show print union -set/show vtblprint set/show print vtbl - -unset [ No longer an alias for delete ] -@end ifinfo - -@tex -\vskip \parskip\vskip \baselineskip -\halign{\tt #\hfil &\qquad#&\tt #\hfil\cr -{\bf Old Command} &&{\bf New Command}\cr -add-syms &&add-symbol-file\cr -delete environment &&unset environment\cr -info convenience &&show convenience\cr -info copying &&show copying\cr -info directories &&show directories \cr -info editing &&show commands\cr -info history &&show values\cr -info targets &&help target\cr -info values &&show values\cr -info version &&show version\cr -info warranty &&show warranty\cr -set{\rm / }show addressprint &&set{\rm / }show print address\cr -set{\rm / }show array-max &&set{\rm / }show print elements\cr -set{\rm / }show arrayprint &&set{\rm / }show print array\cr -set{\rm / }show asm-demangle &&set{\rm / }show print asm-demangle\cr -set{\rm / }show caution &&set{\rm / }show confirm\cr -set{\rm / }show demangle &&set{\rm / }show print demangle\cr -set{\rm / }show history write &&set{\rm / }show history save\cr -set{\rm / }show prettyprint &&set{\rm / }show print pretty\cr -set{\rm / }show screen-height &&set{\rm / }show height\cr -set{\rm / }show screen-width &&set{\rm / }show width\cr -set{\rm / }show sevenbit-strings &&set{\rm / }show print sevenbit-strings\cr -set{\rm / }show unionprint &&set{\rm / }show print union\cr -set{\rm / }show vtblprint &&set{\rm / }show print vtbl\cr -\cr -unset &&\rm(No longer an alias for delete)\cr -} -@end tex diff --git a/gdb/doc/gdb.run-m4 b/gdb/doc/gdb.run-m4 index 09df60b..e69de29 100755 --- a/gdb/doc/gdb.run-m4 +++ b/gdb/doc/gdb.run-m4 @@ -1,390 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Running, Stopping, Commands, Top -@chapter Running Programs Under _GDBN__ - -@menu -* Compilation:: Compiling for Debugging -* Starting:: Starting your Program -* Arguments:: Your Program's Arguments -* Environment:: Your Program's Environment -* Working Directory:: Your Program's Working Directory -* Input/Output:: Your Program's Input and Output -* Attach:: Debugging an Already-Running Process -* Kill Process:: Killing the Child Process -@end menu - -@node Compilation, Starting, Running, Running -@section Compiling for Debugging - -In order to debug a program effectively, you need to generate -debugging information when you compile it. This debugging information -is stored in the object file; it describes the data type of each -variable or function and the correspondence between source line numbers -and addresses in the executable code. - -To request debugging information, specify the @samp{-g} option when you run -the compiler. - -Many C compilers are unable to handle the @samp{-g} and @samp{-O} -options together. Using those compilers, you cannot generate optimized -executables containing debugging information. - -The GNU C compiler supports @samp{-g} with or without @samp{-O}, making it -possible to debug optimized code. We recommend that you @emph{always} use -@samp{-g} whenever you compile a program. You may think the program is -correct, but there's no sense in pushing your luck. - -Some things do not work as well with @samp{-g -O} as with just -@samp{-g}, particularly on machines with instruction scheduling. If in -doubt, recompile with @samp{-g} alone, and if this fixes the problem, -please report it as a bug (including a test case!). - -Older versions of the GNU C compiler permitted a variant option -@samp{-gg} for debugging information. _GDBN__ no longer supports this -format; if your GNU C compiler has this option, do not use it. - -@ignore -@comment As far as I know, there are no cases in which _GDBN__ will -@comment produce strange output in this case. (but no promises). -If your program includes archives made with the @code{ar} program, and -if the object files used as input to @code{ar} were compiled without the -@samp{-g} option and have names longer than 15 characters, _GDBN__ will get -confused reading the program's symbol table. No error message will be -given, but _GDBN__ may behave strangely. The reason for this problem is a -deficiency in the Unix archive file format, which cannot represent file -names longer than 15 characters. - -To avoid this problem, compile the archive members with the @samp{-g} -option or use shorter file names. Alternatively, use a version of GNU -@code{ar} dated more recently than August 1989. -@end ignore - - -@node Starting, Arguments, Compilation, Running -@section Starting your Program -@cindex starting -@cindex running -@table @code -@item run -@itemx r -@kindex run -Use the @code{run} command to start your program under _GDBN__. -_if__(_VXWORKS__) -Except on VxWorks, you -_fi__(_VXWORKS__) -_if__(!_VXWORKS__) -You -_fi__(!_VXWORKS__) -must first specify the program name with an argument to _GDBN__ -(@pxref{Invocation}), or using the @code{file} or @code{exec-file} -command (@pxref{Files}).@refill -@end table - -On targets that support processes, @code{run} creates an inferior -process and makes that process run your program. On other targets, -@code{run} jumps to the start of the program. - -The execution of a program is affected by certain information it -receives from its superior. _GDBN__ provides ways to specify this -information, which you must do @i{before} starting the program. (You -can change it after starting the program, but such changes will only affect -the program the next time you start it.) This information may be -divided into four categories: - -@table @asis -@item The @i{arguments.} -You specify the arguments to give your program as the arguments of the -@code{run} command. If a shell is available on your target, the shell -is used to pass the arguments, so that you may use normal conventions -(such as wildcard expansion or variable substitution) in -describing the arguments. In Unix systems, you can control which shell -is used with the @code{SHELL} environment variable. @xref{Arguments}.@refill - -@item The @i{environment.} -Your program normally inherits its environment from _GDBN__, but you can -use the _GDBN__ commands @code{set environment} and @code{unset -environment} to change parts of the environment that will be given to -the program. @xref{Environment}.@refill - -@item The @i{working directory.} -Your program inherits its working directory from _GDBN__. You can set -_GDBN__'s working directory with the @code{cd} command in _GDBN__. -@xref{Working Directory}. - -@item The @i{standard input and output.} -Your program normally uses the same device for standard input and -standard output as _GDBN__ is using. You can redirect input and output -in the @code{run} command line, or you can use the @code{tty} command to -set a different device for your program. -@xref{Input/Output}. -@end table - -When you issue the @code{run} command, your program begins to execute -immediately. @xref{Stopping}, for discussion of how to arrange for your -program to stop. Once your program has been started by the @code{run} -command (and then stopped), you may evaluate expressions that involve -calls to functions in the inferior, using the @code{print} or -@code{call} commands. @xref{Data}. - -If the modification time of your symbol file has changed since the last -time _GDBN__ read its symbols, _GDBN__ will discard its symbol table and re-read -it. In this process, it tries to retain your current breakpoints. - -@node Arguments, Environment, Starting, Running -@section Your Program's Arguments - -@cindex arguments (to your program) -The arguments to your program can be specified by the arguments of the -@code{run} command. They are passed to a shell, which expands wildcard -characters and performs redirection of I/O, and thence to the program. -_GDBN__ uses the shell indicated by your environment variable -@code{SHELL} if it exists; otherwise, _GDBN__ uses @code{/bin/sh}. - -@code{run} with no arguments uses the same arguments used by the previous -@code{run}, or those set by the @code{set args} command. - -@kindex set args -@table @code -@item set args -Specify the arguments to be used the next time your program is run. If -@code{set args} has no arguments, @code{run} will execute your program -with no arguments. Once you have run your program with arguments, this -is the only way to run it again without arguments. - -@item show args -@kindex show args -Show the arguments to give your program when it is started. -@end table - -@node Environment, Working Directory, Arguments, Running -@section Your Program's Environment - -@cindex environment (of your program) -The @dfn{environment} consists of a set of environment variables and -their values. Environment variables conventionally record such things as -your user name, your home directory, your terminal type, and your search -path for programs to run. Usually you set up environment variables with -the shell and they are inherited by all the other programs you run. When -debugging, it can be useful to try running the program with a modified -environment without having to start _GDBN__ over again. - -@table @code -@item path @var{directory} -@kindex path -Add @var{directory} to the front of the @code{PATH} environment variable -(the search path for executables), for both _GDBN__ and your program. -You may specify several directory names, separated by @samp{:} or -whitespace. If @var{directory} is already in the path, it is moved to -the front, so it will be searched sooner. You can use the string -@samp{$cwd} to refer to whatever is the current working directory at the -time _GDBN__ searches the path. @footnote{If you use @samp{.} instead, -it refers to the directory where you executed the @code{path} command. -_GDBN__ fills in the current path where needed in the @var{directory} -argument, before adding it to the search path.} -@c 'path' is explicitly nonrepeatable, but RMS points out it's silly to -@c document that, since repeating it would be a no-op. - -@item show paths -@kindex show paths -Display the list of search paths for executables (the @code{PATH} -environment variable). - -@item show environment @var{varname} -@kindex show environment -Print the value of environment variable @var{varname} to be given to -your program when it starts. - -@item show environment -Print the names and values of all environment variables to be given to -your program. - -@item set environment @var{varname} @var{value} -@itemx set environment @var{varname} = @var{value} -@kindex set environment -Sets environment variable @var{varname} to @var{value}. The value -changes for your program only, not for _GDBN__ itself. @var{value} may -be any string; the values of environment variables are just strings, and -any interpretation is supplied by your program itself. The @var{value} -parameter is optional; if it is eliminated, the variable is set to a -null value. -@c "any string" here doesn't include leading, trailing -@c blanks. Gnu asks: does anyone care? - -For example, this command: - -@example -set env USER = foo -@end example - -@noindent -tells a Unix program, when subsequently run, that its user is named -@samp{foo}. (The spaces around @samp{=} are used for clarity here; they -are not actually required.) - -@item unset environment @var{varname} -@kindex unset environment -Remove variable @var{varname} from the environment to be passed to your -program. This is different from @samp{set env @var{varname} =}; -@code{unset environment} removes the variable from the environment, -rather than assigning it an empty value. -@end table - -@node Working Directory, Input/Output, Environment, Running -@section Your Program's Working Directory - -@cindex working directory (of your program) -Each time you start your program with @code{run}, it inherits its -working directory from the current working directory of _GDBN__. _GDBN__'s -working directory is initially whatever it inherited from its parent -process (typically the shell), but you can specify a new working -directory in _GDBN__ with the @code{cd} command. - -The _GDBN__ working directory also serves as a default for the commands -that specify files for _GDBN__ to operate on. @xref{Files}. - -@table @code -@item cd @var{directory} -@kindex cd -Set _GDBN__'s working directory to @var{directory}. - -@item pwd -@kindex pwd -Print _GDBN__'s working directory. -@end table - -@node Input/Output, Attach, Working Directory, Running -@section Your Program's Input and Output - -@cindex redirection -@cindex i/o -@cindex terminal -@cindex controlling terminal -By default, the program you run under _GDBN__ does input and output to -the same terminal that _GDBN__ uses. _GDBN__ switches the terminal to -its own terminal modes to interact with you, but it records the terminal -modes your program was using and switches back to them when you continue -running your program. - -@table @code -@item info terminal -@kindex info terminal -Displays _GDBN__'s recorded information about the terminal modes your -program is using. -@end table - -You can redirect the program's input and/or output using shell -redirection with the @code{run} command. For example, - -_0__@example -run > outfile -_1__@end example - -@noindent -starts the program, diverting its output to the file @file{outfile}. - -@kindex tty -Another way to specify where the program should do input and output is -with the @code{tty} command. This command accepts a file name as -argument, and causes this file to be the default for future @code{run} -commands. It also resets the controlling terminal for the child -process, for future @code{run} commands. For example, - -@example -tty /dev/ttyb -@end example - -@noindent -directs that processes started with subsequent @code{run} commands -default to do input and output on the terminal @file{/dev/ttyb} and have -that as their controlling terminal. - -An explicit redirection in @code{run} overrides the @code{tty} command's -effect on the input/output device, but not its effect on the controlling -terminal. - -When you use the @code{tty} command or redirect input in the @code{run} -command, only the input @emph{for your program} is affected. The input -for _GDBN__ still comes from your terminal. - -@node Attach, Kill Process, Input/Output, Running -@section Debugging an Already-Running Process -@kindex attach -@cindex attach - -@table @code -@item attach @var{process-id} -This command -attaches to a running process---one that was started outside _GDBN__. -(@code{info files} will show your active targets.) The command takes as -argument a process ID. The usual way to find out the process-id of -a Unix process is with the @code{ps} utility, or with the @samp{jobs -l} -shell command. - -@code{attach} will not repeat if you press @key{RET} a second time after -executing the command. -@end table - -To use @code{attach}, you must be debugging in an environment which -supports processes. You must also have permission to send the process a -signal, and it must have the same effective user ID as the _GDBN__ -process. - -When using @code{attach}, you should first use the @code{file} command -to specify the program running in the process and load its symbol table. -@xref{Files}. - -The first thing _GDBN__ does after arranging to debug the specified -process is to stop it. You can examine and modify an attached process -with all the _GDBN__ commands that ordinarily available when you start -processes with @code{run}. You can insert breakpoints; you can step and -continue; you can modify storage. If you would rather the process -continue running, you may use the @code{continue} command after -attaching _GDBN__ to the process. - -@table @code -@item detach -@kindex detach -When you have finished debugging the attached process, you can use the -@code{detach} command to release it from _GDBN__'s control. Detaching -the process continues its execution. After the @code{detach} command, -that process and _GDBN__ become completely independent once more, and you -are ready to @code{attach} another process or start one with @code{run}. -@code{detach} will not repeat if you press @key{RET} again after -executing the command. -@end table - -If you exit _GDBN__ or use the @code{run} command while you have an attached -process, you kill that process. By default, you will be asked for -confirmation if you try to do either of these things; you can control -whether or not you need to confirm by using the @code{set confirm} command -(@pxref{Messages/Warnings}). - -@node Kill Process, , Attach, Running -@c @group -@section Killing the Child Process - -@table @code -@item kill -@kindex kill -Kill the child process in which your program is running under _GDBN__. -@end table - -This command is useful if you wish to debug a core dump instead of a -running process. _GDBN__ ignores any core dump file while your program -is running. -@c @end group - -On some operating systems, you can't execute your program in another -process while breakpoints are active inside _GDBN__. You can use the -@code{kill} command in this situation to permit running the program -outside the debugger. - -The @code{kill} command is also useful if you wish to recompile and -relink the program, since on many systems it is impossible to modify an -executable file which is running in a process. In this case, when you -next type @code{run}, _GDBN__ will notice that the file has changed, and -will re-read the symbol table (while trying to preserve your current -breakpoint settings). diff --git a/gdb/doc/gdb.sample-m4 b/gdb/doc/gdb.sample-m4 index ae258ad..e69de29 100755 --- a/gdb/doc/gdb.sample-m4 +++ b/gdb/doc/gdb.sample-m4 @@ -1,263 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Sample Session, Invocation, New Features, Top -@chapter A Sample _GDBN__ Session - -You can use this manual at your leisure to read all about _GDBN__. -However, a handful of commands are enough to get started using the -debugger. This chapter illustrates these commands. - -@iftex -In this sample session, we emphasize user input like this: @i{input}, -to make it easier to pick out from the surrounding output. -@end iftex - -@c FIXME: this example may not be appropriate for some configs, where -@c FIXME...primary interest is in remote use. -_0__ -One of the preliminary versions of GNU @code{m4} (a generic macro -processor) exhibits the following bug: sometimes, when we change its -quote strings from the default, the commands used to capture one macro's -definition in another stop working. In the following short @code{m4} -session, we define a macro @code{foo} which expands to @code{0000}; we -then use the @code{m4} builtin @code{defn} to define @code{bar} as the -same thing. However, when we change the open quote string to -@code{} and the close quote string to @code{}, the same -procedure fails to define a new synonym @code{baz}: - -@smallexample -$ @i{cd gnu/m4} -$ @i{./m4} -@i{define(foo,0000)} - -@i{foo} -0000 -@i{define(bar,defn(`foo'))} - -@i{bar} -0000 -@i{changequote(,)} - -@i{define(baz,defn(foo))} -@i{baz} -@i{C-D} -m4: End of input: 0: fatal error: EOF in string -@end smallexample - -@noindent -Let's use _GDBN__ to try to see what's going on. - -@smallexample -$ @i{_GDBP__ m4} -Reading symbol data from m4...done. -(_GDBP__) -@end smallexample - -@noindent -_GDBN__ only reads enough symbol data to know where to find the rest -when needed; as a result, the first prompt comes up very quickly. We -then tell _GDBN__ to use a narrower display width than usual, so -that examples will fit in this manual. - -@smallexample -(_GDBP__) @i{set width 70} -@end smallexample - -@noindent -Let's see how the @code{m4} builtin @code{changequote} works. -Having looked at the source, we know the relevant subroutine is -@code{m4_changequote}, so we set a breakpoint there with _GDBN__'s -@code{break} command. - -@smallexample -(_GDBP__) @i{break m4_changequote} -Breakpoint 1 at 0x62f4: file builtin.c, line 879. -@end smallexample - -@noindent -Using the @code{run} command, we start @code{m4} running under _GDBN__ -control; as long as control does not reach the @code{m4_changequote} -subroutine, the program runs as usual: - -@smallexample -(_GDBP__) @i{run} -Starting program: /work/Editorial/gdb/gnu/m4/m4 -@i{define(foo,0000)} - -@i{foo} -0000 -@end smallexample - -@noindent -To trigger the breakpoint, we call @code{changequote}. _GDBN__ -suspends execution of @code{m4}, displaying information about the -context where it stops. - -@smallexample -@i{changequote(,)} - -Breakpoint 1, m4_changequote (argc=3, argv=0x33c70) at builtin.c:879 -879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]), argc, 1, 3)) -@end smallexample - -@noindent -Now we use the command @code{n} (@code{next}) to advance execution to -the next line of the current function. - -@smallexample -(_GDBP__) @i{n} -882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1]) : nil, -@end smallexample - -@noindent -@code{set_quotes} looks like a promising subroutine. We can go into it -by using the command @code{s} (@code{step}) instead of @code{next}. -@code{step} goes to the next line to be executed in @emph{any} -subroutine, so it steps into @code{set_quotes}. - -@smallexample -(_GDBP__) @i{s} -set_quotes (lq=0x34c78 "", rq=0x34c88 "") - at input.c:530 -530 if (lquote != def_lquote) -@end smallexample - -@noindent -The summary display showing the subroutine where @code{m4} is now -suspended (and its arguments) is called a stack frame display. We can -use the @code{backtrace} command (which can also be spelled @code{bt}), -to see where we are in the stack: it displays a stack frame for each -active subroutine. - -@smallexample -(_GDBP__) @i{bt} -#0 set_quotes (lq=0x34c78 "", rq=0x34c88 "") - at input.c:530 -#1 0x6344 in m4_changequote (argc=3, argv=0x33c70) at builtin.c:882 -#2 0x8174 in expand_macro (sym=0x33320) at macro.c:242 -#3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30) - at macro.c:71 -#4 0x79dc in expand_input () at macro.c:40 -#5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195 -@end smallexample - -@noindent -Let's step through a few more lines to see what happens. The first two -times, we can use @samp{s}; the next two times we use @code{n} to avoid -falling into the @code{xstrdup} subroutine. -@smallexample -(_GDBP__) @i{s} -0x3b5c 532 if (rquote != def_rquote) -(_GDBP__) @i{s} -0x3b80 535 lquote = (lq == nil || *lq == '\0') ? def_lquote :\ - xstrdup(lq); -(_GDBP__) @i{n} -536 rquote = (rq == nil || *rq == '\0') ? def_rquote : xstrdup\ -(rq); -(_GDBP__) @i{n} -538 len_lquote = strlen(rquote); -@end smallexample - -@noindent -The last line displayed looks a little odd; let's examine the variables -@code{lquote} and @code{rquote} to see if they are in fact the new left -and right quotes we specified. We can use the command @code{p} -(@code{print}) to see their values. - -@smallexample -(_GDBP__) @i{p lquote} -$1 = 0x35d40 "" -(_GDBP__) @i{p rquote} -$2 = 0x35d50 "" -@end smallexample - -@noindent -@code{lquote} and @code{rquote} are indeed the new left and right quotes. -Let's look at some context; we can display ten lines of source -surrounding the current line, with the @code{l} (@code{list}) command. - -@smallexample -(_GDBP__) @i{l} -533 xfree(rquote); -534 -535 lquote = (lq == nil || *lq == '\0') ? def_lquote : xstrdup\ -(lq); -536 rquote = (rq == nil || *rq == '\0') ? def_rquote : xstrdup\ -(rq); -537 -538 len_lquote = strlen(rquote); -539 len_rquote = strlen(lquote); -540 @} -541 -542 void -@end smallexample - -@noindent -Let's step past the two lines that set @code{len_lquote} and -@code{len_rquote}, and then examine the values of those variables. - -@smallexample -(_GDBP__) @i{n} -539 len_rquote = strlen(lquote); -(_GDBP__) @i{n} -540 @} -(_GDBP__) @i{p len_lquote} -$3 = 9 -(_GDBP__) @i{p len_rquote} -$4 = 7 -@end smallexample - -@noindent -That certainly looks wrong, assuming @code{len_lquote} and -@code{len_rquote} are meant to be the lengths of @code{lquote} and -@code{rquote} respectively. Let's try setting them to better values. -We can use the @code{p} command for this, since it'll print the value of -any expression---and that expression can include subroutine calls and -assignments. - -@smallexample -(_GDBP__) p len_lquote=strlen(lquote) -$5 = 7 -(_GDBP__) p len_rquote=strlen(rquote) -$6 = 9 -@end smallexample - -@noindent -Let's see if that fixes the problem of using the new quotes with the -@code{m4} built-in @code{defn}. We can allow @code{m4} to continue -executing with the @code{c} (@code{continue}) command, and then try the -example that caused trouble initially: - -@smallexample -(_GDBP__) @i{c} -Continuing. - -@i{define(baz,defn(foo))} - -baz -0000 -@end smallexample - -@noindent -Success! The new quotes now work just as well as the default ones. The -problem seems to have been just the two typos defining the wrong -lengths. We'll let @code{m4} exit by giving it an EOF as input. - -@smallexample -@i{C-D} -Program exited normally. -@end smallexample - -@noindent -The message @samp{Program exited normally.} is from _GDBN__; it -indicates @code{m4} has finished executing. We can end our _GDBN__ -session with the _GDBN__ @code{quit} command. - -@smallexample -(_GDBP__) @i{quit} - -$ -_1__@end smallexample - diff --git a/gdb/doc/gdb.src-m4 b/gdb/doc/gdb.src-m4 index fdc6e33..e69de29 100755 --- a/gdb/doc/gdb.src-m4 +++ b/gdb/doc/gdb.src-m4 @@ -1,288 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Source, Data, Stack, Top -@chapter Examining Source Files - -_GDBN__ can print parts of your program's source, since the debugging -information recorded in your program tells _GDBN__ what source files -were used to built it. When your program stops, _GDBN__ spontaneously -prints the line where it stopped. Likewise, when you select a stack -frame (@pxref{Selection}), _GDBN__ prints the line where execution in -that frame has stopped. You can print other portions of source files by -explicit command. - -If you use _GDBN__ through its GNU Emacs interface, you may prefer to -use Emacs facilities to view source; @pxref{Emacs}. - -@menu -* List:: Printing Source Lines -* Search:: Searching Source Files -* Source Path:: Specifying Source Directories -* Machine Code:: Source and Machine Code -@end menu - -@node List, Search, Source, Source -@section Printing Source Lines - -@kindex list -@kindex l -To print lines from a source file, use the @code{list} command -(abbreviated @code{l}). There are several ways to specify what part -of the file you want to print. - -Here are the forms of the @code{list} command most commonly used: - -@table @code -@item list @var{linenum} -Print ten lines centered around line number @var{linenum} in the -current source file. - -@item list @var{function} -Print ten lines centered around the beginning of function -@var{function}. - -@item list -Print ten more lines. If the last lines printed were printed with a -@code{list} command, this prints ten lines following the last lines -printed; however, if the last line printed was a solitary line printed -as part of displaying a stack frame (@pxref{Stack}), this prints ten -lines centered around that line. - -@item list - -Print ten lines just before the lines last printed. -@end table - -Repeating a @code{list} command with @key{RET} discards the argument, -so it is equivalent to typing just @code{list}. This is more useful -than listing the same lines again. An exception is made for an -argument of @samp{-}; that argument is preserved in repetition so that -each repetition moves up in the source file. - -@cindex linespec -In general, the @code{list} command expects you to supply zero, one or two -@dfn{linespecs}. Linespecs specify source lines; there are several ways -of writing them but the effect is always to specify some source line. -Here is a complete description of the possible arguments for @code{list}: - -@table @code -@item list @var{linespec} -Print ten lines centered around the line specified by @var{linespec}. - -@item list @var{first},@var{last} -Print lines from @var{first} to @var{last}. Both arguments are -linespecs. - -@item list ,@var{last} -Print ten lines ending with @var{last}. - -@item list @var{first}, -Print ten lines starting with @var{first}. - -@item list + -Print ten lines just after the lines last printed. - -@item list - -Print ten lines just before the lines last printed. - -@item list -As described in the preceding table. -@end table - -Here are the ways of specifying a single source line---all the -kinds of linespec. - -@table @code -@item @var{number} -Specifies line @var{number} of the current source file. -When a @code{list} command has two linespecs, this refers to -the same source file as the first linespec. - -@item +@var{offset} -Specifies the line @var{offset} lines after the last line printed. -When used as the second linespec in a @code{list} command that has -two, this specifies the line @var{offset} lines down from the -first linespec. - -@item -@var{offset} -Specifies the line @var{offset} lines before the last line printed. - -@item @var{filename}:@var{number} -Specifies line @var{number} in the source file @var{filename}. - -@item @var{function} -@c FIXME: "of the open-brace" is C-centric. When we add other langs... -Specifies the line of the open-brace that begins the body of the -function @var{function}. - -@item @var{filename}:@var{function} -Specifies the line of the open-brace that begins the body of the -function @var{function} in the file @var{filename}. You only need the -file name with a function name to avoid ambiguity when there are -identically named functions in different source files. - -@item *@var{address} -Specifies the line containing the program address @var{address}. -@var{address} may be any expression. -@end table - -@node Search, Source Path, List, Source -@section Searching Source Files -@cindex searching -@kindex reverse-search - -There are two commands for searching through the current source file for a -regular expression. - -@table @code -@item forward-search @var{regexp} -@itemx search @var{regexp} -@kindex search -@kindex forward-search -The command @samp{forward-search @var{regexp}} checks each line, starting -with the one following the last line listed, for a match for @var{regexp}. -It lists the line that is found. You can abbreviate the command name -as @code{fo}. The synonym @samp{search @var{regexp}} is also supported. - -@item reverse-search @var{regexp} -The command @samp{reverse-search @var{regexp}} checks each line, starting -with the one before the last line listed and going backward, for a match -for @var{regexp}. It lists the line that is found. You can abbreviate -this command as @code{rev}. -@end table - -@node Source Path, Machine Code, Search, Source -@section Specifying Source Directories - -@cindex source path -@cindex directories for source files -Executable programs sometimes do not record the directories of the source -files from which they were compiled, just the names. Even when they do, -the directories could be moved between the compilation and your debugging -session. _GDBN__ has a list of directories to search for source files; -this is called the @dfn{source path}. Each time _GDBN__ wants a source file, -it tries all the directories in the list, in the order they are present -in the list, until it finds a file with the desired name. Note that -the executable search path is @emph{not} used for this purpose. Neither is -the current working directory, unless it happens to be in the source -path. - -If _GDBN__ can't find a source file in the source path, and the object -program records a directory, _GDBN__ tries that directory too. If the -source path is empty, and there is no record of the compilation -directory, _GDBN__ will, as a last resort, look in the current -directory. - -Whenever you reset or rearrange the source path, _GDBN__ will clear out -any information it has cached about where source files are found, where -each line is in the file, etc. - -@kindex directory -When you start _GDBN__, its source path is empty. -To add other directories, use the @code{directory} command. - -@table @code -@item directory @var{dirname} @dots{} -Add directory @var{dirname} to the front of the source path. Several -directory names may be given to this command, separated by @samp{:} or -whitespace. You may specify a directory that is already in the source -path; this moves it forward, so it will be searched sooner. You can use -the string @samp{$cdir} to refer to the compilation directory (if one is -recorded), and @samp{$cwd} to refer to the current working directory. -@footnote{@samp{$cwd} is not the same as @samp{.}---the former tracks -the current working directory as it changes during your _GDBN__ session, -while the latter is immediately expanded to the current directory at the -time you add an entry to the source path.} - -@item directory -Reset the source path to empty again. This requires confirmation. - -@c RET-repeat for @code{directory} is explicitly disabled, but since -@c repeating it would be a no-op we don't say that. (thanks to RMS) - -@item show directories -@kindex show directories -Print the source path: show which directories it contains. -@end table - -If your source path is cluttered with directories that are no longer of -interest, _GDBN__ may sometimes cause confusion by finding the wrong -versions of source. You can correct the situation as follows: - -@enumerate -@item -Use @code{directory} with no argument to reset the source path to empty. - -@item -Use @code{directory} with suitable arguments to reinstall the -directories you want in the source path. You can add all the -directories in one command. -@end enumerate - -@node Machine Code, , Source Path, Source -@section Source and Machine Code -You can use the command @code{info line} to map source lines to program -addresses (and viceversa), and the command @code{disassemble} to display -a range of addresses as machine instructions. - -@table @code -@item info line @var{linespec} -@kindex info line -Print the starting and ending addresses of the compiled code for -source line @var{linespec}. You can specify source lines in any of the -ways understood by the @code{list} command (@pxref{List}). -@end table - -For example, we can use @code{info line} to inquire on where the object -code for the first line of function @code{m4_changequote} lies: -@smallexample -(_GDBP__) info line m4_changecom -Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350. -@end smallexample - -@noindent -We can also inquire (using @code{*@var{addr}} as the form for -@var{linespec}) what source line covers a particular address: -@smallexample -(_GDBP__) info line *0x63ff -Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404. -@end smallexample - -@kindex $_ -After @code{info line}, the default address for the @code{x} -command is changed to the starting address of the line, so that -@samp{x/i} is sufficient to begin examining the machine code -(@pxref{Memory}). Also, this address is saved as the value of the -convenience variable @code{$_} (@pxref{Convenience Vars}). - -@table @code -@kindex disassemble -@item disassemble -This specialized command is provided to dump a range of memory as -machine instructions. The default memory range is the function -surrounding the program counter of the selected frame. A single -argument to this command is a program counter value; the function -surrounding this value will be dumped. Two arguments (separated by one -or more spaces) specify a range of addresses (first inclusive, second -exclusive) to be dumped. -@end table - -We can use @code{disassemble} to inspect the object code -range shown in the last @code{info line} example: - -@smallexample -(_GDBP__) disas 0x63e4 0x6404 -Dump of assembler code from 0x63e4 to 0x6404: -0x63e4 : ble 0x63f8 -0x63e8 : sethi %hi(0x4c00), %o0 -0x63ec : ld [%i1+4], %o0 -0x63f0 : b 0x63fc -0x63f4 : ld [%o0+4], %o0 -0x63f8 : or %o0, 0x1a4, %o0 -0x63fc : call 0x9288 -0x6400 : nop -End of assembler dump. -(_GDBP__) - -@end smallexample diff --git a/gdb/doc/gdb.stack-m4 b/gdb/doc/gdb.stack-m4 index 4bed2f5..e69de29 100755 --- a/gdb/doc/gdb.stack-m4 +++ b/gdb/doc/gdb.stack-m4 @@ -1,279 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Stack, Source, Stopping, Top -@chapter Examining the Stack - -When your program has stopped, the first thing you need to know is where it -stopped and how it got there. - -@cindex call stack -Each time your program performs a function call, the information about -where in the program the call was made from is saved in a block of data -called a @dfn{stack frame}. The frame also contains the arguments of the -call and the local variables of the function that was called. All the -stack frames are allocated in a region of memory called the @dfn{call -stack}. - -When your program stops, the _GDBN__ commands for examining the stack allow you -to see all of this information. - -@cindex selected frame -One of the stack frames is @dfn{selected} by _GDBN__ and many _GDBN__ commands -refer implicitly to the selected frame. In particular, whenever you ask -_GDBN__ for the value of a variable in the program, the value is found in the -selected frame. There are special _GDBN__ commands to select whichever frame -you are interested in. - -When the program stops, _GDBN__ automatically selects the currently executing -frame and describes it briefly as the @code{frame} command does -(@pxref{Frame Info, Info}). - -@menu -* Frames:: Stack Frames -* Backtrace:: Backtraces -* Selection:: Selecting a Frame -* Frame Info:: Information on a Frame -@end menu - -@node Frames, Backtrace, Stack, Stack -@section Stack Frames - -@cindex frame -@cindex stack frame -The call stack is divided up into contiguous pieces called @dfn{stack -frames}, or @dfn{frames} for short; each frame is the data associated -with one call to one function. The frame contains the arguments given -to the function, the function's local variables, and the address at -which the function is executing. - -@cindex initial frame -@cindex outermost frame -@cindex innermost frame -When your program is started, the stack has only one frame, that of the -function @code{main}. This is called the @dfn{initial} frame or the -@dfn{outermost} frame. Each time a function is called, a new frame is -made. Each time a function returns, the frame for that function invocation -is eliminated. If a function is recursive, there can be many frames for -the same function. The frame for the function in which execution is -actually occurring is called the @dfn{innermost} frame. This is the most -recently created of all the stack frames that still exist. - -@cindex frame pointer -Inside your program, stack frames are identified by their addresses. A -stack frame consists of many bytes, each of which has its own address; each -kind of computer has a convention for choosing one of those bytes whose -address serves as the address of the frame. Usually this address is kept -in a register called the @dfn{frame pointer register} while execution is -going on in that frame. - -@cindex frame number -_GDBN__ assigns numbers to all existing stack frames, starting with -zero for the innermost frame, one for the frame that called it, -and so on upward. These numbers do not really exist in your program; -they are assigned by _GDBN__ to give you a way of designating stack -frames in _GDBN__ commands. - -@cindex frameless execution -Some compilers allow functions to be compiled so that they operate -without stack frames. (For example, the @code{_GCC__} option -@samp{-fomit-frame-pointer} will generate functions without a frame.) -This is occasionally done with heavily used library functions to save -the frame setup time. _GDBN__ has limited facilities for dealing with -these function invocations. If the innermost function invocation has no -stack frame, _GDBN__ will nevertheless regard it as though it had a -separate frame, which is numbered zero as usual, allowing correct -tracing of the function call chain. However, _GDBN__ has no provision -for frameless functions elsewhere in the stack. - -@node Backtrace, Selection, Frames, Stack -@section Backtraces - -A backtrace is a summary of how the program got where it is. It shows one -line per frame, for many frames, starting with the currently executing -frame (frame zero), followed by its caller (frame one), and on up the -stack. - -@table @code -@item backtrace -@itemx bt -@kindex backtrace -@kindex bt -Print a backtrace of the entire stack: one line per frame for all -frames in the stack. - -You can stop the backtrace at any time by typing the system interrupt -character, normally @kbd{Control-C}. - -@item backtrace @var{n} -@itemx bt @var{n} -Similar, but print only the innermost @var{n} frames. - -@item backtrace -@var{n} -@itemx bt -@var{n} -Similar, but print only the outermost @var{n} frames. -@end table - -@kindex where -@kindex info stack -@kindex info s -The names @code{where} and @code{info stack} (abbreviated @code{info s}) -are additional aliases for @code{backtrace}. - -Each line in the backtrace shows the frame number and the function name. -The program counter value is also shown---unless you use @code{set -print address off}. The backtrace also shows the source file name and -line number, as well as the arguments to the function. The program -counter value is omitted if it is at the beginning of the code for that -line number. - -Here is an example of a backtrace. It was made with the command -@samp{bt 3}, so it shows the innermost three frames. - -@smallexample -@group -#0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) at builtin.c:993 -#1 0x6e38 in expand_macro (sym=0x2b600) at macro.c:242 -#2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08) - at macro.c:71 -(More stack frames follow...) -@end group -@end smallexample - -@noindent -The display for frame zero doesn't begin with a program counter -value, indicating that the program has stopped at the beginning of the -code for line @code{993} of @code{builtin.c}. - -@node Selection, Frame Info, Backtrace, Stack -@section Selecting a Frame - -Most commands for examining the stack and other data in the program work on -whichever stack frame is selected at the moment. Here are the commands for -selecting a stack frame; all of them finish by printing a brief description -of the stack frame just selected. - -@table @code -@item frame @var{n} -@itemx f @var{n} -@kindex frame -@kindex f -Select frame number @var{n}. Recall that frame zero is the innermost -(currently executing) frame, frame one is the frame that called the -innermost one, and so on. The highest-numbered frame is @code{main}'s -frame. - -@item frame @var{addr} -@itemx f @var{addr} -Select the frame at address @var{addr}. This is useful mainly if the -chaining of stack frames has been damaged by a bug, making it -impossible for _GDBN__ to assign numbers properly to all frames. In -addition, this can be useful when the program has multiple stacks and -switches between them. - -_if_(_SPARC__) -On the SPARC architecture, @code{frame} needs two addresses to -select an arbitrary frame: a frame pointer and a stack pointer. -@c note to future updaters: this is conditioned on a flag -@c FRAME_SPECIFICATION_DYADIC in the tm-*.h files, currently only used -@c by SPARC, hence the specific attribution. Generalize or list all -@c possibilities if more supported machines start doing this. -_fi_(_SPARC__) - -@item up @var{n} -@kindex up -Move @var{n} frames up the stack. For positive numbers @var{n}, this -advances toward the outermost frame, to higher frame numbers, to frames -that have existed longer. @var{n} defaults to one. - -@item down @var{n} -@kindex down -@kindex do -Move @var{n} frames down the stack. For positive numbers @var{n}, this -advances toward the innermost frame, to lower frame numbers, to frames -that were created more recently. @var{n} defaults to one. You may -abbreviate @code{down} as @code{do}. -@end table - -All of these commands end by printing two lines of output describing the -frame. The first line shows the frame number, the function name, the -arguments, and the source file and line number of execution in that -frame. The second line shows the text of that source line. For -example: - -@smallexample -(_GDBP__) up -#1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc) at env.c:10 -10 read_input_file (argv[i]); -@end smallexample - -After such a printout, the @code{list} command with no arguments will print -ten lines centered on the point of execution in the frame. @xref{List}. - -@table @code -@item up-silently @var{n} -@itemx down-silently @var{n} -@kindex down-silently -@kindex up-silently -These two commands are variants of @code{up} and @code{down}, -respectively; they differ in that they do their work silently, without -causing display of the new frame. They are intended primarily for use -in _GDBN__ command scripts, where the output might be unnecessary and -distracting. - -@end table - -@node Frame Info, , Selection, Stack -@section Information About a Frame - -There are several other commands to print information about the selected -stack frame. - -@table @code -@item frame -@itemx f -When used without any argument, this command does not change which frame -is selected, but prints a brief description of the currently -selected stack frame. It can be abbreviated @code{f}. With an -argument, this command is used to select a stack frame (@pxref{Selection}). - -@item info frame -@kindex info frame -@itemx info f -@kindex info f -This command prints a verbose description of the selected stack frame, -including the address of the frame, the addresses of the next frame down -(called by this frame) and the next frame up (caller of this frame), -the address of the frame's arguments, the program counter saved in it -(the address of execution in the caller frame), and which registers -were saved in the frame. The verbose description is useful when -something has gone wrong that has made the stack format fail to fit -the usual conventions. - -@item info frame @var{addr} -@itemx info f @var{addr} -Print a verbose description of the frame at address @var{addr}, -without selecting that frame. The selected frame remains unchanged by -this command. - -@item info args -@kindex info args -Print the arguments of the selected frame, each on a separate line. - -@item info locals -@kindex info locals -Print the local variables of the selected frame, each on a separate -line. These are all variables declared static or automatic within all -program blocks that execution in this frame is currently inside of. - -@item info catch -@kindex info catch -@cindex catch exceptions -@cindex exception handlers -Print a list of all the exception handlers that are active in the -current stack frame at the current point of execution. To see other -exception handlers, visit the associated frame (using the @code{up}, -@code{down}, or @code{frame} commands); then type @code{info catch}. -@xref{Exception Handling}. -@end table diff --git a/gdb/doc/gdb.stop-m4 b/gdb/doc/gdb.stop-m4 index 934d786..e69de29 100755 --- a/gdb/doc/gdb.stop-m4 +++ b/gdb/doc/gdb.stop-m4 @@ -1,920 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Stopping, Stack, Running, Top -@chapter Stopping and Continuing - -When you run a program normally, it runs until it terminates. The -principal purpose of using a debugger is so that you can stop your -program before it terminates; or so that, if the program runs into -trouble, you can investigate and find out why. - -Inside _GDBN__, your program may stop for any of several reasons, such -as a signal, a breakpoint, or reaching a new line after a _GDBN__ -command such as @code{step}. Usually, the messages shown by _GDBN__ -provide ample explanation of the status of your program---but you can -also explicitly request this information at any time. - -@table @code -@item info program -@kindex info program -Display information about the status of your program: whether it is -running or not, what process it is, and why it stopped. -@end table - -@menu -* Breakpoints:: Breakpoints, Watchpoints, and Exceptions -* Stepping:: Stepping -* Continuing:: Continuing -* Signals:: Signals -@end menu - -@node Breakpoints, Stepping, Stopping, Stopping -@section Breakpoints, Watchpoints, and Exceptions - -@cindex breakpoints -A @dfn{breakpoint} makes your program stop whenever a certain point in -the program is reached. For each breakpoint, you can add various -conditions to control in finer detail whether the program will stop. -You can set breakpoints with the @code{break} command and its variants -(@pxref{Set Breaks}), to specify the place where the program should stop -by line number, function name or exact address in the program. In -languages with exception handling (such as GNU C++), you can also set -breakpoints where an execption is raised (@pxref{Exception Handling}). - -@cindex watchpoints -A @dfn{watchpoint} is a special breakpoint that stops your program when -the value of an expression changes. You must use a different command to -set watchpoints (@pxref{Set Watchpoints}), but aside from that, you can -manage a watchpoint exactly like any other breakpoint: you enable, disable, and -delete both breakpoints and watchpoints using exactly the same commands. - -Each breakpoint or watchpoint is assigned a number when it is created; -these numbers are successive integers starting with one. In many of the -commands for controlling various features of breakpoints you use the -breakpoint number to say which breakpoint you want to change. Each -breakpoint may be @dfn{enabled} or @dfn{disabled}; if disabled, it has -no effect on the program until you enable it again. - -@menu -* Set Breaks:: Setting Breakpoints -* Set Watchpoints:: Setting Watchpoints -* Exception Handling:: Breakpoints and Exceptions -* Delete Breaks:: Deleting Breakpoints -* Disabling:: Disabling Breakpoints -* Conditions:: Break Conditions -* Break Commands:: Breakpoint Command Lists -* Breakpoint Menus:: Breakpoint Menus -* Error in Breakpoints:: -@end menu - -@node Set Breaks, Set Watchpoints, Breakpoints, Breakpoints -@subsection Setting Breakpoints - -@kindex break -@kindex b -Breakpoints are set with the @code{break} command (abbreviated @code{b}). - -You have several ways to say where the breakpoint should go. - -@table @code -@item break @var{function} -Set a breakpoint at entry to function @var{function}. When using source -languages that permit overloading of symbols, such as C++, -@var{function} may refer to more than one possible place to break. -@xref{Breakpoint Menus}, for a discussion of that situation. - -@item break +@var{offset} -@itemx break -@var{offset} -Set a breakpoint some number of lines forward or back from the position -at which execution stopped in the currently selected frame. - -@item break @var{linenum} -Set a breakpoint at line @var{linenum} in the current source file. -That file is the last file whose source text was printed. This -breakpoint will stop the program just before it executes any of the -code on that line. - -@item break @var{filename}:@var{linenum} -Set a breakpoint at line @var{linenum} in source file @var{filename}. - -@item break @var{filename}:@var{function} -Set a breakpoint at entry to function @var{function} found in file -@var{filename}. Specifying a file name as well as a function name is -superfluous except when multiple files contain similarly named -functions. - -@item break *@var{address} -Set a breakpoint at address @var{address}. You can use this to set -breakpoints in parts of the program which do not have debugging -information or source files. - -@item break -When called without any arguments, @code{break} sets a breakpoint at the -next instruction to be executed in the selected stack frame -(@pxref{Stack}). In any selected frame but the innermost, this will -cause the program to stop as soon as control returns to that frame. -This is similar to the effect of a @code{finish} command in the frame -inside the selected frame---except that @code{finish} doesn't leave an -active breakpoint. If you use @code{break} without an argument in the -innermost frame, _GDBN__ will stop the next time it reaches the current -location; this may be useful inside loops. - -_GDBN__ normally ignores breakpoints when it resumes execution, until at -least one instruction has been executed. If it did not do this, you -would be unable to proceed past a breakpoint without first disabling the -breakpoint. This rule applies whether or not the breakpoint already -existed when the program stopped. - -@item break @dots{} if @var{cond} -Set a breakpoint with condition @var{cond}; evaluate the expression -@var{cond} each time the breakpoint is reached, and stop only if the -value is nonzero. @samp{@dots{}} stands for one of the possible -arguments described above (or no argument) specifying where to break. -@xref{Conditions}, for more information on breakpoint conditions. - -@item tbreak @var{args} -@kindex tbreak -Set a breakpoint enabled only for one stop. @var{args} are the -same as in the @code{break} command, and the breakpoint is set in the same -way, but the breakpoint is automatically disabled the first time it -is hit. @xref{Disabling}. - -@item rbreak @var{regex} -@kindex rbreak -Set a breakpoint on all functions matching @var{regex}. This is -useful for setting breakpoints on overloaded functions that are not -members of any special classes. This command sets an unconditional -breakpoint on all matches, printing a list of all breakpoints it set. -Once these breakpoints are set, they are treated just like the -breakpoints set with the @code{break} command. They can be deleted, -disabled, made conditional, etc., in the standard ways. - -@kindex info breakpoints -@kindex $_ -@item info breakpoints -The command @code{info breakpoints} prints a list of all breakpoints -(but not watchpoints) set and not deleted, showing their numbers, where -in the program they are, and any special features in use for them. -Disabled breakpoints are included in the list, but marked as disabled. -@code{info break} with a breakpoint number as argument lists only that -breakpoint. The convenience variable @code{$_} and the default -examining-address for the @code{x} command are set to the address of the -last breakpoint listed (@pxref{Memory}). The equivalent command for -watchpoints is @code{info watch}. -@end table - -_GDBN__ allows you to set any number of breakpoints at the same place in the -program. There is nothing silly or meaningless about this. When the -breakpoints are conditional, this is even useful (@pxref{Conditions}). - -@node Set Watchpoints, Exception Handling, Set Breaks, Breakpoints -@subsection Setting Watchpoints -@cindex setting watchpoints -You can use a watchpoint to stop execution whenever the value of an -expression changes, without having to predict a particular place in the -inferior process where this may happen. - -Watchpoints currently execute two orders of magnitude more slowly than -other breakpoints, but this can well be worth it to catch errors where -you have no clue what part of your program is the culprit. Some -processors provide special hardware to implement this feature; future -releases of _GDBN__ will use such hardware if it is available. - -@table @code -@kindex watch -@item watch @var{expr} -Set a watchpoint for an expression. - -@kindex info watchpoints -@item info watchpoints -This command prints a list of watchpoints; it is otherwise similar to -@code{info break}. -@end table - -@node Exception Handling, Delete Breaks, Set Watchpoints, Breakpoints -@subsection Breakpoints and Exceptions -@cindex exception handlers - -Some languages, such as GNU C++, implement exception handling. _GDBN__ -can be used to examine what caused the program to raise an exception -and to list the exceptions the program is prepared to handle at a -given point in time. - -@table @code -@item catch @var{exceptions} -@kindex catch - -You can set breakpoints at active exception handlers by using the -@code{catch} command. @var{exceptions} is a list of names of exceptions -to catch. -@end table - -You can use @code{info catch} to list active exception handlers; -@pxref{Frame Info}. - -There are currently some limitations to exception handling in _GDBN__. -These will be corrected in a future release. - -@itemize @bullet -@item -If you call a function interactively, _GDBN__ normally returns -control to you when the function has finished executing. If the call -raises an exception, however, the call may bypass the mechanism that -returns control to the user and cause the program to simply continue -running until it hits a breakpoint, catches a signal that _GDBN__ is -listening for, or exits. -@item -You cannot raise an exception interactively. -@item -You cannot interactively install an exception handler. -@end itemize - -@cindex raise exceptions -Sometimes @code{catch} is not the best way to debug exception handling: -if you need to know exactly where an exception is raised, it's better to -stop @emph{before} the exception handler is called, since that way you -can see the stack before any unwinding takes place. If you set a -breakpoint in an exception handler instead, it may not be easy to find -out where the exception was raised. - -To stop just before an exception handler is called, you need some -knowledge of the implementation. In the case of GNU C++ exception are -raised by calling a library function named @code{__raise_exception} -which has the following ANSI C interface: - -@example - /* ADDR is where the exception identifier is stored. - ID is the exception identifier. */ - void __raise_exception (void **@var{addr}, void *@var{id}); -@end example - -@noindent -To make the debugger catch all exceptions before any stack -unwinding takes place, set a breakpoint on @code{__raise_exception} -(@pxref{Breakpoints}). - -With a conditional breakpoint (@xref{Conditions}) that depends on the -value of @var{id}, you can stop your program when a specific exception -is raised. You can use multiple conditional breakpoints to stop the -program when any of a number of exceptions are raised. - -@node Delete Breaks, Disabling, Exception Handling, Breakpoints -@subsection Deleting Breakpoints - -@cindex clearing breakpoints, watchpoints -@cindex deleting breakpoints, watchpoints -It is often necessary to eliminate a breakpoint or watchpoint once it -has done its job and you no longer want the program to stop there. This -is called @dfn{deleting} the breakpoint. A breakpoint that has been -deleted no longer exists in any sense; it is forgotten. - -With the @code{clear} command you can delete breakpoints according to -where they are in the program. With the @code{delete} command you can -delete individual breakpoints or watchpoints by specifying their -breakpoint numbers. - -It is not necessary to delete a breakpoint to proceed past it. _GDBN__ -automatically ignores breakpoints on the first instruction to be executed -when you continue execution without changing the execution address. - -@table @code -@item clear -@kindex clear -Delete any breakpoints at the next instruction to be executed in the -selected stack frame (@pxref{Selection}). When the innermost frame -is selected, this is a good way to delete a breakpoint that the program -just stopped at. - -@item clear @var{function} -@itemx clear @var{filename}:@var{function} -Delete any breakpoints set at entry to the function @var{function}. - -@item clear @var{linenum} -@itemx clear @var{filename}:@var{linenum} -Delete any breakpoints set at or within the code of the specified line. - -@item delete breakpoints @var{bnums}@dots{} -@itemx delete @var{bnums}@dots{} -@itemx delete -@cindex delete breakpoints -@kindex delete -@kindex d -Delete the breakpoints or watchpoints of the numbers specified as -arguments. If no argument is specified, delete all breakpoints. You -can abbreviate this command as @code{d}. -@end table - -@node Disabling, Conditions, Delete Breaks, Breakpoints -@subsection Disabling Breakpoints - -@cindex disabled breakpoints -@cindex enabled breakpoints -Rather than deleting a breakpoint or watchpoint, you might prefer to -@dfn{disable} it. This makes the breakpoint inoperative as if it had -been deleted, but remembers the information on the breakpoint so that -you can @dfn{enable} it again later. - -You disable and enable breakpoints and watchpoints with the -@code{enable} and @code{disable} commands, optionally specifying one or -more breakpoint numbers as arguments. Use @code{info break} or -@code{info watch} to print a list of breakpoints or watchpoints if you -don't know which numbers to use. - -A breakpoint or watchpoint can have any of four different states of -enablement: - -@itemize @bullet -@item -Enabled. The breakpoint will stop the program. A breakpoint made -with the @code{break} command starts out in this state. -@item -Disabled. The breakpoint has no effect on the program. -@item -Enabled once. The breakpoint will stop the program, but -when it does so it will become disabled. A breakpoint made -with the @code{tbreak} command starts out in this state. -@item -Enabled for deletion. The breakpoint will stop the program, but -immediately after it does so it will be deleted permanently. -@end itemize - -You can use the following commands to enable or disable breakpoints and -watchpoints: - -@table @code -@item disable breakpoints @var{bnums}@dots{} -@itemx disable @var{bnums}@dots{} -@itemx disable -@kindex disable breakpoints -@kindex disable -@kindex dis -Disable the specified breakpoints---or all breakpoints, if none are -listed. A disabled breakpoint has no effect but is not forgotten. All -options such as ignore-counts, conditions and commands are remembered in -case the breakpoint is enabled again later. You may abbreviate -@code{disable} as @code{dis}. - -@item enable breakpoints @var{bnums}@dots{} -@itemx enable @var{bnums}@dots{} -@itemx enable -@kindex enable breakpoints -@kindex enable -Enable the specified breakpoints (or all defined breakpoints). They -become effective once again in stopping the program, until you specify -otherwise. - -@item enable breakpoints once @var{bnums}@dots{} -@itemx enable once @var{bnums}@dots{} -Enable the specified breakpoints temporarily. Each will be disabled -again the next time it stops the program (unless you have used one of -these commands to specify a different state before that time comes). - -@item enable breakpoints delete @var{bnums}@dots{} -@itemx enable delete @var{bnums}@dots{} -Enable the specified breakpoints to work once and then die. Each of -the breakpoints will be deleted the next time it stops the program -(unless you have used one of these commands to specify a different -state before that time comes). -@end table - -Save for a breakpoint set with @code{tbreak} (@pxref{Set Breaks}), -breakpoints that you set initially enabled; subsequently, they become -disabled or enabled only when you use one of the commands above. (The -command @code{until} can set and delete a breakpoint of its own, but it -will not change the state of your other breakpoints; -@pxref{Stepping}.) - -@node Conditions, Break Commands, Disabling, Breakpoints -@subsection Break Conditions -@cindex conditional breakpoints -@cindex breakpoint conditions - -The simplest sort of breakpoint breaks every time the program reaches a -specified place. You can also specify a @dfn{condition} for a -breakpoint. A condition is just a Boolean expression in your -programming language. (@xref{Expressions}). A breakpoint with a -condition evaluates the expression each time the program reaches it, and -the program stops only if the condition is true. - -Conditions are also accepted for watchpoints; you may not need them, -since a watchpoint is inspecting the value of an expression anyhow---but -it might be simpler, say, to just set a watchpoint on a variable name, -then have a condition that tests whether the new value is an interesting -one. - -Break conditions may have side effects, and may even call functions in your -program. These may sound like strange things to do, but their effects are -completely predictable unless there is another enabled breakpoint at the -same address. (In that case, _GDBN__ might see the other breakpoint first and -stop the program without checking the condition of this one.) Note that -breakpoint commands are usually more convenient and flexible for the -purpose of performing side effects when a breakpoint is reached -(@pxref{Break Commands}). - -Break conditions can be specified when a breakpoint is set, by using -@samp{if} in the arguments to the @code{break} command. @xref{Set Breaks}. -They can also be changed at any time with the @code{condition} command. -The @code{watch} command doesn't recognize the @code{if} keyword; -@code{condition} is the only way to impose a further condition on a -watchpoint. - -@table @code -@item condition @var{bnum} @var{expression} -@kindex condition -Specify @var{expression} as the break condition for breakpoint or -watchpoint number @var{bnum}. From now on, this breakpoint will stop -the program only if the value of @var{expression} is true (nonzero, in -C). When you call @code{condition}, the expression you specify is -checked immediately for syntactic correctness, and to determine whether -symbols in it have referents in the context of your breakpoint. _GDBN__ -does not actually evaluate @var{expression} at the time the -@code{condition} command is given, however. @xref{Expressions}. - -@item condition @var{bnum} -Remove the condition from breakpoint number @var{bnum}. It becomes -an ordinary unconditional breakpoint. -@end table - -@cindex ignore count (of breakpoint) -A special case of a breakpoint condition is to stop only when the -breakpoint has been reached a certain number of times. This is so -useful that there is a special way to do it, using the @dfn{ignore -count} of the breakpoint. Every breakpoint has an ignore count, which -is an integer. Most of the time, the ignore count is zero, and -therefore has no effect. But if the program reaches a breakpoint whose -ignore count is positive, then instead of stopping, it just decrements -the ignore count by one and continues. As a result, if the ignore count -value is @var{n}, the breakpoint will not stop the next @var{n} times it -is reached. - -@table @code -@item ignore @var{bnum} @var{count} -@kindex ignore -Set the ignore count of breakpoint number @var{bnum} to @var{count}. -The next @var{count} times the breakpoint is reached, your program's -execution will not stop; other than to decrement the ignore count, _GDBN__ -takes no action. - -To make the breakpoint stop the next time it is reached, specify -a count of zero. - -@item continue @var{count} -@itemx c @var{count} -@itemx fg @var{count} -@kindex continue @var{count} -Continue execution of the program, setting the ignore count of the -breakpoint that the program stopped at to @var{count} minus one. -Thus, the program will not stop at this breakpoint until the -@var{count}'th time it is reached. - -An argument to this command is meaningful only when the program stopped -due to a breakpoint. At other times, the argument to @code{continue} is -ignored. - -The synonym @code{fg} is provided purely for convenience, and has -exactly the same behavior as other forms of the command. -@end table - -If a breakpoint has a positive ignore count and a condition, the condition -is not checked. Once the ignore count reaches zero, the condition will -be checked. - -You could achieve the effect of the ignore count with a -condition such as _0__@w{@samp{$foo-- <= 0}}_1__ using a debugger convenience -variable that is decremented each time. @xref{Convenience Vars}. - -@node Break Commands, Breakpoint Menus, Conditions, Breakpoints -@subsection Breakpoint Command Lists - -@cindex breakpoint commands -You can give any breakpoint (or watchpoint) a series of commands to -execute when the program stops due to that breakpoint. For example, you -might want to print the values of certain expressions, or enable other -breakpoints. - -@table @code -@item commands @var{bnum} -@itemx @dots{} @var{command-list} @dots{} -@itemx end -@kindex commands -@kindex end -Specify a list of commands for breakpoint number @var{bnum}. The commands -themselves appear on the following lines. Type a line containing just -@code{end} to terminate the commands. - -To remove all commands from a breakpoint, use the command -@code{commands} and follow it immediately by @code{end}; that is, give -no commands. - -With no @var{bnum} argument, @code{commands} refers to the last -breakpoint or watchpoint set (not to the breakpoint most recently -encountered). -@end table - -Pressing @key{RET} as a means of repeating the last _GDBN__ command is -disabled from the time you enter @code{commands} to just after the -corresponding @code{end}. - -You can use breakpoint commands to start the program up again. Simply -use the @code{continue} command, or @code{step}, or any other command to -resume execution. However, if you do this, any further commands in the -same breakpoint's command list are ignored. When the program stops -again, _GDBN__ will act according to the cause of that stop. - -@kindex silent -If the first command specified is @code{silent}, the usual message about -stopping at a breakpoint is not printed. This may be desirable for -breakpoints that are to print a specific message and then continue. -If the remaining commands too print nothing, you will see no sign that -the breakpoint was reached at all. @code{silent} is not really a command; -it is meaningful only at the beginning of the commands for a breakpoint. - -The commands @code{echo} and @code{output} that allow you to print precisely -controlled output are often useful in silent breakpoints. @xref{Output}. - -For example, here is how you could use breakpoint commands to print the -value of @code{x} at entry to @code{foo} whenever @code{x} is positive. - -_0__@example -break foo if x>0 -commands -silent -echo x is\040 -output x -echo \n -cont -end -_1__@end example - -One application for breakpoint commands is to correct one bug so you can -test another. Put a breakpoint just after the erroneous line of code, give -it a condition to detect the case in which something erroneous has been -done, and give it commands to assign correct values to any variables that -need them. End with the @code{continue} command so that the program does not -stop, and start with the @code{silent} command so that no output is -produced. Here is an example: - -@example -break 403 -commands -silent -set x = y + 4 -cont -end -@end example - -@cindex lost output -One deficiency in the operation of automatically continuing breakpoints -under Unix appears when your program uses raw mode for the terminal. -_GDBN__ switches back to its own terminal modes (not raw) before executing -commands, and then must switch back to raw mode when your program is -continued. This causes any pending terminal input to be lost. -In the GNU system, this will be fixed by changing the behavior of -terminal modes. - -Under Unix, when you have this problem, you might be able to get around -it by putting your actions into the breakpoint condition instead of -commands. For example - -@example -condition 5 (x = y + 4), 0 -@end example - -@noindent -specifies a condition expression (@xref{Expressions}) that will change -@code{x} as needed, then always have the value zero so the program will not -stop. Loss of input is avoided here because break conditions are -evaluated without changing the terminal modes. When you want to have -nontrivial conditions for performing the side effects, the operators -@samp{&&}, @samp{||} and @samp{?@dots{}:} may be useful. - -@node Breakpoint Menus, Error in Breakpoints, Break Commands, Breakpoints -@subsection Breakpoint Menus -@cindex C++ overloading -@cindex symbol overloading - -Some programming languages (notably C++) permit a single function name -to be defined several times, for application in different contexts. -This is called @dfn{overloading}. When a function name is overloaded, -@samp{break @var{function}} is not enough to tell _GDBN__ where you want -a breakpoint. _GDBN__ responds to this situation by offering you a menu -of numbered choices for different possible breakpoints, and waiting for -your selection with the prompt @samp{>}. The first two -options are always @samp{[0] cancel} and @samp{[1] all}. Typing @kbd{1} -will set a breakpoint at all the definitions available for -@var{function}, and typing @kbd{0} will abort the @code{break} command -without setting any new breakpoints. - -For example, the following session excerpt shows an attempt to set a -breakpoint at the overloaded symbol @code{String::after}. In the -example, we choose three particular definitions of the function: - -@example -(_GDBP__) b String::after -[0] cancel -[1] all -[2] file:String.cc; line number:867 -[3] file:String.cc; line number:860 -[4] file:String.cc; line number:875 -[5] file:String.cc; line number:853 -[6] file:String.cc; line number:846 -[7] file:String.cc; line number:735 -> 2 4 6 -Breakpoint 1 at 0xb26c: file String.cc, line 867. -Breakpoint 2 at 0xb344: file String.cc, line 875. -Breakpoint 3 at 0xafcc: file String.cc, line 846. -Multiple breakpoints were set. -Use the "delete" command to delete unwanted breakpoints. -(_GDBP__) -@end example - - -@node Error in Breakpoints, , Breakpoint Menus, Breakpoints -@subsection ``Cannot Insert Breakpoints'' - -@c FIXME: "cannot insert breakpoints" error, v unclear. -@c Q in pending mail to Gilmore. ---pesch@cygnus.com, 26mar91 -Under some operating systems, breakpoints cannot be used in a program if -any other process is running that program. In this situation, -attempting to run or continue a program with a breakpoint will cause _GDBN__ -to stop the other process. - -When this happens, you have three ways to proceed: - -@enumerate -@item -Remove or disable the breakpoints, then continue. - -@item -Suspend _GDBN__, and copy the file containing the program to a new name. -Resume _GDBN__ and use the @code{exec-file} command to specify that _GDBN__ -should run the program under that name. Then start the program again. - -@c FIXME: RMS commented here "Show example". Maybe when someone -@c explains the first FIXME: in this section... - -@item -Relink the program so that the text segment is nonsharable, using the -linker option @samp{-N}. The operating system limitation may not apply -to nonsharable executables. -@end enumerate - -@node Stepping, Continuing, Breakpoints, Stopping -@section Stepping - -@cindex stepping -@dfn{Stepping} means setting your program in motion for a limited time, -so that control will return automatically to _GDBN__ after one line of -code or one machine instruction. @footnote{Your program might stop even -sooner, during stepping, since a signal may arrive before your program -reaches the next source line. Also, since breakpoints are active during -stepping, your program will stop for them even if it has not gone as far -as the stepping command specifies.} - -A typical technique for using stepping is to put a breakpoint -(@pxref{Breakpoints}) at the beginning of the function or the section of -the program in which a problem is believed to lie, run the program until -it stops at that breakpoint, and then step through the suspect area, -examining the variables that are interesting, until you see the problem -happen. - -@table @code -@item step -@kindex step -@kindex s -Continue running the program until control reaches a different source -line, then stop it and return control to the debugger. This command is -abbreviated @code{s}. - -You may use the @code{step} command when control is within a function -for which there is no debugging information. In that case, execution -will proceed until control reaches a different function, or is about to -return from this function. - -@item step @var{count} -Continue running as in @code{step}, but do so @var{count} times. If a -breakpoint is reached or a signal not related to stepping occurs before -@var{count} steps, stepping stops right away. - -@item next -@kindex next -@kindex n -Continue to the next source line in the current stack frame. Similar to -@code{step}, but any function calls appearing within the line of code -are executed without stopping. Execution stops when control reaches a -different line of code at the stack level which was executing when the -@code{next} command was given. This command is abbreviated @code{n}. - -An argument is a repeat count, as in @code{step}. - -@code{next} within a function that lacks debugging information acts like -@code{step}, but any function calls appearing within the code of the -function are executed without stopping. - -@item finish -@kindex finish -Continue running until just after the selected stack frame returns (or -until there is some other reason to stop, such as a fatal signal or a -breakpoint). Print the value returned by the selected stack frame (if -any). - -Contrast this with the @code{return} command (@pxref{Returning}). - -@item until -@kindex until -@item u -@kindex u -Continue running until a source line past the current line, in the -current stack frame, is reached. This command is used to avoid single -stepping through a loop more than once. It is like the @code{next} -command, except that when @code{until} encounters a jump, it -automatically continues execution until the program counter is greater -than the address of the jump. - -This means that when you reach the end of a loop after single stepping -though it, @code{until} will cause the program to continue execution -until the loop is exited. In contrast, a @code{next} command at the end -of a loop will simply step back to the beginning of the loop, which -would force you to step through the next iteration. - -@code{until} always stops the program if it attempts to exit the current -stack frame. - -@code{until} may produce somewhat counterintuitive results if the order -of the source lines does not match the actual order of execution. For -example, in the following excerpt from a debugging session, the @code{f} -(@code{frame}) command shows that execution is stopped at line -@code{206}; yet when we use @code{until}, we get to line @code{195}: - -@example -(_GDBP__) f -#0 main (argc=4, argv=0xf7fffae8) at m4.c:206 -206 expand_input(); -(_GDBP__) until -195 for ( ; argc > 0; NEXTARG) @{ -@end example - -In this case, (as for any C @code{for}-loop), the loop-step expression -(here, @samp{argc > 0}) is executed @emph{after} the statements in the -body of the loop, but is written before them. Therefore, the -@code{until} command appeared to step back to the beginning of the loop -when it advanced to this expression. However, it has not really gone to -an earlier statement---not in terms of the actual machine code. - -@code{until} with no argument works by means of single -instruction stepping, and hence is slower than @code{until} with an -argument. - -@item until @var{location} -@item u @var{location} -Continue running the program until either the specified location is -reached, or the current (innermost) stack frame returns. @var{location} -is any of the forms of argument acceptable to @code{break} (@pxref{Set -Breaks}). This form of the command uses breakpoints, and hence is -quicker than @code{until} without an argument. - -@item stepi -@itemx si -@kindex stepi -@kindex si -Execute one machine instruction, then stop and return to the debugger. - -It is often useful to do @samp{display/i $pc} when stepping by machine -instructions. This will cause the next instruction to be executed to -be displayed automatically at each stop. @xref{Auto Display}. - -An argument is a repeat count, as in @code{step}. - -@item nexti -@itemx ni -@kindex nexti -@kindex ni -Execute one machine instruction, but if it is a function call, -proceed until the function returns. - -An argument is a repeat count, as in @code{next}. -@end table - -The @code{continue} command can be used after stepping to resume execution -until the next breakpoint or signal. - -@node Continuing, Signals, Stepping, Stopping -@section Continuing - -After your program stops, most likely you will want it to run some more if -the bug you are looking for has not happened yet. - -@table @code -@item continue -@kindex continue -Continue running the program at the place where it stopped. -@end table - -If the program stopped at a breakpoint, the place to continue running -is the address of the breakpoint. You might expect that continuing would -just stop at the same breakpoint immediately. In fact, @code{continue} -takes special care to prevent that from happening. You do not need -to disable the breakpoint to proceed through it after stopping there. -You can, however, specify an ignore-count for the breakpoint that the -program stopped at, by means of an argument to the @code{continue} command. -@xref{Conditions}. - -If the program stopped because of a signal other than @code{SIGINT} or -@code{SIGTRAP}, continuing will cause the program to see that signal. -You may not want this to happen. For example, if the program stopped -due to some sort of memory reference error, you might store correct -values into the erroneous variables and continue, hoping to see more -execution; but the program would probably terminate immediately as -a result of the fatal signal once it sees the signal. To prevent this, -you can continue with @samp{signal 0}. @xref{Signaling}. You can -also act in advance to control what signals your program will see, using -the @code{handle} command (@pxref{Signals}). - -@node Signals, , Continuing, Stopping -@section Signals -@cindex signals - -A signal is an asynchronous event that can happen in a program. The -operating system defines the possible kinds of signals, and gives each -kind a name and a number. For example, in Unix @code{SIGINT} is the -signal a program gets when you type an interrupt (often @kbd{C-c}); -@code{SIGSEGV} is the signal a program gets from referencing a place in -memory far away from all the areas in use; @code{SIGALRM} occurs when -the alarm clock timer goes off (which happens only if the program has -requested an alarm). - -@cindex fatal signals -Some signals, including @code{SIGALRM}, are a normal part of the -functioning of the program. Others, such as @code{SIGSEGV}, indicate -errors; these signals are @dfn{fatal} (kill the program immediately) if the -program has not specified in advance some other way to handle the signal. -@code{SIGINT} does not indicate an error in the program, but it is normally -fatal so it can carry out the purpose of the interrupt: to kill the program. - -_GDBN__ has the ability to detect any occurrence of a signal in the program -running under _GDBN__'s control. You can tell _GDBN__ in advance what to do for -each kind of signal. - -@cindex handling signals -Normally, _GDBN__ is set up to ignore non-erroneous signals like @code{SIGALRM} -(so as not to interfere with their role in the functioning of the program) -but to stop the program immediately whenever an error signal happens. -You can change these settings with the @code{handle} command. - -@table @code -@item info signals -@kindex info signals -Print a table of all the kinds of signals and how _GDBN__ has been told to -handle each one. You can use this to see the signal numbers of all -the defined types of signals. - -@item handle @var{signal} @var{keywords}@dots{} -@kindex handle -Change the way _GDBN__ handles signal @var{signal}. @var{signal} can be the -number of a signal or its name (with or without the @samp{SIG} at the -beginning). The @var{keywords} say what change to make. -@end table - -@c @group -The keywords allowed by the @code{handle} command can be abbreviated. -Their full names are: - -@table @code -@item nostop -_GDBN__ should not stop the program when this signal happens. It may -still print a message telling you that the signal has come in. - -@item stop -_GDBN__ should stop the program when this signal happens. This implies -the @code{print} keyword as well. - -@item print -_GDBN__ should print a message when this signal happens. - -@item noprint -_GDBN__ should not mention the occurrence of the signal at all. This -implies the @code{nostop} keyword as well. - -@item pass -_GDBN__ should allow the program to see this signal; the program will be -able to handle the signal, or may be terminated if the signal is fatal -and not handled. - -@item nopass -_GDBN__ should not allow the program to see this signal. -@end table -@c @end group - -When a signal has been set to stop the program, the program cannot see the -signal until you continue. It will see the signal then, if @code{pass} is -in effect for the signal in question @i{at that time}. In other words, -after _GDBN__ reports a signal, you can use the @code{handle} command with -@code{pass} or @code{nopass} to control whether that signal will be seen by -the program when you later continue it. - -You can also use the @code{signal} command to prevent the program from -seeing a signal, or cause it to see a signal it normally would not see, -or to give it any signal at any time. @xref{Signaling}. - diff --git a/gdb/doc/gdb.symb-m4 b/gdb/doc/gdb.symb-m4 index e257d31..e69de29 100755 --- a/gdb/doc/gdb.symb-m4 +++ b/gdb/doc/gdb.symb-m4 @@ -1,132 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Symbols, Altering, Data, Top -@chapter Examining the Symbol Table - -The commands described in this section allow you to inquire about the -symbols (names of variables, functions and types) defined in your -program. This information is inherent in the text of your program and -does not change as the program executes. _GDBN__ finds it in your -program's symbol table, in the file indicated when you started _GDBN__ -(@pxref{File Options}), or by one of the file-management commands -(@pxref{Files}). - -@table @code -@item info address @var{symbol} -@kindex info address -Describe where the data for @var{symbol} is stored. For a register -variable, this says which register it is kept in. For a non-register -local variable, this prints the stack-frame offset at which the variable -is always stored. - -Note the contrast with @samp{print &@var{symbol}}, which does not work -at all for a register variables, and for a stack local variable prints -the exact address of the current instantiation of the variable. - -@item whatis @var{exp} -@kindex whatis -Print the data type of expression @var{exp}. @var{exp} is not -actually evaluated, and any side-effecting operations (such as -assignments or function calls) inside it do not take place. -@xref{Expressions}. - -@item whatis -Print the data type of @code{$}, the last value in the value history. - -@item ptype @var{typename} -@kindex ptype -Print a description of data type @var{typename}. @var{typename} may be -the name of a type, or for C code it may have the form -@samp{struct @var{struct-tag}}, @samp{union @var{union-tag}} or -@samp{enum @var{enum-tag}}.@refill - -@item ptype @var{exp} -Print a description of the type of expression @var{exp}. @code{ptype} -differs from @code{whatis} by printing a detailed description, instead of just -the name of the type. For example, if your program declares a variable -as -@example -struct complex @{double real; double imag;@} v; -@end example -@noindent -compare the output of the two commands: -@example -(_GDBP__) whatis v -type = struct complex -(_GDBP__) ptype v -type = struct complex @{ - double real; - double imag; -@} -@end example - -@item info types @var{regexp} -@itemx info types -@kindex info types -Print a brief description of all types whose name matches @var{regexp} -(or all types in your program, if you supply no argument). Each -complete typename is matched as though it were a complete line; thus, -@samp{i type value} gives information on all types in your program whose -name includes the string @code{value}, but @samp{i type ^value$} gives -information only on types whose complete name is @code{value}. - -This command differs from @code{ptype} in two ways: first, like -@code{whatis}, it does not print a detailed description; second, it -lists all source files where a type is defined. - -@item info source -@kindex info source -Show the name of the current source file---that is, the source file for -the function containing the current point of execution. - -@item info sources -@kindex info sources -Print the names of all source files in the program for which there is -debugging information, organized into two lists: those for which symbols -have been read in, and those for which symbols will be read in on -demand. -@c FIXME: above passive AND awkward! - -@item info functions -@kindex info functions -Print the names and data types of all defined functions. - -@item info functions @var{regexp} -Print the names and data types of all defined functions -whose names contain a match for regular expression @var{regexp}. -Thus, @samp{info fun step} finds all functions whose names -include @code{step}; @samp{info fun ^step} finds those whose names -start with @code{step}. - -@item info variables -@kindex info variables -Print the names and data types of all variables that are declared -outside of functions (i.e., excluding local variables). - -@item info variables @var{regexp} -Print the names and data types of all variables (except for local -variables) whose names contain a match for regular expression -@var{regexp}. - - -@ignore -This was never implemented. -@item info methods -@itemx info methods @var{regexp} -@kindex info methods -The @code{info methods} command permits the user to examine all defined -methods within C++ program, or (with the @var{regexp} argument) a -specific set of methods found in the various C++ classes. Many -C++ classes provide a large number of methods. Thus, the output -from the @code{ptype} command can be overwhelming and hard to use. The -@code{info-methods} command filters the methods, printing only those -which match the regular-expression @var{regexp}. -@end ignore - -@item printsyms @var{filename} -@kindex printsyms -Write a complete dump of the debugger's symbol data into the -file @var{filename}. -@end table diff --git a/gdb/doc/gdb.tgts-m4 b/gdb/doc/gdb.tgts-m4 index f3bee50..e69de29 100755 --- a/gdb/doc/gdb.tgts-m4 +++ b/gdb/doc/gdb.tgts-m4 @@ -1,192 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@node Targets, Controlling _GDBN__, _GDBN__ Files, Top -@chapter Specifying a Debugging Target -@cindex debugging target -@kindex target -A @dfn{target} is an interface between the debugger and a particular -kind of file or process. - -Often, you will be able to run _GDBN__ in the same host environment as the -program you are debugging; in that case, the debugging target can just be -specified as a side effect of the @code{file} or @code{core} commands. -When you need more flexibility---for example, running _GDBN__ on a -physically separate host, controlling standalone systems over a -serial port, or realtime systems over a TCP/IP connection---you can use -the @code{target} command. - -@menu -* Active Targets:: Active Targets -* Target Commands:: Commands for Managing Targets -* Remote:: Remote Debugging -@end menu - -@node Active Targets, Target Commands, Targets, Targets -@section Active Targets -@cindex stacking targets -@cindex active targets -@cindex multiple targets - -Targets are managed in three @dfn{strata} that correspond to different -classes of target: processes, core files, and executable files. This -allows you to (for example) start a process and inspect its activity -without abandoning your work on a core file. - -More than one target can potentially respond to a request. In -particular, when you access memory _GDBN__ will examine the three strata of -targets until it finds a target that can handle that particular address. -Strata are always examined in a fixed order: first a process if there is -one, then a core file if there is one, and finally an executable file if -there is one of those. - -When you specify a new target in a given stratum, it replaces any target -previously in that stratum. - -To get rid of a target without replacing it, use the @code{detach} -command. The related command @code{attach} provides you with a way of -choosing a particular running process as a new target. @xref{Attach}. - -@node Target Commands, Remote, Active Targets, Targets -@section Commands for Managing Targets - -@table @code -@item target @var{type} @var{parameters} -Connects the _GDBN__ host environment to a target machine or process. A -target is typically a protocol for talking to debugging facilities. You -use the argument @var{type} to specify the type or protocol of the -target machine. - -Further @var{parameters} are interpreted by the target protocol, but -typically include things like device names or host names to connect -with, process numbers, and baud rates. - -The @code{target} command will not repeat if you press @key{RET} again -after executing the command. - -@item help target -@kindex help target -Displays the names of all targets available. To display targets -currently selected, use either @code{info target} or @code{info files} -(@pxref{Files}). - -@item help target @var{name} -Describe a particular target, including any parameters necessary to -select it. -@end table - -Here are some common targets (available, or not, depending on the _GDBN__ -configuration): - -@table @code -@item target exec @var{prog} -@kindex target exec -An executable file. @samp{target exec @var{prog}} is the same as -@samp{exec-file @var{prog}}. - -@item target core @var{filename} -@kindex target core -A core dump file. @samp{target core @var{filename}} is the same as -@samp{core-file @var{filename}}. - -@item target remote @var{dev} -@kindex target remote -Remote serial target in _GDBN__-specific protocol. The argument @var{dev} -specifies what serial device to use for the connection (e.g. -@file{/dev/ttya}). @xref{Remote}. - -_if__(_AMD29K__) -@item target amd-eb @var{dev} @var{speed} @var{PROG} -@kindex target amd-eb -@cindex AMD EB29K -Remote PC-resident AMD EB29K board, attached over serial lines. -@var{dev} is the serial device, as for @code{target remote}; -@var{speed} allows you to specify the linespeed; and @var{PROG} is the -name of the program to be debugged, as it appears to DOS on the PC. -@xref{EB29K Remote}. - -_fi__(_AMD29K__) -_if__(_I960__) -@item target nindy @var{devicename} -@kindex target nindy -An Intel 960 board controlled by a Nindy Monitor. @var{devicename} is -the name of the serial device to use for the connection, e.g. -@file{/dev/ttya}. @xref{i960-Nindy Remote}. - -_fi__(_I960__) -_if__(_VXWORKS__) -@item target vxworks @var{machinename} -@kindex target vxworks -A VxWorks system, attached via TCP/IP. The argument @var{machinename} -is the target system's machine name or IP address. -@xref{VxWorks Remote}. -_fi__(_VXWORKS__) -@end table - -_if__(_GENERIC__) -Different targets are available on different configurations of _GDBN__; your -configuration may have more or fewer targets. -_fi__(_GENERIC__) - -@node Remote, , Target Commands, Targets -@section Remote Debugging -@cindex remote debugging - -_if__(_GENERIC__) -@menu -_include__(gdb.inv.m-m4)<>_dnl__ -@end menu -_fi__(_GENERIC__) - -If you are trying to debug a program running on a machine that can't run -_GDBN__ in the usual way, it is often useful to use remote debugging. For -example, you might use remote debugging on an operating system kernel, or on -a small system which does not have a general purpose operating system -powerful enough to run a full-featured debugger. - -Some configurations of _GDBN__ have special serial or TCP/IP interfaces -to make this work with particular debugging targets. In addition, -_GDBN__ comes with a generic serial protocol (specific to _GDBN__, but -not specific to any particular target system) which you can use if you -write the remote stubs---the code that will run on the remote system to -communicate with _GDBN__. - -To use the _GDBN__ remote serial protocol, the program to be debugged on -the remote machine needs to contain a debugging stub which talks to -_GDBN__ over the serial line. Several working remote stubs are -distributed with _GDBN__; see the @file{README} file in the _GDBN__ -distribution for more information. - -For details of this communication protocol, see the comments in the -_GDBN__ source file @file{remote.c}. - -To start remote debugging, first run _GDBN__ and specify as an executable file -the program that is running in the remote machine. This tells _GDBN__ how -to find the program's symbols and the contents of its pure text. Then -establish communication using the @code{target remote} command with a device -name as an argument. For example: - -@example -target remote /dev/ttyb -@end example - -@noindent -if the serial line is connected to the device named @file{/dev/ttyb}. This -will stop the remote machine if it is not already stopped. - -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. - -Other remote targets may be available in your -configuration of _GDBN__; use @code{help targets} to list them. - -_if__(_GENERIC__) -_include__(gdb.inv.s-m4) -@c Text on starting up GDB in various specific cases; it goes up front -@c in manuals configured for any of those particular situations, here -@c otherwise. -_fi__(_GENERIC__) diff --git a/gdb/doc/gdb.top-m4 b/gdb/doc/gdb.top-m4 index f17e305..e69de29 100755 --- a/gdb/doc/gdb.top-m4 +++ b/gdb/doc/gdb.top-m4 @@ -1,451 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT: $Id$ -@c -@syncodeindex ky cp -@c FOR UPDATES LEADING TO THIS DRAFT, GDB CHANGELOG CONSULTED BETWEEN: -@c Sun May 19 05:36:59 1991 John Gilmore (gnu at cygint.cygnus.com) -@c Sat Dec 22 02:51:40 1990 John Gilmore (gnu at cygint) -@ifinfo -This file documents the GNU debugger _GDBN__. - -Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' may be -included in a translation approved by the Free Software Foundation -instead of in the original English. -@end ifinfo -@smallbook -@setchapternewpage odd -_if__(_GENERIC__) -@settitle Using _GDBN__ (v4.0) -_fi__(_GENERIC__) -_if__(!_GENERIC__) -@settitle Using _GDBN__ v4.0 (_HOST__) -_fi__(!_GENERIC__) -@iftex -@finalout -@end iftex -@titlepage -@title{Using _GDBN__} -@subtitle{A Guide to the GNU Source-Level Debugger} -_if__(!_GENERIC__) -@subtitle{On _HOST__ Systems} -_fi__(!_GENERIC__) -@sp 1 -@c Maybe crank this up to "Fourth Edition" when released at FSF -@c @subtitle Third Edition---_GDBN__ version 4.0 -@subtitle _GDBN__ version 4.0 -@subtitle May 1991 -@author{Richard M. Stallman@qquad @hfill Free Software Foundation} -@author{Roland H. Pesch@qquad @hfill Cygnus Support} -@page -@tex -{\parskip=0pt -\hfill rms\@ai.mit.edu, pesch\@cygnus.com\par -\hfill {\it Using _GDBN__}, \manvers\par -\hfill \TeX{}info \texinfoversion\par -} -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1988, 1989, 1990, 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' may be -included in a translation approved by the Free Software Foundation -instead of in the original English. -@end titlepage -@page - -@node Top, Summary, (dir), (dir) -@ifinfo -This file describes version 4.0 of GDB, the GNU symbolic debugger. -@end ifinfo - -@menu -* Summary:: Summary of _GDBN__ -* New Features:: New Features in _GDBN__ version 4.0 -* Sample Session:: A Sample _GDBN__ Session -* Invocation:: Getting In and Out of _GDBN__ -* Commands:: -* Running:: Running Programs Under _GDBN__ -* Stopping:: Stopping and Continuing -* Stack:: Examining the Stack -* Source:: Examining Source Files -* Data:: Examining Data -* Symbols:: Examining the Symbol Table -* Altering:: Altering Execution -* _GDBN__ Files:: -* Targets:: Specifying a Debugging Target -* Controlling _GDBN__:: Controlling _GDBN__ -* Sequences:: Canned Sequences of Commands -* Emacs:: Using _GDBN__ under GNU Emacs -* _GDBN__ Bugs:: Reporting Bugs in _GDBN__ -* Renamed Commands:: -* Installing _GDBN__:: Installing _GDBN__ -* Copying:: GNU GENERAL PUBLIC LICENSE -* Index:: Index - --- The Detailed Node Listing --- - -Summary of _GDBN__ - -* Free Software:: Free Software -* Contributors:: Contributors to _GDBN__ - -Getting In and Out of _GDBN__ - -* Starting _GDBN__:: Starting _GDBN__ -* Leaving _GDBN__:: Leaving _GDBN__ -* Shell Commands:: Shell Commands - -Starting _GDBN__ - -* File Options:: Choosing Files -* Mode Options:: Choosing Modes - -_GDBN__ Commands - -* Command Syntax:: Command Syntax -* Help:: Getting Help - -Running Programs Under _GDBN__ - -* Compilation:: Compiling for Debugging -* Starting:: Starting your Program -* Arguments:: Your Program's Arguments -* Environment:: Your Program's Environment -* Working Directory:: Your Program's Working Directory -* Input/Output:: Your Program's Input and Output -* Attach:: Debugging an Already-Running Process -* Kill Process:: Killing the Child Process - -Stopping and Continuing - -* Breakpoints:: Breakpoints, Watchpoints, and Exceptions -* Stepping:: Stepping -* Continuing:: Continuing -* Signals:: Signals - -Breakpoints, Watchpoints, and Exceptions - -* Set Breaks:: Setting Breakpoints -* Set Watchpoints:: Setting Watchpoints -* Exception Handling:: Breakpoints and Exceptions -* Delete Breaks:: Deleting Breakpoints -* Disabling:: Disabling Breakpoints -* Conditions:: Break Conditions -* Break Commands:: Breakpoint Command Lists -* Breakpoint Menus:: Breakpoint Menus -* Error in Breakpoints:: - -Examining the Stack - -* Frames:: Stack Frames -* Backtrace:: Backtraces -* Selection:: Selecting a Frame -* Frame Info:: Information on a Frame - -Examining Source Files - -* List:: Printing Source Lines -* Search:: Searching Source Files -* Source Path:: Specifying Source Directories -* Machine Code:: Source and Machine Code - -Examining Data - -* Expressions:: Expressions -* Variables:: Program Variables -* Arrays:: Artificial Arrays -* Output formats:: Output formats -* Memory:: Examining Memory -* Auto Display:: Automatic Display -* Print Settings:: Print Settings -* Value History:: Value History -* Convenience Vars:: Convenience Variables -* Registers:: Registers -* Floating Point Hardware:: Floating Point Hardware - -Altering Execution - -* Assignment:: Assignment to Variables -* Jumping:: Continuing at a Different Address -* Signaling:: Giving the Program a Signal -* Returning:: Returning from a Function -* Calling:: Calling your Program's Functions - -_GDBN__'s Files - -* Files:: Commands to Specify Files -* Symbol Errors:: Errors Reading Symbol Files - -Specifying a Debugging Target - -* Active Targets:: Active Targets -* Target Commands:: Commands for Managing Targets -* Remote:: Remote Debugging - -Remote Debugging - -* i960-Nindy Remote:: -* EB29K Remote:: -* VxWorks Remote:: - -_GDBN__ with a Remote i960 (Nindy) - -* Nindy Startup:: Startup with Nindy -* Nindy Options:: Options for Nindy -* Nindy reset:: Nindy Reset Command - -_GDBN__ with a Remote EB29K - -* Comms (EB29K):: Communications Setup -* gdb-EB29K:: EB29K cross-debugging -* Remote Log:: Remote Log - -_GDBN__ and VxWorks - -* VxWorks connection:: Connecting to VxWorks -* VxWorks download:: VxWorks Download -* VxWorks attach:: Running Tasks - -Controlling _GDBN__ - -* Prompt:: Prompt -* Editing:: Command Editing -* History:: Command History -* Screen Size:: Screen Size -* Numbers:: Numbers -* Messages/Warnings:: Optional Warnings and Messages - -Canned Sequences of Commands - -* Define:: User-Defined Commands -* Command Files:: Command Files -* Output:: Commands for Controlled Output - -Reporting Bugs in _GDBN__ - -* Bug Criteria:: Have You Found a Bug? -* Bug Reporting:: How to Report Bugs -@end menu - -@node Summary, New Features, Top, Top -@unnumbered Summary of _GDBN__ - -The purpose of a debugger such as _GDBN__ is to allow you to see what is -going on ``inside'' another program while it executes---or what another -program was doing at the moment it crashed. - -_GDBN__ can do four main kinds of things (plus other things in support of -these) to help you catch bugs in the act: - -@itemize @bullet -@item -Start your program, specifying anything that might affect its behavior. - -@item -Make your program stop on specified conditions. - -@item -Examine what has happened, when your program has stopped. - -@item -Change things in your program, so you can experiment with correcting the -effects of one bug and go on to learn about another. -@end itemize - -_GDBN__ can be used to debug programs written in C and C++. Pascal support -is being implemented, and Fortran support will be added when a GNU -Fortran compiler is ready. - -@menu -* Free Software:: Free Software -* Contributors:: Contributors to GDB -@end menu - -@node Free Software, Contributors, Summary, Summary -@unnumberedsec Free Software -_GDBN__ is @dfn{free software}, protected by the GNU General Public License (GPL). -The GPL gives you the freedom to copy or adapt a licensed -program---but every person getting a copy also gets with it the -freedom to modify that copy (which means that they must get access to -the source code), and the freedom to distribute further copies. -Typical software companies use copyrights to limit your freedoms; the -Free Software Foundation uses the GPL to preserve these freedoms. - -Fundamentally, the General Public License is a license which says that -you have these freedoms and that you can't take these freedoms away -from anyone else. - -@c FIXME: (passim) go through all xrefs, expanding to use text headings -For full details, @pxref{Copying}. -@node Contributors, , Free Software, Summary -@unnumberedsec Contributors to GDB - -Richard Stallman was the original author of GDB, as with many GNU -programs. Many others have contributed to its development. This -section attempts to credit major contributors. One of the virtues of -free software is that everyone is free to contribute to it; with -regret, we cannot actually acknowledge everyone here. The file -@file{ChangeLog} in the GDB distribution approximates a blow-by-blow -account. - -Changes much prior to version 2.0 are lost in the mists of time. - -@quotation -@emph{Plea:} Additions to this section are particularly welcome. If you -or your friends (or enemies; let's be evenhanded) have been unfairly -omitted from this list, we would like to add your names! -@end quotation - -So that they may not regard their long labor as thankless, we -particularly thank those who shepherded GDB through major releases: -John Gilmore (release 4.0); Jim Kingdon (releases 3.9, 3.5, 3.4, 3.3); -and Randy Smith (releases 3.2, 3.1, 3.0). As major maintainer of GDB -for some period, each contributed significantly to the structure, -stability, and capabilities of the entire debugger. - -Richard Stallman, assisted at various times by Pete TerMaat, Chris -Hanson, and Richard Mlynarik, handled releases through 2.8. - -Michael Tiemann is the author of most of the GNU C++ support in GDB, -with significant additional contributions from Per Bothner. James -Clark wrote the GNU C++ demangler. Early work on C++ was by Peter -TerMaat (who also did much general update work leading to release 3.0). - -GDB 4.0 uses the BFD subroutine library to examine multiple -object-file formats; BFD was a joint project of V. Gumby -Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore. - -David Johnson wrote the original COFF support; Pace Willison did -the original support for encapsulated COFF. - -Adam de Boor and Bradley Davis contributed the ISI Optimum V support. -Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS -support. Jean-Daniel Fekete contributed Sun 386i support. Chris -Hanson improved the HP9000 support. Noboyuki Hikichi and Tomoyuki -Hasei contributed Sony/News OS 3 support. David Johnson contributed -Encore Umax support. Jyrki Kuoppala contributed Altos 3068 support. -Keith Packard contributed NS32K support. Doug Rabson contributed -Acorn Risc Machine support. Chris Smith contributed Convex support -(and Fortran debugging). Jonathan Stone contributed Pyramid support. -Michael Tiemann contributed SPARC support. Tim Tucker contributed -support for the Gould NP1 and Gould Powernode. Pace Willison -contributed Intel 386 support. Jay Vosburgh contributed Symmetry -support. - -Rich Schaefer helped with support of SunOS shared libraries. - -Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about -several machine instruction sets. - -Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped -develop remote debugging. Intel Corporation and Wind River Systems -contributed remote debugging modules for their products. - -Brian Fox is the author of the readline libraries providing -command-line editing and command history. - -@node New Features, Sample Session, Summary, Top -@unnumbered New Features since _GDBN__ version 3.5 - -@table @emph -@item Targets -Using the new command @code{target}, you can select at runtime whether -you are debugging local files, local processes, standalone systems over -a serial port, realtime systems over a TCP/IP connection, etc. -Internally, _GDBN__ now uses a function vector to mediate access to -different targets; if you need to add your own support for a remote -protocol, this makes it much easier. - -@item Watchpoints -_GDBN__ now sports watchpoints as well as breakpoints. You can use a -watchpoint to stop execution whenever the value of an expression -changes, without having to predict a particular place in your program -where this may happen. - -@item Object Code Formats -_GDBN__ uses a new scheme called Binary File Descriptors (BFD) to permit -it to switch dynamically, without reconfiguration or recompilation, -between different object-file formats. Formats currently supported are -COFF, a.out, and the Intel 960 b.out; files may be read as .o's, archive -libraries, or core dumps. BFD is available as a subroutine library so -that other programs may take advantage of it, and the other GNU binary -utilities are being converted to use it. - -@item Configuration -Compile-time configuration (to select a particular architecture and -operating system) is much easier. The script @code{config.gdb} now -handles specification of separate host and target configurations. - -@item Interaction -The user interface to _GDBN__'s control variables has been simplified -and consolidated in two commands, @code{set} and @code{show}. Output -lines are now broken at readable places, rather than overflowing onto -the next line. You can suppress output of machine-level addresses, -displaying only source language information. - - -@item Source Language -_GDBN__ now has limited support for C++ exception handling: _GDBN__ can -break when an exception is raised, before the stack is peeled back to -the exception handler's context. - -@item Command Rationalization -Many _GDBN__ commands have been renamed to make them easier to remember -and use. In particular, the subcommands of @code{info} and -@code{show}/@code{set} are grouped to make the former refer to the state -of your program, and the latter refer to the state of _GDBN__ itself. -@xref{Renamed Commands}, for details on what commands were renamed. - -@item Ports -_GDBN__ has been ported to the following new architectures: AT&T 3b1, -Acorn RISC machine, HP300 running HPUX, big- and little-endian MIPS -machines, Motorola 88k, Sun 386i, and Sun 3 running SunOS 4. In -addition, the following are supported as targets only: AMD 29k, Intel -960, and Wind River's VxWorks. - -@item Shared Libraries -_GDBN__ 4.0 supports SunOS shared libraries. - -@item Work in Progress -Kernel debugging for BSD and Mach systems; Tahoe and HPPA architecture -support. - -@end table - diff --git a/gdb/doc/gdbinv-m.m4 b/gdb/doc/gdbinv-m.m4 index 8fe5f91..e69de29 100755 --- a/gdb/doc/gdbinv-m.m4 +++ b/gdb/doc/gdbinv-m.m4 @@ -1,13 +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__(_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__) diff --git a/gdb/doc/gdbinv-s.m4 b/gdb/doc/gdbinv-s.m4 index e0814be..e69de29 100755 --- a/gdb/doc/gdbinv-s.m4 +++ b/gdb/doc/gdbinv-s.m4 @@ -1,427 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT $Id$ -@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). -_if__(_I960__) -_if__(!_GENERIC__) -@node i960-Nindy Remote, EB29K Remote, Mode Options, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node i960-Nindy Remote, EB29K Remote, Remote, Remote -_fi__(_GENERIC__) -@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}. - -@end itemize - -@menu -* Nindy Startup:: Startup with Nindy -* Nindy Options:: Options for Nindy -* Nindy reset:: Nindy Reset Command -@end menu - -@node Nindy Startup, Nindy Options, i960-Nindy Remote, i960-Nindy Remote -@subsubsection Startup with Nindy - -If you simply start @code{_GDBN__} 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}). - -@node Nindy Options, Nindy reset, Nindy Startup, i960-Nindy Remote -@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. - -@node Nindy reset, , Nindy Options, i960-Nindy Remote -@c @group -@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__) -_if__(!_GENERIC__) -@node EB29K Remote, VxWorks Remote, i960-Nindy Remote, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node EB29K Remote, VxWorks Remote, i960-Nindy Remote, Remote -_fi__(_GENERIC__) -@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), _GDBP__-EB29K, EB29K Remote, EB29K Remote -@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 what 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 don't 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, Remote Log, Comms (EB29K), EB29K Remote -@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 -@end example -@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 - -@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're 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, , _GDBP__-EB29K, EB29K Remote -@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__(_VXWORKS__) -_if__(!_GENERIC__) -@node VxWorks Remote, , EB29K Remote, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node VxWorks Remote, , EB29K Remote, Remote -_fi__(_GENERIC__) -@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 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 -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 @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 _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, VxWorks download, VxWorks Remote, VxWorks Remote -@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}); 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, VxWorks attach, VxWorks connection, VxWorks Remote -@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, , VxWorks download, VxWorks Remote -@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 - -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__) diff --git a/gdb/doc/interim-gdb.texinfo b/gdb/doc/interim-gdb.texinfo index 53a01e4..e69de29 100755 --- a/gdb/doc/interim-gdb.texinfo +++ b/gdb/doc/interim-gdb.texinfo @@ -1,7901 +0,0 @@ -_dnl__ -*-Texinfo-*- -_dnl__ Copyright (c) 1988 1989 1990 1991 Free Software Foundation, Inc. -\input texinfo -@setfilename _GDBP__.info -@c $Id$ -@c THIS MANUAL REQUIRES TEXINFO-2 macros and info-makers to format properly. -@c -@c NOTE: this manual is marked up for preprocessing with a collection -@c of m4 macros called "pretex.m4". If you see <_if__> and <_fi__> -@c scattered around the source, you have the full source before -@c preprocessing; if you don't, you have the source configured for -@c _HOST__ architectures (and you can of course get the full source, -@c with all configurations, from wherever you got this). -_if__(0) - -THIS IS THE SOURCE PRIOR TO PREPROCESSING. The full source needs to -be run through m4 before either tex- or info- formatting: for example, -_0__ - m4 pretex.m4 none.m4 all.m4 gdb.texinfo >gdb-all.texinfo -_1__ -will produce (assuming your path finds either GNU m4 >= 0.84, or SysV -m4; Berkeley won't do) a file suitable for formatting. See the text in -"pretex.m4" for a fuller explanation (and the macro definitions). - -_fi__(0) -_include__(gdbVN.m4) -@tex -\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision$} % For use in headers, footers too -@end tex -@c -@syncodeindex ky cp -@c FOR UPDATES LEADING TO THIS DRAFT, GDB CHANGELOG CONSULTED BETWEEN: -@c Fri Sep 20 16:10:52 1991 John Gilmore (gnu at cygnus.com) -@c Sat Dec 22 02:51:40 1990 John Gilmore (gnu at cygint) -@ifinfo -This file documents the GNU debugger _GDBN__. - -Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' may be -included in a translation approved by the Free Software Foundation -instead of in the original English. -@end ifinfo -@c @smallbook -@setchapternewpage odd -_if__(_GENERIC__) -@settitle Using _GDBN__ (_GDB_VN__) -_fi__(_GENERIC__) -_if__(!_GENERIC__) -@settitle Using _GDBN__ _GDB_VN__ (_HOST__) -_fi__(!_GENERIC__) -@iftex -@finalout -@end iftex -@titlepage -@title{Using _GDBN__} -@subtitle{A Guide to the GNU Source-Level Debugger} -_if__(!_GENERIC__) -@subtitle{On _HOST__ Systems} -_fi__(!_GENERIC__) -@sp 1 -@c Maybe crank this up to "Fourth Edition" when released at FSF -@c @subtitle Third Edition---_GDBN__ version _GDB_VN__ -@subtitle _GDBN__ version _GDB_VN__ -@subtitle July 1991 -@author{Richard M. Stallman@qquad @hfill Free Software Foundation} -@author{Roland H. Pesch@qquad @hfill Cygnus Support} -@page -@tex -{\parskip=0pt -\hfill rms\@ai.mit.edu, pesch\@cygnus.com\par -\hfill {\it Using _GDBN__}, \manvers\par -\hfill \TeX{}info \texinfoversion\par -} -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1988, 1989, 1990, 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and provided that the entire resulting derived work is -distributed under the terms of a permission notice identical to this -one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' may be -included in a translation approved by the Free Software Foundation -instead of in the original English. -@end titlepage -@page - -@node Top, Summary, (dir), (dir) -@ifinfo -This file describes version _GDB_VN__ of GDB, the GNU symbolic debugger. -@end ifinfo - -@menu -* Summary:: Summary of _GDBN__ -* New Features:: New Features in _GDBN__ version _GDB_VN__ -* Sample Session:: A Sample _GDBN__ Session -* Invocation:: Getting In and Out of _GDBN__ -* Commands:: _GDBN__ Commands -* Running:: Running Programs Under _GDBN__ -* Stopping:: Stopping and Continuing -* Stack:: Examining the Stack -* Source:: Examining Source Files -* Data:: Examining Data -* Languages:: Using _GDBN__ with Different Languages -* Symbols:: Examining the Symbol Table -* Altering:: Altering Execution -* _GDBN__ Files:: _GDBN__'s Files -* Targets:: Specifying a Debugging Target -* Controlling _GDBN__:: Controlling _GDBN__ -* Sequences:: Canned Sequences of Commands -* Emacs:: Using _GDBN__ under GNU Emacs -* _GDBN__ Bugs:: Reporting Bugs in _GDBN__ -* Renamed Commands:: -* Installing _GDBN__:: Installing _GDBN__ -* Copying:: GNU GENERAL PUBLIC LICENSE -* Index:: Index - - --- The Detailed Node Listing --- - -Summary of _GDBN__ - -* Free Software:: Free Software -* Contributors:: Contributors to _GDBN__ - -Getting In and Out of _GDBN__ - -* Starting _GDBN__:: Starting _GDBN__ -* Leaving _GDBN__:: Leaving _GDBN__ -* Shell Commands:: Shell Commands - -Starting _GDBN__ - -* File Options:: Choosing Files -* Mode Options:: Choosing Modes - -_GDBN__ Commands - -* Command Syntax:: Command Syntax -* Help:: Getting Help - -Running Programs Under _GDBN__ - -* Compilation:: Compiling for Debugging -* Starting:: Starting your Program -* Arguments:: Your Program's Arguments -* Environment:: Your Program's Environment -* Working Directory:: Your Program's Working Directory -* Input/Output:: Your Program's Input and Output -* Attach:: Debugging an Already-Running Process -* Kill Process:: Killing the Child Process - -Stopping and Continuing - -* Breakpoints:: Breakpoints, Watchpoints, and Exceptions -* Continuing and Stepping:: Resuming Execution -* Signals:: Signals - -Breakpoints, Watchpoints, and Exceptions - -* Set Breaks:: Setting Breakpoints -* Set Watchpoints:: Setting Watchpoints -* Exception Handling:: Breakpoints and Exceptions -* Delete Breaks:: Deleting Breakpoints -* Disabling:: Disabling Breakpoints -* Conditions:: Break Conditions -* Break Commands:: Breakpoint Command Lists -* Breakpoint Menus:: Breakpoint Menus -* Error in Breakpoints:: ``Cannot insert breakpoints'' - -Examining the Stack - -* Frames:: Stack Frames -* Backtrace:: Backtraces -* Selection:: Selecting a Frame -* Frame Info:: Information on a Frame - -Examining Source Files - -* List:: Printing Source Lines -* Search:: Searching Source Files -* Source Path:: Specifying Source Directories -* Machine Code:: Source and Machine Code - -Examining Data - -* Expressions:: Expressions -* Variables:: Program Variables -* Arrays:: Artificial Arrays -* Output formats:: Output formats -* Memory:: Examining Memory -* Auto Display:: Automatic Display -* Print Settings:: Print Settings -* Value History:: Value History -* Convenience Vars:: Convenience Variables -* Registers:: Registers -* Floating Point Hardware:: Floating Point Hardware - -Using GDB with Different Languages - -* Setting:: Switching between source languages -* Show:: Displaying the language -* Checks:: Type and Range checks -* Support:: Supported languages - -Switching between source languages - -* Manually:: Setting the working language manually -* Automatically:: Having GDB infer the source language - -Type and range Checking - -* Type Checking:: An overview of type checking -* Range Checking:: An overview of range checking - -Supported Languages - -* C:: C and C++ -* Modula-2:: Modula-2 - -C and C++ - -* C Operators:: C and C++ Operators -* C Constants:: C and C++ Constants -* Cplusplus expressions:: C++ Expressions -* C Defaults:: Default settings for C and C++ -* C Checks:: C and C++ Type and Range Checks -* Debugging C:: _GDBN__ and C -* Debugging C plus plus:: Special features for C++ - -Modula-2 - -* M2 Operators:: Built-in operators -* Builtin Func/Proc:: Built-in Functions and Procedures -* M2 Constants:: Modula-2 Constants -* M2 Defaults:: Default settings for Modula-2 -* Deviations:: Deviations from standard Modula-2 -* M2 Checks:: Modula-2 Type and Range Checks -* M2 Scope:: The scope operators @code{::} and @code{.} -* GDB/M2:: GDB and Modula-2 - -Altering Execution - -* Assignment:: Assignment to Variables -* Jumping:: Continuing at a Different Address -* Signaling:: Giving the Program a Signal -* Returning:: Returning from a Function -* Calling:: Calling your Program's Functions -* Patching:: Patching your Program - -_GDBN__'s Files - -* Files:: Commands to Specify Files -* Symbol Errors:: Errors Reading Symbol Files - -Specifying a Debugging Target - -* Active Targets:: Active Targets -* Target Commands:: Commands for Managing Targets -* Remote:: Remote Debugging - -Remote Debugging - -* i960-Nindy Remote:: _GDBN__ with a Remote i960 (Nindy) -* EB29K Remote:: _GDBN__ with a Remote EB29K -* VxWorks Remote:: _GDBN__ and VxWorks - -_GDBN__ with a Remote i960 (Nindy) - -* Nindy Startup:: Startup with Nindy -* Nindy Options:: Options for Nindy -* Nindy reset:: Nindy Reset Command - -_GDBN__ with a Remote EB29K - -* Comms (EB29K):: Communications Setup -* gdb-EB29K:: EB29K cross-debugging -* Remote Log:: Remote Log - -_GDBN__ and VxWorks - -* VxWorks connection:: Connecting to VxWorks -* VxWorks download:: VxWorks Download -* VxWorks attach:: Running Tasks - -Controlling _GDBN__ - -* Prompt:: Prompt -* Editing:: Command Editing -* History:: Command History -* Screen Size:: Screen Size -* Numbers:: Numbers -* Messages/Warnings:: Optional Warnings and Messages - -Canned Sequences of Commands - -* Define:: User-Defined Commands -* Command Files:: Command Files -* Output:: Commands for Controlled Output - -Reporting Bugs in _GDBN__ - -* Bug Criteria:: Have You Found a Bug? -* Bug Reporting:: How to Report Bugs - -Installing GDB - -* Subdirectories:: Configuration subdirectories -* Config Names:: Specifying names for hosts and targets -* configure Options:: Summary of options for configure -* Formatting Documentation:: How to format and print GDB documentation -@end menu - -@node Summary, New Features, Top, Top -@unnumbered Summary of _GDBN__ - -The purpose of a debugger such as _GDBN__ is to allow you to see what is -going on ``inside'' another program while it executes---or what another -program was doing at the moment it crashed. - -_GDBN__ can do four main kinds of things (plus other things in support of -these) to help you catch bugs in the act: - -@itemize @bullet -@item -Start your program, specifying anything that might affect its behavior. - -@item -Make your program stop on specified conditions. - -@item -Examine what has happened, when your program has stopped. - -@item -Change things in your program, so you can experiment with correcting the -effects of one bug and go on to learn about another. -@end itemize - -You can use _GDBN__ to debug programs written in C, C++, and Modula-2. -Fortran support will be added when a GNU Fortran compiler is ready. - -@menu -* Free Software:: Free Software -* Contributors:: Contributors to GDB -@end menu - -@node Free Software, Contributors, Summary, Summary -@unnumberedsec Free Software -_GDBN__ is @dfn{free software}, protected by the GNU General Public License (GPL). -The GPL gives you the freedom to copy or adapt a licensed -program---but every person getting a copy also gets with it the -freedom to modify that copy (which means that they must get access to -the source code), and the freedom to distribute further copies. -Typical software companies use copyrights to limit your freedoms; the -Free Software Foundation uses the GPL to preserve these freedoms. - -Fundamentally, the General Public License is a license which says that -you have these freedoms and that you can't take these freedoms away -from anyone else. - -@c FIXME: (passim) go through all xrefs, expanding to use text headings -For full details, @pxref{Copying}. -@node Contributors, , Free Software, Summary -@unnumberedsec Contributors to GDB - -Richard Stallman was the original author of GDB, and of many other GNU -programs. Many others have contributed to its development. This -section attempts to credit major contributors. One of the virtues of -free software is that everyone is free to contribute to it; with -regret, we cannot actually acknowledge everyone here. The file -@file{ChangeLog} in the GDB distribution approximates a blow-by-blow -account. - -Changes much prior to version 2.0 are lost in the mists of time. - -@quotation -@emph{Plea:} Additions to this section are particularly welcome. If you -or your friends (or enemies; let's be evenhanded) have been unfairly -omitted from this list, we would like to add your names! -@end quotation - -So that they may not regard their long labor as thankless, we -particularly thank those who shepherded GDB through major releases: John -Gilmore (releases _GDB_VN__, 4.0); Jim Kingdon (releases 3.9, 3.5, 3.4, 3.3); -and Randy Smith (releases 3.2, 3.1, 3.0). As major maintainer of GDB -for some period, each contributed significantly to the structure, -stability, and capabilities of the entire debugger. - -Richard Stallman, assisted at various times by Pete TerMaat, Chris -Hanson, and Richard Mlynarik, handled releases through 2.8. - -Michael Tiemann is the author of most of the GNU C++ support in GDB, -with significant additional contributions from Per Bothner. James -Clark wrote the GNU C++ demangler. Early work on C++ was by Peter -TerMaat (who also did much general update work leading to release 3.0). - -GDB _GDB_VN__ uses the BFD subroutine library to examine multiple -object-file formats; BFD was a joint project of V. Gumby -Henkel-Wallace, Rich Pixley, Steve Chamberlain, and John Gilmore. - -David Johnson wrote the original COFF support; Pace Willison did -the original support for encapsulated COFF. - -Adam de Boor and Bradley Davis contributed the ISI Optimum V support. -Per Bothner, Noboyuki Hikichi, and Alessandro Forin contributed MIPS -support. Jean-Daniel Fekete contributed Sun 386i support. Chris -Hanson improved the HP9000 support. Noboyuki Hikichi and Tomoyuki -Hasei contributed Sony/News OS 3 support. David Johnson contributed -Encore Umax support. Jyrki Kuoppala contributed Altos 3068 support. -Keith Packard contributed NS32K support. Doug Rabson contributed -Acorn Risc Machine support. Chris Smith contributed Convex support -(and Fortran debugging). Jonathan Stone contributed Pyramid support. -Michael Tiemann contributed SPARC support. Tim Tucker contributed -support for the Gould NP1 and Gould Powernode. Pace Willison -contributed Intel 386 support. Jay Vosburgh contributed Symmetry -support. - -Rich Schaefer and Peter Schauer helped with support of SunOS shared -libraries. - -Jay Fenlason and Roland McGrath ensured that GDB and GAS agree about -several machine instruction sets. - -Patrick Duval, Ted Goldstein, Vikram Koka and Glenn Engel helped -develop remote debugging. Intel Corporation and Wind River Systems -contributed remote debugging modules for their products. - -Brian Fox is the author of the readline libraries providing -command-line editing and command history. - -Andrew Beers of SUNY Buffalo wrote the language-switching code and -the Modula-2 support, and contributed the Languages chapter of this -manual. - -@node New Features, Sample Session, Summary, Top -@unnumbered New Features since _GDBN__ version 3.5 - -@table @emph -@item Targets -Using the new command @code{target}, you can select at runtime whether -you are debugging local files, local processes, standalone systems over -a serial port, realtime systems over a TCP/IP connection, etc. The -command @code{load} can download programs into a remote system. Serial -stubs are available for Motorola 680x0 and Intel 80386 remote systems; -_GDBN__ also supports debugging realtime processes running under -VxWorks, using SunRPC Remote Procedure Calls over TCP/IP to talk to a -debugger stub on the target system. Internally, _GDBN__ now uses a -function vector to mediate access to different targets; if you need to -add your own support for a remote protocol, this makes it much easier. - -@item Watchpoints -_GDBN__ now sports watchpoints as well as breakpoints. You can use a -watchpoint to stop execution whenever the value of an expression -changes, without having to predict a particular place in your program -where this may happen. - -@item Wide Output -Commands that issue wide output now insert newlines at places designed -to make the output more readable. - -@item Object Code Formats -_GDBN__ uses a new library called the Binary File Descriptor (BFD) -Library to permit it to switch dynamically, without reconfiguration or -recompilation, between different object-file formats. Formats currently -supported are COFF, a.out, and the Intel 960 b.out; files may be read as -.o's, archive libraries, or core dumps. BFD is available as a -subroutine library so that other programs may take advantage of it, and -the other GNU binary utilities are being converted to use it. - -@item Configuration and Ports -Compile-time configuration (to select a particular architecture and -operating system) is much easier. The script @code{configure} now -allows you to configure _GDBN__ as either a native debugger or a -cross-debugger. @xref{Installing _GDBN__} for details on how to -configure and on what architectures are now available. - -@item Interaction -The user interface to _GDBN__'s control variables has been simplified -and consolidated in two commands, @code{set} and @code{show}. Output -lines are now broken at readable places, rather than overflowing onto -the next line. You can suppress output of machine-level addresses, -displaying only source language information. - - -@item C++ -_GDBN__ now supports C++ multiple inheritance (if used with a GCC -version 2 compiler), and also has limited support for C++ exception -handling, with the commands @code{catch} and @code{info catch}: _GDBN__ -can break when an exception is raised, before the stack is peeled back -to the exception handler's context. - -@item Modula-2 -_GDBN__ now has preliminary support for the GNU Modula-2 compiler, -currently under development at the State University of New York at -Buffalo. Coordinated development of both _GDBN__ and the GNU Modula-2 -compiler will continue through the fall of 1991 and into 1992. Other -Modula-2 compilers are currently not supported, and attempting to debug -programs compiled with them will likely result in an error as the symbol -table of the executable is read in. - -@item Command Rationalization -Many _GDBN__ commands have been renamed to make them easier to remember -and use. In particular, the subcommands of @code{info} and -@code{show}/@code{set} are grouped to make the former refer to the state -of your program, and the latter refer to the state of _GDBN__ itself. -@xref{Renamed Commands}, for details on what commands were renamed. - -@item Shared Libraries -_GDBN__ _GDB_VN__ can debug programs and core files that use SunOS shared -libraries. - -@item Reference Card -_GDBN__ _GDB_VN__ has a reference card; @xref{Formatting Documentation} for -instructions on printing it. - -@item Work in Progress -Kernel debugging for BSD and Mach systems; Tahoe and HPPA architecture -support. - -@end table - -@node Sample Session, Invocation, New Features, Top -@chapter A Sample _GDBN__ Session - -You can use this manual at your leisure to read all about _GDBN__. -However, a handful of commands are enough to get started using the -debugger. This chapter illustrates these commands. - -@iftex -In this sample session, we emphasize user input like this: @i{input}, -to make it easier to pick out from the surrounding output. -@end iftex - -@c FIXME: this example may not be appropriate for some configs, where -@c FIXME...primary interest is in remote use. -_0__ -One of the preliminary versions of GNU @code{m4} (a generic macro -processor) exhibits the following bug: sometimes, when we change its -quote strings from the default, the commands used to capture one macro's -definition in another stop working. In the following short @code{m4} -session, we define a macro @code{foo} which expands to @code{0000}; we -then use the @code{m4} builtin @code{defn} to define @code{bar} as the -same thing. However, when we change the open quote string to -@code{} and the close quote string to @code{}, the same -procedure fails to define a new synonym @code{baz}: - -@smallexample -$ @i{cd gnu/m4} -$ @i{./m4} -@i{define(foo,0000)} - -@i{foo} -0000 -@i{define(bar,defn(`foo'))} - -@i{bar} -0000 -@i{changequote(,)} - -@i{define(baz,defn(foo))} -@i{baz} -@i{C-d} -m4: End of input: 0: fatal error: EOF in string -@end smallexample - -@noindent -Let's use _GDBN__ to try to see what's going on. - -@smallexample -$ @i{_GDBP__ m4} -GDB is free software and you are welcome to distribute copies of it - under certain conditions; type "info copying" to see the conditions. -There is absolutely no warranty for GDB; type "info warranty" for details. -GDB _GDB_VN__, Copyright 1991 Free Software Foundation, Inc... -(_GDBP__) -@end smallexample - -@noindent -_GDBN__ reads only enough symbol data to know where to find the rest -when needed; as a result, the first prompt comes up very quickly. We -then tell _GDBN__ to use a narrower display width than usual, so -that examples will fit in this manual. - -@smallexample -(_GDBP__) @i{set width 70} -@end smallexample - -@noindent -Let's see how the @code{m4} builtin @code{changequote} works. -Having looked at the source, we know the relevant subroutine is -@code{m4_changequote}, so we set a breakpoint there with _GDBN__'s -@code{break} command. - -@smallexample -(_GDBP__) @i{break m4_changequote} -Breakpoint 1 at 0x62f4: file builtin.c, line 879. -@end smallexample - -@noindent -Using the @code{run} command, we start @code{m4} running under _GDBN__ -control; as long as control does not reach the @code{m4_changequote} -subroutine, the program runs as usual: - -@smallexample -(_GDBP__) @i{run} -Starting program: /work/Editorial/gdb/gnu/m4/m4 -@i{define(foo,0000)} - -@i{foo} -0000 -@end smallexample - -@noindent -To trigger the breakpoint, we call @code{changequote}. _GDBN__ -suspends execution of @code{m4}, displaying information about the -context where it stops. - -@smallexample -@i{changequote(,)} - -Breakpoint 1, m4_changequote (argc=3, argv=0x33c70) at builtin.c:879 -879 if (bad_argc(TOKEN_DATA_TEXT(argv[0]), argc, 1, 3)) -@end smallexample - -@noindent -Now we use the command @code{n} (@code{next}) to advance execution to -the next line of the current function. - -@smallexample -(_GDBP__) @i{n} -882 set_quotes((argc >= 2) ? TOKEN_DATA_TEXT(argv[1]) : nil, -@end smallexample - -@noindent -@code{set_quotes} looks like a promising subroutine. We can go into it -by using the command @code{s} (@code{step}) instead of @code{next}. -@code{step} goes to the next line to be executed in @emph{any} -subroutine, so it steps into @code{set_quotes}. - -@smallexample -(_GDBP__) @i{s} -set_quotes (lq=0x34c78 "", rq=0x34c88 "") - at input.c:530 -530 if (lquote != def_lquote) -@end smallexample - -@noindent -The summary display showing the subroutine where @code{m4} is now -suspended (and its arguments) is called a stack frame display. We can -use the @code{backtrace} command (which can also be spelled @code{bt}), -to see where we are in the stack: it displays a stack frame for each -active subroutine. - -@smallexample -(_GDBP__) @i{bt} -#0 set_quotes (lq=0x34c78 "", rq=0x34c88 "") - at input.c:530 -#1 0x6344 in m4_changequote (argc=3, argv=0x33c70) at builtin.c:882 -#2 0x8174 in expand_macro (sym=0x33320) at macro.c:242 -#3 0x7a88 in expand_token (obs=0x0, t=209696, td=0xf7fffa30) - at macro.c:71 -#4 0x79dc in expand_input () at macro.c:40 -#5 0x2930 in main (argc=0, argv=0xf7fffb20) at m4.c:195 -@end smallexample - -@noindent -Let's step through a few more lines to see what happens. The first two -times, we can use @samp{s}; the next two times we use @code{n} to avoid -falling into the @code{xstrdup} subroutine. -@smallexample -(_GDBP__) @i{s} -0x3b5c 532 if (rquote != def_rquote) -(_GDBP__) @i{s} -0x3b80 535 lquote = (lq == nil || *lq == '\0') ? def_lquote :\ - xstrdup(lq); -(_GDBP__) @i{n} -536 rquote = (rq == nil || *rq == '\0') ? def_rquote : xstrdup\ -(rq); -(_GDBP__) @i{n} -538 len_lquote = strlen(rquote); -@end smallexample - -@noindent -The last line displayed looks a little odd; let's examine the variables -@code{lquote} and @code{rquote} to see if they are in fact the new left -and right quotes we specified. We can use the command @code{p} -(@code{print}) to see their values. - -@smallexample -(_GDBP__) @i{p lquote} -$1 = 0x35d40 "" -(_GDBP__) @i{p rquote} -$2 = 0x35d50 "" -@end smallexample - -@noindent -@code{lquote} and @code{rquote} are indeed the new left and right quotes. -Let's look at some context; we can display ten lines of source -surrounding the current line, with the @code{l} (@code{list}) command. - -@smallexample -(_GDBP__) @i{l} -533 xfree(rquote); -534 -535 lquote = (lq == nil || *lq == '\0') ? def_lquote : xstrdup\ -(lq); -536 rquote = (rq == nil || *rq == '\0') ? def_rquote : xstrdup\ -(rq); -537 -538 len_lquote = strlen(rquote); -539 len_rquote = strlen(lquote); -540 @} -541 -542 void -@end smallexample - -@noindent -Let's step past the two lines that set @code{len_lquote} and -@code{len_rquote}, and then examine the values of those variables. - -@smallexample -(_GDBP__) @i{n} -539 len_rquote = strlen(lquote); -(_GDBP__) @i{n} -540 @} -(_GDBP__) @i{p len_lquote} -$3 = 9 -(_GDBP__) @i{p len_rquote} -$4 = 7 -@end smallexample - -@noindent -That certainly looks wrong, assuming @code{len_lquote} and -@code{len_rquote} are meant to be the lengths of @code{lquote} and -@code{rquote} respectively. Let's try setting them to better values. -We can use the @code{p} command for this, since it'll print the value of -any expression---and that expression can include subroutine calls and -assignments. - -@smallexample -(_GDBP__) p len_lquote=strlen(lquote) -$5 = 7 -(_GDBP__) p len_rquote=strlen(rquote) -$6 = 9 -@end smallexample - -@noindent -Let's see if that fixes the problem of using the new quotes with the -@code{m4} built-in @code{defn}. We can allow @code{m4} to continue -executing with the @code{c} (@code{continue}) command, and then try the -example that caused trouble initially: - -@smallexample -(_GDBP__) @i{c} -Continuing. - -@i{define(baz,defn(foo))} - -baz -0000 -@end smallexample - -@noindent -Success! The new quotes now work just as well as the default ones. The -problem seems to have been just the two typos defining the wrong -lengths. We'll let @code{m4} exit by giving it an EOF as input. - -@smallexample -@i{C-d} -Program exited normally. -@end smallexample - -@noindent -The message @samp{Program exited normally.} is from _GDBN__; it -indicates @code{m4} has finished executing. We can end our _GDBN__ -session with the _GDBN__ @code{quit} command. - -@smallexample -(_GDBP__) @i{quit} -_1__@end smallexample - -@node Invocation, Commands, Sample Session, Top -@chapter Getting In and Out of _GDBN__ - -@menu -* Starting _GDBN__:: Starting _GDBN__ -* Leaving _GDBN__:: Leaving _GDBN__ -* Shell Commands:: Shell Commands -@end menu - -@node Starting _GDBN__, Leaving _GDBN__, Invocation, Invocation -@section Starting _GDBN__ - -_GDBN__ is invoked with the shell command @code{_GDBP__}. Once started, -it reads commands from the terminal until you tell it to exit. - -You can run @code{_GDBP__} with no arguments or options; but the most -usual way to start _GDBN__ is with one argument or two, specifying an -executable program as the argument: -@example -_GDBP__ program -@end example -@noindent -You can also start with both an executable program and a core file specified: -@example -_GDBP__ program core -@end example - -You can, instead, specify a process ID as a second argument, if you want -to debug a running process: -@example -_GDBP__ program 1234 -@end example -@noindent -would attach _GDBN__ to process @code{1234} (unless you also have a file -named @file{1234}; _GDBN__ does check for a core file first). - -@noindent -You can further control how _GDBN__ starts up by using command-line -options. _GDBN__ itself can remind you of the options available: -@example -_GDBP__ -help -@end example -@noindent -will display all available options and briefly describe their use -(@samp{_GDBP__ -h} is a shorter equivalent). - -All options and command line arguments you give are processed -in sequential order. The order makes a difference when the -@samp{-x} option is used. - -@menu -* File Options:: Choosing Files -* Mode Options:: Choosing Modes -_if__(!_GENERIC__) -_include__(gdbinv-m.m4)_dnl__ -_fi__(!_GENERIC__) -@end menu - -@node File Options, Mode Options, Starting _GDBN__, Starting _GDBN__ -@subsection Choosing Files - -As shown above, any arguments other than options specify an executable -file and core file; that is, the first argument encountered with no -associated option flag is equivalent to a @samp{-se} option, and the -second, if any, is equivalent to a @samp{-c} option. Many options have -both long and short forms; both are shown here. The long forms are also -recognized if you truncate them, so long as enough of the option is -present to be unambiguous. (If you prefer, you can flag option -arguments with @samp{+} rather than @samp{-}, though we illustrate the -more usual convention.) - -@table @code -@item -symbols=@var{file} -@itemx -s @var{file} -Read symbol table from file @var{file}. - -@item -exec=@var{file} -@itemx -e @var{file} -Use file @var{file} as the executable file to execute when -appropriate, and for examining pure data in conjunction with a core -dump. - -@item -se=@var{file} -Read symbol table from file @var{file} and use it as the executable -file. - -@item -core=@var{file} -@itemx -c @var{file} -Use file @var{file} as a core dump to examine. - -@item -command=@var{file} -@itemx -x @var{file} -Execute _GDBN__ commands from file @var{file}. @xref{Command Files}. - -@item -directory=@var{directory} -@itemx -d @var{directory} -Add @var{directory} to the path to search for source files. -@end table - -_if__(!_GENERIC__) -@node Mode Options, Mode Options, File Options, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node Mode Options, , File Options, Starting _GDBN__ -_fi__(_GENERIC__) -@subsection Choosing Modes - -@table @code -@item -nx -@itemx -n -Do not execute commands from any @file{_GDBINIT__} initialization files. -Normally, the commands in these files are executed after all the -command options and arguments have been processed. -@xref{Command Files}. - -@item -quiet -@itemx -q -``Quiet''. Do not print the introductory and copyright messages. These -messages are also suppressed in batch mode. - -@item -batch -Run in batch mode. Exit with status @code{0} after processing all the command -files specified with @samp{-x} (and @file{_GDBINIT__}, if not inhibited). -Exit with nonzero status if an error occurs in executing the _GDBN__ -commands in the command files. - -Batch mode may be useful for running _GDBN__ as a filter, for example to -download and run a program on another computer; in order to make this -more useful, the message -@example -Program exited normally. -@end example -@noindent -(which is ordinarily issued whenever a program running under _GDBN__ control -terminates) is not issued when running in batch mode. - -@item -cd=@var{directory} -Run _GDBN__ using @var{directory} as its working directory, -instead of the current directory. - -@item -fullname -@itemx -f -Emacs sets this option when it runs _GDBN__ as a subprocess. It tells _GDBN__ -to output the full file name and line number in a standard, -recognizable fashion each time a stack frame is displayed (which -includes each time the program stops). This recognizable format looks -like two @samp{\032} characters, followed by the file name, line number -and character position separated by colons, and a newline. The -Emacs-to-_GDBN__ interface program uses the two @samp{\032} characters as -a signal to display the source code for the frame. - -@item -b @var{bps} -Set the line speed (baud rate or bits per second) of any serial -interface used by _GDBN__ for remote debugging. - -@item -tty=@var{device} -Run using @var{device} for your program's standard input and output. -@c FIXME: kingdon thinks there's more to -tty. Investigate. -@end table - -_if__(!_GENERIC__) -_include__(gdbinv-s.m4) -_fi__(!_GENERIC__) - -@node Leaving _GDBN__, Shell Commands, Starting _GDBN__, Invocation -@section Leaving _GDBN__ -@cindex exiting _GDBN__ -@table @code -@item quit -@kindex quit -@kindex q -To exit _GDBN__, use the @code{quit} command (abbreviated @code{q}), or type -an end-of-file character (usually @kbd{C-d}). -@end table - -@cindex interrupt -An interrupt (often @kbd{C-c}) will not exit from _GDBN__, but rather -will terminate the action of any _GDBN__ command that is in progress and -return to _GDBN__ command level. It is safe to type the interrupt -character at any time because _GDBN__ does not allow it to take effect -until a time when it is safe. - -If you've been using _GDBN__ to control an attached process or device, -you can release it with the @code{detach} command; @pxref{Attach}. - -@node Shell Commands, , Leaving _GDBN__, Invocation -@section Shell Commands -If you need to execute occasional shell commands during your -debugging session, there's no need to leave or suspend _GDBN__; you can -just use the @code{shell} command. - -@table @code -@item shell @var{command string} -@kindex shell -@cindex shell escape -Directs _GDBN__ to invoke an inferior shell to execute @var{command -string}. If it exists, the environment variable @code{SHELL} is used -for the name of the shell to run. Otherwise _GDBN__ uses -@code{/bin/sh}. -@end table - -The utility @code{make} is often needed in development environments. -You don't have to use the @code{shell} command for this purpose in _GDBN__: - -@table @code -@item make @var{make-args} -@kindex make -@cindex calling make -Causes _GDBN__ to execute an inferior @code{make} program with the specified -arguments. This is equivalent to @samp{shell make @var{make-args}}. -@end table - -@node Commands, Running, Invocation, Top -@chapter _GDBN__ Commands - -@menu -* Command Syntax:: Command Syntax -* Help:: Getting Help -@end menu - -@node Command Syntax, Help, Commands, Commands -@section Command Syntax -A _GDBN__ command is a single line of input. There is no limit on how long -it can be. It starts with a command name, which is followed by arguments -whose meaning depends on the command name. For example, the command -@code{step} accepts an argument which is the number of times to step, -as in @samp{step 5}. You can also use the @code{step} command with -no arguments. Some command names do not allow any arguments. - -@cindex abbreviation -_GDBN__ command names may always be truncated if that abbreviation is -unambiguous. Other possible command abbreviations are listed in the -documentation for individual commands. In some cases, even ambiguous -abbreviations are allowed; for example, @code{s} is specially defined as -equivalent to @code{step} even though there are other commands whose -names start with @code{s}. You can test abbreviations by using them as -arguments to the @code{help} command. - -@cindex repeating commands -@kindex RET -A blank line as input to _GDBN__ (typing just @key{RET}) means to -repeat the previous command. Certain commands (for example, @code{run}) -will not repeat this way; these are commands for which unintentional -repetition might cause trouble and which you are unlikely to want to -repeat. - -The @code{list} and @code{x} commands, when you repeat them with -@key{RET}, construct new arguments rather than repeating -exactly as typed. This permits easy scanning of source or memory. - -_GDBN__ can also use @key{RET} in another way: to partition lengthy -output, in a way similar to the common utility @code{more} -(@pxref{Screen Size}). Since it's easy to press one @key{RET} too many -in this situation, _GDBN__ disables command repetition after any command -that generates this sort of display. - -@kindex # -@cindex comment -A line of input starting with @kbd{#} is a comment; it does nothing. -This is useful mainly in command files (@xref{Command Files}). - -@node Help, , Command Syntax, Commands -@section Getting Help -@cindex online documentation -@kindex help -You can always ask _GDBN__ itself for information on its commands, using the -command @code{help}. - -@table @code -@item help -@itemx h -@kindex h -You can use @code{help} (abbreviated @code{h}) with no arguments to -display a short list of named classes of commands: -@smallexample -(_GDBP__) help -List of classes of commands: - -running -- Running the program -stack -- Examining the stack -data -- Examining data -breakpoints -- Making program stop at certain points -files -- Specifying and examining files -status -- Status inquiries -support -- Support facilities -user-defined -- User-defined commands -aliases -- Aliases of other commands -obscure -- Obscure features - -Type "help" followed by a class name for a list of commands in that class. -Type "help" followed by command name for full documentation. -Command name abbreviations are allowed if unambiguous. -(_GDBP__) -@end smallexample - -@item help @var{class} -Using one of the general help classes as an argument, you can get a -list of the individual commands in that class. For example, here is the -help display for the class @code{status}: -@smallexample -(_GDBP__) help status -Status inquiries. - -List of commands: - -show -- Generic command for showing things set with "set" -info -- Generic command for printing status - -Type "help" followed by command name for full documentation. -Command name abbreviations are allowed if unambiguous. -(_GDBP__) -@end smallexample - -@item help @var{command} -With a command name as @code{help} argument, _GDBN__ will display a -short paragraph on how to use that command. -@end table - -In addition to @code{help}, you can use the _GDBN__ commands @code{info} -and @code{show} to inquire about the state of your program, or the state -of _GDBN__ itself. Each command supports many topics of inquiry; this -manual introduces each of them in the appropriate context. The listings -under @code{info} and under @code{show} in the Index point to -all the sub-commands. -@c FIXME: @pxref{Index} used to be here, but even though it shows up in -@c FIXME...the 'aux' file with a pageno the xref can't find it. - -@c @group -@table @code -@item info -@kindex info -@kindex i -This command (abbreviated @code{i}) is for describing the state of your -program; for example, it can list the arguments given to your program -(@code{info args}), the registers currently in use (@code{info -registers}), or the breakpoints you've set (@code{info breakpoints}). -You can get a complete list of the @code{info} sub-commands with -@w{@code{help info}}. - -@kindex show -@item show -In contrast, @code{show} is for describing the state of _GDBN__ itself. -You can change most of the things you can @code{show}, by using the -related command @code{set}; for example, you can control what number -system is used for displays with @code{set radix}, or simply inquire -which is currently in use with @code{show radix}. - -@kindex info set -To display all the settable parameters and their current -values, you can use @code{show} with no arguments; you may also use -@code{info set}. Both commands produce the same display. -@c FIXME: "info set" violates the rule that "info" is for state of -@c FIXME...program. Ck w/ GNU: "info set" to be called something else, -@c FIXME...or change desc of rule---eg "state of prog and debugging session"? -@end table -@c @end group - -Here are three miscellaneous @code{show} subcommands, all of which are -exceptional in lacking corresponding @code{set} commands: - -@table @code -@kindex show version -@cindex version number -@item show version -Show what version of _GDBN__ is running. You should include this -information in _GDBN__ bug-reports. If multiple versions of _GDBN__ are -in use at your site, you may occasionally want to make sure what version -of _GDBN__ you're running; as _GDBN__ evolves, new commands are -introduced, and old ones may wither away. The version number is also -announced when you start _GDBN__ with no arguments. - -@kindex show copying -@item show copying -Display information about permission for copying _GDBN__. - -@kindex show warranty -@item show warranty -Display the GNU ``NO WARRANTY'' statement. -@end table - -@node Running, Stopping, Commands, Top -@chapter Running Programs Under _GDBN__ - -@menu -* Compilation:: Compiling for Debugging -* Starting:: Starting your Program -* Arguments:: Your Program's Arguments -* Environment:: Your Program's Environment -* Working Directory:: Your Program's Working Directory -* Input/Output:: Your Program's Input and Output -* Attach:: Debugging an Already-Running Process -* Kill Process:: Killing the Child Process -@end menu - -@node Compilation, Starting, Running, Running -@section Compiling for Debugging - -In order to debug a program effectively, you need to generate -debugging information when you compile it. This debugging information -is stored in the object file; it describes the data type of each -variable or function and the correspondence between source line numbers -and addresses in the executable code. - -To request debugging information, specify the @samp{-g} option when you run -the compiler. - -Many C compilers are unable to handle the @samp{-g} and @samp{-O} -options together. Using those compilers, you cannot generate optimized -executables containing debugging information. - -The GNU C compiler supports @samp{-g} with or without @samp{-O}, making it -possible to debug optimized code. We recommend that you @emph{always} use -@samp{-g} whenever you compile a program. You may think the program is -correct, but there's no sense in pushing your luck. - -Some things do not work as well with @samp{-g -O} as with just -@samp{-g}, particularly on machines with instruction scheduling. If in -doubt, recompile with @samp{-g} alone, and if this fixes the problem, -please report it as a bug (including a test case!). - -Older versions of the GNU C compiler permitted a variant option -@samp{-gg} for debugging information. _GDBN__ no longer supports this -format; if your GNU C compiler has this option, do not use it. - -@ignore -@comment As far as I know, there are no cases in which _GDBN__ will -@comment produce strange output in this case. (but no promises). -If your program includes archives made with the @code{ar} program, and -if the object files used as input to @code{ar} were compiled without the -@samp{-g} option and have names longer than 15 characters, _GDBN__ will get -confused reading the program's symbol table. No error message will be -given, but _GDBN__ may behave strangely. The reason for this problem is a -deficiency in the Unix archive file format, which cannot represent file -names longer than 15 characters. - -To avoid this problem, compile the archive members with the @samp{-g} -option or use shorter file names. Alternatively, use a version of GNU -@code{ar} dated more recently than August 1989. -@end ignore - - -@node Starting, Arguments, Compilation, Running -@section Starting your Program -@cindex starting -@cindex running -@table @code -@item run -@itemx r -@kindex run -Use the @code{run} command to start your program under _GDBN__. You -must first specify the program name -_if__(_VXWORKS__) -(except on VxWorks) -_fi__(_VXWORKS__) -with an argument to _GDBN__ -(@pxref{Invocation}), or using the @code{file} or @code{exec-file} -command (@pxref{Files}). -@refill -@end table - -On targets that support processes, @code{run} creates an inferior -process and makes that process run your program. On other targets, -@code{run} jumps to the start of the program. - -The execution of a program is affected by certain information it -receives from its superior. _GDBN__ provides ways to specify this -information, which you must do @i{before} starting the program. (You -can change it after starting the program, but such changes will only affect -the program the next time you start it.) This information may be -divided into four categories: - -@table @asis -@item The @i{arguments.} -You specify the arguments to give your program as the arguments of the -@code{run} command. If a shell is available on your target, the shell -is used to pass the arguments, so that you may use normal conventions -(such as wildcard expansion or variable substitution) in -describing the arguments. In Unix systems, you can control which shell -is used with the @code{SHELL} environment variable. @xref{Arguments}.@refill - -@item The @i{environment.} -Your program normally inherits its environment from _GDBN__, but you can -use the _GDBN__ commands @code{set environment} and @code{unset -environment} to change parts of the environment that will be given to -the program. @xref{Environment}.@refill - -@item The @i{working directory.} -Your program inherits its working directory from _GDBN__. You can set -_GDBN__'s working directory with the @code{cd} command in _GDBN__. -@xref{Working Directory}. - -@item The @i{standard input and output.} -Your program normally uses the same device for standard input and -standard output as _GDBN__ is using. You can redirect input and output -in the @code{run} command line, or you can use the @code{tty} command to -set a different device for your program. -@xref{Input/Output}. - -@cindex pipes -@emph{Warning:} While input and output redirection work, you can't use -pipes to pass the output of the program you're debugging to another -program; if you attempt this, _GDBN__ is likely to wind up debugging the -wrong program. -@end table - -When you issue the @code{run} command, your program begins to execute -immediately. @xref{Stopping}, for discussion of how to arrange for your -program to stop. Once your program has been started by the @code{run} -command (and then stopped), you may evaluate expressions that involve -calls to functions in the inferior, using the @code{print} or -@code{call} commands. @xref{Data}. - -If the modification time of your symbol file has changed since the last -time _GDBN__ read its symbols, _GDBN__ will discard its symbol table and re-read -it. In this process, it tries to retain your current breakpoints. - -@node Arguments, Environment, Starting, Running -@section Your Program's Arguments - -@cindex arguments (to your program) -The arguments to your program can be specified by the arguments of the -@code{run} command. They are passed to a shell, which expands wildcard -characters and performs redirection of I/O, and thence to the program. -_GDBN__ uses the shell indicated by your environment variable -@code{SHELL} if it exists; otherwise, _GDBN__ uses @code{/bin/sh}. - -@code{run} with no arguments uses the same arguments used by the previous -@code{run}, or those set by the @code{set args} command. - -@kindex set args -@table @code -@item set args -Specify the arguments to be used the next time your program is run. If -@code{set args} has no arguments, @code{run} will execute your program -with no arguments. Once you have run your program with arguments, -using @code{set args} before the next @code{run} is the only way to run -it again without arguments. - -@item show args -@kindex show args -Show the arguments to give your program when it is started. -@end table - -@node Environment, Working Directory, Arguments, Running -@section Your Program's Environment - -@cindex environment (of your program) -The @dfn{environment} consists of a set of environment variables and -their values. Environment variables conventionally record such things as -your user name, your home directory, your terminal type, and your search -path for programs to run. Usually you set up environment variables with -the shell and they are inherited by all the other programs you run. When -debugging, it can be useful to try running the program with a modified -environment without having to start _GDBN__ over again. - -@table @code -@item path @var{directory} -@kindex path -Add @var{directory} to the front of the @code{PATH} environment variable -(the search path for executables), for both _GDBN__ and your program. -You may specify several directory names, separated by @samp{:} or -whitespace. If @var{directory} is already in the path, it is moved to -the front, so it will be searched sooner. - -You can use the string @samp{$cwd} to refer to whatever is the current -working directory at the time _GDBN__ searches the path. If you use -@samp{.} instead, it refers to the directory where you executed the -@code{path} command. _GDBN__ fills in the current path where needed in -the @var{directory} argument, before adding it to the search path. -@c 'path' is explicitly nonrepeatable, but RMS points out it's silly to -@c document that, since repeating it would be a no-op. - -@item show paths -@kindex show paths -Display the list of search paths for executables (the @code{PATH} -environment variable). - -@item show environment @r{[}@var{varname}@r{]} -@kindex show environment -Print the value of environment variable @var{varname} to be given to -your program when it starts. If you don't supply @var{varname}, -print the names and values of all environment variables to be given to -your program. You can abbreviate @code{environment} as @code{env}. - -@item set environment @var{varname} @r{[}=@r{]} @var{value} -@kindex set environment -Sets environment variable @var{varname} to @var{value}. The value -changes for your program only, not for _GDBN__ itself. @var{value} may -be any string; the values of environment variables are just strings, and -any interpretation is supplied by your program itself. The @var{value} -parameter is optional; if it is eliminated, the variable is set to a -null value. -@c "any string" here doesn't include leading, trailing -@c blanks. Gnu asks: does anyone care? - -For example, this command: - -@example -set env USER = foo -@end example - -@noindent -tells a Unix program, when subsequently run, that its user is named -@samp{foo}. (The spaces around @samp{=} are used for clarity here; they -are not actually required.) - -@item unset environment @var{varname} -@kindex unset environment -Remove variable @var{varname} from the environment to be passed to your -program. This is different from @samp{set env @var{varname} =}; -@code{unset environment} removes the variable from the environment, -rather than assigning it an empty value. -@end table - -@node Working Directory, Input/Output, Environment, Running -@section Your Program's Working Directory - -@cindex working directory (of your program) -Each time you start your program with @code{run}, it inherits its -working directory from the current working directory of _GDBN__. _GDBN__'s -working directory is initially whatever it inherited from its parent -process (typically the shell), but you can specify a new working -directory in _GDBN__ with the @code{cd} command. - -The _GDBN__ working directory also serves as a default for the commands -that specify files for _GDBN__ to operate on. @xref{Files}. - -@table @code -@item cd @var{directory} -@kindex cd -Set _GDBN__'s working directory to @var{directory}. - -@item pwd -@kindex pwd -Print _GDBN__'s working directory. -@end table - -@node Input/Output, Attach, Working Directory, Running -@section Your Program's Input and Output - -@cindex redirection -@cindex i/o -@cindex terminal -By default, the program you run under _GDBN__ does input and output to -the same terminal that _GDBN__ uses. _GDBN__ switches the terminal to -its own terminal modes to interact with you, but it records the terminal -modes your program was using and switches back to them when you continue -running your program. - -@table @code -@item info terminal -@kindex info terminal -Displays _GDBN__'s recorded information about the terminal modes your -program is using. -@end table - -You can redirect the program's input and/or output using shell -redirection with the @code{run} command. For example, - -_0__@example -run > outfile -_1__@end example - -@noindent -starts the program, diverting its output to the file @file{outfile}. - -@kindex tty -@cindex controlling terminal -Another way to specify where the program should do input and output is -with the @code{tty} command. This command accepts a file name as -argument, and causes this file to be the default for future @code{run} -commands. It also resets the controlling terminal for the child -process, for future @code{run} commands. For example, - -@example -tty /dev/ttyb -@end example - -@noindent -directs that processes started with subsequent @code{run} commands -default to do input and output on the terminal @file{/dev/ttyb} and have -that as their controlling terminal. - -An explicit redirection in @code{run} overrides the @code{tty} command's -effect on the input/output device, but not its effect on the controlling -terminal. - -When you use the @code{tty} command or redirect input in the @code{run} -command, only the input @emph{for your program} is affected. The input -for _GDBN__ still comes from your terminal. - -@node Attach, Kill Process, Input/Output, Running -@section Debugging an Already-Running Process -@kindex attach -@cindex attach - -@table @code -@item attach @var{process-id} -This command -attaches to a running process---one that was started outside _GDBN__. -(@code{info files} will show your active targets.) The command takes as -argument a process ID. The usual way to find out the process-id of -a Unix process is with the @code{ps} utility, or with the @samp{jobs -l} -shell command. - -@code{attach} will not repeat if you press @key{RET} a second time after -executing the command. -@end table - -To use @code{attach}, you must be debugging in an environment which -supports processes. You must also have permission to send the process a -signal, and it must have the same effective user ID as the _GDBN__ -process. - -When using @code{attach}, you should first use the @code{file} command -to specify the program running in the process and load its symbol table. -@xref{Files}. - -The first thing _GDBN__ does after arranging to debug the specified -process is to stop it. You can examine and modify an attached process -with all the _GDBN__ commands that are ordinarily available when you start -processes with @code{run}. You can insert breakpoints; you can step and -continue; you can modify storage. If you would rather the process -continue running, you may use the @code{continue} command after -attaching _GDBN__ to the process. - -@table @code -@item detach -@kindex detach -When you have finished debugging the attached process, you can use the -@code{detach} command to release it from _GDBN__'s control. Detaching -the process continues its execution. After the @code{detach} command, -that process and _GDBN__ become completely independent once more, and you -are ready to @code{attach} another process or start one with @code{run}. -@code{detach} will not repeat if you press @key{RET} again after -executing the command. -@end table - -If you exit _GDBN__ or use the @code{run} command while you have an attached -process, you kill that process. By default, you will be asked for -confirmation if you try to do either of these things; you can control -whether or not you need to confirm by using the @code{set confirm} command -(@pxref{Messages/Warnings}). - -@node Kill Process, , Attach, Running -@c @group -@section Killing the Child Process - -@table @code -@item kill -@kindex kill -Kill the child process in which your program is running under _GDBN__. -@end table - -This command is useful if you wish to debug a core dump instead of a -running process. _GDBN__ ignores any core dump file while your program -is running. -@c @end group - -On some operating systems, a program can't be executed outside _GDBN__ -while you have breakpoints set on it inside _GDBN__. You can use the -@code{kill} command in this situation to permit running the program -outside the debugger. - -The @code{kill} command is also useful if you wish to recompile and -relink the program, since on many systems it is impossible to modify an -executable file while it is running in a process. In this case, when you -next type @code{run}, _GDBN__ will notice that the file has changed, and -will re-read the symbol table (while trying to preserve your current -breakpoint settings). - -@node Stopping, Stack, Running, Top -@chapter Stopping and Continuing - -The principal purpose of using a debugger is so that you can stop your -program before it terminates; or so that, if the program runs into -trouble, you can investigate and find out why. - -Inside _GDBN__, your program may stop for any of several reasons, such -as a signal, a breakpoint, or reaching a new line after a _GDBN__ -command such as @code{step}. You may then examine and change -variables, set new breakpoints or remove old ones, and then continue -execution. Usually, the messages shown by _GDBN__ provide ample -explanation of the status of your program---but you can also explicitly -request this information at any time. - -@table @code -@item info program -@kindex info program -Display information about the status of your program: whether it is -running or not, what process it is, and why it stopped. -@end table - -@menu -* Breakpoints:: Breakpoints, Watchpoints, and Exceptions -* Continuing and Stepping:: Resuming Execution -* Signals:: Signals -@end menu - -@node Breakpoints, Continuing and Stepping, Stopping, Stopping -@section Breakpoints, Watchpoints, and Exceptions - -@cindex breakpoints -A @dfn{breakpoint} makes your program stop whenever a certain point in -the program is reached. For each breakpoint, you can add various -conditions to control in finer detail whether the program will stop. -You can set breakpoints with the @code{break} command and its variants -(@pxref{Set Breaks}), to specify the place where the program should stop -by line number, function name or exact address in the program. In -languages with exception handling (such as GNU C++), you can also set -breakpoints where an exception is raised (@pxref{Exception Handling}). - -@cindex watchpoints -A @dfn{watchpoint} is a special breakpoint that stops your program when -the value of an expression changes. You must use a different command to -set watchpoints (@pxref{Set Watchpoints}), but aside from that, you can -manage a watchpoint like any other breakpoint: you enable, disable, and -delete both breakpoints and watchpoints using the same commands. - -Each breakpoint or watchpoint is assigned a number when it is created; -these numbers are successive integers starting with one. In many of the -commands for controlling various features of breakpoints you use the -breakpoint number to say which breakpoint you want to change. Each -breakpoint may be @dfn{enabled} or @dfn{disabled}; if disabled, it has -no effect on the program until you enable it again. - -@menu -* Set Breaks:: Setting Breakpoints -* Set Watchpoints:: Setting Watchpoints -* Exception Handling:: Breakpoints and Exceptions -* Delete Breaks:: Deleting Breakpoints -* Disabling:: Disabling Breakpoints -* Conditions:: Break Conditions -* Break Commands:: Breakpoint Command Lists -* Breakpoint Menus:: Breakpoint Menus -* Error in Breakpoints:: -@end menu - -@node Set Breaks, Set Watchpoints, Breakpoints, Breakpoints -@subsection Setting Breakpoints - -@kindex break -@kindex b -Breakpoints are set with the @code{break} command (abbreviated @code{b}). - -You have several ways to say where the breakpoint should go. - -@table @code -@item break @var{function} -Set a breakpoint at entry to function @var{function}. When using source -languages that permit overloading of symbols, such as C++, -@var{function} may refer to more than one possible place to break. -@xref{Breakpoint Menus}, for a discussion of that situation. - -@item break +@var{offset} -@itemx break -@var{offset} -Set a breakpoint some number of lines forward or back from the position -at which execution stopped in the currently selected frame. - -@item break @var{linenum} -Set a breakpoint at line @var{linenum} in the current source file. -That file is the last file whose source text was printed. This -breakpoint will stop the program just before it executes any of the -code on that line. - -@item break @var{filename}:@var{linenum} -Set a breakpoint at line @var{linenum} in source file @var{filename}. - -@item break @var{filename}:@var{function} -Set a breakpoint at entry to function @var{function} found in file -@var{filename}. Specifying a file name as well as a function name is -superfluous except when multiple files contain similarly named -functions. - -@item break *@var{address} -Set a breakpoint at address @var{address}. You can use this to set -breakpoints in parts of the program which do not have debugging -information or source files. - -@item break -When called without any arguments, @code{break} sets a breakpoint at the -next instruction to be executed in the selected stack frame -(@pxref{Stack}). In any selected frame but the innermost, this will -cause the program to stop as soon as control returns to that frame. -This is similar to the effect of a @code{finish} command in the frame -inside the selected frame---except that @code{finish} doesn't leave an -active breakpoint. If you use @code{break} without an argument in the -innermost frame, _GDBN__ will stop the next time it reaches the current -location; this may be useful inside loops. - -_GDBN__ normally ignores breakpoints when it resumes execution, until at -least one instruction has been executed. If it did not do this, you -would be unable to proceed past a breakpoint without first disabling the -breakpoint. This rule applies whether or not the breakpoint already -existed when the program stopped. - -@item break @dots{} if @var{cond} -Set a breakpoint with condition @var{cond}; evaluate the expression -@var{cond} each time the breakpoint is reached, and stop only if the -value is nonzero---that is, if @var{cond} evaluates as true. -@samp{@dots{}} stands for one of the possible arguments described above -(or no argument) specifying where to break. @xref{Conditions}, for more -information on breakpoint conditions. - -@item tbreak @var{args} -@kindex tbreak -Set a breakpoint enabled only for one stop. @var{args} are the -same as for the @code{break} command, and the breakpoint is set in the same -way, but the breakpoint is automatically disabled the first time it -is hit. @xref{Disabling}. - -@item rbreak @var{regex} -@kindex rbreak -@cindex regular expression -Set breakpoints on all functions matching the regular expression -@var{regex}. This command -sets an unconditional breakpoint on all matches, printing a list of all -breakpoints it set. Once these breakpoints are set, they are treated -just like the breakpoints set with the @code{break} command. They can -be deleted, disabled, made conditional, etc., in the standard ways. - -When debugging C++ programs, @code{rbreak} is useful for setting -breakpoints on overloaded functions that are not members of any special -classes. - -@kindex info breakpoints -@cindex @code{$_} and @code{info breakpoints} -@item info breakpoints @r{[}@var{n}@r{]} -@item info break @r{[}@var{n}@r{]} -Print a list of all breakpoints (but not watchpoints) set and not -deleted, showing their numbers, where in the program they are, and any -special features in use for them. Disabled breakpoints are included in -the list, but marked as disabled. @code{info break} with a breakpoint -number @var{n} as argument lists only that breakpoint. The convenience -variable @code{$_} and the default examining-address for the @code{x} -command are set to the address of the last breakpoint listed -(@pxref{Memory}). The equivalent command for watchpoints is @code{info -watch}. @end table - -_GDBN__ allows you to set any number of breakpoints at the same place in the -program. There is nothing silly or meaningless about this. When the -breakpoints are conditional, this is even useful (@pxref{Conditions}). - -@node Set Watchpoints, Exception Handling, Set Breaks, Breakpoints -@subsection Setting Watchpoints -@cindex setting watchpoints -You can use a watchpoint to stop execution whenever the value of an -expression changes, without having to predict a particular place -where this may happen. - -Watchpoints currently execute two orders of magnitude more slowly than -other breakpoints, but this can well be worth it to catch errors where -you have no clue what part of your program is the culprit. Some -processors provide special hardware to support watchpoint evaluation; future -releases of _GDBN__ will use such hardware if it is available. - -@table @code -@kindex watch -@item watch @var{expr} -Set a watchpoint for an expression. - -@kindex info watchpoints -@item info watchpoints -This command prints a list of watchpoints; it is otherwise similar to -@code{info break}. -@end table - -@node Exception Handling, Delete Breaks, Set Watchpoints, Breakpoints -@subsection Breakpoints and Exceptions -@cindex exception handlers - -Some languages, such as GNU C++, implement exception handling. You can -use _GDBN__ to examine what caused the program to raise an exception, -and to list the exceptions the program is prepared to handle at a -given point in time. - -@table @code -@item catch @var{exceptions} -@kindex catch -You can set breakpoints at active exception handlers by using the -@code{catch} command. @var{exceptions} is a list of names of exceptions -to catch. -@end table - -You can use @code{info catch} to list active exception handlers; -@pxref{Frame Info}. - -There are currently some limitations to exception handling in _GDBN__. -These will be corrected in a future release. - -@itemize @bullet -@item -If you call a function interactively, _GDBN__ normally returns -control to you when the function has finished executing. If the call -raises an exception, however, the call may bypass the mechanism that -returns control to the user and cause the program to simply continue -running until it hits a breakpoint, catches a signal that _GDBN__ is -listening for, or exits. -@item -You cannot raise an exception interactively. -@item -You cannot interactively install an exception handler. -@end itemize - -@cindex raise exceptions -Sometimes @code{catch} is not the best way to debug exception handling: -if you need to know exactly where an exception is raised, it's better to -stop @emph{before} the exception handler is called, since that way you -can see the stack before any unwinding takes place. If you set a -breakpoint in an exception handler instead, it may not be easy to find -out where the exception was raised. - -To stop just before an exception handler is called, you need some -knowledge of the implementation. In the case of GNU C++, exceptions are -raised by calling a library function named @code{__raise_exception} -which has the following ANSI C interface: - -@example - /* @var{addr} is where the exception identifier is stored. - ID is the exception identifier. */ - void __raise_exception (void **@var{addr}, void *@var{id}); -@end example - -@noindent -To make the debugger catch all exceptions before any stack -unwinding takes place, set a breakpoint on @code{__raise_exception} -(@pxref{Breakpoints}). - -With a conditional breakpoint (@xref{Conditions}) that depends on the -value of @var{id}, you can stop your program when a specific exception -is raised. You can use multiple conditional breakpoints to stop the -program when any of a number of exceptions are raised. - -@node Delete Breaks, Disabling, Exception Handling, Breakpoints -@subsection Deleting Breakpoints - -@cindex clearing breakpoints, watchpoints -@cindex deleting breakpoints, watchpoints -It is often necessary to eliminate a breakpoint or watchpoint once it -has done its job and you no longer want the program to stop there. This -is called @dfn{deleting} the breakpoint. A breakpoint that has been -deleted no longer exists; it is forgotten. - -With the @code{clear} command you can delete breakpoints according to -where they are in the program. With the @code{delete} command you can -delete individual breakpoints or watchpoints by specifying their -breakpoint numbers. - -It is not necessary to delete a breakpoint to proceed past it. _GDBN__ -automatically ignores breakpoints on the first instruction to be executed -when you continue execution without changing the execution address. - -@table @code -@item clear -@kindex clear -Delete any breakpoints at the next instruction to be executed in the -selected stack frame (@pxref{Selection}). When the innermost frame -is selected, this is a good way to delete a breakpoint that the program -just stopped at. - -@item clear @var{function} -@itemx clear @var{filename}:@var{function} -Delete any breakpoints set at entry to the function @var{function}. - -@item clear @var{linenum} -@itemx clear @var{filename}:@var{linenum} -Delete any breakpoints set at or within the code of the specified line. - -@item delete @r{[}breakpoints@r{]} @r{[}@var{bnums}@dots{}@r{]} -@cindex delete breakpoints -@kindex delete -@kindex d -Delete the breakpoints or watchpoints of the numbers specified as -arguments. If no argument is specified, delete all breakpoints (_GDBN__ -asks confirmation, unless you've @code{set confirm off}). You -can abbreviate this command as @code{d}. -@end table - -@node Disabling, Conditions, Delete Breaks, Breakpoints -@subsection Disabling Breakpoints - -@cindex disabled breakpoints -@cindex enabled breakpoints -Rather than deleting a breakpoint or watchpoint, you might prefer to -@dfn{disable} it. This makes the breakpoint inoperative as if it had -been deleted, but remembers the information on the breakpoint so that -you can @dfn{enable} it again later. - -You disable and enable breakpoints and watchpoints with the -@code{enable} and @code{disable} commands, optionally specifying one or -more breakpoint numbers as arguments. Use @code{info break} or -@code{info watch} to print a list of breakpoints or watchpoints if you -don't know which numbers to use. - -A breakpoint or watchpoint can have any of four different states of -enablement: - -@itemize @bullet -@item -Enabled. The breakpoint will stop the program. A breakpoint set -with the @code{break} command starts out in this state. -@item -Disabled. The breakpoint has no effect on the program. -@item -Enabled once. The breakpoint will stop the program, but -when it does so it will become disabled. A breakpoint set -with the @code{tbreak} command starts out in this state. -@item -Enabled for deletion. The breakpoint will stop the program, but -immediately after it does so it will be deleted permanently. -@end itemize - -You can use the following commands to enable or disable breakpoints and -watchpoints: - -@table @code -@item disable @r{[}breakpoints@r{]} @r{[}@var{bnums}@dots{}@r{]} -@kindex disable breakpoints -@kindex disable -@kindex dis -Disable the specified breakpoints---or all breakpoints, if none are -listed. A disabled breakpoint has no effect but is not forgotten. All -options such as ignore-counts, conditions and commands are remembered in -case the breakpoint is enabled again later. You may abbreviate -@code{disable} as @code{dis}. - -@item enable @r{[}breakpoints@r{]} @r{[}@var{bnums}@dots{}@r{]} -@kindex enable breakpoints -@kindex enable -Enable the specified breakpoints (or all defined breakpoints). They -become effective once again in stopping the program. - -@item enable @r{[}breakpoints@r{]} once @var{bnums}@dots{} -Enable the specified breakpoints temporarily. Each will be disabled -again the next time it stops the program. - -@item enable @r{[}breakpoints@r{]} delete @var{bnums}@dots{} -Enable the specified breakpoints to work once and then die. Each of -the breakpoints will be deleted the next time it stops the program. -@end table - -Save for a breakpoint set with @code{tbreak} (@pxref{Set Breaks}), -breakpoints that you set are initially enabled; subsequently, they become -disabled or enabled only when you use one of the commands above. (The -command @code{until} can set and delete a breakpoint of its own, but it -will not change the state of your other breakpoints; -@pxref{Continuing and Stepping}.) - -@node Conditions, Break Commands, Disabling, Breakpoints -@subsection Break Conditions -@cindex conditional breakpoints -@cindex breakpoint conditions - -The simplest sort of breakpoint breaks every time the program reaches a -specified place. You can also specify a @dfn{condition} for a -breakpoint. A condition is just a Boolean expression in your -programming language. (@xref{Expressions}). A breakpoint with a condition -evaluates the expression each time the program reaches it, and the -program stops only if the condition is @emph{true}. - -This is the converse of using assertions for program validation; in that -situation, you want to stop when the assertion is violated---that is, -when the condition is false. In C, if you want to test an assertion expressed -by the condition @var{assert}, you should set the condition -@samp{! @var{assert}} on the appropriate breakpoint. - -Conditions are also accepted for watchpoints; you may not need them, -since a watchpoint is inspecting the value of an expression anyhow---but -it might be simpler, say, to just set a watchpoint on a variable name, -and specify a condition that tests whether the new value is an interesting -one. - -Break conditions ca have side effects, and may even call functions in -your program. This can be useful, for example, to activate functions -that log program progress, or to use your own print functions to format -special data structures. The effects are completely predictable unless -there is another enabled breakpoint at the same address. (In that -case, _GDBN__ might see the other breakpoint first and stop the program -without checking the condition of this one.) Note that breakpoint -commands are usually more convenient and flexible for the purpose of -performing side effects when a breakpoint is reached -(@pxref{Break Commands}). - -Break conditions can be specified when a breakpoint is set, by using -@samp{if} in the arguments to the @code{break} command. @xref{Set Breaks}. -They can also be changed at any time with the @code{condition} command. -The @code{watch} command doesn't recognize the @code{if} keyword; -@code{condition} is the only way to impose a further condition on a -watchpoint. - -@table @code -@item condition @var{bnum} @var{expression} -@kindex condition -Specify @var{expression} as the break condition for breakpoint or -watchpoint number @var{bnum}. From now on, this breakpoint will stop -the program only if the value of @var{expression} is true (nonzero, in -C). When you use @code{condition}, _GDBN__ checks @var{expression} -immediately for syntactic correctness, and to determine whether symbols -in it have referents in the context of your breakpoint. _GDBN__ does -not actually evaluate @var{expression} at the time the @code{condition} -command is given, however. @xref{Expressions}. - -@item condition @var{bnum} -Remove the condition from breakpoint number @var{bnum}. It becomes -an ordinary unconditional breakpoint. -@end table - -@cindex ignore count (of breakpoint) -A special case of a breakpoint condition is to stop only when the -breakpoint has been reached a certain number of times. This is so -useful that there is a special way to do it, using the @dfn{ignore -count} of the breakpoint. Every breakpoint has an ignore count, which -is an integer. Most of the time, the ignore count is zero, and -therefore has no effect. But if the program reaches a breakpoint whose -ignore count is positive, then instead of stopping, it just decrements -the ignore count by one and continues. As a result, if the ignore count -value is @var{n}, the breakpoint will not stop the next @var{n} times it -is reached. - -@table @code -@item ignore @var{bnum} @var{count} -@kindex ignore -Set the ignore count of breakpoint number @var{bnum} to @var{count}. -The next @var{count} times the breakpoint is reached, your program's -execution will not stop; other than to decrement the ignore count, _GDBN__ -takes no action. - -To make the breakpoint stop the next time it is reached, specify -a count of zero. - -@item continue @var{count} -@itemx c @var{count} -@itemx fg @var{count} -@kindex continue @var{count} -Continue execution of the program, setting the ignore count of the -breakpoint that the program stopped at to @var{count} minus one. -Thus, the program will not stop at this breakpoint until the -@var{count}'th time it is reached. - -An argument to this command is meaningful only when the program stopped -due to a breakpoint. At other times, the argument to @code{continue} is -ignored. - -The synonym @code{fg} is provided purely for convenience, and has -exactly the same behavior as other forms of the command. -@end table - -If a breakpoint has a positive ignore count and a condition, the condition -is not checked. Once the ignore count reaches zero, the condition will -be checked. - -You could achieve the effect of the ignore count with a -condition such as _0__@w{@samp{$foo-- <= 0}}_1__ using a debugger convenience -variable that is decremented each time. @xref{Convenience Vars}. - -@node Break Commands, Breakpoint Menus, Conditions, Breakpoints -@subsection Breakpoint Command Lists - -@cindex breakpoint commands -You can give any breakpoint (or watchpoint) a series of commands to -execute when the program stops due to that breakpoint. For example, you -might want to print the values of certain expressions, or enable other -breakpoints. - -@table @code -@item commands @r{[}@var{bnum}@r{]} -@itemx @dots{} @var{command-list} @dots{} -@itemx end -@kindex commands -@kindex end -Specify a list of commands for breakpoint number @var{bnum}. The commands -themselves appear on the following lines. Type a line containing just -@code{end} to terminate the commands. - -To remove all commands from a breakpoint, type @code{commands} followed -immediately by @code{end}; that is, give no commands. - -With no @var{bnum} argument, @code{commands} refers to the last -breakpoint or watchpoint set (not to the breakpoint most recently -encountered). -@end table - -Pressing @key{RET} as a means of repeating the last _GDBN__ command is -disabled within a @var{command-list}. - -You can use breakpoint commands to start the program up again. Simply -use the @code{continue} command, or @code{step}, or any other command -that resumes execution. Subsequent commands in the command list are -ignored. - -@kindex silent -If the first command specified is @code{silent}, the usual message about -stopping at a breakpoint is not printed. This may be desirable for -breakpoints that are to print a specific message and then continue. -If the remaining commands too print nothing, you will see no sign that -the breakpoint was reached at all. @code{silent} is meaningful only -at the beginning of a breakpoint command list. - -The commands @code{echo} and @code{output} that allow you to print precisely -controlled output are often useful in silent breakpoints. @xref{Output}. - -For example, here is how you could use breakpoint commands to print the -value of @code{x} at entry to @code{foo} whenever @code{x} is positive. - -_0__@example -break foo if x>0 -commands -silent -echo x is\040 -output x -echo \n -cont -end -_1__@end example - -One application for breakpoint commands is to compensate for one bug so -you can test for another. Put a breakpoint just after the erroneous line -of code, give it a condition to detect the case in which something -erroneous has been done, and give it commands to assign correct values -to any variables that need them. End with the @code{continue} command -so that the program does not stop, and start with the @code{silent} -command so that no output is produced. Here is an example: - -@example -break 403 -commands -silent -set x = y + 4 -cont -end -@end example - -@cindex lost output -One deficiency in the operation of automatically continuing breakpoints -under Unix appears when your program uses raw mode for the terminal. -_GDBN__ switches back to its own terminal modes (not raw) before executing -commands, and then must switch back to raw mode when your program is -continued. This causes any pending terminal input to be lost. -@c FIXME: revisit below when GNU sys avail. -@c In the GNU system, this will be fixed by changing the behavior of -@c terminal modes. - -Under Unix, you can get around this problem by writing actions into -the breakpoint condition rather than in commands. For example - -@example -condition 5 (x = y + 4), 0 -@end example - -@noindent -specifies a condition expression (@xref{Expressions}) that will change -@code{x} as needed, then always have the value zero so the program will -not stop. No input is lost here, because _GDBN__ evaluates break -conditions without changing the terminal modes. When you want to have -nontrivial conditions for performing the side effects, the operators -@samp{&&}, @samp{||} and @samp{?@dots{}:} may be useful. - -@node Breakpoint Menus, Error in Breakpoints, Break Commands, Breakpoints -@subsection Breakpoint Menus -@cindex overloading -@cindex symbol overloading - -Some programming languages (notably C++) permit a single function name -to be defined several times, for application in different contexts. -This is called @dfn{overloading}. When a function name is overloaded, -@samp{break @var{function}} is not enough to tell _GDBN__ where you -want a breakpoint. _GDBN__ offers you a menu of numbered choices for -different possible breakpoints, and waits for your selection with the -prompt @samp{>}. The first two options are always @samp{[0] cancel} -and @samp{[1] all}. Typing @kbd{1} sets a breakpoint at each -definition of @var{function}, and typing @kbd{0} aborts the -@code{break} command without setting any new breakpoints. - -For example, the following session excerpt shows an attempt to set a -breakpoint at the overloaded symbol @code{String::after}. -We choose three particular definitions of that function name: - -@example -(_GDBP__) b String::after -[0] cancel -[1] all -[2] file:String.cc; line number:867 -[3] file:String.cc; line number:860 -[4] file:String.cc; line number:875 -[5] file:String.cc; line number:853 -[6] file:String.cc; line number:846 -[7] file:String.cc; line number:735 -> 2 4 6 -Breakpoint 1 at 0xb26c: file String.cc, line 867. -Breakpoint 2 at 0xb344: file String.cc, line 875. -Breakpoint 3 at 0xafcc: file String.cc, line 846. -Multiple breakpoints were set. -Use the "delete" command to delete unwanted breakpoints. -(_GDBP__) -@end example - - -@node Error in Breakpoints, , Breakpoint Menus, Breakpoints -@subsection ``Cannot Insert Breakpoints'' - -@c FIXME: "cannot insert breakpoints" error, v unclear. -@c Q in pending mail to Gilmore. ---pesch@cygnus.com, 26mar91 -@c some light may be shed by looking at instances of -@c ONE_PROCESS_WRITETEXT. But error seems possible otherwise -@c too. pesch, 20sep91 -Under some operating systems, breakpoints cannot be used in a program if -any other process is running that program. In this situation, -attempting to run or continue a program with a breakpoint causes _GDBN__ -to stop the other process. - -When this happens, you have three ways to proceed: - -@enumerate -@item -Remove or disable the breakpoints, then continue. - -@item -Suspend _GDBN__, and copy the file containing the program to a new name. -Resume _GDBN__ and use the @code{exec-file} command to specify that _GDBN__ -should run the program under that name. Then start the program again. - -@c FIXME: RMS commented here "Show example". Maybe when someone -@c explains the first FIXME: in this section... - -@item -Relink the program so that the text segment is nonsharable, using the -linker option @samp{-N}. The operating system limitation may not apply -to nonsharable executables. -@end enumerate - -@node Continuing and Stepping, Signals, Breakpoints, Stopping -@section Continuing and Stepping - -@cindex stepping -@cindex continuing -@cindex resuming execution -@dfn{Continuing} means resuming program execution until your program -completes normally. In contrast, @dfn{stepping} means resuming program -execution for a very limited time: one line of source code, or one -machine instruction. Either when continuing or when stepping, the -program may stop even sooner, due to a breakpoint or to a signal. (If -due to a signal, you may want to use @code{handle}, or use @samp{signal -0} to resume execution; @pxref{Signals}.) - -@table @code -@item continue @r{[}@var{ignore-count}@r{]} -@kindex continue -Resume program execution, at the address where the program last stopped; -any breakpoints set at that address are bypassed. The optional argument -@var{ignore-count} allows you to specify a further number of times to -ignore a breakpoint at this location; its effect is like that of -@code{ignore} (@pxref{Conditions}). - -To resume execution at a different place, you can use @code{return} -(@pxref{Returning}) to go back to the calling function; or @code{jump} -(@pxref{Jumping}) to go to an arbitrary location in your program. - -@end table - -A typical technique for using stepping is to set a breakpoint -(@pxref{Breakpoints}) at the beginning of the function or the section of -the program in which a problem is believed to lie, run the program until -it stops at that breakpoint, and then step through the suspect area, -examining the variables that are interesting, until you see the problem -happen. - -@table @code -@item step -@kindex step -@kindex s -Continue running the program until control reaches a different source -line, then stop it and return control to _GDBN__. This command is -abbreviated @code{s}. - -@quotation -@emph{Warning:} If you use the @code{step} command while control is -within a function that was compiled without debugging information, -execution will proceed until control reaches another function. -@end quotation - -@item step @var{count} -Continue running as in @code{step}, but do so @var{count} times. If a -breakpoint is reached or a signal not related to stepping occurs before -@var{count} steps, stepping stops right away. - -@item next @r{[}@var{count}@r{]} -@kindex next -@kindex n -Continue to the next source line in the current (innermost) stack frame. -Similar to @code{step}, but any function calls appearing within the line -of code are executed without stopping. Execution stops when control -reaches a different line of code at the stack level which was executing -when the @code{next} command was given. This command is abbreviated -@code{n}. - -An argument @var{count} is a repeat count, as for @code{step}. - -@code{next} within a function that lacks debugging information acts like -@code{step}, but any function calls appearing within the code of the -function are executed without stopping. - -@item finish -@kindex finish -Continue running until just after function in the selected stack frame -returns. Print the returned value (if any). - -Contrast this with the @code{return} command (@pxref{Returning}). - -@item until -@kindex until -@item u -@kindex u -Continue running until a source line past the current line, in the -current stack frame, is reached. This command is used to avoid single -stepping through a loop more than once. It is like the @code{next} -command, except that when @code{until} encounters a jump, it -automatically continues execution until the program counter is greater -than the address of the jump. - -This means that when you reach the end of a loop after single stepping -though it, @code{until} will cause the program to continue execution -until the loop is exited. In contrast, a @code{next} command at the end -of a loop will simply step back to the beginning of the loop, which -would force you to step through the next iteration. - -@code{until} always stops the program if it attempts to exit the current -stack frame. - -@code{until} may produce somewhat counterintuitive results if the order -of machine code does not match the order of the source lines. For -example, in the following excerpt from a debugging session, the @code{f} -(@code{frame}) command shows that execution is stopped at line -@code{206}; yet when we use @code{until}, we get to line @code{195}: - -@example -(_GDBP__) f -#0 main (argc=4, argv=0xf7fffae8) at m4.c:206 -206 expand_input(); -(_GDBP__) until -195 for ( ; argc > 0; NEXTARG) @{ -@end example - -This happened because, for execution efficiency, the compiler had -generated code for the loop closure test at the end, rather than the -start, of the loop---even though the test in a C @code{for}-loop is -written before the body of the loop. The @code{until} command appeared -to step back to the beginning of the loop when it advanced to this -expression; however, it has not really gone to an earlier -statement---not in terms of the actual machine code. - -@code{until} with no argument works by means of single -instruction stepping, and hence is slower than @code{until} with an -argument. - -@item until @var{location} -@item u @var{location} -Continue running the program until either the specified location is -reached, or the current stack frame returns. @var{location} -is any of the forms of argument acceptable to @code{break} -(@pxref{Set Breaks}). This form of the command uses breakpoints, and -hence is quicker than @code{until} without an argument. - -@item stepi -@itemx si -@kindex stepi -@kindex si -Execute one machine instruction, then stop and return to the debugger. - -It is often useful to do @samp{display/i $pc} when stepping by machine -instructions. This will cause the next instruction to be executed to -be displayed automatically at each stop. @xref{Auto Display}. - -An argument is a repeat count, as in @code{step}. - -@item nexti -@itemx ni -@kindex nexti -@kindex ni -Execute one machine instruction, but if it is a function call, -proceed until the function returns. - -An argument is a repeat count, as in @code{next}. -@end table - - -@node Signals, , Continuing and Stepping, Stopping -@section Signals -@cindex signals - -A signal is an asynchronous event that can happen in a program. The -operating system defines the possible kinds of signals, and gives each -kind a name and a number. For example, in Unix @code{SIGINT} is the -signal a program gets when you type an interrupt (often @kbd{C-c}); -@code{SIGSEGV} is the signal a program gets from referencing a place in -memory far away from all the areas in use; @code{SIGALRM} occurs when -the alarm clock timer goes off (which happens only if the program has -requested an alarm). - -@cindex fatal signals -Some signals, including @code{SIGALRM}, are a normal part of the -functioning of the program. Others, such as @code{SIGSEGV}, indicate -errors; these signals are @dfn{fatal} (kill the program immediately) if the -program has not specified in advance some other way to handle the signal. -@code{SIGINT} does not indicate an error in the program, but it is normally -fatal so it can carry out the purpose of the interrupt: to kill the program. - -_GDBN__ has the ability to detect any occurrence of a signal in the program -running under _GDBN__'s control. You can tell _GDBN__ in advance what to do for -each kind of signal. - -@cindex handling signals -Normally, _GDBN__ is set up to ignore non-erroneous signals like @code{SIGALRM} -(so as not to interfere with their role in the functioning of the program) -but to stop the program immediately whenever an error signal happens. -You can change these settings with the @code{handle} command. - -@table @code -@item info signals -@kindex info signals -Print a table of all the kinds of signals and how _GDBN__ has been told to -handle each one. You can use this to see the signal numbers of all -the defined types of signals. - -@item handle @var{signal} @var{keywords}@dots{} -@kindex handle -Change the way _GDBN__ handles signal @var{signal}. @var{signal} can be the -number of a signal or its name (with or without the @samp{SIG} at the -beginning). The @var{keywords} say what change to make. -@end table - -@c @group -The keywords allowed by the @code{handle} command can be abbreviated. -Their full names are: - -@table @code -@item nostop -_GDBN__ should not stop the program when this signal happens. It may -still print a message telling you that the signal has come in. - -@item stop -_GDBN__ should stop the program when this signal happens. This implies -the @code{print} keyword as well. - -@item print -_GDBN__ should print a message when this signal happens. - -@item noprint -_GDBN__ should not mention the occurrence of the signal at all. This -implies the @code{nostop} keyword as well. - -@item pass -_GDBN__ should allow the program to see this signal; the program will be -able to handle the signal, or may be terminated if the signal is fatal -and not handled. - -@item nopass -_GDBN__ should not allow the program to see this signal. -@end table -@c @end group - -When a signal has been set to stop the program, the program cannot see the -signal until you continue. It will see the signal then, if @code{pass} is -in effect for the signal in question @i{at that time}. In other words, -after _GDBN__ reports a signal, you can use the @code{handle} command with -@code{pass} or @code{nopass} to control whether that signal will be seen by -the program when you later continue it. - -You can also use the @code{signal} command to prevent the program from -seeing a signal, or cause it to see a signal it normally would not see, -or to give it any signal at any time. For example, if the program stopped -due to some sort of memory reference error, you might store correct -values into the erroneous variables and continue, hoping to see more -execution; but the program would probably terminate immediately as -a result of the fatal signal once it sees the signal. To prevent this, -you can continue with @samp{signal 0}. @xref{Signaling}. - -@node Stack, Source, Stopping, Top -@chapter Examining the Stack - -When your program has stopped, the first thing you need to know is where it -stopped and how it got there. - -@cindex call stack -Each time your program performs a function call, the information about -where in the program the call was made from is saved in a block of data -called a @dfn{stack frame}. The frame also contains the arguments of the -call and the local variables of the function that was called. All the -stack frames are allocated in a region of memory called the @dfn{call -stack}. - -When your program stops, the _GDBN__ commands for examining the stack allow you -to see all of this information. - -@cindex selected frame -One of the stack frames is @dfn{selected} by _GDBN__ and many _GDBN__ commands -refer implicitly to the selected frame. In particular, whenever you ask -_GDBN__ for the value of a variable in the program, the value is found in the -selected frame. There are special _GDBN__ commands to select whichever frame -you are interested in. - -When the program stops, _GDBN__ automatically selects the currently executing -frame and describes it briefly as the @code{frame} command does -(@pxref{Frame Info}). - -@menu -* Frames:: Stack Frames -* Backtrace:: Backtraces -* Selection:: Selecting a Frame -* Frame Info:: Information on a Frame -@end menu - -@node Frames, Backtrace, Stack, Stack -@section Stack Frames - -@cindex frame -@cindex stack frame -The call stack is divided up into contiguous pieces called @dfn{stack -frames}, or @dfn{frames} for short; each frame is the data associated -with one call to one function. The frame contains the arguments given -to the function, the function's local variables, and the address at -which the function is executing. - -@cindex initial frame -@cindex outermost frame -@cindex innermost frame -When your program is started, the stack has only one frame, that of the -function @code{main}. This is called the @dfn{initial} frame or the -@dfn{outermost} frame. Each time a function is called, a new frame is -made. Each time a function returns, the frame for that function invocation -is eliminated. If a function is recursive, there can be many frames for -the same function. The frame for the function in which execution is -actually occurring is called the @dfn{innermost} frame. This is the most -recently created of all the stack frames that still exist. - -@cindex frame pointer -Inside your program, stack frames are identified by their addresses. A -stack frame consists of many bytes, each of which has its own address; each -kind of computer has a convention for choosing one of those bytes whose -address serves as the address of the frame. Usually this address is kept -in a register called the @dfn{frame pointer register} while execution is -going on in that frame. - -@cindex frame number -_GDBN__ assigns numbers to all existing stack frames, starting with -zero for the innermost frame, one for the frame that called it, -and so on upward. These numbers do not really exist in your program; -they are assigned by _GDBN__ to give you a way of designating stack -frames in _GDBN__ commands. - -@cindex frameless execution -Some compilers allow functions to be compiled so that they operate -without stack frames. (For example, the @code{_GCC__} option -@samp{-fomit-frame-pointer} will generate functions without a frame.) -This is occasionally done with heavily used library functions to save -the frame setup time. _GDBN__ has limited facilities for dealing with -these function invocations. If the innermost function invocation has no -stack frame, _GDBN__ will nevertheless regard it as though it had a -separate frame, which is numbered zero as usual, allowing correct -tracing of the function call chain. However, _GDBN__ has no provision -for frameless functions elsewhere in the stack. - -@node Backtrace, Selection, Frames, Stack -@section Backtraces - -A backtrace is a summary of how the program got where it is. It shows one -line per frame, for many frames, starting with the currently executing -frame (frame zero), followed by its caller (frame one), and on up the -stack. - -@table @code -@item backtrace -@itemx bt -@kindex backtrace -@kindex bt -Print a backtrace of the entire stack: one line per frame for all -frames in the stack. - -You can stop the backtrace at any time by typing the system interrupt -character, normally @kbd{C-c}. - -@item backtrace @var{n} -@itemx bt @var{n} -Similar, but print only the innermost @var{n} frames. - -@item backtrace -@var{n} -@itemx bt -@var{n} -Similar, but print only the outermost @var{n} frames. -@end table - -@kindex where -@kindex info stack -@kindex info s -The names @code{where} and @code{info stack} (abbreviated @code{info s}) -are additional aliases for @code{backtrace}. - -Each line in the backtrace shows the frame number and the function name. -The program counter value is also shown---unless you use @code{set -print address off}. The backtrace also shows the source file name and -line number, as well as the arguments to the function. The program -counter value is omitted if it is at the beginning of the code for that -line number. - -Here is an example of a backtrace. It was made with the command -@samp{bt 3}, so it shows the innermost three frames. - -@smallexample -@group -#0 m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) at builtin.c:993 -#1 0x6e38 in expand_macro (sym=0x2b600) at macro.c:242 -#2 0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08) - at macro.c:71 -(More stack frames follow...) -@end group -@end smallexample - -@noindent -The display for frame zero doesn't begin with a program counter -value, indicating that the program has stopped at the beginning of the -code for line @code{993} of @code{builtin.c}. - -@node Selection, Frame Info, Backtrace, Stack -@section Selecting a Frame - -Most commands for examining the stack and other data in the program work on -whichever stack frame is selected at the moment. Here are the commands for -selecting a stack frame; all of them finish by printing a brief description -of the stack frame just selected. - -@table @code -@item frame @var{n} -@itemx f @var{n} -@kindex frame -@kindex f -Select frame number @var{n}. Recall that frame zero is the innermost -(currently executing) frame, frame one is the frame that called the -innermost one, and so on. The highest-numbered frame is @code{main}'s -frame. - -@item frame @var{addr} -@itemx f @var{addr} -Select the frame at address @var{addr}. This is useful mainly if the -chaining of stack frames has been damaged by a bug, making it -impossible for _GDBN__ to assign numbers properly to all frames. In -addition, this can be useful when the program has multiple stacks and -switches between them. - -_if__(_SPARC__) -On the SPARC architecture, @code{frame} needs two addresses to -select an arbitrary frame: a frame pointer and a stack pointer. -@c note to future updaters: this is conditioned on a flag -@c FRAME_SPECIFICATION_DYADIC in the tm-*.h files, currently only used -@c by SPARC, hence the specific attribution. Generalize or list all -@c possibilities if more supported machines start doing this. -_fi__(_SPARC__) - -@item up @var{n} -@kindex up -Move @var{n} frames up the stack. For positive numbers @var{n}, this -advances toward the outermost frame, to higher frame numbers, to frames -that have existed longer. @var{n} defaults to one. - -@item down @var{n} -@kindex down -@kindex do -Move @var{n} frames down the stack. For positive numbers @var{n}, this -advances toward the innermost frame, to lower frame numbers, to frames -that were created more recently. @var{n} defaults to one. You may -abbreviate @code{down} as @code{do}. -@end table - -All of these commands end by printing two lines of output describing the -frame. The first line shows the frame number, the function name, the -arguments, and the source file and line number of execution in that -frame. The second line shows the text of that source line. For -example: - -@smallexample -(_GDBP__) up -#1 0x22f0 in main (argc=1, argv=0xf7fffbf4, env=0xf7fffbfc) at env.c:10 -10 read_input_file (argv[i]); -@end smallexample - -After such a printout, the @code{list} command with no arguments will print -ten lines centered on the point of execution in the frame. @xref{List}. - -@table @code -@item up-silently @var{n} -@itemx down-silently @var{n} -@kindex down-silently -@kindex up-silently -These two commands are variants of @code{up} and @code{down}, -respectively; they differ in that they do their work silently, without -causing display of the new frame. They are intended primarily for use -in _GDBN__ command scripts, where the output might be unnecessary and -distracting. - -@end table - -@node Frame Info, , Selection, Stack -@section Information About a Frame - -There are several other commands to print information about the selected -stack frame. - -@table @code -@item frame -@itemx f -When used without any argument, this command does not change which frame -is selected, but prints a brief description of the currently -selected stack frame. It can be abbreviated @code{f}. With an -argument, this command is used to select a stack frame (@pxref{Selection}). - -@item info frame -@kindex info frame -@itemx info f -@kindex info f -This command prints a verbose description of the selected stack frame, -including the address of the frame, the addresses of the next frame down -(called by this frame) and the next frame up (caller of this frame), the -language that the source code corresponding to this frame was written in, -the address of the frame's arguments, the program counter saved in it -(the address of execution in the caller frame), and which registers -were saved in the frame. The verbose description is useful when -something has gone wrong that has made the stack format fail to fit -the usual conventions. - -@item info frame @var{addr} -@itemx info f @var{addr} -Print a verbose description of the frame at address @var{addr}, -without selecting that frame. The selected frame remains unchanged by -this command. - -@item info args -@kindex info args -Print the arguments of the selected frame, each on a separate line. - -@item info locals -@kindex info locals -Print the local variables of the selected frame, each on a separate -line. These are all variables declared static or automatic within all -program blocks that execution in this frame is currently inside of. - -@item info catch -@kindex info catch -@cindex catch exceptions -@cindex exception handlers -Print a list of all the exception handlers that are active in the -current stack frame at the current point of execution. To see other -exception handlers, visit the associated frame (using the @code{up}, -@code{down}, or @code{frame} commands); then type @code{info catch}. -@xref{Exception Handling}. -@end table - -@node Source, Data, Stack, Top -@chapter Examining Source Files - -_GDBN__ can print parts of your program's source, since the debugging -information recorded in your program tells _GDBN__ what source files -were used to built it. When your program stops, _GDBN__ spontaneously -prints the line where it stopped. Likewise, when you select a stack -frame (@pxref{Selection}), _GDBN__ prints the line where execution in -that frame has stopped. You can print other portions of source files by -explicit command. - -If you use _GDBN__ through its GNU Emacs interface, you may prefer to -use Emacs facilities to view source; @pxref{Emacs}. - -@menu -* List:: Printing Source Lines -* Search:: Searching Source Files -* Source Path:: Specifying Source Directories -* Machine Code:: Source and Machine Code -@end menu - -@node List, Search, Source, Source -@section Printing Source Lines - -@kindex list -@kindex l -To print lines from a source file, use the @code{list} command -(abbreviated @code{l}). There are several ways to specify what part -of the file you want to print. - -Here are the forms of the @code{list} command most commonly used: - -@table @code -@item list @var{linenum} -Print lines centered around line number @var{linenum} in the -current source file. - -@item list @var{function} -Print lines centered around the beginning of function -@var{function}. - -@item list -Print more lines. If the last lines printed were printed with a -@code{list} command, this prints lines following the last lines -printed; however, if the last line printed was a solitary line printed -as part of displaying a stack frame (@pxref{Stack}), this prints -lines centered around that line. - -@item list - -Print lines just before the lines last printed. -@end table - -By default, _GDBN__ prints ten source lines with any of these forms of -the @code{list} command. You can change this using @code{set listsize}: - -@table @code -@item set listsize @var{count} -@kindex set listsize -Make the @code{list} command display @var{count} source lines (unless -the @code{list} argument explicitly specifies some other number). - -@item show listsize -@kindex show listsize -Display the number of lines that @code{list} will currently display by -default. -@end table - -Repeating a @code{list} command with @key{RET} discards the argument, -so it is equivalent to typing just @code{list}. This is more useful -than listing the same lines again. An exception is made for an -argument of @samp{-}; that argument is preserved in repetition so that -each repetition moves up in the source file. - -@cindex linespec -In general, the @code{list} command expects you to supply zero, one or two -@dfn{linespecs}. Linespecs specify source lines; there are several ways -of writing them but the effect is always to specify some source line. -Here is a complete description of the possible arguments for @code{list}: - -@table @code -@item list @var{linespec} -Print lines centered around the line specified by @var{linespec}. - -@item list @var{first},@var{last} -Print lines from @var{first} to @var{last}. Both arguments are -linespecs. - -@item list ,@var{last} -Print lines ending with @var{last}. - -@item list @var{first}, -Print lines starting with @var{first}. - -@item list + -Print lines just after the lines last printed. - -@item list - -Print lines just before the lines last printed. - -@item list -As described in the preceding table. -@end table - -Here are the ways of specifying a single source line---all the -kinds of linespec. - -@table @code -@item @var{number} -Specifies line @var{number} of the current source file. -When a @code{list} command has two linespecs, this refers to -the same source file as the first linespec. - -@item +@var{offset} -Specifies the line @var{offset} lines after the last line printed. -When used as the second linespec in a @code{list} command that has -two, this specifies the line @var{offset} lines down from the -first linespec. - -@item -@var{offset} -Specifies the line @var{offset} lines before the last line printed. - -@item @var{filename}:@var{number} -Specifies line @var{number} in the source file @var{filename}. - -@item @var{function} -@c FIXME: "of the open-brace" is C-centric. When we add other langs... -Specifies the line of the open-brace that begins the body of the -function @var{function}. - -@item @var{filename}:@var{function} -Specifies the line of the open-brace that begins the body of the -function @var{function} in the file @var{filename}. You only need the -file name with a function name to avoid ambiguity when there are -identically named functions in different source files. - -@item *@var{address} -Specifies the line containing the program address @var{address}. -@var{address} may be any expression. -@end table - -@node Search, Source Path, List, Source -@section Searching Source Files -@cindex searching -@kindex reverse-search - -There are two commands for searching through the current source file for a -regular expression. - -@table @code -@item forward-search @var{regexp} -@itemx search @var{regexp} -@kindex search -@kindex forward-search -The command @samp{forward-search @var{regexp}} checks each line, starting -with the one following the last line listed, for a match for @var{regexp}. -It lists the line that is found. You can abbreviate the command name -as @code{fo}. The synonym @samp{search @var{regexp}} is also supported. - -@item reverse-search @var{regexp} -The command @samp{reverse-search @var{regexp}} checks each line, starting -with the one before the last line listed and going backward, for a match -for @var{regexp}. It lists the line that is found. You can abbreviate -this command as @code{rev}. -@end table - -@node Source Path, Machine Code, Search, Source -@section Specifying Source Directories - -@cindex source path -@cindex directories for source files -Executable programs sometimes do not record the directories of the source -files from which they were compiled, just the names. Even when they do, -the directories could be moved between the compilation and your debugging -session. _GDBN__ has a list of directories to search for source files; -this is called the @dfn{source path}. Each time _GDBN__ wants a source file, -it tries all the directories in the list, in the order they are present -in the list, until it finds a file with the desired name. Note that -the executable search path is @emph{not} used for this purpose. Neither is -the current working directory, unless it happens to be in the source -path. - -If _GDBN__ can't find a source file in the source path, and the object -program records a directory, _GDBN__ tries that directory too. If the -source path is empty, and there is no record of the compilation -directory, _GDBN__ will, as a last resort, look in the current -directory. - -Whenever you reset or rearrange the source path, _GDBN__ will clear out -any information it has cached about where source files are found, where -each line is in the file, etc. - -@kindex directory -When you start _GDBN__, its source path is empty. -To add other directories, use the @code{directory} command. - -@table @code -@item directory @var{dirname} @dots{} -Add directory @var{dirname} to the front of the source path. Several -directory names may be given to this command, separated by @samp{:} or -whitespace. You may specify a directory that is already in the source -path; this moves it forward, so it will be searched sooner. - -You can use the string @samp{$cdir} to refer to the compilation -directory (if one is recorded), and @samp{$cwd} to refer to the current -working directory. @samp{$cwd} is not the same as @samp{.}---the former -tracks the current working directory as it changes during your _GDBN__ -session, while the latter is immediately expanded to the current -directory at the time you add an entry to the source path. - -@item directory -Reset the source path to empty again. This requires confirmation. - -@c RET-repeat for @code{directory} is explicitly disabled, but since -@c repeating it would be a no-op we don't say that. (thanks to RMS) - -@item show directories -@kindex show directories -Print the source path: show which directories it contains. -@end table - -If your source path is cluttered with directories that are no longer of -interest, _GDBN__ may sometimes cause confusion by finding the wrong -versions of source. You can correct the situation as follows: - -@enumerate -@item -Use @code{directory} with no argument to reset the source path to empty. - -@item -Use @code{directory} with suitable arguments to reinstall the -directories you want in the source path. You can add all the -directories in one command. -@end enumerate - -@node Machine Code, , Source Path, Source -@section Source and Machine Code -You can use the command @code{info line} to map source lines to program -addresses (and viceversa), and the command @code{disassemble} to display -a range of addresses as machine instructions. - -@table @code -@item info line @var{linespec} -@kindex info line -Print the starting and ending addresses of the compiled code for -source line @var{linespec}. You can specify source lines in any of the -ways understood by the @code{list} command (@pxref{List}). -@end table - -For example, we can use @code{info line} to inquire on where the object -code for the first line of function @code{m4_changequote} lies: -@smallexample -(_GDBP__) info line m4_changecom -Line 895 of "builtin.c" starts at pc 0x634c and ends at 0x6350. -@end smallexample - -@noindent -We can also inquire (using @code{*@var{addr}} as the form for -@var{linespec}) what source line covers a particular address: -@smallexample -(_GDBP__) info line *0x63ff -Line 926 of "builtin.c" starts at pc 0x63e4 and ends at 0x6404. -@end smallexample - -@cindex @code{$_} and @code{info line} -After @code{info line}, the default address for the @code{x} -command is changed to the starting address of the line, so that -@samp{x/i} is sufficient to begin examining the machine code -(@pxref{Memory}). Also, this address is saved as the value of the -convenience variable @code{$_} (@pxref{Convenience Vars}). - -@table @code -@kindex disassemble -@item disassemble -This specialized command is provided to dump a range of memory as -machine instructions. The default memory range is the function -surrounding the program counter of the selected frame. A single -argument to this command is a program counter value; the function -surrounding this value will be dumped. Two arguments (separated by one -or more spaces) specify a range of addresses (first inclusive, second -exclusive) to be dumped. -@end table - -We can use @code{disassemble} to inspect the object code -range shown in the last @code{info line} example: - -@smallexample -(_GDBP__) disas 0x63e4 0x6404 -Dump of assembler code from 0x63e4 to 0x6404: -0x63e4 : ble 0x63f8 -0x63e8 : sethi %hi(0x4c00), %o0 -0x63ec : ld [%i1+4], %o0 -0x63f0 : b 0x63fc -0x63f4 : ld [%o0+4], %o0 -0x63f8 : or %o0, 0x1a4, %o0 -0x63fc : call 0x9288 -0x6400 : nop -End of assembler dump. -(_GDBP__) - -@end smallexample - -@node Data, Languages, Source, Top -@chapter Examining Data - -@cindex printing data -@cindex examining data -@kindex print -@kindex inspect -@c "inspect" isn't quite a synonym if you're using Epoch, which we don't -@c document because it's nonstandard... Under Epoch it displays in a -@c different window or something like that. -The usual way to examine data in your program is with the @code{print} -command (abbreviated @code{p}), or its synonym @code{inspect}. It -evaluates and prints the value of an expression of the language your -program is written in (@pxref{Languages}). You type - -@example -print @var{exp} -@end example - -@noindent -where @var{exp} is an expression (in the source language), and -the value of @var{exp} is printed in a format appropriate to its data -type. - -A more low-level way of examining data is with the @code{x} command. -It examines data in memory at a specified address and prints it in a -specified format. @xref{Memory}. - -If you're interested in information about types, or about how the fields -of a struct or class are declared, use the @code{ptype @var{exp}} -command rather than @code{print}. @xref{Symbols}. - -@menu -* Expressions:: Expressions -* Variables:: Program Variables -* Arrays:: Artificial Arrays -* Output formats:: Output formats -* Memory:: Examining Memory -* Auto Display:: Automatic Display -* Print Settings:: Print Settings -* Value History:: Value History -* Convenience Vars:: Convenience Variables -* Registers:: Registers -* Floating Point Hardware:: Floating Point Hardware -@end menu - -@node Expressions, Variables, Data, Data -@section Expressions - -@cindex expressions -@code{print} and many other _GDBN__ commands accept an expression and -compute its value. Any kind of constant, variable or operator defined -by the programming language you are using is legal in an expression in -_GDBN__. This includes conditional expressions, function calls, casts -and string constants. It unfortunately does not include symbols defined -by preprocessor @code{#define} commands. - -Because C is so widespread, most of the expressions shown in examples in -this manual are in C. @xref{Languages,, Using _GDBN__ with Different -Languages}, for information on how to use expressions in other -languages. - -In this section, we discuss operators that you can use in _GDBN__ -expressions regardless of your programming language. - -Casts are supported in all languages, not just in C, because it is so -useful to cast a number into a pointer so as to examine a structure -at that address in memory. -@c FIXME: casts supported---Mod2 true? - -_GDBN__ supports these operators in addition to those of programming -languages: - -@table @code -@item @@ -@samp{@@} is a binary operator for treating parts of memory as arrays. -@xref{Arrays}, for more information. - -@item :: -@samp{::} allows you to specify a variable in terms of the file or -function where it is defined. @xref{Variables}. - -@item @{@var{type}@} @var{addr} -Refers to an object of type @var{type} stored at address @var{addr} in -memory. @var{addr} may be any expression whose value is an integer or -pointer (but parentheses are required around binary operators, just as in -a cast). This construct is allowed regardless of what kind of data is -normally supposed to reside at @var{addr}.@refill -@end table - -@node Variables, Arrays, Expressions, Data -@section Program Variables - -The most common kind of expression to use is the name of a variable -in your program. - -Variables in expressions are understood in the selected stack frame -(@pxref{Selection}); they must either be global (or static) or be visible -according to the scope rules of the programming language from the point of -execution in that frame. This means that in the function - -@example -foo (a) - int a; -@{ - bar (a); - @{ - int b = test (); - bar (b); - @} -@} -@end example - -@noindent -the variable @code{a} is usable whenever the program is executing -within the function @code{foo}, but the variable @code{b} is visible -only while the program is executing inside the block in which @code{b} -is declared. - -@cindex variable name conflict -There is an exception: you can refer to a variable or function whose -scope is a single source file even if the current execution point is not -in this file. But it is possible to have more than one such variable or -function with the same name (in different source files). If that happens, -referring to that name has unpredictable effects. If you wish, you can -specify a variable in a particular file, using the colon-colon notation: - -@cindex colon-colon -@kindex :: -@example -@var{file}::@var{variable} -@end example - -@noindent -Here @var{file} is the name of the source file whose variable you want. - -@cindex C++ scope resolution -This use of @samp{::} is very rarely in conflict with the very similar -use of the same notation in C++. _GDBN__ also supports use of the C++ -scope resolution operator in _GDBN__ expressions. - -@cindex wrong values -@cindex variable values, wrong -@quotation -@emph{Warning:} Occasionally, a local variable may appear to have the -wrong value at certain points in a function---just after entry to the -function, and just before exit. You may see this problem when you're -stepping by machine instructions. This is because on most machines, it -takes more than one instruction to set up a stack frame (including local -variable definitions); if you're stepping by machine instructions, -variables may appear to have the wrong values until the stack frame is -completely built. On function exit, it usually also takes more than one -machine instruction to destroy a stack frame; after you begin stepping -through that group of instructions, local variable definitions may be -gone. -@end quotation - -@node Arrays, Output formats, Variables, Data -@section Artificial Arrays - -@cindex artificial array -@kindex @@ -It is often useful to print out several successive objects of the -same type in memory; a section of an array, or an array of -dynamically determined size for which only a pointer exists in the -program. - -This can be done by constructing an @dfn{artificial array} with the -binary operator @samp{@@}. The left operand of @samp{@@} should be -the first element of the desired array, as an individual object. -The right operand should be the desired length of the array. The result is -an array value whose elements are all of the type of the left argument. -The first element is actually the left argument; the second element -comes from bytes of memory immediately following those that hold the -first element, and so on. Here is an example. If a program says - -@example -int *array = (int *) malloc (len * sizeof (int)); -@end example - -@noindent -you can print the contents of @code{array} with - -@example -p *array@@len -@end example - -The left operand of @samp{@@} must reside in memory. Array values made -with @samp{@@} in this way behave just like other arrays in terms of -subscripting, and are coerced to pointers when used in expressions. -Artificial arrays most often appear in expressions via the value history -(@pxref{Value History}), after printing one out.) - -Sometimes the artificial array mechanism isn't quite enough; in -moderately complex data structures, the elements of interest may not -actually be adjacent---for example, if you're interested in the values -of pointers in an array. One useful work-around in this situation is to -use a convenience variable (@pxref{Convenience Vars}) as a counter in an -expression that prints the first interesting value, and then repeat that -expression via @key{RET}. For instance, suppose you have an array -@code{dtab} of pointers to structures, and you're interested in the -values of a field @code{fv} in each structure. Here's an example of -what you might type: -@example -set $i = 0 -p dtab[$i++]->fv -@key{RET} -@key{RET} -@dots{} -@end example - -@node Output formats, Memory, Arrays, Data -@section Output formats - -@cindex formatted output -@cindex output formats -By default, _GDBN__ prints a value according to its data type. Sometimes -this is not what you want. For example, you might want to print a number -in hex, or a pointer in decimal. Or you might want to view data in memory -at a certain address as a character string or as an instruction. To do -these things, specify an @dfn{output format} when you print a value. - -The simplest use of output formats is to say how to print a value -already computed. This is done by starting the arguments of the -@code{print} command with a slash and a format letter. The format -letters supported are: - -@table @code -@item x -Regard the bits of the value as an integer, and print the integer in -hexadecimal. - -@item d -Print as integer in signed decimal. - -@item u -Print as integer in unsigned decimal. - -@item o -Print as integer in octal. - -@item t -Print as integer in binary. The letter @samp{t} stands for ``two''. - -@item a -Print as an address, both absolute in hex and as an offset from the -nearest preceding symbol. This format can be used to discover where (in -what function) an unknown address is located: -@example -(_GDBP__) p/a 0x54320 -_0__$3 = 0x54320 <_initialize_vx+396>_1__ -@end example - - -@item c -Regard as an integer and print it as a character constant. - -@item f -Regard the bits of the value as a floating point number and print -using typical floating point syntax. -@end table - -For example, to print the program counter in hex (@pxref{Registers}), type - -@example -p/x $pc -@end example - -@noindent -Note that no space is required before the slash; this is because command -names in _GDBN__ cannot contain a slash. - -To reprint the last value in the value history with a different format, -you can use the @code{print} command with just a format and no -expression. For example, @samp{p/x} reprints the last value in hex. - -@node Memory, Auto Display, Output formats, Data -@section Examining Memory - -@cindex examining memory -@table @code -@kindex x -@item x/@var{nfu} @var{expr} -The command @code{x} (for `examine') can be used to examine memory -without being constrained by your program's data types. You can specify -the unit size @var{u} of memory to inspect, and a repeat count @var{n} of how -many of those units to display. @code{x} understands the formats -@var{f} used by @code{print}; two additional formats, @samp{s} (string) -and @samp{i} (machine instruction) can be used without specifying a unit -size. -@end table - -For example, @samp{x/3uh 0x54320} is a request to display three halfwords -(@code{h}) of memory, formatted as unsigned decimal integers (@samp{u}), -starting at address @code{0x54320}. @samp{x/4xw $sp} prints the four -words (@samp{w}) of memory above the stack pointer (here, @samp{$sp}; -@pxref{Registers}) in hexadecimal (@samp{x}). - -Since the letters indicating unit sizes are all distinct from the -letters specifying output formats, you don't have to remember whether -unit size or format comes first; either order will work. The output -specifications @samp{4xw} and @samp{4wx} mean exactly the same thing. - -After the format specification, you supply an expression for the address -where _GDBN__ is to begin reading from memory. The expression need not -have a pointer value (though it may); it is always interpreted as an -integer address of a byte of memory. @xref{Expressions} for more -information on expressions. - -These are the memory units @var{u} you can specify with the @code{x} -command: - -@table @code -@item b -Examine individual bytes. - -@item h -Examine halfwords (two bytes each). - -@item w -Examine words (four bytes each). - -@cindex word -Many assemblers and cpu designers still use `word' for a 16-bit quantity, -as a holdover from specific predecessor machines of the 1970's that really -did use two-byte words. But more generally the term `word' has always -referred to the size of quantity that a machine normally operates on and -stores in its registers. This is 32 bits for all the machines that _GDBN__ -runs on. - -@item g -Examine giant words (8 bytes). -@end table - -You can combine these unit specifications with any of the formats -described for @code{print}. @xref{Output formats}. - -@code{x} has two additional output specifications which derive the unit -size from the data inspected: - -@table @code -@item s -Print a null-terminated string of characters. Any explicitly specified -unit size is ignored; instead, the unit is however many bytes it takes -to reach a null character (including the null character). - -@item i -Print a machine instruction in assembler syntax (or nearly). Any -specified unit size is ignored; the number of bytes in an instruction -varies depending on the type of machine, the opcode and the addressing -modes used. The command @code{disassemble} gives an alternative way of -inspecting machine instructions. @xref{Machine Code}. -@end table - -If you omit either the format @var{f} or the unit size @var{u}, @code{x} -will use the same one that was used last. If you don't use any letters -or digits after the slash, you can omit the slash as well. - -You can also omit the address to examine. Then the address used is just -after the last unit examined. This is why string and instruction -formats actually compute a unit-size based on the data: so that the next -string or instruction examined will start in the right place. - -When the @code{print} command shows a value that resides in memory, -@code{print} also sets the default address for the @code{x} command. -@code{info line} also sets the default for @code{x}, to the address of -the start of the machine code for the specified line -(@pxref{Machine Code}), -and @code{info breakpoints} sets it to the address of the last -breakpoint listed (@pxref{Set Breaks}).@refill - -When you use @key{RET} to repeat an @code{x} command, the address -specified previously (if any) is ignored, so that the repeated command -examines the successive locations in memory rather than the same ones. - -You can examine several consecutive units of memory with one command by -writing a repeat-count after the slash (before the format letters, if -any). Omitting the repeat count @var{n} displays one unit of the -appropriate size. The repeat count must be a decimal integer. It has -the same effect as repeating the @code{x} command @var{n} times except -that the output may be more compact, with several units per line. For -example, - -@example -x/10i $pc -@end example - -@noindent -prints ten instructions starting with the one to be executed next in the -selected frame. After doing this, you could print a further seven -instructions with - -@example -x/7 -@end example - -@noindent ----where the format and address are allowed to default. - -@cindex @code{$_}, @code{$__}, and value history -The addresses and contents printed by the @code{x} command are not put -in the value history because there is often too much of them and they -would get in the way. Instead, _GDBN__ makes these values available for -subsequent use in expressions as values of the convenience variables -@code{$_} and @code{$__}. After an @code{x} command, the last address -examined is available for use in expressions in the convenience variable -@code{$_}. The contents of that address, as examined, are available in -the convenience variable @code{$__}. - -If the @code{x} command has a repeat count, the address and contents saved -are from the last memory unit printed; this is not the same as the last -address printed if several units were printed on the last line of output. - -@node Auto Display, Print Settings, Memory, Data -@section Automatic Display -@cindex automatic display -@cindex display of expressions - -If you find that you want to print the value of an expression frequently -(to see how it changes), you might want to add it to the @dfn{automatic -display list} so that _GDBN__ will print its value each time the program stops. -Each expression added to the list is given a number to identify it; -to remove an expression from the list, you specify that number. -The automatic display looks like this: - -@example -2: foo = 38 -3: bar[5] = (struct hack *) 0x3804 -@end example - -@noindent -showing item numbers, expressions and their current values. As with -displays you request manually using @code{x} or @code{print}, you can -specify the output format you prefer; in fact, @code{display} decides -whether to use @code{print} or @code{x} depending on how elaborate your -format specification is---it uses @code{x} if you specify a unit size, -or one of the two formats (@samp{i} and @samp{s}) that are only -supported by @code{x}; otherwise it uses @code{print}. - -@table @code -@item display @var{exp} -@kindex display -Add the expression @var{exp} to the list of expressions to display -each time the program stops. @xref{Expressions}. - -@code{display} will not repeat if you press @key{RET} again after using it. - -@item display/@var{fmt} @var{exp} -For @var{fmt} specifying only a display format and not a size or -count, add the expression @var{exp} to the auto-display list but -arranges to display it each time in the specified format @var{fmt}. -@xref{Output formats}. - -@item display/@var{fmt} @var{addr} -For @var{fmt} @samp{i} or @samp{s}, or including a unit-size or a -number of units, add the expression @var{addr} as a memory address to -be examined each time the program stops. Examining means in effect -doing @samp{x/@var{fmt} @var{addr}}. @xref{Memory}. -@end table - -For example, @samp{display/i $pc} can be helpful, to see the machine -instruction about to be executed each time execution stops (@samp{$pc} -is a common name for the program counter; @pxref{Registers}). - -@table @code -@item undisplay @var{dnums}@dots{} -@itemx delete display @var{dnums}@dots{} -@kindex delete display -@kindex undisplay -Remove item numbers @var{dnums} from the list of expressions to display. - -@code{undisplay} will not repeat if you press @key{RET} after using it. -(Otherwise you would just get the error @samp{No display number @dots{}}.) - -@item disable display @var{dnums}@dots{} -@kindex disable display -Disable the display of item numbers @var{dnums}. A disabled display -item is not printed automatically, but is not forgotten. It may be -enabled again later. - -@item enable display @var{dnums}@dots{} -@kindex enable display -Enable display of item numbers @var{dnums}. It becomes effective once -again in auto display of its expression, until you specify otherwise. - -@item display -Display the current values of the expressions on the list, just as is -done when the program stops. - -@item info display -@kindex info display -Print the list of expressions previously set up to display -automatically, each one with its item number, but without showing the -values. This includes disabled expressions, which are marked as such. -It also includes expressions which would not be displayed right now -because they refer to automatic variables not currently available. -@end table - -If a display expression refers to local variables, then it does not make -sense outside the lexical context for which it was set up. Such an -expression is disabled when execution enters a context where one of its -variables is not defined. For example, if you give the command -@code{display last_char} while inside a function with an argument -@code{last_char}, then this argument will be displayed while the program -continues to stop inside that function. When it stops elsewhere---where -there is no variable @code{last_char}---display is disabled. The next time -your program stops where @code{last_char} is meaningful, you can enable the -display expression once again. - -@node Print Settings, Value History, Auto Display, Data -@section Print Settings - -@cindex format options -@cindex print settings -_GDBN__ provides the following ways to control how arrays, structures, -and symbols are printed. - -@noindent -These settings are useful for debugging programs in any language: - -@table @code -@item set print address -@item set print address on -@kindex set print address -_GDBN__ will print memory addresses showing the location of stack -traces, structure values, pointer values, breakpoints, and so forth, -even when it also displays the contents of those addresses. The default -is on. For example, this is what a stack frame display looks like, with -@code{set print address on}: -@smallexample -(_GDBP__) f -#0 set_quotes (lq=0x34c78 "<<", rq=0x34c88 ">>") - at input.c:530 -530 if (lquote != def_lquote) -@end smallexample - -@item set print address off -Do not print addresses when displaying their contents. For example, -this is the same stack frame displayed with @code{set print address off}: -@example -(_GDBP__) set print addr off -(_GDBP__) f -#0 set_quotes (lq="<<", rq=">>") at input.c:530 -530 if (lquote != def_lquote) -@end example - -@item show print address -@kindex show print address -Show whether or not addresses are to be printed. - -@item set print array -@itemx set print array on -@kindex set print array -_GDBN__ will pretty print arrays. This format is more convenient to read, -but uses more space. The default is off. - -@item set print array off. -Return to compressed format for arrays. - -@item show print array -@kindex show print array -Show whether compressed or pretty format is selected for displaying -arrays. - -@item set print elements @var{number-of-elements} -@kindex set print elements -If _GDBN__ is printing a large array, it will stop printing after it has -printed the number of elements set by the @code{set print elements} command. -This limit also applies to the display of strings. - -@item show print elements -@kindex show print elements -Display the number of elements of a large array that _GDBN__ will print -before losing patience. - -@item set print pretty on -@kindex set print pretty -Cause _GDBN__ to print structures in an indented format with one member per -line, like this: - -@example -$1 = @{ - next = 0x0, - flags = @{ - sweet = 1, - sour = 1 - @}, - meat = 0x54 "Pork" -@} -@end example - -@item set print pretty off -Cause _GDBN__ to print structures in a compact format, like this: - -@smallexample -$1 = @{next = 0x0, flags = @{sweet = 1, sour = 1@}, meat \ -= 0x54 "Pork"@} -@end smallexample - -@noindent -This is the default format. - -@item show print pretty -@kindex show print pretty -Show which format _GDBN__ will use to print structures. - -@item set print sevenbit-strings on -@kindex set print sevenbit-strings -Print using only seven-bit characters; if this option is set, -_GDBN__ will display any eight-bit characters (in strings or character -values) using the notation @code{\}@var{nnn}. For example, @kbd{M-a} is -displayed as @code{\341}. - -@item set print sevenbit-strings off -Print using either seven-bit or eight-bit characters, as required. This -is the default. - -@item show print sevenbit-strings -@kindex show print sevenbit-strings -Show whether or not _GDBN__ will print only seven-bit characters. - -@item set print union on -@kindex set print union -Tell _GDBN__ to print unions which are contained in structures. This is the -default setting. - -@item set print union off -Tell _GDBN__ not to print unions which are contained in structures. - -@item show print union -@kindex show print union -Ask _GDBN__ whether or not it will print unions which are contained in -structures. - -For example, given the declarations - -@smallexample -typedef enum @{Tree, Bug@} Species; -typedef enum @{Big_tree, Acorn, Seedling@} Tree_forms; -typedef enum @{Caterpillar, Cocoon, Butterfly@} Bug_forms; - -struct thing @{ - Species it; - union @{ - Tree_forms tree; - Bug_forms bug; - @} form; -@}; - -struct thing foo = @{Tree, @{Acorn@}@}; -@end smallexample - -@noindent -with @code{set print union on} in effect @samp{p foo} would print - -@smallexample -$1 = @{it = Tree, form = @{tree = Acorn, bug = Cocoon@}@} -@end smallexample - -@noindent -and with @code{set print union off} in effect it would print - -@smallexample -$1 = @{it = Tree, form = @{...@}@} -@end smallexample -@end table - -@noindent -These settings are of interest when debugging C++ programs: - -@table @code -@item set print demangle -@itemx set print demangle on -@kindex set print demangle -Print C++ names in their source form rather than in the mangled form -in which they are passed to the assembler and linker for type-safe linkage. -The default is on. - -@item show print demangle -@kindex show print demangle -Show whether C++ names will be printed in mangled or demangled form. - -@item set print asm-demangle -@itemx set print asm-demangle on -@kindex set print asm-demangle -Print C++ names in their source form rather than their mangled form, even -in assembler code printouts such as instruction disassemblies. -The default is off. - -@item show print asm-demangle -@kindex show print asm-demangle -Show whether C++ names in assembly listings will be printed in mangled -or demangled form. - -@item set print object -@itemx set print object on -@kindex set print object -When displaying a pointer to an object, identify the @emph{actual} -(derived) type of the object rather than the @emph{declared} type, using -the virtual function table. - -@item set print object off -Display only the declared type of objects, without reference to the -virtual function table. This is the default setting. - -@item show print object -@kindex show print object -Show whether actual, or declared, object types will be displayed. - -@item set print vtbl -@itemx set print vtbl on -@kindex set print vtbl -Pretty print C++ virtual function tables. The default is off. - -@item set print vtbl off -Do not pretty print C++ virtual function tables. - -@item show print vtbl -@kindex show print vtbl -Show whether C++ virtual function tables are pretty printed, or not. - -@end table - -@node Value History, Convenience Vars, Print Settings, Data -@section Value History - -@cindex value history -Values printed by the @code{print} command are saved in _GDBN__'s @dfn{value -history} so that you can refer to them in other expressions. Values are -kept until the symbol table is re-read or discarded (for example with -the @code{file} or @code{symbol-file} commands). When the symbol table -changes, the value history is discarded, since the values may contain -pointers back to the types defined in the symbol table. - -@cindex @code{$} -@cindex @code{$$} -@cindex history number -The values printed are given @dfn{history numbers} for you to refer to them -by. These are successive integers starting with one. @code{print} shows you -the history number assigned to a value by printing @samp{$@var{num} = } -before the value; here @var{num} is the history number. - -To refer to any previous value, use @samp{$} followed by the value's -history number. The way @code{print} labels its output is designed to -remind you of this. Just @code{$} refers to the most recent value in -the history, and @code{$$} refers to the value before that. -@code{$$@var{n}} refers to the @var{n}th value from the end; @code{$$2} -is the value just prior to @code{$$}, @code{$$1} is equivalent to -@code{$$}, and @code{$$0} is equivalent to @code{$}. - -For example, suppose you have just printed a pointer to a structure and -want to see the contents of the structure. It suffices to type - -@example -p *$ -@end example - -If you have a chain of structures where the component @code{next} points -to the next one, you can print the contents of the next one with this: - -@example -p *$.next -@end example - -@noindent -You can print successive links in the chain by repeating this -command---which you can do by just typing @key{RET}. - -Note that the history records values, not expressions. If the value of -@code{x} is 4 and you type these commands: - -@example -print x -set x=5 -@end example - -@noindent -then the value recorded in the value history by the @code{print} command -remains 4 even though the value of @code{x} has changed. - -@table @code -@kindex show values -@item show values -Print the last ten values in the value history, with their item numbers. -This is like @samp{p@ $$9} repeated ten times, except that @code{show -values} does not change the history. - -@item show values @var{n} -Print ten history values centered on history item number @var{n}. - -@item show values + -Print ten history values just after the values last printed. If no more -values are available, produces no display. -@end table - -Pressing @key{RET} to repeat @code{show values @var{n}} has exactly the -same effect as @samp{show values +}. - -@node Convenience Vars, Registers, Value History, Data -@section Convenience Variables - -@cindex convenience variables -_GDBN__ provides @dfn{convenience variables} that you can use within -_GDBN__ to hold on to a value and refer to it later. These variables -exist entirely within _GDBN__; they are not part of your program, and -setting a convenience variable has no direct effect on further execution -of your program. That's why you can use them freely. - -Convenience variables are prefixed with @samp{$}. Any name preceded by -@samp{$} can be used for a convenience variable, unless it is one of -the predefined machine-specific register names (@pxref{Registers}). -(Value history references, in contrast, are @emph{numbers} preceded -by @samp{$}. @xref{Value History}.) - -You can save a value in a convenience variable with an assignment -expression, just as you would set a variable in your program. Example: - -@example -set $foo = *object_ptr -@end example - -@noindent -would save in @code{$foo} the value contained in the object pointed to by -@code{object_ptr}. - -Using a convenience variable for the first time creates it; but its value -is @code{void} until you assign a new value. You can alter the value with -another assignment at any time. - -Convenience variables have no fixed types. You can assign a convenience -variable any type of value, including structures and arrays, even if -that variable already has a value of a different type. The convenience -variable, when used as an expression, has the type of its current value. - -@table @code -@item show convenience -@kindex show convenience -Print a list of convenience variables used so far, and their values. -Abbreviated @code{show con}. -@end table - -One of the ways to use a convenience variable is as a counter to be -incremented or a pointer to be advanced. For example, to print -a field from successive elements of an array of structures: - -_0__@example -set $i = 0 -print bar[$i++]->contents -@i{@dots{} repeat that command by typing @key{RET}.} -_1__@end example - -Some convenience variables are created automatically by _GDBN__ and given -values likely to be useful. - -@table @code -@item $_ -@kindex $_ -The variable @code{$_} is automatically set by the @code{x} command to -the last address examined (@pxref{Memory}). Other commands which -provide a default address for @code{x} to examine also set @code{$_} -to that address; these commands include @code{info line} and @code{info -breakpoint}. The type of @code{$_} is @code{void *} except when set by the -@code{x} command, in which case it is a pointer to the type of @code{$__}. - -@item $__ -@kindex $__ -The variable @code{$__} is automatically set by the @code{x} command -to the value found in the last address examined. Its type is chosen -to match the format in which the data was printed. -@end table - -@node Registers, Floating Point Hardware, Convenience Vars, Data -@section Registers - -@cindex registers -You can refer to machine register contents, in expressions, as variables -with names starting with @samp{$}. The names of registers are different -for each machine; use @code{info registers} to see the names used on -your machine. - -@table @code -@item info registers -@kindex info registers -Print the names and values of all registers except floating-point -registers (in the selected stack frame). - -@item info all-registers -@kindex info all-registers -@cindex floating point registers -Print the names and values of all registers, including floating-point -registers. - -@item info registers @var{regname} -Print the relativized value of register @var{regname}. @var{regname} -may be any register name valid on the machine you are using, with -or without the initial @samp{$}. -@end table - -The register names @code{$pc} and @code{$sp} are used on most machines -for the program counter register and the stack pointer. For example, -you could print the program counter in hex with -@example -p/x $pc -@end example - -@noindent -or print the instruction to be executed next with -@example -x/i $pc -@end example - -@noindent -or add four to the stack pointer with -@example -set $sp += 4 -@end example - -@noindent -The last is a way of removing one word from the stack, on machines where -stacks grow downward in memory (most machines, nowadays). This assumes -that the innermost stack frame is selected; setting @code{$sp} is -not allowed when other stack frames are selected. (To pop entire frames -off the stack, regardless of machine architecture, use @code{return}; -@pxref{Returning}.) - -Often @code{$fp} is used for a register that contains a pointer to the -current stack frame, and @code{$ps} is sometimes used for a register -that contains the processor status. These standard register names may -be available on your machine even though the @code{info registers} -command shows other names. For example, on the SPARC, @code{info -registers} displays the processor status register as @code{$psr} but you -can also refer to it as @code{$ps}. - -_GDBN__ always considers the contents of an ordinary register as an -integer when the register is examined in this way. Some machines have -special registers which can hold nothing but floating point; these -registers are considered to have floating point values. There is no way -to refer to the contents of an ordinary register as floating point value -(although you can @emph{print} it as a floating point value with -@samp{print/f $@var{regname}}). - -Some registers have distinct ``raw'' and ``virtual'' data formats. This -means that the data format in which the register contents are saved by -the operating system is not the same one that your program normally -sees. For example, the registers of the 68881 floating point -coprocessor are always saved in ``extended'' (raw) format, but all C -programs expect to work with ``double'' (virtual) format. In such -cases, _GDBN__ normally works with the virtual format only (the format that -makes sense for your program), but the @code{info registers} command -prints the data in both formats. - -Normally, register values are relative to the selected stack frame -(@pxref{Selection}). This means that you get the value that the -register would contain if all stack frames farther in were exited and -their saved registers restored. In order to see the true contents of -hardware registers, you must select the innermost frame (with -@samp{frame 0}). - -However, _GDBN__ must deduce where registers are saved, from the machine -code generated by your compiler. If some registers are not saved, or if -_GDBN__ is unable to locate the saved registers, the selected stack -frame will make no difference. - -@node Floating Point Hardware, , Registers, Data -@section Floating Point Hardware -@cindex floating point -Depending on the host machine architecture, _GDBN__ may be able to give -you more information about the status of the floating point hardware. - -@table @code -@item info float -@kindex info float -If available, provides hardware-dependent information about the floating -point unit. The exact contents and layout vary depending on the -floating point chip. -@end table -@c FIXME: this is a cop-out. Try to get examples, explanations. Only -@c FIXME...supported currently on arm's and 386's. Mark properly with -@c FIXME... m4 macros to isolate general statements from hardware-dep, -@c FIXME... at that point. - -@node Languages, Symbols, Data, Top -@chapter Using _GDBN__ with Different Languages -@cindex languages - -Although programming languages generally have common aspects, they are -rarely expressed in the same manner. For instance, in ANSI C, -dereferencing a pointer @code{p} is accomplished by @code{*p}, but in -Modula-2, it is accomplished by @code{p^}. Values can also be -represented (and displayed) differently. Hex numbers in C are written -like @samp{0x1ae}, while in Modula-2 they appear as @samp{1AEH}. - -@cindex working language -Language-specific information is built into _GDBN__ for some languages, -allowing you to express operations like the above in the program's -native language, and allowing _GDBN__ to output values in a manner -consistent with the syntax of the program's native language. The -language you use to build expressions, called the @dfn{working -language}, can be selected manually, or _GDBN__ can set it -automatically. - -@menu -* Setting:: Switching between source languages -* Show:: Displaying the language -* Checks:: Type and Range checks -* Support:: Supported languages -@end menu - -@node Setting, Show, Languages, Languages -@section Switching between source languages - -There are two ways to control the working language---either have _GDBN__ -set it automatically, or select it manually yourself. You can use the -@code{set language} command for either purpose. On startup, _GDBN__ -defaults to setting the language automatically. - -@menu -* Manually:: Setting the working language manually -* Automatically:: Having _GDBN__ infer the source language -@end menu - -@node Manually, Automatically, Setting, Setting -@subsection Setting the working language - -@kindex set language -To set the language, issue the command @samp{set language @var{lang}}, -where @var{lang} is the name of a language: @code{c} or @code{modula-2}. -For a list of the supported languages, type @samp{set language}. - -Setting the language manually prevents _GDBN__ from updating the working -language automatically. This can lead to confusion if you try -to debug a program when the working language is not the same as the -source language, when an expression is acceptable to both -languages---but means different things. For instance, if the current -source file were written in C, and _GDBN__ was parsing Modula-2, a -command such as: - -@example -print a = b + c -@end example - -@noindent -might not have the effect you intended. In C, this means to add -@code{b} and @code{c} and place the result in @code{a}. The result -printed would be the value of @code{a}. In Modula-2, this means to compare -@code{a} to the result of @code{b+c}, yielding a @code{BOOLEAN} value. - -If you allow _GDBN__ to set the language automatically, then -you can count on expressions evaluating the same way in your debugging -session and in your program. - -@node Automatically, , Manually, Setting -@subsection Having _GDBN__ infer the source language - -To have _GDBN__ set the working language automatically, use @samp{set -language local} or @samp{set language auto}. _GDBN__ then infers the -language that a program was written in by looking at the name of its -source files, and examining their extensions: - -@table @file -@item *.mod -Modula-2 source file - -@item *.c -@itemx *.cc -C or C++ source file. -@end table - -This information is recorded for each function or procedure in a source -file. When your program stops in a frame (usually by encountering a -breakpoint), _GDBN__ sets the working language to the language recorded -for the function in that frame. If the language for a frame is unknown -(that is, if the function or block corresponding to the frame was -defined in a source file that does not have a recognized extension), the -current working language is not changed, and _GDBN__ issues a warning. - -This may not seem necessary for most programs, which are written -entirely in one source language. However, program modules and libraries -written in one source language can be used by a main program written in -a different source language. Using @samp{set language auto} in this -case frees you from having to set the working language manually. - -@node Show, Checks, Setting, Languages -@section Displaying the language - -The following commands will help you find out which language is the -working language, and also what language source files were written in. - -@kindex show language -@kindex info frame -@kindex info source -@table @code -@item show language -Display the current working language. This is the -language you can use with commands such as @code{print} to -build and compute expressions that may involve variables in the program. - -@item info frame -Among the other information listed here (@pxref{Frame Info,,Information -about a Frame}) is the source language for this frame. This is the -language that will become the working language if you ever use an -identifier that is in this frame. - -@item info source -Among the other information listed here (@pxref{Symbols,,Examining the -Symbol Table}) is the source language of this source file. - -@end table - -@node Checks, Support, Show, Languages -@section Type and range Checking - -@quotation -@emph{Warning:} In this release, the _GDBN__ commands for type and range -checking are included, but they do not yet have any effect. This -section documents the intended facilities. -@end quotation -@c FIXME remove warning when type/range code added - -Some languages are designed to guard you against making seemingly common -errors through a series of compile- and run-time checks. These include -checking the type of arguments to functions and operators, and making -sure mathematical overflows are caught at run time. Checks such as -these help to ensure a program's correctness once it has been compiled -by eliminating type mismatches, and providing active checks for range -errors when the program is running. - -_GDBN__ can check for conditions like the above if you wish. -Although _GDBN__ will not check the statements in your program, it -can check expressions entered directly into _GDBN__ for evaluation via -the @code{print} command, for example. As with the working language, -_GDBN__ can also decide whether or not to check automatically based on -the source language of the program being debugged. -@xref{Support,,Supported Languages}, for the default settings -of supported languages. - -@menu -* Type Checking:: An overview of type checking -* Range Checking:: An overview of range checking -@end menu - -@cindex type checking -@cindex checks, type -@node Type Checking, Range Checking, Checks, Checks -@subsection An overview of type checking - -Some languages, such as Modula-2, are strongly typed, meaning that the -arguments to operators and functions have to be of the correct type, -otherwise an error occurs. These checks prevent type mismatch -errors from ever causing any run-time problems. For example, - -@example -1 + 2 @result{} 3 -@error{} 1 + 2.3 -@end example - -The second example fails because the @code{CARDINAL} 1 is not -type-compatible with the @code{REAL} 2.3. - -For expressions you use in _GDBN__ commands, you can tell the _GDBN__ -type checker to skip checking; to treat any mismatches as errors and -abandon the expression; or only issue warnings when type mismatches -occur, but evaluate the expression anyway. When you choose the last of -these, _GDBN__ evaluates expressions like the second example above, but -also issues a warning. - -Even though you may turn type checking off, other type-based reasons may -prevent _GDBN__ from evaluating an expression. For instance, _GDBN__ does not -know how to add an @code{int} and a @code{struct foo}. These particular -type errors have nothing to do with the language in use, and usually -arise from expressions, such as the one described above, which make -little sense to evaluate anyway. - -Each language defines to what degree it is strict about type. For -instance, both Modula-2 and C require the arguments to arithmetical -operators to be numbers. In C, enumerated types and pointers can be -represented as numbers, so that they are valid arguments to mathematical -operators. @xref{Support,,Supported Languages}, for futher -details on specific languages. - -_GDBN__ provides some additional commands for controlling the type checker: - -@kindex set check -@kindex set check type -@kindex show check type -@table @code -@item set check type auto -Set type checking on or off based on the current working language. -@xref{Support,,Supported Languages}, for the default settings for -each language. - -@item set check type on -@itemx set check type off -Set type checking on or off, overriding the default setting for the -current working language. Issue a warning if the setting does not -match the language's default. If any type mismatches occur in -evaluating an expression while typechecking is on, _GDBN__ prints a -message and aborts evaluation of the expression. - -@item set check type warn -Cause the type checker to issue warnings, but to always attempt to -evaluate the expression. Evaluating the expression may still -be impossible for other reasons. For example, _GDBN__ cannot add -numbers and structures. - -@item show type -Show the current setting of the type checker, and whether or not _GDBN__ is -setting it automatically. -@end table - -@cindex range checking -@cindex checks, range -@node Range Checking, , Type Checking, Checks -@subsection An overview of Range Checking - -In some languages (such as Modula-2), it is an error to exceed the -bounds of a type; this is enforced with run-time checks. Such range -checking is meant to ensure program correctness by making sure -computations do not overflow, or indices on an array element access do -not exceed the bounds of the array. - -For expressions you use in _GDBN__ commands, you can tell _GDBN__ to -ignore range errors; to always treat them as errors and abandon the -expression; or to issue warnings when a range error occurs but evaluate -the expression anyway. - -A range error can result from numerical overflow, from exceeding an -array index bound, or when you type in a constant that is not a member -of any type. Some languages, however, do not treat overflows as an -error. In many implementations of C, mathematical overflow causes the -result to ``wrap around'' to lower values---for example, if @var{m} is -the largest integer value, and @var{s} is the smallest, then -@example -@var{m} + 1 @result{} @var{s} -@end example - -This, too, is specific to individual languages, and in some cases -specific to individual compilers or machines. @xref{Support,, -Supported Languages}, for further details on specific languages. - -_GDBN__ provides some additional commands for controlling the range checker: - -@kindex set check -@kindex set check range -@kindex show check range -@table @code -@item set check range auto -Set range checking on or off based on the current working language. -@xref{Support,,Supported Languages}, for the default settings for -each language. - -@item set check range on -@itemx set check range off -Set range checking on or off, overriding the default setting for the -current working language. A warning is issued if the setting does not -match the language's default. If a range error occurs, then a message -is printed and evaluation of the expression is aborted. - -@item set check range warn -Output messages when the _GDBN__ range checker detects a range error, -but attempt to evaluate the expression anyway. Evaluating the -expression may still be impossible for other reasons, such as accessing -memory that the process does not own (a typical example from many UNIX -systems). - -@item show range -Show the current setting of the range checker, and whether or not it is -being set automatically by _GDBN__. -@end table - -@node Support, , Checks, Languages -@section Supported Languages - -_GDBN__ _GDB_VN__ supports C, C++, and Modula-2. The syntax for C and C++ is -so closely related that _GDBN__ does not distinguish the two. Some -_GDBN__ features may be used in expressions regardless of the language -you use: the _GDBN__ @code{@@} and @code{::} operators, and the -@samp{@{type@}addr} construct (@pxref{Expressions}) can be used with the constructs of -any of the supported languages. - -The following sections detail to what degree each of these -source languages is supported by _GDBN__. These sections are -not meant to be language tutorials or references, but serve only as a -reference guide to what the _GDBN__ expression parser will accept, and -what input and output formats should look like for different languages. -There are many good books written on each of these languages; please -look to these for a language reference or tutorial. - -@menu -* C:: C and C++ -* Modula-2:: Modula-2 -@end menu - -@node C, Modula-2, Support, Support -@subsection C and C++ -@cindex C and C++ - -@cindex expressions in C or C++ -Since C and C++ are so closely related, _GDBN__ does not distinguish -between them when interpreting the expressions recognized in _GDBN__ -commands. - -@cindex C++ -@kindex g++ -@cindex GNU C++ -The C++ debugging facilities are jointly implemented by the GNU C++ -compiler and _GDBN__. Therefore, to debug your C++ code effectively, -you must compile your C++ programs with the GNU C++ compiler, -@code{g++}. - - -@menu -* C Operators:: C and C++ Operators -* C Constants:: C and C++ Constants -* Cplusplus expressions:: C++ Expressions -* C Defaults:: Default settings for C and C++ -* C Checks:: C and C++ Type and Range Checks -* Debugging C:: _GDBN__ and C -* Debugging C plus plus:: Special features for C++ -@end menu - -@cindex C and C++ operators -@node C Operators, C Constants, C, C -@subsubsection C and C++ Operators - -Operators must be defined on values of specific types. For instance, -@code{+} is defined on numbers, but not on structures. Operators are -often defined on groups of types. For the purposes of C and C++, the -following definitions hold: - -@itemize @bullet -@item -@emph{Integral types} include @code{int} with any of its storage-class -specifiers, @code{char}, and @code{enum}s. - -@item -@emph{Floating-point types} include @code{float} and @code{double}. - -@item -@emph{Pointer types} include all types defined as @code{(@var{type} -*)}. - -@item -@emph{Scalar types} include all of the above. - -@end itemize - -@noindent -The following operators are supported. They are listed here -in order of increasing precedence: - -@table @code -_0__ -@item , -The comma or sequencing operator. Expressions in a comma-separated list -are evaluated from left to right, with the result of the entire -expression being the last expression evaluated. - -@item = -Assignment. The value of an assignment expression is the value -assigned. Defined on scalar types. - -@item @var{op}= -Used in an expression of the form @var{a} @var{op}@code{=} @var{b}, and -translated to @var{a} @code{=} @var{a op b}. @var{op}@code{=} and -@code{=} have the same precendence. @var{op} is any one of the -operators @code{|}, @code{^}, @code{&}, @code{<<}, @code{>>}, @code{+}, -@code{-}, @code{*}, @code{/}, @code{%}. - -@item ?: -The ternary operator. @code{@var{a} ? @var{b} : @var{c}} can be thought -of as: if @var{a} then @var{b} else @var{c}. @var{a} should be of an -integral type. - -@item || -Logical OR. Defined on integral types. - -@item && -Logical AND. Defined on integral types. - -@item | -Bitwise OR. Defined on integral types. - -@item ^ -Bitwise exclusive-OR. Defined on integral types. - -@item & -Bitwise AND. Defined on integral types. - -@item ==@r{, }!= -Equality and inequality. Defined on scalar types. The value of these -expressions is 0 for false and non-zero for true. - -@item <@r{, }>@r{, }<=@r{, }>= -Less than, greater than, less than or equal, greater than or equal. -Defined on scalar types. The value of these expressions is 0 for false -and non-zero for true. - -@item <<@r{, }>> -left shift, and right shift. Defined on integral types. - -@item @@ -The _GDBN__ ``artificial array'' operator (@pxref{Expressions}). - -@item +@r{, }- -Addition and subtraction. Defined on integral types, floating-point types and -pointer types. - -@item *@r{, }/@r{, }% -Multiplication, division, and modulus. Multiplication and division are -defined on integral and floating-point types. Modulus is defined on -integral types. - -@item ++@r{, }-- -Increment and decrement. When appearing before a variable, the -operation is performed before the variable is used in an expression; -when appearing after it, the variable's value is used before the -operation takes place. - -@item * -Pointer dereferencing. Defined on pointer types. Same precedence as -@code{++}. - -@item & -Address operator. Defined on variables. Same precedence as @code{++}. - -@item - -Negative. Defined on integral and floating-point types. Same -precedence as @code{++}. - -@item ! -Logical negation. Defined on integral types. Same precedence as -@code{++}. - -@item ~ -Bitwise complement operator. Defined on integral types. Same precedence as -@code{++}. - -@item .@r{, }-> -Structure member, and pointer-to-structure member. For convenience, -_GDBN__ regards the two as equivalent, choosing whether to dereference a -pointer based on the stored type information. -Defined on @code{struct}s and @code{union}s. - -@item [] -Array indexing. @code{@var{a}[@var{i}]} is defined as -@code{*(@var{a}+@var{i})}. Same precedence as @code{->}. - -@item () -Function parameter list. Same precedence as @code{->}. - -@item :: -C++ scope resolution operator. Defined on -@code{struct}, @code{union}, and @code{class} types. - -@item :: -The _GDBN__ scope operator (@pxref{Expressions}). Same precedence as -@code{::}, above. _1__ -@end table - -@cindex C and C++ constants -@node C Constants, Cplusplus expressions, C Operators, C -@subsubsection C and C++ Constants - -_GDBN__ allows you to express the constants of C and C++ in the -following ways: - -@itemize @bullet - -@item -Integer constants are a sequence of digits. Octal constants are -specified by a leading @samp{0} (ie. zero), and hexadecimal constants by -a leading @samp{0x} or @samp{0X}. Constants may also end with an -@samp{l}, specifying that the constant should be treated as a -@code{long} value. - -@item -Floating point constants are a sequence of digits, followed by a decimal -point, followed by a sequence of digits, and optionally followed by an -exponent. An exponent is of the form: -@samp{@w{e@r{[[}+@r{]|}-@r{]}@var{nnn}}}, where @var{nnn} is another -sequence of digits. The @samp{+} is optional for positive exponents. - -@item -Enumerated constants consist of enumerated identifiers, or their -integral equivalents. - -@item -Character constants are a single character surrounded by single quotes -(@code{'}), or a number---the ordinal value of the corresponding character -(usually its @sc{ASCII} value). Within quotes, the single character may -be represented by a letter or by @dfn{escape sequences}, which are of -the form @samp{\@var{nnn}}, where @var{nnn} is the octal representation -of the character's ordinal value; or of the form @samp{\@var{x}}, where -@samp{@var{x}} is a predefined special character---for example, -@samp{\n} for newline. - -@item -String constants are a sequence of character constants surrounded -by double quotes (@code{"}). - -@item -Pointer constants are an integral value. - -@end itemize - - -@node Cplusplus expressions, C Defaults, C Constants, C -@subsubsection C++ Expressions - -@cindex expressions in C++ -_GDBN__'s expression handling has the following extensions to -interpret a significant subset of C++ expressions: - -@enumerate - -@cindex member functions -@item -Member function calls are allowed; you can use expressions like -@example -count = aml->GetOriginal(x, y) -@end example - -@kindex this -@cindex namespace in C++ -@item -While a member function is active (in the selected stack frame), your -expressions have the same namespace available as the member function; -that is, _GDBN__ allows implicit references to the class instance -pointer @code{this} following the same rules as C++. - -@cindex call overloaded functions -@cindex type conversions in C++ -@item -You can call overloaded functions; _GDBN__ will resolve the function -call to the right definition, with one restriction---you must use -arguments of the type required by the function that you want to call. -_GDBN__ will not perform conversions requiring constructors or -user-defined type operators. - -@cindex reference declarations -@item -_GDBN__ understands variables declared as C++ references; you can use them in -expressions just as you do in C++ source---they are automatically -dereferenced. - -In the parameter list shown when _GDBN__ displays a frame, the values of -reference variables are not displayed (unlike other variables); this -avoids clutter, since references are often used for large structures. -The @emph{address} of a reference variable is always shown, unless -you've specified @samp{set print address off}. - - -@item -_GDBN__ supports the C++ name resolution operator @code{::}---your -expressions can use it just as expressions in your program do. Since -one scope may be defined in another, you can use @code{::} repeatedly if -necessary, for example in an expression like -@samp{@var{scope1}::@var{scope2}::@var{name}}. _GDBN__ also allows -resolving name scope by reference to source files, in both C and C++ -debugging; @pxref{Variables}. - -@end enumerate - - -@node C Defaults, C Checks, Cplusplus expressions, C -@subsubsection C and C++ Defaults -@cindex C and C++ defaults - -If you allow _GDBN__ to set type and range checking automatically, they -both default to @code{off} whenever the working language changes to -C/C++. This happens regardless of whether you, or _GDBN__, -selected the working language. - -If you allow _GDBN__ to set the language automatically, it sets the -working language to C/C++ on entering code compiled from a source file -whose name ends with @file{.c} or @file{.cc}. -@xref{Automatically,,Having _GDBN__ infer the source language}, for -further details. - -@node C Checks, Debugging C, C Defaults, C -@subsubsection C and C++ Type and Range Checks -@cindex C and C++ checks - -@quotation -@emph{Warning:} in this release, _GDBN__ does not yet perform type or -range checking. -@end quotation -@c FIXME remove warning when type/range checks added - -By default, when _GDBN__ parses C or C++ expressions, type checking -is not used. However, if you turn type checking on, _GDBN__ will -consider two variables type equivalent if: - -@itemize @bullet -@item -The two variables are structured and have the same structure, union, or -enumerated tag. - -@item -Two two variables have the same type name, or types that have been -declared equivalent through @code{typedef}. - -@ignore -@c leaving this out because neither J Gilmore nor R Pesch understand it. -@c FIXME--beers? -@item -The two @code{struct}, @code{union}, or @code{enum} variables are -declared in the same declaration. (Note: this may not be true for all C -compilers.) -@end ignore - -@end itemize - -Range checking, if turned on, is done on mathematical operations. Array -indices are not checked, since they are often used to index a pointer -that is not itself an array. - -@node Debugging C, Debugging C plus plus, C Checks, C -@subsubsection _GDBN__ and C - -The @code{set print union} and @code{show print union} commands apply to -the @code{union} type. When set to @samp{on}, any @code{union} that is -inside a @code{struct} or @code{class} will also be printed. -Otherwise, it will appear as @samp{@{...@}}. - -The @code{@@} operator aids in the debugging of dynamic arrays, formed -with pointers and a memory allocation function. (@pxref{Expressions}) - -@node Debugging C plus plus, , Debugging C, C -@subsubsection _GDBN__ Commands for C++ - -@cindex commands for C++ -Some _GDBN__ commands are particularly useful with C++, and some are -designed specifically for use with C++. Here is a summary: - -@table @code -@cindex break in overloaded functions -@item @r{breakpoint menus} -When you want a breakpoint in a function whose name is overloaded, -_GDBN__'s breakpoint menus help you specify which function definition -you want. @xref{Breakpoint Menus}. - -@cindex overloading in C++ -@item rbreak @var{regex} -Setting breakpoints using regular expressions is helpful for setting -breakpoints on overloaded functions that are not members of any special -classes. -@xref{Set Breaks}. - -@cindex C++ exception handling -@item catch @var{exceptions} -@itemx info catch -Debug C++ exception handling using these commands. @xref{Exception Handling}. - -@cindex inheritance -@item ptype @var{typename} -Print inheritance relationships as well as other information for type -@var{typename}. -@xref{Symbols}. - -@cindex C++ symbol display -@item set print demangle -@itemx show print demangle -@itemx set print asm-demangle -@itemx show print asm-demangle -Control whether C++ symbols display in their source form, both when -displaying code as C++ source and when displaying disassemblies. -@xref{Print Settings}. - -@item set print object -@itemx show print object -Choose whether to print derived (actual) or declared types of objects. -@xref{Print Settings}. - -@item set print vtbl -@itemx show print vtbl -Control the format for printing virtual function tables. -@xref{Print Settings}. - -@end table - - -@node Modula-2, , C, Support -@subsection Modula-2 -@cindex Modula-2 - -The extensions made to _GDBN__ to support Modula-2 support output -from the GNU Modula-2 compiler (which is currently being developed). -Other Modula-2 compilers are not currently supported, and attempting to -debug executables produced by them will most likely result in an error -as _GDBN__ reads in the executable's symbol table. - -@cindex expressions in Modula-2 -@menu -* M2 Operators:: Built-in operators -* Builtin Func/Proc:: Built-in Functions and Procedures -* M2 Constants:: Modula-2 Constants -* M2 Defaults:: Default settings for Modula-2 -* Deviations:: Deviations from standard Modula-2 -* M2 Checks:: Modula-2 Type and Range Checks -* M2 Scope:: The scope operators @code{::} and @code{.} -* GDB/M2:: _GDBN__ and Modula-2 -@end menu - -@node M2 Operators, Builtin Func/Proc, Modula-2, Modula-2 -@subsubsection Operators -@cindex Modula-2 operators - -Operators must be defined on values of specific types. For instance, -@code{+} is defined on numbers, but not on structures. Operators are -often defined on groups of types. For the purposes of Modula-2, the -following definitions hold: - -@itemize @bullet - -@item -@emph{Integral types} consist of @code{INTEGER}, @code{CARDINAL}, and -their subranges. - -@item -@emph{Character types} consist of @code{CHAR} and its subranges. - -@item -@emph{Floating-point types} consist of @code{REAL}. - -@item -@emph{Pointer types} consist of anything declared as @code{POINTER TO -@var{type}}. - -@item -@emph{Scalar types} consist of all of the above. - -@item -@emph{Set types} consist of @code{SET}s and @code{BITSET}s. - -@item -@emph{Boolean types} consist of @code{BOOLEAN}. - -@end itemize - -@noindent -The following operators are supported, and appear in order of -increasing precedence: - -@table @code -_0__ -@item , -Function argument or array index separator. - -@item := -Assignment. The value of @var{var} @code{:=} @var{value} is -@var{value}. - -@item <@r{, }> -Less than, greater than on integral, floating-point, or enumerated -types. - -@item <=@r{, }>= -Less than, greater than, less than or equal to, greater than or equal to -on integral, floating-point and enumerated types, or set inclusion on -set types. Same precedence as @code{<}. - -@item =@r{, }<>@r{, }# -Equality and two ways of expressing inequality, valid on scalar types. -Same precedence as @code{<}. In _GDBN__ scripts, only @code{<>} is -available for inequality, since @code{#} conflicts with the script -comment character. - -@item IN -Set membership. Defined on set types and the types of their members. -Same precedence as @code{<}. - -@item OR -Boolean disjunction. Defined on boolean types. - -@item AND@r{, }& -Boolean conjuction. Defined on boolean types. - -@item @@ -The _GDBN__ ``artificial array'' operator (@pxref{Expressions}). - -@item +@r{, }- -Addition and subtraction on integral and floating-point types, or union -and difference on set types. - -@item * -Multiplication on integral and floating-point types, or set intersection -on set types. - -@item / -Division on floating-point types, or symmetric set difference on set -types. Same precedence as @code{*}. - -@item DIV@r{, }MOD -Integer division and remainder. Defined on integral types. Same -precedence as @code{*}. - -@item - -Negative. Defined on @code{INTEGER}s and @code{REAL}s. - -@item ^ -Pointer dereferencing. Defined on pointer types. - -@item NOT -Boolean negation. Defined on boolean types. Same precedence as -@code{^}. - -@item . -@code{RECORD} field selector. Defined on @code{RECORD}s. Same -precedence as @code{^}. - -@item [] -Array indexing. Defined on @code{ARRAY}s. Same precedence as @code{^}. - -@item () -Procedure argument list. Defined on @code{PROCEDURE}s. Same precedence -as @code{^}. - -@item ::@r{, }. -_GDBN__ and Modula-2 scope operators. - -@end table - -@quotation -@emph{Warning:} Sets and their operations are not yet supported, so _GDBN__ -will treat the use of the operator @code{IN}, or the use of operators -@code{+}, @code{-}, @code{*}, @code{/}, @code{=}, , @code{<>}, @code{#}, -@code{<=}, and @code{>=} on sets as an error. -@end quotation -_1__ - -@cindex Modula-2 builtins -@node Builtin Func/Proc, M2 Constants, M2 Operators, Modula-2 -@subsubsection Built-in Functions and Procedures - -Modula-2 also makes available several built-in procedures and functions. -In describing these, the following metavariables are used: - -@table @var - -@item a -represents an @code{ARRAY} variable. - -@item c -represents a @code{CHAR} constant or variable. - -@item i -represents a variable or constant of integral type. - -@item m -represents an identifier that belongs to a set. Generally used in the -same function with the metavariable @var{s}. The type of @var{s} should -be @code{SET OF @var{mtype}} (where @var{mtype} is the type of @var{m}. - -@item n -represents a variable or constant of integral or floating-point type. - -@item r -represents a variable or constant of floating-point type. - -@item t -represents a type. - -@item v -represents a variable. - -@item x -represents a variable or constant of one of many types. See the -explanation of the function for details. - -@end table - -All Modula-2 built-in procedures also return a result, described below. - -@table @code -@item ABS(@var{n}) -Returns the absolute value of @var{n}. - -@item CAP(@var{c}) -If @var{c} is a lower case letter, it returns its upper case -equivalent, otherwise it returns its argument - -@item CHR(@var{i}) -Returns the character whose ordinal value is @var{i}. - -@item DEC(@var{v}) -Decrements the value in the variable @var{v}. Returns the new value. - -@item DEC(@var{v},@var{i}) -Decrements the value in the variable @var{v} by @var{i}. Returns the -new value. - -@item EXCL(@var{m},@var{s}) -Removes the element @var{m} from the set @var{s}. Returns the new -set. - -@item FLOAT(@var{i}) -Returns the floating point equivalent of the integer @var{i}. - -@item HIGH(@var{a}) -Returns the index of the last member of @var{a}. - -@item INC(@var{v}) -Increments the value in the variable @var{v}. Returns the new value. - -@item INC(@var{v},@var{i}) -Increments the value in the variable @var{v} by @var{i}. Returns the -new value. - -@item INCL(@var{m},@var{s}) -Adds the element @var{m} to the set @var{s} if it is not already -there. Returns the new set. - -@item MAX(@var{t}) -Returns the maximum value of the type @var{t}. - -@item MIN(@var{t}) -Returns the minimum value of the type @var{t}. - -@item ODD(@var{i}) -Returns boolean TRUE if @var{i} is an odd number. - -@item ORD(@var{x}) -Returns the ordinal value of its argument. For example, the ordinal -value of a character is its ASCII value (on machines supporting the -ASCII character set). @var{x} must be of an ordered type, which include -integral, character and enumerated types. - -@item SIZE(@var{x}) -Returns the size of its argument. @var{x} can be a variable or a type. - -@item TRUNC(@var{r}) -Returns the integral part of @var{r}. - -@item VAL(@var{t},@var{i}) -Returns the member of the type @var{t} whose ordinal value is @var{i}. -@end table - -@quotation -@emph{Warning:} Sets and their operations are not yet supported, so -_GDBN__ will treat the use of procedures @code{INCL} and @code{EXCL} as -an error. -@end quotation - -@cindex Modula-2 constants -@node M2 Constants, M2 Defaults, Builtin Func/Proc, Modula-2 -@subsubsection Constants - -_GDBN__ allows you to express the constants of Modula-2 in the following -ways: - -@itemize @bullet - -@item -Integer constants are simply a sequence of digits. When used in an -expression, a constant is interpreted to be type-compatible with the -rest of the expression. Hexadecimal integers are specified by a -trailing @samp{H}, and octal integers by a trailing @samp{B}. - -@item -Floating point constants appear as a sequence of digits, followed by a -decimal point and another sequence of digits. An optional exponent can -then be specified, in the form @samp{E@r{[}+@r{|}-@r{]}@var{nnn}}, where -@samp{@r{[}+@r{|}-@r{]}@var{nnn}} is the desired exponent. All of the -digits of the floating point constant must be valid decimal (base 10) -digits. - -@item -Character constants consist of a single character enclosed by a pair of -like quotes, either single (@code{'}) or double (@code{"}). They may -also be expressed by their ordinal value (their ASCII value, usually) -followed by a @samp{C}. - -@item -String constants consist of a sequence of characters enclosed by a pair -of like quotes, either single (@code{'}) or double (@code{"}). Escape -sequences in the style of C are also allowed. @xref{C Constants}, for a -brief explanation of escape sequences. - -@item -Enumerated constants consist of an enumerated identifier. - -@item -Boolean constants consist of the identifiers @code{TRUE} and -@code{FALSE}. - -@item -Pointer constants consist of integral values only. - -@item -Set constants are not yet supported. - -@end itemize - -@node M2 Defaults, Deviations, M2 Constants, Modula-2 -@subsubsection Modula-2 Defaults -@cindex Modula-2 defaults - -If type and range checking are set automatically by _GDBN__, they -both default to @code{on} whenever the working language changes to -Modula-2. This happens regardless of whether you, or _GDBN__, -selected the working language. - -If you allow _GDBN__ to set the language automatically, then entering -code compiled from a file whose name ends with @file{.mod} will set the -working language to Modula-2. @xref{Automatically,,Having _GDBN__ set -the language automatically}, for further details. - -@node Deviations, M2 Checks, M2 Defaults, Modula-2 -@subsubsection Deviations from Standard Modula-2 -@cindex Modula-2, deviations from - -A few changes have been made to make Modula-2 programs easier to debug. -This is done primarily via loosening its type strictness: - -@itemize @bullet -@item -Unlike in standard Modula-2, pointer constants can be formed by -integers. This allows you to modify pointer variables during -debugging. (In standard Modula-2, the actual address contained in a -pointer variable is hidden from you; it can only be modified -through direct assignment to another pointer variable or expression that -returned a pointer.) - -@item -C escape sequences can be used in strings and characters to represent -non-printable characters. _GDBN__ will print out strings with these -escape sequences embedded. Single non-printable characters are -printed using the @samp{CHR(@var{nnn})} format. - -@item -The assignment operator (@code{:=}) returns the value of its right-hand -argument. - -@item -All builtin procedures both modify @emph{and} return their argument. - -@end itemize - -@node M2 Checks, M2 Scope, Deviations, Modula-2 -@subsubsection Modula-2 Type and Range Checks -@cindex Modula-2 checks - -@quotation -@emph{Warning:} in this release, _GDBN__ does not yet perform type or -range checking. -@end quotation -@c FIXME remove warning when type/range checks added - -_GDBN__ considers two Modula-2 variables type equivalent if: - -@itemize @bullet -@item -They are of types that have been declared equivalent via a @code{TYPE -@var{t1} = @var{t2}} statement - -@item -They have been declared on the same line. (Note: This is true of the -GNU Modula-2 compiler, but it may not be true of other compilers.) - -@end itemize - -As long as type checking is enabled, any attempt to combine variables -whose types are not equivalent is an error. - -Range checking is done on all mathematical operations, assignment, array -index bounds, and all builtin functions and procedures. - -@node M2 Scope, GDB/M2, M2 Checks, Modula-2 -@subsubsection The scope operators @code{::} and @code{.} -@cindex scope -@kindex . -@kindex :: - -There are a few subtle differences between the Modula-2 scope operator -(@code{.}) and the _GDBN__ scope operator (@code{::}). The two have -similar syntax: - -@example - -@var{module} . @var{id} -@var{scope} :: @var{id} - -@end example - -@noindent -where @var{scope} is the name of a module or a procedure, -@var{module} the name of a module, and @var{id} is any delcared -identifier within the program, except another module. - -Using the @code{::} operator makes _GDBN__ search the scope -specified by @var{scope} for the identifier @var{id}. If it is not -found in the specified scope, then _GDBN__ will search all scopes -enclosing the one specified by @var{scope}. - -Using the @code{.} operator makes _GDBN__ search the current scope for -the identifier specified by @var{id} that was imported from the -definition module specified by @var{module}. With this operator, it is -an error if the identifier @var{id} was not imported from definition -module @var{module}, or if @var{id} is not an identifier in -@var{module}. - -@node GDB/M2, , M2 Scope, Modula-2 -@subsubsection _GDBN__ and Modula-2 - -Some _GDBN__ commands have little use when debugging Modula-2 programs. -Five subcommands of @code{set print} and @code{show print} apply -specifically to C and C++: @samp{vtbl}, @samp{demangle}, -@samp{asm-demangle}, @samp{object}, and @samp{union}. The first four -apply to C++, and the last to C's @code{union} type, which has no direct -analogue in Modula-2. - -The @code{@@} operator (@pxref{Expressions}), while available -while using any language, is not useful with Modula-2. Its -intent is to aid the debugging of @dfn{dynamic arrays}, which cannot be -created in Modula-2 as they can in C or C++. However, because an -address can be specified by an integral constant, the construct -@samp{@{@var{type}@}@var{adrexp}} is still useful. (@pxref{Expressions}) - -_0__ -@cindex @code{#} in Modula-2 -In _GDBN__ scripts, the Modula-2 inequality operator @code{#} is -interpreted as the beginning of a comment. Use @code{<>} instead. -_1__ - - -@node Symbols, Altering, Languages, Top -@chapter Examining the Symbol Table - -The commands described in this section allow you to inquire about the -symbols (names of variables, functions and types) defined in your -program. This information is inherent in the text of your program and -does not change as the program executes. _GDBN__ finds it in your -program's symbol table, in the file indicated when you started _GDBN__ -(@pxref{File Options}), or by one of the file-management commands -(@pxref{Files}). - -@table @code -@item info address @var{symbol} -@kindex info address -Describe where the data for @var{symbol} is stored. For a register -variable, this says which register it is kept in. For a non-register -local variable, this prints the stack-frame offset at which the variable -is always stored. - -Note the contrast with @samp{print &@var{symbol}}, which does not work -at all for a register variables, and for a stack local variable prints -the exact address of the current instantiation of the variable. - -@item whatis @var{exp} -@kindex whatis -Print the data type of expression @var{exp}. @var{exp} is not -actually evaluated, and any side-effecting operations (such as -assignments or function calls) inside it do not take place. -@xref{Expressions}. - -@item whatis -Print the data type of @code{$}, the last value in the value history. - -@item ptype @var{typename} -@kindex ptype -Print a description of data type @var{typename}. @var{typename} may be -the name of a type, or for C code it may have the form -@samp{struct @var{struct-tag}}, @samp{union @var{union-tag}} or -@samp{enum @var{enum-tag}}.@refill - -@item ptype @var{exp} -Print a description of the type of expression @var{exp}. @code{ptype} -differs from @code{whatis} by printing a detailed description, instead of just -the name of the type. For example, if your program declares a variable -as -@example -struct complex @{double real; double imag;@} v; -@end example -@noindent -compare the output of the two commands: -@example -(_GDBP__) whatis v -type = struct complex -(_GDBP__) ptype v -type = struct complex @{ - double real; - double imag; -@} -@end example - -@item info types @var{regexp} -@itemx info types -@kindex info types -Print a brief description of all types whose name matches @var{regexp} -(or all types in your program, if you supply no argument). Each -complete typename is matched as though it were a complete line; thus, -@samp{i type value} gives information on all types in your program whose -name includes the string @code{value}, but @samp{i type ^value$} gives -information only on types whose complete name is @code{value}. - -This command differs from @code{ptype} in two ways: first, like -@code{whatis}, it does not print a detailed description; second, it -lists all source files where a type is defined. - -@item info source -@kindex info source -Show the name of the current source file---that is, the source file for -the function containing the current point of execution---and the language -it was written in. - -@item info sources -@kindex info sources -Print the names of all source files in the program for which there is -debugging information, organized into two lists: files whose symbols -have already been read, and files whose symbols will be read when needed. - -@item info functions -@kindex info functions -Print the names and data types of all defined functions. - -@item info functions @var{regexp} -Print the names and data types of all defined functions -whose names contain a match for regular expression @var{regexp}. -Thus, @samp{info fun step} finds all functions whose names -include @code{step}; @samp{info fun ^step} finds those whose names -start with @code{step}. - -@item info variables -@kindex info variables -Print the names and data types of all variables that are declared -outside of functions (i.e., excluding local variables). - -@item info variables @var{regexp} -Print the names and data types of all variables (except for local -variables) whose names contain a match for regular expression -@var{regexp}. - - -@ignore -This was never implemented. -@item info methods -@itemx info methods @var{regexp} -@kindex info methods -The @code{info methods} command permits the user to examine all defined -methods within C++ program, or (with the @var{regexp} argument) a -specific set of methods found in the various C++ classes. Many -C++ classes provide a large number of methods. Thus, the output -from the @code{ptype} command can be overwhelming and hard to use. The -@code{info-methods} command filters the methods, printing only those -which match the regular-expression @var{regexp}. -@end ignore - -@item printsyms @var{filename} -@kindex printsyms -Write a dump of debugging symbol data into the file -@var{filename}. Only symbols with debugging data are included. _GDBN__ -includes all the symbols it already knows about: that is, @var{filename} -reflects symbols for only those files whose symbols _GDBN__ has read. -You can find out which files these are using the command @code{info -files}. The description of @code{symbol-file} describes how _GDBN__ -reads symbols; both commands are described under @ref{Files}. -@end table - -@node Altering, _GDBN__ Files, Symbols, Top -@chapter Altering Execution - -Once you think you have found an error in the program, you might want to -find out for certain whether correcting the apparent error would lead to -correct results in the rest of the run. You can find the answer by -experiment, using the _GDBN__ features for altering execution of the -program. - -For example, you can store new values into variables or memory -locations, give the program a signal, restart it at a different address, -or even return prematurely from a function to its caller. - -@menu -* Assignment:: Assignment to Variables -* Jumping:: Continuing at a Different Address -* Signaling:: Giving the Program a Signal -* Returning:: Returning from a Function -* Calling:: Calling your Program's Functions -* Patching:: Patching your Program -@end menu - -@node Assignment, Jumping, Altering, Altering -@section Assignment to Variables - -@cindex assignment -@cindex setting variables -To alter the value of a variable, evaluate an assignment expression. -@xref{Expressions}. For example, - -@example -print x=4 -@end example - -@noindent -would store the value 4 into the variable @code{x}, and then print the -value of the assignment expression (which is 4). @xref{Languages}, for -more information on operators in supported languages. - -@kindex set variable -@cindex variables, setting -If you are not interested in seeing the value of the assignment, use the -@code{set} command instead of the @code{print} command. @code{set} is -really the same as @code{print} except that the expression's value is not -printed and is not put in the value history (@pxref{Value History}). The -expression is evaluated only for its effects. - -If the beginning of the argument string of the @code{set} command -appears identical to a @code{set} subcommand, use the @code{set -variable} command instead of just @code{set}. This command is identical -to @code{set} except for its lack of subcommands. For example, a -program might well have a variable @code{width}---which leads to -an error if we try to set a new value with just @samp{set width=13}, as -we might if @code{set width} didn't happen to be a _GDBN__ command: -@example -(_GDBP__) whatis width -type = double -(_GDBP__) p width -$4 = 13 -(_GDBP__) set width=47 -Invalid syntax in expression. -@end example -@noindent -The invalid expression, of course, is @samp{=47}. What we can do in -order to actually set our program's variable @code{width} is -@example -(_GDBP__) set var width=47 -@end example - -_GDBN__ allows more implicit conversions in assignments than C does; you can -freely store an integer value into a pointer variable or vice versa, and -any structure can be converted to any other structure that is the same -length or shorter. -@comment FIXME: how do structs align/pad in these conversions? -@comment /pesch@cygnus.com 18dec1990 - -To store values into arbitrary places in memory, use the @samp{@{@dots{}@}} -construct to generate a value of specified type at a specified address -(@pxref{Expressions}). For example, @code{@{int@}0x83040} refers -to memory location @code{0x83040} as an integer (which implies a certain size -and representation in memory), and - -@example -set @{int@}0x83040 = 4 -@end example - -@noindent -stores the value 4 into that memory location. - -@node Jumping, Signaling, Assignment, Altering -@section Continuing at a Different Address - -Ordinarily, when you continue the program, you do so at the place where -it stopped, with the @code{continue} command. You can instead continue at -an address of your own choosing, with the following commands: - -@table @code -@item jump @var{linespec} -@kindex jump -Resume execution at line @var{linespec}. Execution will stop -immediately if there is a breakpoint there. @xref{List} for a -description of the different forms of @var{linespec}. - -The @code{jump} command does not change the current stack frame, or -the stack pointer, or the contents of any memory location or any -register other than the program counter. If line @var{linespec} is in -a different function from the one currently executing, the results may -be bizarre if the two functions expect different patterns of arguments or -of local variables. For this reason, the @code{jump} command requests -confirmation if the specified line is not in the function currently -executing. However, even bizarre results are predictable if you are -well acquainted with the machine-language code of the program. - -@item jump *@var{address} -Resume execution at the instruction at address @var{address}. -@end table - -You can get much the same effect as the @code{jump} command by storing a -new value into the register @code{$pc}. The difference is that this -does not start the program running; it only changes the address where it -@emph{will} run when it is continued. For example, - -@example -set $pc = 0x485 -@end example - -@noindent -causes the next @code{continue} command or stepping command to execute at -address 0x485, rather than at the address where the program stopped. -@xref{Continuing and Stepping}. - -The most common occasion to use the @code{jump} command is to back up, -perhaps with more breakpoints set, over a portion of a program that has -already executed, in order to examine its execution in more detail. - -@node Signaling, Returning, Jumping, Altering -@c @group -@section Giving the Program a Signal - -@table @code -@item signal @var{signalnum} -@kindex signal -Resume execution where the program stopped, but give it immediately the -signal number @var{signalnum}. - -Alternatively, if @var{signalnum} is zero, continue execution without -giving a signal. This is useful when the program stopped on account of -a signal and would ordinary see the signal when resumed with the -@code{continue} command; @samp{signal 0} causes it to resume without a -signal. - -@code{signal} does not repeat when you press @key{RET} a second time -after executing the command. -@end table -@c @end group - -@node Returning, Calling, Signaling, Altering -@section Returning from a Function - -@table @code -@item return -@itemx return @var{expression} -@cindex returning from a function -@kindex return -You can cancel execution of a function call with the @code{return} -command. If you give an -@var{expression} argument, its value is used as the function's return -value. -@end table - -When you use @code{return}, _GDBN__ discards the selected stack frame -(and all frames within it). You can think of this as making the -discarded frame return prematurely. If you wish to specify a value to -be returned, give that value as the argument to @code{return}. - -This pops the selected stack frame (@pxref{Selection}), and any other -frames inside of it, leaving its caller as the innermost remaining -frame. That frame becomes selected. The specified value is stored in -the registers used for returning values of functions. - -The @code{return} command does not resume execution; it leaves the -program stopped in the state that would exist if the function had just -returned. In contrast, the @code{finish} command -(@pxref{Continuing and Stepping}) -resumes execution until the selected stack frame returns naturally.@refill - -@node Calling, Patching, Returning, Altering -@section Calling your Program's Functions - -@cindex calling functions -@kindex call -@table @code -@item call @var{expr} -Evaluate the expression @var{expr} without displaying @code{void} -returned values. -@end table - -You can use this variant of the @code{print} command if you want to -execute a function from your program, but without cluttering the output -with @code{void} returned values. The result is printed and saved in -the value history, if it is not void. - -@node Patching, , Calling, Altering -@section Patching your Program -@cindex patching binaries -@cindex writing into executables -@cindex writing into corefiles -By default, _GDBN__ opens the file containing your program's executable -code (or the corefile) read-only. This prevents accidental alterations -to machine code; but it also prevents you from intentionally patching -your program's binary. - -If you'd like to be able to patch the binary, you can specify that -explicitly with the @code{set write} command. For example, you might -want to turn on internal debugging flags, or even to make emergency -repairs. - -@table @code -@item set write on -@itemx set write off -@kindex set write -If you specify @samp{set write on}, _GDBN__ will open executable and -core files for both reading and writing; if you specify @samp{set write -off} (the default), _GDBN__ will open them read-only. - -If you've already loaded a file, you must load it -again (using the @code{exec-file} or @code{core-file} command) after -changing @code{set write}, for your new setting to take effect. - -@item show write -@kindex show write -Display whether executable files and core files will be opened for -writing as well as reading. - -@end table - -@node _GDBN__ Files, Targets, Altering, Top -@chapter _GDBN__'s Files - -@menu -* Files:: Commands to Specify Files -* Symbol Errors:: Errors Reading Symbol Files -@end menu - -@node Files, Symbol Errors, _GDBN__ Files, _GDBN__ Files -@section Commands to Specify Files -@cindex core dump file -@cindex symbol table -_GDBN__ needs to know the file name of the program to be debugged, both in -order to read its symbol table and in order to start the program. To -debug a core dump of a previous run, _GDBN__ must be told the file name of -the core dump. - -The usual way to specify the executable and core dump file names is with -the command arguments given when you start _GDBN__, as discussed in -@pxref{Invocation}. - -Occasionally it is necessary to change to a different file during a -_GDBN__ session. Or you may run _GDBN__ and forget to specify the files you -want to use. In these situations the _GDBN__ commands to specify new files -are useful. - -@table @code -@item file @var{filename} -@cindex executable file -@kindex file -Use @var{filename} as the program to be debugged. It is read for its -symbols and for the contents of pure memory. It is also the program -executed when you use the @code{run} command. If you do not specify a -directory and the file is not found in _GDBN__'s working directory, - -_GDBN__ uses the environment variable @code{PATH} as a list of -directories to search, just as the shell does when looking for a program -to run. You can change the value of this variable, for both _GDBN__ and -your program, using the @code{path} command. - -@code{file} with no argument makes _GDBN__ discard any information it -has on both executable file and the symbol table. - -@item exec-file @var{filename} -@kindex exec-file -Specify that the program to be run (but not the symbol table) is found -in @var{filename}. _GDBN__ will search the environment variable @code{PATH} -if necessary to locate the program. - -@item symbol-file @var{filename} -@kindex symbol-file -Read symbol table information from file @var{filename}. @code{PATH} is -searched when necessary. Use the @code{file} command to get both symbol -table and program to run from the same file. - -@code{symbol-file} with no argument clears out _GDBN__'s information on your -program's symbol table. - -The @code{symbol-file} command causes _GDBN__ to forget the contents of its -convenience variables, the value history, and all breakpoints and -auto-display expressions. This is because they may contain pointers to -the internal data recording symbols and data types, which are part of -the old symbol table data being discarded inside _GDBN__. - -@code{symbol-file} will not repeat if you press @key{RET} again after -executing it once. - -On some kinds of object files, the @code{symbol-file} command does not -actually read the symbol table in full right away. Instead, it scans -the symbol table quickly to find which source files and which symbols -are present. The details are read later, one source file at a time, -when they are needed. - -The purpose of this two-stage reading strategy is to make _GDBN__ start up -faster. For the most part, it is invisible except for occasional pauses -while the symbol table details for a particular source file are being -read. (The @code{set verbose} command can turn these pauses into -messages if desired. @xref{Messages/Warnings}). - -When the symbol table is stored in COFF format, @code{symbol-file} does -read the symbol table data in full right away. We haven't implemented -the two-stage strategy for COFF yet. - -When _GDBN__ is configured for a particular environment, it will -understand debugging information in whatever format is the standard -generated for that environment; you may use either a GNU compiler, or -other compilers that adhere to the local conventions. Best results are -usually obtained from GNU compilers; for example, using @code{_GCC__} -you can generate debugging information for optimized code. - -@item core-file @var{filename} -@itemx core @var{filename} -@kindex core -@kindex core-file -Specify the whereabouts of a core dump file to be used as the ``contents -of memory''. Traditionally, core files contain only some parts of the -address space of the process that generated them; _GDBN__ can access the -executable file itself for other parts. - -@code{core-file} with no argument specifies that no core file is -to be used. - -Note that the core file is ignored when your program is actually running -under _GDBN__. So, if you have been running the program and you wish to -debug a core file instead, you must kill the subprocess in which the -program is running. To do this, use the @code{kill} command -(@pxref{Kill Process}). - -@item load @var{filename} -@kindex load -_if__(_GENERIC__) -Depending on what remote debugging facilities are configured into -_GDBN__, the @code{load} command may be available. Where it exists, it -is meant to make @var{filename} (an executable) available for debugging -on the remote system---by downloading, or dynamic linking, for example. -@code{load} also records @var{filename}'s symbol table in _GDBN__, like -the @code{add-symbol-file} command. - -If @code{load} is not available on your _GDBN__, attempting to execute -it gets the error message ``@code{You can't do that when your target is -@dots{}}'' -_fi__(_GENERIC__) - -_if__(_VXWORKS__) -On VxWorks, @code{load} will dynamically link @var{filename} on the -current target system as well as adding its symbols in _GDBN__. -_fi__(_VXWORKS__) - -_if__(_I960__) -@cindex download to Nindy-960 -With the Nindy interface to an Intel 960 board, @code{load} will -download @var{filename} to the 960 as well as adding its symbols in -_GDBN__. -_fi__(_I960__) - -@code{load} will not repeat if you press @key{RET} again after using it. - -@item add-symbol-file @var{filename} @var{address} -@kindex add-symbol-file -@cindex dynamic linking -The @code{add-symbol-file} command reads additional symbol table information -from the file @var{filename}. You would use this command when @var{filename} -has been dynamically loaded (by some other means) into the program that -is running. @var{address} should be the memory address at which the -file has been loaded; _GDBN__ cannot figure this out for itself. - -The symbol table of the file @var{filename} is added to the symbol table -originally read with the @code{symbol-file} command. You can use the -@code{add-symbol-file} command any number of times; the new symbol data thus -read keeps adding to the old. To discard all old symbol data instead, -use the @code{symbol-file} command. - -@code{add-symbol-file} will not repeat if you press @key{RET} after using it. - -@item info files -@itemx info target -@kindex info files -@kindex info target -@code{info files} and @code{info target} are synonymous; both print the -current targets (@pxref{Targets}), including the names of the executable -and core dump files currently in use by _GDBN__, and the files from -which symbols were loaded. The command @code{help targets} lists all -possible targets rather than current ones. - -@end table - -All file-specifying commands allow both absolute and relative file names -as arguments. _GDBN__ always converts the file name to an absolute path -name and remembers it that way. - -@cindex shared libraries - -_GDBN__ supports the SunOS shared library format. _GDBN__ automatically -loads symbol definitions from shared libraries when you use the -@code{run} command, or when you examine a core file. (Before you issue -the @code{run} command, _GDBN__ won't understand references to a -function in a shared library, however---unless you're debugging a core -file). -@c FIXME: next _GDBN__ release should permit some refs to undef -@c FIXME...symbols---eg in a break cmd---assuming they're from a shared lib - -@table @code -@item info share -@itemx info sharedlibrary -@kindex info sharedlibrary -@kindex info share -Print the names of the shared libraries which are currently loaded. - -@item sharedlibrary @var{regex} -@itemx share @var{regex} -@kindex sharedlibrary -@kindex share -This is an obsolescent command; you can use it to explicitly -load shared object library symbols for files matching a UNIX regular -expression, but as with files loaded automatically, it will only load -shared libraries required by your program for a core file or after -typing @code{run}. If @var{regex} is omitted all shared libraries -required by your program are loaded. -@end table - -@node Symbol Errors, , Files, _GDBN__ Files -@section Errors Reading Symbol Files -While reading a symbol file, _GDBN__ will occasionally encounter -problems, such as symbol types it does not recognize, or known bugs in -compiler output. By default, _GDBN__ does not notify you of such -problems, since they're relatively common and primarily of interest to -people debugging compilers. If you are interested in seeing information -about ill-constructed symbol tables, you can either ask _GDBN__ to print -only one message about each such type of problem, no matter how many -times the problem occurs; or you can ask _GDBN__ to print more messages, -to see how many times the problems occur, with the @code{set complaints} -command (@xref{Messages/Warnings}). - -The messages currently printed, and their meanings, are: - -@table @code -@item inner block not inside outer block in @var{symbol} - -The symbol information shows where symbol scopes begin and end -(such as at the start of a function or a block of statements). This -error indicates that an inner scope block is not fully contained -in its outer scope blocks. - -_GDBN__ circumvents the problem by treating the inner block as if it had -the same scope as the outer block. In the error message, @var{symbol} -may be shown as ``@code{(don't know)}'' if the outer block is not a -function. - -@item block at @var{address} out of order - -The symbol information for symbol scope blocks should occur in -order of increasing addresses. This error indicates that it does not -do so. - -_GDBN__ does not circumvent this problem, and will have trouble locating -symbols in the source file whose symbols being read. (You can often -determine what source file is affected by specifying @code{set verbose -on}. @xref{Messages/Warnings}.) - -@item bad block start address patched - -The symbol information for a symbol scope block has a start address -smaller than the address of the preceding source line. This is known -to occur in the SunOS 4.1.1 (and earlier) C compiler. - -_GDBN__ circumvents the problem by treating the symbol scope block as -starting on the previous source line. - -@item bad string table offset in symbol @var{n} - -@cindex foo -Symbol number @var{n} contains a pointer into the string table which is -larger than the size of the string table. - -_GDBN__ circumvents the problem by considering the symbol to have the -name @code{foo}, which may cause other problems if many symbols end up -with this name. - -@item unknown symbol type @code{0x@var{nn}} - -The symbol information contains new data types that _GDBN__ does not yet -know how to read. @code{0x@var{nn}} is the symbol type of the misunderstood -information, in hexadecimal. - -_GDBN__ circumvents the error by ignoring this symbol information. This -will usually allow the program to be debugged, though certain symbols -will not be accessible. If you encounter such a problem and feel like -debugging it, you can debug @code{_GDBP__} with itself, breakpoint on -@code{complain}, then go up to the function @code{read_dbx_symtab} and -examine @code{*bufp} to see the symbol. - -@item stub type has NULL name -_GDBN__ could not find the full definition for a struct or class. - -@ignore -@c this is #if 0'd in dbxread.c as of (at least!) 17 may 1991 -@item const/volatile indicator missing, got '@var{X}' - -The symbol information for a C++ member function is missing some -information that the compiler should have output for it. -@end ignore - -@item C++ type mismatch between compiler and debugger - -_GDBN__ could not parse a type specification output by the compiler -for some C++ object. - -@end table - -@node Targets, Controlling _GDBN__, _GDBN__ Files, Top -@chapter Specifying a Debugging Target -@cindex debugging target -@kindex target -A @dfn{target} is an interface between the debugger and a particular -kind of file or process. - -Often, you will be able to run _GDBN__ in the same host environment as the -program you are debugging; in that case, the debugging target can just be -specified as a side effect of the @code{file} or @code{core} commands. -When you need more flexibility---for example, running _GDBN__ on a -physically separate host, controlling standalone systems over a -serial port, or realtime systems over a TCP/IP connection---you can use -the @code{target} command. - -@menu -* Active Targets:: Active Targets -* Target Commands:: Commands for Managing Targets -* Remote:: Remote Debugging -@end menu - -@node Active Targets, Target Commands, Targets, Targets -@section Active Targets -@cindex stacking targets -@cindex active targets -@cindex multiple targets - -Targets are managed in three @dfn{strata} that correspond to different -classes of target: processes, core files, and executable files. This -allows you to (for example) start a process and inspect its activity -without abandoning your work on a core file. - -More than one target can potentially respond to a request. In -particular, when you access memory _GDBN__ will examine the three strata of -targets until it finds a target that can handle that particular address. -Strata are always examined in a fixed order: first a process if there is -one, then a core file if there is one, and finally an executable file if -there is one of those. - -When you specify a new target in a given stratum, it replaces any target -previously in that stratum. - -To get rid of a target without replacing it, use the @code{detach} -command. The related command @code{attach} provides you with a way of -choosing a particular running process as a new target. @xref{Attach}. - -@node Target Commands, Remote, Active Targets, Targets -@section Commands for Managing Targets - -@table @code -@item target @var{type} @var{parameters} -Connects the _GDBN__ host environment to a target machine or process. A -target is typically a protocol for talking to debugging facilities. You -use the argument @var{type} to specify the type or protocol of the -target machine. - -Further @var{parameters} are interpreted by the target protocol, but -typically include things like device names or host names to connect -with, process numbers, and baud rates. - -The @code{target} command will not repeat if you press @key{RET} again -after executing the command. - -@item help target -@kindex help target -Displays the names of all targets available. To display targets -currently selected, use either @code{info target} or @code{info files} -(@pxref{Files}). - -@item help target @var{name} -Describe a particular target, including any parameters necessary to -select it. -@end table - -Here are some common targets (available, or not, depending on the _GDBN__ -configuration): - -@table @code -@item target exec @var{prog} -@kindex target exec -An executable file. @samp{target exec @var{prog}} is the same as -@samp{exec-file @var{prog}}. - -@item target core @var{filename} -@kindex target core -A core dump file. @samp{target core @var{filename}} is the same as -@samp{core-file @var{filename}}. - -@item target remote @var{dev} -@kindex target remote -Remote serial target in _GDBN__-specific protocol. The argument @var{dev} -specifies what serial device to use for the connection (e.g. -@file{/dev/ttya}). @xref{Remote}. - -_if__(_AMD29K__) -@item target amd-eb @var{dev} @var{speed} @var{PROG} -@kindex target amd-eb -@cindex AMD EB29K -Remote PC-resident AMD EB29K board, attached over serial lines. -@var{dev} is the serial device, as for @code{target remote}; -@var{speed} allows you to specify the linespeed; and @var{PROG} is the -name of the program to be debugged, as it appears to DOS on the PC. -@xref{EB29K Remote}. - -_fi__(_AMD29K__) -_if__(_I960__) -@item target nindy @var{devicename} -@kindex target nindy -An Intel 960 board controlled by a Nindy Monitor. @var{devicename} is -the name of the serial device to use for the connection, e.g. -@file{/dev/ttya}. @xref{i960-Nindy Remote}. - -_fi__(_I960__) -_if__(_VXWORKS__) -@item target vxworks @var{machinename} -@kindex target vxworks -A VxWorks system, attached via TCP/IP. The argument @var{machinename} -is the target system's machine name or IP address. -@xref{VxWorks Remote}. -_fi__(_VXWORKS__) -@end table - -_if__(_GENERIC__) -Different targets are available on different configurations of _GDBN__; your -configuration may have more or fewer targets. -_fi__(_GENERIC__) - -@node Remote, , Target Commands, Targets -@section Remote Debugging -@cindex remote debugging - -_if__(_GENERIC__) -@menu -_include__(gdbinv-m.m4)<>_dnl__ -@end menu -_fi__(_GENERIC__) - -If you are trying to debug a program running on a machine that can't run -_GDBN__ in the usual way, it is often useful to use remote debugging. For -example, you might use remote debugging on an operating system kernel, or on -a small system which does not have a general purpose operating system -powerful enough to run a full-featured debugger. - -Some configurations of _GDBN__ have special serial or TCP/IP interfaces -to make this work with particular debugging targets. In addition, -_GDBN__ comes with a generic serial protocol (specific to _GDBN__, but -not specific to any particular target system) which you can use if you -write the remote stubs---the code that will run on the remote system to -communicate with _GDBN__. - -To use the _GDBN__ remote serial protocol, the program to be debugged on -the remote machine needs to contain a debugging stub which talks to -_GDBN__ over the serial line. Several working remote stubs are -distributed with _GDBN__; see the @file{README} file in the _GDBN__ -distribution for more information. - -For details of this communication protocol, see the comments in the -_GDBN__ source file @file{remote.c}. - -To start remote debugging, first run _GDBN__ and specify as an executable file -the program that is running in the remote machine. This tells _GDBN__ how -to find the program's symbols and the contents of its pure text. Then -establish communication using the @code{target remote} command with a device -name as an argument. For example: - -@example -target remote /dev/ttyb -@end example - -@noindent -if the serial line is connected to the device named @file{/dev/ttyb}. This -will stop the remote machine if it is not already stopped. - -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. - -Other remote targets may be available in your -configuration of _GDBN__; use @code{help targets} to list them. - -_if__(_GENERIC__) -@c Text on starting up GDB in various specific cases; it goes up front -@c in manuals configured for any of those particular situations, here -@c otherwise. -_include__(gdbinv-s.m4) -_fi__(_GENERIC__) - -@node Controlling _GDBN__, Sequences, Targets, Top -@chapter Controlling _GDBN__ - -You can alter many aspects of _GDBN__'s interaction with you by using -the @code{set} command. For commands controlling how _GDBN__ displays -data, @pxref{Print Settings}; other settings are described here. - -@menu -* Prompt:: Prompt -* Editing:: Command Editing -* History:: Command History -* Screen Size:: Screen Size -* Numbers:: Numbers -* Messages/Warnings:: Optional Warnings and Messages -@end menu - -@node Prompt, Editing, Controlling _GDBN__, Controlling _GDBN__ -@section Prompt -@cindex prompt -_GDBN__ indicates its readiness to read a command by printing a string -called the @dfn{prompt}. This string is normally @samp{(_GDBP__)}. You -can change the prompt string with the @code{set prompt} command. For -instance, when debugging _GDBN__ with _GDBN__, it is useful to change -the prompt in one of the _GDBN__<>s so that you can always tell which -one you are talking to. - -@table @code -@item set prompt @var{newprompt} -@kindex set prompt -Directs _GDBN__ to use @var{newprompt} as its prompt string henceforth. -@kindex show prompt -@item show prompt -Prints a line of the form: @samp{Gdb's prompt is: @var{your-prompt}} -@end table - -@node Editing, History, Prompt, Controlling _GDBN__ -@section Command Editing -@cindex readline -@cindex command line editing -_GDBN__ reads its input commands via the @dfn{readline} interface. This -GNU library provides consistent behavior for programs which provide a -command line interface to the user. Advantages are @code{emacs}-style -or @code{vi}-style inline editing of commands, @code{csh}-like history -substitution, and a storage and recall of command history across -debugging sessions. - -You may control the behavior of command line editing in _GDBN__ with the -command @code{set}. - -@table @code -@kindex set editing -@cindex editing -@item set editing -@itemx set editing on -Enable command line editing (enabled by default). - -@item set editing off -Disable command line editing. - -@kindex show editing -@item show editing -Show whether command line editing is enabled. -@end table - -@node History, Screen Size, Editing, Controlling _GDBN__ -@section Command History -@table @code -@cindex history substitution -@cindex history file -@kindex set history filename -@item set history filename @var{fname} -Set the name of the _GDBN__ command history file to @var{fname}. This is -the file from which _GDBN__ will read an initial command history -list or to which it will write this list when it exits. This list is -accessed through history expansion or through the history -command editing characters listed below. This file defaults to the -value of the environment variable @code{GDBHISTFILE}, or to -@file{./.gdb_history} if this variable is not set. - -@cindex history save -@kindex set history save -@item set history save -@itemx set history save on -Record command history in a file, whose name may be specified with the -@code{set history filename} command. By default, this option is disabled. - -@item set history save off -Stop recording command history in a file. - -@cindex history size -@kindex set history size -@item set history size @var{size} -Set the number of commands which _GDBN__ will keep in its history list. -This defaults to the value of the environment variable -@code{HISTSIZE}, or to 256 if this variable is not set. -@end table - -@cindex history expansion -History expansion assigns special meaning to the character @kbd{!}. -@iftex -(@xref{Event Designators}.) -@end iftex -Since @kbd{!} is also the logical not operator in C, history expansion -is off by default. If you decide to enable history expansion with the -@code{set history expansion on} command, you may sometimes need to -follow @kbd{!} (when it is used as logical not, in an expression) with -a space or a tab to prevent it from being expanded. The readline -history facilities will not attempt substitution on the strings -@kbd{!=} and @kbd{!(}, even when history expansion is enabled. - -The commands to control history expansion are: - -@table @code - -@kindex set history expansion -@item set history expansion on -@itemx set history expansion -Enable history expansion. History expansion is off by default. - -@item set history expansion off -Disable history expansion. - -The readline code comes with more complete documentation of -editing and history expansion features. Users unfamiliar with @code{emacs} -or @code{vi} may wish to read it. -@iftex -@xref{Command Line Editing}. -@end iftex - -@c @group -@kindex show history -@item show history -@itemx show history filename -@itemx show history save -@itemx show history size -@itemx show history expansion -These commands display the state of the _GDBN__ history parameters. -@code{show history} by itself displays all four states. -@c @end group - -@end table - -@table @code -@kindex show commands -@item show commands -Display the last ten commands in the command history. - -@item show commands @var{n} -Print ten commands centered on command number @var{n}. - -@item show commands + -Print ten commands just after the commands last printed. - -@end table - -@node Screen Size, Numbers, History, Controlling _GDBN__ -@section Screen Size -@cindex size of screen -@cindex pauses in output -Certain commands to _GDBN__ may produce large amounts of information -output to the screen. To help you read all of it, _GDBN__ pauses and -asks you for input at the end of each page of output. Type @key{RET} -when you want to continue the output. _GDBN__ also uses the screen -width setting to determine when to wrap lines of output. Depending on -what is being printed, it tries to break the line at a readable place, -rather than simply letting it overflow onto the following line. - -Normally _GDBN__ knows the size of the screen from the termcap data base -together with the value of the @code{TERM} environment variable and the -@code{stty rows} and @code{stty cols} settings. If this is not correct, -you can override it with the @code{set height} and @code{set -width} commands: - -@table @code -@item set height @var{lpp} -@itemx show height -@itemx set width @var{cpl} -@itemx show width -@kindex set height -@kindex set width -@kindex show width -@kindex show height -These @code{set} commands specify a screen height of @var{lpp} lines and -a screen width of @var{cpl} characters. The associated @code{show} -commands display the current settings. - -If you specify a height of zero lines, _GDBN__ will not pause during output -no matter how long the output is. This is useful if output is to a file -or to an editor buffer. -@end table - -@node Numbers, Messages/Warnings, Screen Size, Controlling _GDBN__ -@section Numbers -@cindex number representation -@cindex entering numbers -You can always enter numbers in octal, decimal, or hexadecimal in _GDBN__ by -the usual conventions: octal numbers begin with @samp{0}, decimal -numbers end with @samp{.}, and hexadecimal numbers begin with @samp{0x}. -Numbers that begin with none of these are, by default, entered in base -10; likewise, the default display for numbers---when no particular -format is specified---is base 10. You can change the default base for -both input and output with the @code{set radix} command. - -@table @code -@kindex set radix -@item set radix @var{base} -Set the default base for numeric input and display. Supported choices -for @var{base} are decimal 2, 8, 10, 16. @var{base} must itself be -specified either unambiguously or using the current default radix; for -example, any of - -@example -set radix 1010 -set radix 012 -set radix 10. -set radix 0xa -@end example - -@noindent -will set the base to decimal. On the other hand, @samp{set radix 10} -will leave the radix unchanged no matter what it was. - -@kindex show radix -@item show radix -Display the current default base for numeric input and display. - -@end table - -@node Messages/Warnings, , Numbers, Controlling _GDBN__ -@section Optional Warnings and Messages -By default, _GDBN__ is silent about its inner workings. If you are running -on a slow machine, you may want to use the @code{set verbose} command. -It will make _GDBN__ tell you when it does a lengthy internal operation, so -you won't think it has crashed. - -Currently, the messages controlled by @code{set verbose} are those which -announce that the symbol table for a source file is being read -(@pxref{Files}, in the description of the command -@code{symbol-file}). -@c The following is the right way to do it, but emacs 18.55 doesn't support -@c @ref, and neither the emacs lisp manual version of texinfmt or makeinfo -@c is released. -@ignore -see @code{symbol-file} in @ref{Files}). -@end ignore - -@table @code -@kindex set verbose -@item set verbose on -Enables _GDBN__'s output of certain informational messages. - -@item set verbose off -Disables _GDBN__'s output of certain informational messages. - -@kindex show verbose -@item show verbose -Displays whether @code{set verbose} is on or off. -@end table - -By default, if _GDBN__ encounters bugs in the symbol table of an object -file, it is silent; but if you are debugging a compiler, you may find -this information useful (@pxref{Symbol Errors}). - -@table @code -@kindex set complaints -@item set complaints @var{limit} -Permits _GDBN__ to output @var{limit} complaints about each type of unusual -symbols before becoming silent about the problem. Set @var{limit} to -zero to suppress all complaints; set it to a large number to prevent -complaints from being suppressed. - -@kindex show complaints -@item show complaints -Displays how many symbol complaints _GDBN__ is permitted to produce. -@end table - -By default, _GDBN__ is cautious, and asks what sometimes seem to be a -lot of stupid questions to confirm certain commands. For example, if -you try to run a program which is already running: -@example -(_GDBP__) run -The program being debugged has been started already. -Start it from the beginning? (y or n) -@end example - -If you're willing to unflinchingly face the consequences of your own -commands, you can disable this ``feature'': - -@table @code -@kindex set confirm -@cindex flinching -@cindex confirmation -@cindex stupid questions -@item set confirm off -Disables confirmation requests. - -@item set confirm on -Enables confirmation requests (the default). - -@item show confirm -@kindex show confirm -Displays state of confirmation requests. -@end table - -@c FIXME this doesn't really belong here. But where *does* it belong? -@cindex reloading symbols -Some systems allow individual object files that make up your program to -be replaced without stopping and restarting your program. -_if__(_VXWORKS__) -For example, in VxWorks you can simply recompile a defective object file -and keep on running. -_fi__(_VXWORKS__) -If you're running on one of these systems, you can allow _GDBN__ to -reload the symbols for automatically relinked modules:@refill -@table @code -@kindex set symbol-reloading -@item set symbol-reloading on -Replace symbol definitions for the corresponding source file when an -object file with a particular name is seen again. - -@item set symbol-reloading off -Don't replace symbol definitions when re-encountering object files of -the same name. This is the default state; if you're not running on a -system that permits automatically relinking modules, you should leave -@code{symbol-reloading} off, since otherwise _GDBN__ may discard symbols -when linking large programs, that may contain several modules (from -different directories or libraries) with the same name. - -@item show symbol-reloading -Show the current @code{on} or @code{off} setting. -@end table - -@node Sequences, Emacs, Controlling _GDBN__, Top -@chapter Canned Sequences of Commands - -Aside from breakpoint commands (@pxref{Break Commands}), _GDBN__ provides two -ways to store sequences of commands for execution as a unit: -user-defined commands and command files. - -@menu -* Define:: User-Defined Commands -* Command Files:: Command Files -* Output:: Commands for Controlled Output -@end menu - -@node Define, Command Files, Sequences, Sequences -@section User-Defined Commands - -@cindex user-defined command -A @dfn{user-defined command} is a sequence of _GDBN__ commands to which you -assign a new name as a command. This is done with the @code{define} -command. - -@table @code -@item define @var{commandname} -@kindex define -Define a command named @var{commandname}. If there is already a command -by that name, you are asked to confirm that you want to redefine it. - -The definition of the command is made up of other _GDBN__ command lines, -which are given following the @code{define} command. The end of these -commands is marked by a line containing @code{end}. - -@item document @var{commandname} -@kindex document -Give documentation to the user-defined command @var{commandname}. The -command @var{commandname} must already be defined. This command reads -lines of documentation just as @code{define} reads the lines of the -command definition, ending with @code{end}. After the @code{document} -command is finished, @code{help} on command @var{commandname} will print -the documentation you have specified. - -You may use the @code{document} command again to change the -documentation of a command. Redefining the command with @code{define} -does not change the documentation. - -@item help user-defined -@kindex help user-defined -List all user-defined commands, with the first line of the documentation -(if any) for each. - -@item info user -@itemx info user @var{commandname} -@kindex info user -Display the _GDBN__ commands used to define @var{commandname} (but not its -documentation). If no @var{commandname} is given, display the -definitions for all user-defined commands. -@end table - -User-defined commands do not take arguments. When they are executed, the -commands of the definition are not printed. An error in any command -stops execution of the user-defined command. - -Commands that would ask for confirmation if used interactively proceed -without asking when used inside a user-defined command. Many _GDBN__ commands -that normally print messages to say what they are doing omit the messages -when used in a user-defined command. - -@node Command Files, Output, Define, Sequences -@section Command Files - -@cindex command files -A command file for _GDBN__ is a file of lines that are _GDBN__ commands. Comments -(lines starting with @kbd{#}) may also be included. An empty line in a -command file does nothing; it does not mean to repeat the last command, as -it would from the terminal. - -@cindex init file -@cindex @file{_GDBINIT__} -When you start _GDBN__, it automatically executes commands from its -@dfn{init files}. These are files named @file{_GDBINIT__}. _GDBN__ -reads the init file (if any) in your home directory and then the init -file (if any) in the current working directory. (The init files are not -executed if you use the @samp{-nx} option; @pxref{Mode Options}.) You -can also request the execution of a command file with the @code{source} -command: - -@table @code -@item source @var{filename} -@kindex source -Execute the command file @var{filename}. -@end table - -The lines in a command file are executed sequentially. They are not -printed as they are executed. An error in any command terminates execution -of the command file. - -Commands that would ask for confirmation if used interactively proceed -without asking when used in a command file. Many _GDBN__ commands that -normally print messages to say what they are doing omit the messages -when called from command files. - -@node Output, , Command Files, Sequences -@section Commands for Controlled Output - -During the execution of a command file or a user-defined command, normal -_GDBN__ output is suppressed; the only output that appears is what is -explicitly printed by the commands in the definition. This section -describes three commands useful for generating exactly the output you -want. - -@table @code -@item echo @var{text} -@kindex echo -@c I don't consider backslash-space a standard C escape sequence -@c because it's not in ANSI. -Print @var{text}. Nonprinting characters can be included in @var{text} -using C escape sequences, such as @samp{\n} to print a newline. @b{No -newline will be printed unless you specify one.} In addition to the -standard C escape sequences, a backslash followed by a space stands for a -space. This is useful for outputting a string with spaces at the -beginning or the end, since leading and trailing spaces are otherwise -trimmed from all arguments. Thus, to print @samp{@ and foo =@ }, use the -command @samp{echo \@ and foo = \@ }. -@c FIXME: verify hard copy actually issues enspaces for '@ '! Will this -@c confuse texinfo? - -A backslash at the end of @var{text} can be used, as in C, to continue -the command onto subsequent lines. For example, - -@example -echo This is some text\n\ -which is continued\n\ -onto several lines.\n -@end example - -produces the same output as - -@example -echo This is some text\n -echo which is continued\n -echo onto several lines.\n -@end example - -@item output @var{expression} -@kindex output -Print the value of @var{expression} and nothing but that value: no -newlines, no @samp{$@var{nn} = }. The value is not entered in the -value history either. @xref{Expressions} for more information on -expressions. - -@item output/@var{fmt} @var{expression} -Print the value of @var{expression} in format @var{fmt}. You can use -the same formats as for @code{print}; @pxref{Output formats}, for more -information. - -@item printf @var{string}, @var{expressions}@dots{} -@kindex printf -Print the values of the @var{expressions} under the control of -@var{string}. The @var{expressions} are separated by commas and may -be either numbers or pointers. Their values are printed as specified -by @var{string}, exactly as if the program were to execute - -@example -printf (@var{string}, @var{expressions}@dots{}); -@end example - -For example, you can print two values in hex like this: - -@example -printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo -@end example - -The only backslash-escape sequences that you can use in the format -string are the simple ones that consist of backslash followed by a -letter. -@end table - -@node Emacs, _GDBN__ Bugs, Sequences, Top -@chapter Using _GDBN__ under GNU Emacs - -@cindex emacs -A special interface allows you to use GNU Emacs to view (and -edit) the source files for the program you are debugging with -_GDBN__. - -To use this interface, use the command @kbd{M-x gdb} in Emacs. Give the -executable file you want to debug as an argument. This command starts -_GDBN__ as a subprocess of Emacs, with input and output through a newly -created Emacs buffer. - -Using _GDBN__ under Emacs is just like using _GDBN__ normally except for two -things: - -@itemize @bullet -@item -All ``terminal'' input and output goes through the Emacs buffer. -@end itemize - -This applies both to _GDBN__ commands and their output, and to the input -and output done by the program you are debugging. - -This is useful because it means that you can copy the text of previous -commands and input them again; you can even use parts of the output -in this way. - -All the facilities of Emacs' Shell mode are available for interacting -with your program. In particular, you can send signals the usual -way---for example, @kbd{C-c C-c} for an interrupt, @kbd{C-c C-z} for a -stop. - -@itemize @bullet -@item -_GDBN__ displays source code through Emacs. -@end itemize - -Each time _GDBN__ displays a stack frame, Emacs automatically finds the -source file for that frame and puts an arrow (_0__@samp{=>}_1__) at the -left margin of the current line. Emacs uses a separate buffer for -source display, and splits the window to show both your _GDBN__ session -and the source. - -Explicit _GDBN__ @code{list} or search commands still produce output as -usual, but you probably will have no reason to use them. - -@quotation -@emph{Warning:} If the directory where your program resides is not your -current directory, it can be easy to confuse Emacs about the location of -the source files, in which case the auxiliary display buffer will not -appear to show your source. _GDBN__ can find programs by searching your -environment's @code{PATH} variable, so the _GDBN__ input and output -session will proceed normally; but Emacs doesn't get enough information -back from _GDBN__ to locate the source files in this situation. To -avoid this problem, either start _GDBN__ mode from the directory where -your program resides, or specify a full path name when prompted for the -@kbd{M-x gdb} argument. - -A similar confusion can result if you use the _GDBN__ @code{file} command to -switch to debugging a program in some other location, from an existing -_GDBN__ buffer in Emacs. -@end quotation - -By default, @kbd{M-x gdb} calls the program called @file{gdb}. If -you need to call _GDBN__ by a different name (for example, if you keep -several configurations around, with different names) you can set the -Emacs variable @code{gdb-command-name}; for example, -@example -(setq gdb-command-name "mygdb") -@end example -@noindent -(preceded by @kbd{ESC ESC}, or typed in the @code{*scratch*} buffer, or -in your @file{.emacs} file) will make Emacs call the program named -``@code{mygdb}'' instead. - -In the _GDBN__ I/O buffer, you can use these special Emacs commands in -addition to the standard Shell mode commands: - -@table @kbd -@item C-h m -Describe the features of Emacs' _GDBN__ Mode. - -@item M-s -Execute to another source line, like the _GDBN__ @code{step} command; also -update the display window to show the current file and location. - -@item M-n -Execute to next source line in this function, skipping all function -calls, like the _GDBN__ @code{next} command. Then update the display window -to show the current file and location. - -@item M-i -Execute one instruction, like the _GDBN__ @code{stepi} command; update -display window accordingly. - -@item M-x gdb-nexti -Execute to next instruction, using the _GDBN__ @code{nexti} command; update -display window accordingly. - -@item C-c C-f -Execute until exit from the selected stack frame, like the _GDBN__ -@code{finish} command. - -@item M-c -Continue execution of the program, like the _GDBN__ @code{continue} -command. @emph{Warning:} In Emacs v19, this command is @kbd{C-c C-p}. - -@item M-u -Go up the number of frames indicated by the numeric argument -(@pxref{Arguments, , Numeric Arguments, emacs, The GNU Emacs Manual}), -like the _GDBN__ @code{up} command. @emph{Warning:} In Emacs v19, this -command is @kbd{C-c C-u}.@refill - -@item M-d -Go down the number of frames indicated by the numeric argument, like the -_GDBN__ @code{down} command. @emph{Warning:} In Emacs v19, this command -is @kbd{C-c C-d}. - -@item C-x & -Read the number where the cursor is positioned, and insert it at the end -of the _GDBN__ I/O buffer. For example, if you wish to disassemble code -around an address that was displayed earlier, type @kbd{disassemble}; -then move the cursor to the address display, and pick up the -argument for @code{disassemble} by typing @kbd{C-x &}. - -You can customize this further on the fly by defining elements of the list -@code{gdb-print-command}; once it is defined, you can format or -otherwise process numbers picked up by @kbd{C-x &} before they are -inserted. A numeric argument to @kbd{C-x &} will both indicate that you -wish special formatting, and act as an index to pick an element of the -list. If the list element is a string, the number to be inserted is -formatted using the Emacs function @code{format}; otherwise the number -is passed as an argument to the corresponding list element. - -@end table - -In any source file, the Emacs command @kbd{C-x SPC} (@code{gdb-break}) -tells _GDBN__ to set a breakpoint on the source line point is on. - -If you accidentally delete the source-display buffer, an easy way to get -it back is to type the command @code{f} in the _GDBN__ buffer, to -request a frame display; when you run under Emacs, this will recreate -the source buffer if necessary to show you the context of the current -frame. - -The source files displayed in Emacs are in ordinary Emacs buffers -which are visiting the source files in the usual way. You can edit -the files with these buffers if you wish; but keep in mind that _GDBN__ -communicates with Emacs in terms of line numbers. If you add or -delete lines from the text, the line numbers that _GDBN__ knows will cease -to correspond properly to the code. - -@c The following dropped because Epoch is nonstandard. Reactivate -@c if/when v19 does something similar. ---pesch@cygnus.com 19dec1990 -@ignore -@kindex emacs epoch environment -@kindex epoch -@kindex inspect - -Version 18 of Emacs has a built-in window system called the @code{epoch} -environment. Users of this environment can use a new command, -@code{inspect} which performs identically to @code{print} except that -each value is printed in its own window. -@end ignore - -@node _GDBN__ Bugs, Renamed Commands, Emacs, Top -@chapter Reporting Bugs in _GDBN__ -@cindex Bugs in _GDBN__ -@cindex Reporting Bugs in _GDBN__ - -Your bug reports play an essential role in making _GDBN__ reliable. - -Reporting a bug may help you by bringing a solution to your problem, or it -may not. But in any case the principal function of a bug report is to help -the entire community by making the next version of _GDBN__ work better. Bug -reports are your contribution to the maintenance of _GDBN__. - -In order for a bug report to serve its purpose, you must include the -information that enables us to fix the bug. - -@menu -* Bug Criteria:: Have You Found a Bug? -* Bug Reporting:: How to Report Bugs -@end menu - -@node Bug Criteria, Bug Reporting, _GDBN__ Bugs, _GDBN__ Bugs -@section Have You Found a Bug? -@cindex Bug Criteria - -If you are not sure whether you have found a bug, here are some guidelines: - -@itemize @bullet -@item -@cindex Fatal Signal -@cindex Core Dump -If the debugger gets a fatal signal, for any input whatever, that is a -_GDBN__ bug. Reliable debuggers never crash. - -@item -@cindex error on Valid Input -If _GDBN__ produces an error message for valid input, that is a bug. - -@item -@cindex Invalid Input -If _GDBN__ does not produce an error message for invalid input, -that is a bug. However, you should note that your idea of -``invalid input'' might be our idea of ``an extension'' or ``support -for traditional practice''. - -@item -If you are an experienced user of debugging tools, your suggestions -for improvement of _GDBN__ are welcome in any case. -@end itemize - -@node Bug Reporting, , Bug Criteria, _GDBN__ Bugs -@section How to Report Bugs -@cindex Bug Reports -@cindex _GDBN__ Bugs, Reporting - -A number of companies and individuals offer support for GNU products. -If you obtained _GDBN__ from a support organization, we recommend you -contact that organization first. - -Contact information for many support companies and individuals is -available in the file @file{etc/SERVICE} in the GNU Emacs distribution. - -In any event, we also recommend that you send bug reports for _GDBN__ to one -of these addresses: - -@example -bug-gdb@@prep.ai.mit.edu -@{ucbvax|mit-eddie|uunet@}!prep.ai.mit.edu!bug-gdb -@end example - -@strong{Do not send bug reports to @samp{info-gdb}, or to -@samp{help-gdb}, or to any newsgroups.} Most users of _GDBN__ do not want to -receive bug reports. Those that do, have arranged to receive @samp{bug-gdb}. - -The mailing list @samp{bug-gdb} has a newsgroup @samp{gnu.gdb.bug} which -serves as a repeater. The mailing list and the newsgroup carry exactly -the same messages. Often people think of posting bug reports to the -newsgroup instead of mailing them. This appears to work, but it has one -problem which can be crucial: a newsgroup posting often lacks a mail -path back to the sender. Thus, if we need to ask for more information, -we may be unable to reach you. For this reason, it is better to send -bug reports to the mailing list. - -As a last resort, send bug reports on paper to: - -@example -GNU Debugger Bugs -Free Software Foundation -545 Tech Square -Cambridge, MA 02139 -@end example - -The fundamental principle of reporting bugs usefully is this: -@strong{report all the facts}. If you are not sure whether to state a -fact or leave it out, state it! - -Often people omit facts because they think they know what causes the -problem and assume that some details don't matter. Thus, you might -assume that the name of the variable you use in an example does not matter. -Well, probably it doesn't, but one cannot be sure. Perhaps the bug is a -stray memory reference which happens to fetch from the location where that -name is stored in memory; perhaps, if the name were different, the contents -of that location would fool the debugger into doing the right thing despite -the bug. Play it safe and give a specific, complete example. That is the -easiest thing for you to do, and the most helpful. - -Keep in mind that the purpose of a bug report is to enable us to fix -the bug if it is new to us. It isn't as important what happens if -the bug is already known. Therefore, always write your bug reports on -the assumption that the bug has not been reported previously. - -Sometimes people give a few sketchy facts and ask, ``Does this ring a -bell?'' Those bug reports are useless, and we urge everyone to -@emph{refuse to respond to them} except to chide the sender to report -bugs properly. - -To enable us to fix the bug, you should include all these things: - -@itemize @bullet -@item -The version of _GDBN__. _GDBN__ announces it if you start with no -arguments; you can also print it at any time using @code{show version}. - -Without this, we won't know whether there is any point in looking for -the bug in the current version of _GDBN__. - -@item -A complete input script, and all necessary source files, that will -reproduce the bug. - -@item -What compiler (and its version) was used to compile _GDBN__---e.g. -``_GCC__-1.37.1''. - -@item -The command arguments you gave the compiler to compile your example and -observe the bug. For example, did you use @samp{-O}? To guarantee -you won't omit something important, list them all. - -If we were to try to guess the arguments, we would probably guess wrong -and then we might not encounter the bug. - -@item -The type of machine you are using, and the operating system name and -version number. - -@item -A description of what behavior you observe that you believe is -incorrect. For example, ``It gets a fatal signal.'' - -Of course, if the bug is that _GDBN__ gets a fatal signal, then we will -certainly notice it. But if the bug is incorrect output, we might not -notice unless it is glaringly wrong. We are human, after all. You -might as well not give us a chance to make a mistake. - -Even if the problem you experience is a fatal signal, you should still -say so explicitly. Suppose something strange is going on, such as, -your copy of _GDBN__ is out of synch, or you have encountered a -bug in the C library on your system. (This has happened!) Your copy -might crash and ours would not. If you told us to expect a crash, -then when ours fails to crash, we would know that the bug was not -happening for us. If you had not told us to expect a crash, then we -would not be able to draw any conclusion from our observations. - -@item -If you wish to suggest changes to the _GDBN__ source, send us context -diffs. If you even discuss something in the _GDBN__ source, refer to -it by context, not by line number. - -The line numbers in our development sources won't match those in your -sources. Your line numbers would convey no useful information to us. - -@end itemize - -Here are some things that are not necessary: - -@itemize @bullet -@item -A description of the envelope of the bug. - -Often people who encounter a bug spend a lot of time investigating -which changes to the input file will make the bug go away and which -changes will not affect it. - -This is often time consuming and not very useful, because the way we -will find the bug is by running a single example under the debugger -with breakpoints, not by pure deduction from a series of examples. -We recommend that you save your time for something else. - -Of course, if you can find a simpler example to report @emph{instead} -of the original one, that is a convenience for us. Errors in the -output will be easier to spot, running under the debugger will take -less time, etc. - -However, simplification is not vital; if you don't want to do this, -report the bug anyway and send us the entire test case you used. - -@item -A patch for the bug. - -A patch for the bug does help us if it is a good one. But don't omit -the necessary information, such as the test case, on the assumption that -a patch is all we need. We might see problems with your patch and decide -to fix the problem another way, or we might not understand it at all. - -Sometimes with a program as complicated as _GDBN__ it is very hard to -construct an example that will make the program follow a certain path -through the code. If you don't send us the example, we won't be able -to construct one, so we won't be able to verify that the bug is fixed. - -And if we can't understand what bug you are trying to fix, or why your -patch should be an improvement, we won't install it. A test case will -help us to understand. - -@item -A guess about what the bug is or what it depends on. - -Such guesses are usually wrong. Even we can't guess right about such -things without first using the debugger to find the facts. -@end itemize - -@iftex -@include rdl-apps.texi -@end iftex - -@node Renamed Commands, Installing _GDBN__, _GDBN__ Bugs, Top -@appendix Renamed Commands - -The following commands were renamed in _GDBN__ 4.0, in order to make the -command set as a whole more consistent and easier to use and remember: - -@kindex add-syms -@kindex delete environment -@kindex info copying -@kindex info convenience -@kindex info directories -@kindex info editing -@kindex info history -@kindex info targets -@kindex info values -@kindex info version -@kindex info warranty -@kindex set addressprint -@kindex set arrayprint -@kindex set prettyprint -@kindex set screen-height -@kindex set screen-width -@kindex set unionprint -@kindex set vtblprint -@kindex set demangle -@kindex set asm-demangle -@kindex set sevenbit-strings -@kindex set array-max -@kindex set caution -@kindex set history write -@kindex show addressprint -@kindex show arrayprint -@kindex show prettyprint -@kindex show screen-height -@kindex show screen-width -@kindex show unionprint -@kindex show vtblprint -@kindex show demangle -@kindex show asm-demangle -@kindex show sevenbit-strings -@kindex show array-max -@kindex show caution -@kindex show history write -@kindex unset - -@ifinfo -@example -OLD COMMAND NEW COMMAND ---------------- ------------------------------- -add-syms add-symbol-file -delete environment unset environment -info convenience show convenience -info copying show copying -info directories show directories -info editing show commands -info history show values -info targets help target -info values show values -info version show version -info warranty show warranty -set/show addressprint set/show print address -set/show array-max set/show print elements -set/show arrayprint set/show print array -set/show asm-demangle set/show print asm-demangle -set/show caution set/show confirm -set/show demangle set/show print demangle -set/show history write set/show history save -set/show prettyprint set/show print pretty -set/show screen-height set/show height -set/show screen-width set/show width -set/show sevenbit-strings set/show print sevenbit-strings -set/show unionprint set/show print union -set/show vtblprint set/show print vtbl - -unset [No longer an alias for delete] -@end example -@end ifinfo - -@tex -\vskip \parskip\vskip \baselineskip -\halign{\tt #\hfil &\qquad#&\tt #\hfil\cr -{\bf Old Command} &&{\bf New Command}\cr -add-syms &&add-symbol-file\cr -delete environment &&unset environment\cr -info convenience &&show convenience\cr -info copying &&show copying\cr -info directories &&show directories \cr -info editing &&show commands\cr -info history &&show values\cr -info targets &&help target\cr -info values &&show values\cr -info version &&show version\cr -info warranty &&show warranty\cr -set{\rm / }show addressprint &&set{\rm / }show print address\cr -set{\rm / }show array-max &&set{\rm / }show print elements\cr -set{\rm / }show arrayprint &&set{\rm / }show print array\cr -set{\rm / }show asm-demangle &&set{\rm / }show print asm-demangle\cr -set{\rm / }show caution &&set{\rm / }show confirm\cr -set{\rm / }show demangle &&set{\rm / }show print demangle\cr -set{\rm / }show history write &&set{\rm / }show history save\cr -set{\rm / }show prettyprint &&set{\rm / }show print pretty\cr -set{\rm / }show screen-height &&set{\rm / }show height\cr -set{\rm / }show screen-width &&set{\rm / }show width\cr -set{\rm / }show sevenbit-strings &&set{\rm / }show print sevenbit-strings\cr -set{\rm / }show unionprint &&set{\rm / }show print union\cr -set{\rm / }show vtblprint &&set{\rm / }show print vtbl\cr -\cr -unset &&\rm(No longer an alias for delete)\cr -} -@end tex - -@node Installing _GDBN__, Copying, Renamed Commands, Top -@appendix Installing _GDBN__ -@cindex configuring _GDBN__ -@cindex installation - -_GDBN__ comes with a @code{configure} script that automates the process -of preparing _GDBN__ for installation; you can then use @code{make} to -build the @code{_GDBP__} program. - -The _GDBP__ distribution includes all the source code you need for -_GDBP__ in a single directory @file{gdb-_GDB_VN__}. That directory in turn -contains: - -@table @code -@item gdb-_GDB_VN__/configure -Overall script for configuring _GDBN__ and all its supporting libraries. - -@item gdb-_GDB_VN__/gdb -the source specific to _GDBN__ itself - -@item gdb-_GDB_VN__/bfd -source for the Binary File Descriptor Library - -@item gdb-_GDB_VN__/include -GNU include files - -@item gdb-_GDB_VN__/libiberty -source for the @samp{-liberty} free software library - -@item gdb-_GDB_VN__/readline -source for the GNU command-line interface -@end table -@noindent -Each of these directories has its own @code{configure} script, which are -used by the overall @code{configure} script in @file{gdb-_GDB_VN__}. - -It is most convenient to run @code{configure} from the @file{gdb-_GDB_VN__} -directory. The simplest way to configure and build _GDBN__ is the -following: -@example -cd gdb-_GDB_VN__ -./configure @var{host} -make -@end example -@noindent -where @var{host} is something like @samp{sun4} or @samp{decstation}, that -identifies the platform where _GDBN__ will run. This builds the three -libraries @file{bfd}, @file{readline}, and @file{libiberty}, then -@code{gdb} itself. The configured source files, and the binaries, are -left in the corresponding source directories. - -You can install @code{_GDBP__} anywhere; it has no hardwired paths. However, -you should make sure that the shell on your path (named by the -@samp{SHELL} environment variable) is publicly readable; some systems -refuse to let _GDBN__ debug child processes whose programs are not -readable, and _GDBN__ uses the shell to start your program. - -@menu -* Subdirectories:: Configuration subdirectories -* Config Names:: Specifying names for hosts and targets -* configure Options:: Summary of options for configure -* Formatting Documentation:: How to format and print _GDBN__ documentation -@end menu - - -@node Subdirectories, Config Names, Installing _GDBN__, Installing _GDBN__ -@section Configuration Subdirectories -If you want to run _GDBN__ versions for several host or target machines, -you'll need a different _GDBP__ compiled for each combination of host -and target. @code{configure} is designed to make this easy by allowing -you to generate each configuration in a separate subdirectory. If your -@code{make} program handles the @samp{VPATH} feature (GNU @code{make} -does), running @code{make} in each of these directories then builds the -_GDBP__ program specified there. - -@code{configure} creates these subdirectories for you when you -simultaneously specify several configurations; but it's a good habit -even for a single configuration. You can specify the use of -subdirectories using the @samp{+subdirs} option (abbreviated -@samp{+sub}). For example, you can build _GDBN__ on a Sun 4 as follows: - -@example -@group -cd gdb-_GDB_VN__ -./configure +sub sun4 -cd Host-sparc-sun-sunos4/Target-sparc-sun-sunos4 -make -@end group -@end example - -When @code{configure} uses subdirectories to build programs or -libraries, it creates nested directories -@file{Host-@var{host}/Target-@var{target}}. (As you see in the example, -the names used for @var{host} and @var{target} may be expanded from your -@code{configure} argument; @pxref{Config Names}). @code{configure} uses -these two directory levels because _GDBN__ can be configured for -cross-compiling: _GDBN__ can run on one machine (the host) while -debugging programs that run on another machine (the target). You -specify cross-debugging targets by giving the -@samp{+target=@var{target}} option to @code{configure}. Specifying only -hosts still gives you two levels of subdirectory for each host, with the -same configuration suffix on both; that is, if you give any number of -hosts but no targets, _GDBN__ will be configured for native debugging on -each host. On the other hand, whenever you specify both hosts and -targets on the same command line, @code{configure} creates all -combinations of the hosts and targets you list.@refill - -When you run @code{make} to build a program or library, you must run it -in a configured directory. If you made a single configuration, -without subdirectories, run @code{make} in the source directory. -If you have @file{Host-@var{host}/Target-@var{target}} subdirectories, -run @code{make} in those subdirectories. - -Each @code{configure} and @code{Makefile} under each source directory -runs recursively, so that typing @code{make} in @file{gdb-_GDB_VN__} (or in a -@file{gdb-_GDB_VN__/Host-@var{host}/Target-@var{target}} subdirectory) -builds all the required libraries, then _GDBN__.@refill - -If you run @code{configure} from a directory (such as @file{gdb-_GDB_VN__}) that -contains source directories for multiple libraries or programs, -@code{configure} creates the @file{Host-@var{host}/Target-@var{target}} -subdirectories in each library or program's source directory. For -example, typing: -@example -cd gdb-_GDB_VN__ -configure sun4 +target=vxworks960 -@end example -@noindent -creates the following directories: -@smallexample -gdb-_GDB_VN__/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks -gdb-_GDB_VN__/bfd/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks -gdb-_GDB_VN__/gdb/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks -gdb-_GDB_VN__/libiberty/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks -gdb-_GDB_VN__/readline/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks -@end smallexample -@noindent -The @code{Makefile} in -@smallexample -gdb-_GDB_VN__/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks -@end smallexample -@noindent -will @code{cd} to the appropriate lower-level directories, for example: -@smallexample -gdb-_GDB_VN__/bfd/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks -@end smallexample -@noindent -building each in turn. - -When you have multiple hosts or targets configured, you can run -@code{make} on them in parallel (for example, if they are NFS-mounted on -each of the hosts); they will not interfere with each other. - - -@iftex -@c FIXME isn't there something kinder, gentler than @page? -@page -@end iftex -@node Config Names, configure Options, Subdirectories, Installing _GDBN__ -@section Specifying Names for Hosts and Targets - -The specifications used for hosts and targets in the @code{configure} -script are based on a three-part naming scheme, but some short predefined -aliases are also supported. The full naming scheme encodes three pieces -of information in the following pattern: -@example -@var{architecture}-@var{vendor}-@var{os} -@end example - -For example, you can use the alias @code{sun4} as a @var{host} argument -or in a @code{+target=@var{target}} option, but the full name of that -configuration specifies that the architecture is @samp{sparc}, the -vendor is @samp{sun}, and the operating system is @samp{sunos4}. - -@iftex -@c I know this is ugly, but @group is useless except in examples now... -@c (using texinfo 2.52 or so) -@page -@end iftex - -The following table shows all the architectures, hosts, and OS prefixes -that @code{configure} recognizes in _GDBN__ _GDB_VN__. Entries in the ``OS -prefix'' column ending in a @samp{*} may be followed by a release number. - -@ifinfo -@example - -ARCHITECTURE VENDOR OS prefix -------------+-------------+------------- - | | - 580 | altos | aix* - a29k | amdahl | amigados - alliant | aout | aout - arm | apollo | bout - c1 | att | bsd* - c2 | bull | coff - cray2 | bcs | ctix* - h8300 | bout | dynix* - i386 | cbm | esix* - i860 | coff | hpux* - i960 | convergent | irix* - m68000 | convex | isc* - m68k | cray | kern - m88k | dec | mach* - mips | encore | newsos* - ns32k | gould | nindy* - pyramid | hp | none - romp | ibm | osf* - rs6000 | intel | sco* - rtpc | isi | sunos* - sparc | little | svr4 - tahoe | mips | sym* - tron | motorola | sysv* - vax | ncr | ultrix* - xmp | next | unicos - ymp | none | unos* - | nyu | uts - | sco | v88r* - | sequent | vms* - | sgi | vxworks* - | sony | - | sun | - | unicom | - | utek | - | wrs | - -@end example -@quotation -@emph{Warning:} Many combinations of architecture, vendor, and OS are -untested. -@end quotation -@end ifinfo -@c FIXME: this table is probably screwed in @smallbook. Try setting -@c FIXME...smallbook fonts? -@tex -%\vskip\parskip -\vskip \baselineskip -\halign{\hskip\parindent\tt #\hfil &\qquad#&\tt #\hfil &\qquad#&\tt -#\hfil &\qquad\qquad\it #\hfil\cr -{\bf Architecture} &&{\bf Vendor} &&{\bf OS prefix}\cr -\multispan5\hrulefill\cr - 580 && altos && aix* \cr - a29k && amdahl && amigados\cr - alliant && aout && aout \cr - arm && apollo && bout \cr - c1 && att && bsd* \cr - c2 && bull && coff \cr - cray2 && bcs && ctix* \cr - h8300 && bout && dynix* \cr - i386 && cbm && esix* \cr - i860 && coff && hpux* &Warning: \cr - i960 && convergent && irix* &Many combinations \cr - m68000 && convex && isc* &of architecture, vendor \cr - m68k && cray && kern &and OS are untested. \cr - m88k && dec && mach* \cr - mips && encore && newsos* \cr - ns32k && gould && nindy* \cr - pyramid && hp && none \cr - romp && ibm && osf* \cr - rs6000 && intel && sco* \cr - rtpc && isi && sunos* \cr - sparc && little && svr4 \cr - tahoe && mips && sym* \cr - tron && motorola && sysv* \cr - vax && ncr && ultrix* \cr - xmp && next && unicos \cr - ymp && none && unos* \cr - && nyu && uts \cr - && sco && v88r* \cr - && sequent && vms* \cr - && sgi && vxworks*\cr - && sony &&\cr - && sun &&\cr - && unicom &&\cr - && utek &&\cr - && wrs &&\cr -} -@end tex - -The @code{configure} script accompanying _GDBN__ _GDB_VN__ does not provide -any query facility to list all supported host and target names or -aliases. @code{configure} calls the Bourne shell script -@code{config.sub} to map abbreviations to full names; you can read the -script, if you wish, or you can use it to test your guesses on -abbreviations---for example: -@example -% sh config.sub sun4 -sparc-sun-sunos4 -% sh config.sub sun3 -m68k-sun-sunos4 -% sh config.sub decstation -mips-dec-ultrix -% sh config.sub hp300bsd -m68k-hp-bsd -% sh config.sub i386v -i386-none-sysv -% sh config.sub i486v -*** No vendor: configuration `i486v' not recognized -@end example - -@node configure Options, Formatting Documentation, Config Names, Installing _GDBN__ -@section @code{configure} Options - -Here is a summary of all the @code{configure} options and arguments that -you might use for building _GDBN__: - -@example -configure @r{[}+destdir=@var{dir}@r{]} @r{[}+subdirs@r{]} @r{[}+norecur@r{]} @r{[}+rm@r{]} - @r{[}+target=@var{target}@dots{}@r{]} @var{host}@dots{} -@end example -@noindent -You may introduce options with the character @samp{-} rather than -@samp{+} if you prefer; but you may abbreviate option names if you use -@samp{+}. - -@table @code -@item +destdir=@var{dir} -@var{dir} is an installation directory @emph{path prefix}. After you -configure with this option, @code{make install} will install _GDBN__ as -@file{@var{dir}/bin/_GDBP__}, and the libraries in @file{@var{dir}/lib}. -If you specify @samp{+destdir=/usr/local}, for example, @code{make -install} creates @file{/usr/local/bin/gdb}.@refill - -@item +subdirs -Write configuration specific files in subdirectories of the form -@example -Host-@var{host}/Target-@var{target} -@end example -@noindent -(and configure the @code{Makefile} to write binaries there too). -Without this option, if you specify only one configuration for _GDBN__, -@code{configure} will use the same directory for source, configured -files, and binaries. This option is used automatically if you specify -more than one @var{host} or more than one @samp{+target=@var{target}} -option on the @code{configure} command line. - -@item +norecur -Configure only the directory where @code{configure} is executed; do not -propagate configuration to subdirectories. - -@item +rm -Remove the configuration that the other arguments specify. - -@c This doesn't work (yet if ever). FIXME. -@c @item +parse=@var{lang} @dots{} -@c Configure the _GDBN__ expression parser to parse the listed languages. -@c @samp{all} configures _GDBN__ for all supported languages. To get a -@c list of all supported languages, omit the argument. Without this -@c option, _GDBN__ is configured to parse all supported languages. - -@item +target=@var{target} @dots{} -Configure _GDBN__ for cross-debugging programs running on each specified -@var{target}. You may specify as many @samp{+target} options as you -wish. Without this option, _GDBN__ is configured to debug programs that -run on the same machine (@var{host}) as _GDBN__ itself. - -There is no convenient way to generate a list of all available targets. - -@item @var{host} @dots{} -Configure _GDBN__ to run on each specified @var{host}. You may specify as -many host names as you wish. - -There is no convenient way to generate a list of all available hosts. -@end table - -@noindent -@code{configure} accepts other options, for compatibility with -configuring other GNU tools recursively; but these are the only -options that affect _GDBN__ or its supporting libraries. - -@node Formatting Documentation, , configure Options, Installing _GDBN__ -@section Formatting the Documentation - -@cindex _GDBN__ reference card -@cindex reference card -The _GDBN__ _GDB_VN__ release includes an already-formatted reference card, -ready for printing on a PostScript printer, as @file{gdb-_GDB_VN__/gdb/refcard.ps}. -It uses the most common PostScript fonts: the Times family, Courier, and -Symbol. If you have a PostScript printer, you can print the reference -card by just sending @file{refcard.ps} to the printer. - -The release also includes the online Info version of this manual already -formatted: the main Info file is @file{gdb-_GDB_VN__/gdb/gdb.info}, and it -refers to subordinate files matching @samp{gdb.info*} in the same -directory. - -If you want to make these Info files yourself from the _GDBN__ manual's -source, you need the GNU @code{makeinfo} program. Once you have it, you -can type -@example -cd gdb-_GDB_VN__/gdb -make gdb.info -@end example -@noindent -to make the Info file. - -If you want to format and print copies of the manual, you need several -things: -@itemize @bullet -@item -@TeX{}, the public domain typesetting program written by Donald Knuth, -must be installed on your system and available through your execution -path. -@item -@file{gdb-_GDB_VN__/texinfo}: @TeX{} macros defining the GNU -Documentation Format. -@item -@emph{A @sc{dvi} output program.} @TeX{} doesn't actually make marks on -paper; it produces output files called @sc{dvi} files. If your system -has @TeX{} installed, chances are it has a program for printing out -these files; one popular example is @code{dvips}, which can print -@sc{dvi} files on PostScript printers. -@end itemize -@noindent -Once you have these things, you can type -@example -cd gdb-_GDB_VN__/gdb -make gdb.dvi -@end example -@noindent -to format the text of this manual, and print it with the usual output -method for @TeX{} @sc{dvi} files at your site. - -If you want to print the reference card, but don't have a PostScript -printer, or you want to use Computer Modern fonts instead, -you can still print it if you have @TeX{}. Format the reference card by typing -@example -cd gdb-_GDB_VN__/gdb -make refcard.dvi -@end example -@noindent - -The _GDBN__ reference card is designed to print in landscape mode on US -``letter'' size paper; that is, on a sheet 11 inches wide by 8.5 inches -high. You will need to specify this form of printing as an option to -your @sc{dvi} output program. - - -@node Copying, Index, Installing _GDBN__, Top -@unnumbered GNU GENERAL PUBLIC LICENSE -@center Version 2, June 1991 - -@display -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc. -675 Mass Ave, Cambridge, MA 02139, USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@unnumberedsec Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software---to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - -@iftex -@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end iftex -@ifinfo -@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end ifinfo - -@enumerate -@item -This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The ``Program'', below, -refers to any such program or work, and a ``work based on the Program'' -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term ``modification''.) Each licensee is addressed as ``you''. - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - -@item -You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -@item -You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - -@alphaenumerate -@item -You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. - -@item -You must cause any work that you distribute or publish, that in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. - -@item -If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based on -the Program is not required to print an announcement.) -@end alphaenumerate - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - -@item -You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - -@alphaenumerate -@item -Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; or, - -@item -Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, - -@item -Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) -@end alphaenumerate - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - -@item -You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - -@item -You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -@item -Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - -@item -If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -@item -If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -@item -The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and ``any -later version'', you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -@item -If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - -@iftex -@heading NO WARRANTY -@end iftex -@ifinfo -@center NO WARRANTY -@end ifinfo - -@item -BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - -@item -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. -@end enumerate - -@iftex -@heading END OF TERMS AND CONDITIONS -@end iftex -@ifinfo -@center END OF TERMS AND CONDITIONS -@end ifinfo - -@page -@unnumberedsec Applying These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the ``copyright'' line and a pointer to where the full notice is found. - -@smallexample -@var{one line to give the program's name and a brief idea of what it does.} -Copyright (C) 19@var{yy} @var{name of author} - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -@end smallexample - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -@smallexample -Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it -under certain conditions; type `show c' for details. -@end smallexample - -The hypothetical commands @samp{show w} and @samp{show c} should show -the appropriate parts of the General Public License. Of course, the -commands you use may be called something other than @samp{show w} and -@samp{show c}; they could even be mouse-clicks or menu items---whatever -suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a ``copyright disclaimer'' for the program, if -necessary. Here is a sample; alter the names: - -@example -Yoyodyne, Inc., hereby disclaims all copyright interest in the program -`Gnomovision' (which makes passes at compilers) written by James Hacker. - -@var{signature of Ty Coon}, 1 April 1989 -Ty Coon, President of Vice -@end example - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - - -@node Index, , Copying, Top -@unnumbered Index - -@printindex cp - -@tex -% I think something like @colophon should be in texinfo. In the -% meantime: -\long\def\colophon{\hbox to0pt{}\vfill -\centerline{The body of this manual is set in} -\centerline{\fontname\tenrm,} -\centerline{with headings in {\bf\fontname\tenbf}} -\centerline{and examples in {\tt\fontname\tentt}.} -\centerline{{\it\fontname\tenit\/} and} -\centerline{{\sl\fontname\tensl\/}} -\centerline{are used for emphasis.}\vfill} -\page\colophon -% Blame: pesch@cygnus.com, 28mar91. -@end tex - -@contents -@bye diff --git a/gdb/doc/interim-gdbinv-m.m4 b/gdb/doc/interim-gdbinv-m.m4 index 8fe5f91..e69de29 100755 --- a/gdb/doc/interim-gdbinv-m.m4 +++ b/gdb/doc/interim-gdbinv-m.m4 @@ -1,13 +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__(_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__) diff --git a/gdb/doc/interim-gdbinv-s.m4 b/gdb/doc/interim-gdbinv-s.m4 index 82de97a..e69de29 100755 --- a/gdb/doc/interim-gdbinv-s.m4 +++ b/gdb/doc/interim-gdbinv-s.m4 @@ -1,427 +0,0 @@ -_dnl__ -*- Texinfo -*- -_dnl__ Copyright (c) 1990 1991 Free Software Foundation, Inc. -_dnl__ This file is part of the source for the GDB manual. -@c M4 FRAGMENT $Id$ -@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). -_if__(_I960__) -_if__(!_GENERIC__) -@node i960-Nindy Remote, EB29K Remote, Mode Options, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node i960-Nindy Remote, EB29K Remote, Remote, Remote -_fi__(_GENERIC__) -@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}. - -@end itemize - -@menu -* Nindy Startup:: Startup with Nindy -* Nindy Options:: Options for Nindy -* Nindy reset:: Nindy Reset Command -@end menu - -@node Nindy Startup, Nindy Options, i960-Nindy Remote, i960-Nindy Remote -@subsubsection Startup with Nindy - -If you simply start @code{_GDBN__} 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}). - -@node Nindy Options, Nindy reset, Nindy Startup, i960-Nindy Remote -@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. - -@node Nindy reset, , Nindy Options, i960-Nindy Remote -@c @group -@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__) -_if__(!_GENERIC__) -@node EB29K Remote, VxWorks Remote, i960-Nindy Remote, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node EB29K Remote, VxWorks Remote, i960-Nindy Remote, Remote -_fi__(_GENERIC__) -@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), _GDBP__-EB29K, EB29K Remote, EB29K Remote -@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 what 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 don't 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, Remote Log, Comms (EB29K), EB29K Remote -@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 -@end example -@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 - -@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're 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, , _GDBP__-EB29K, EB29K Remote -@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__(_VXWORKS__) -_if__(!_GENERIC__) -@node VxWorks Remote, , EB29K Remote, Starting _GDBN__ -_fi__(!_GENERIC__) -_if__(_GENERIC__) -@node VxWorks Remote, , EB29K Remote, Remote -_fi__(_GENERIC__) -@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 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 -Defining @code{INCLUDE_RDB} in the VxWorks configuration file -@file{configAll.h} includes the RDB interface routines and spawns the -source debugging task @code{tRdbTask} when VxWorks is booted. For more -information on configuring and remaking 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 _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, VxWorks download, VxWorks Remote, VxWorks Remote -@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}); 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, VxWorks attach, VxWorks connection, VxWorks Remote -@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, , VxWorks download, VxWorks Remote -@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 - -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__) diff --git a/gdb/doc/rc-cm.tex b/gdb/doc/rc-cm.tex index 1b44a07..e69de29 100755 --- a/gdb/doc/rc-cm.tex +++ b/gdb/doc/rc-cm.tex @@ -1,22 +0,0 @@ -% $Id$ -% To choose CM (Computer Modern) fonts for the refcard, link -% or copy this file to rcfonts.tex -% -%The Times-Roman family is both more attractive and more compact than -%Computer Modern. On the other hand, while common, it is not free. -%There are three sets of font definitions: -% 1) rc-cm.tex uses the free (Computer Modern) fonts -% 2) rc-ps.tex uses common PostScript fonts, with fontnames from the -% Karl Berry scheme recommended in the documentation for dvips. -% 3) rc-pslong.tex uses common PostScript fonts, with the long names -% used by PostScript programs directly. -% -%-------------------- Computer Modern font defs: -------------------- -\font\bbf=cmbx10 -\font\vbbf=cmbx12 -\font\smrm=cmr5 -\font\brm=cmr10 -\font\rm=cmr7 -\font\it=cmti7 -\font\tt=cmtt8 -%-------------------- end font defs --------------------------------- diff --git a/gdb/doc/rc-ps.tex b/gdb/doc/rc-ps.tex index 1a0e970..e69de29 100755 --- a/gdb/doc/rc-ps.tex +++ b/gdb/doc/rc-ps.tex @@ -1,30 +0,0 @@ -% $Id$ -% To choose PS fonts (Karl Berry TeX fontnames) for the refcard, link -% or copy this file to rcfonts.tex -% -%The Times-Roman family is both more attractive and more compact than -%Computer Modern. On the other hand, while common, it is not free. -%There are three sets of font definitions: -% 1) rc-cm.tex uses the free (Computer Modern) fonts -% 2) rc-ps.tex uses common PostScript fonts, with fontnames from the -% Karl Berry scheme recommended in the documentation for dvips. -% 3) rc-pslong.tex uses common PostScript fonts, with the long names -% used by PostScript programs directly. -% -% One caution: due to differing character ordering between TeX and PS, -%if your TeX is pre-3.0, or if you don't have virtual Courier -%matching the TeX character positions, you might want to use CMtt for -%\tt even if you switch to PostScript fonts for the rest of the text. -% -%-------------------- PostScript fonts (K Berry names) -------------- -\font\bbf=ptmb at 10pt -\font\vbbf=ptmb at 12pt -\font\smrm=ptmr at 6pt -\font\brm=ptmr at 10pt -\font\rm=ptmr at 8pt -\font\it=ptmri at 8pt -\font\tt=pcrr at 8pt -% Used only for \copyright, replacing plain TeX macro. -\font\sym=psyr at 7pt -\def\copyright{{\sym\char'323}} -%-------------------- end font defs --------------------------------- diff --git a/gdb/doc/rc-pslong.tex b/gdb/doc/rc-pslong.tex index 24643d1..e69de29 100755 --- a/gdb/doc/rc-pslong.tex +++ b/gdb/doc/rc-pslong.tex @@ -1,30 +0,0 @@ -% $Id$ -% To choose PS fonts (long PS fontnames) for the refcard, link -% or copy this file to rcfonts.tex -% -%The Times-Roman family is both more attractive and more compact than -%Computer Modern. On the other hand, while common, it is not free. -%There are three sets of font definitions: -% 1) rc-cm.tex uses the free (Computer Modern) fonts -% 2) rc-ps.tex uses common PostScript fonts, with fontnames from the -% Karl Berry scheme recommended in the documentation for dvips. -% 3) rc-pslong.tex uses common PostScript fonts, with the long names -% used by PostScript programs directly. -% -% One caution: due to differing character ordering between TeX and PS, -%if your TeX is pre-3.0, or if you don't have virtual Courier -%matching the TeX character positions, you might want to use CMtt for -%\tt even if you switch to PostScript fonts for the rest of the text. -% -%-------------------- PostScript fonts (long names) ----------------- -\font\bbf=Times-Bold at 10pt -\font\vbbf=Times-Bold at 12pt -\font\smrm=Times-Roman at 6pt -\font\brm=Times-Roman at 10pt -\font\rm=Times-Roman at 8pt -\font\it=Times-Italic at 8pt -\font\tt=Courier at 8pt -% Used only for \copyright, replacing plain TeX macro. -\font\sym=Symbol at 7pt -\def\copyright{{\sym\char'323}} -%-------------------- end font defs --------------------------------- diff --git a/gdb/doc/rdl-apps.texi b/gdb/doc/rdl-apps.texi index bc92490..e69de29 100755 --- a/gdb/doc/rdl-apps.texi +++ b/gdb/doc/rdl-apps.texi @@ -1,2 +0,0 @@ -@include ./../../readline/doc/rluser.texinfo -@include ./../../readline/doc/inc-hist.texi diff --git a/gdb/doc/threecol.tex b/gdb/doc/threecol.tex deleted file mode 100755 index a4622c4..0000000 --- a/gdb/doc/threecol.tex +++ /dev/null @@ -1,46 +0,0 @@ -%Three-column format for landscape printing on 8.5x11 paper -%pesch 1990 december 31 -%We want output .25 inch *from paper edge*; i.e. -.75in from TeX default -\hoffset=-0.8in \voffset=-0.75in -\newdimen\fullhsize -\fullhsize=10.5in \hsize=3.3in -\def\fulline{\hbox to \fullhsize} -\let\lcr=L \newbox\leftcolumn\newbox\centercolumn -\output={\if L\lcr - \global\setbox\leftcolumn=\columnbox \global\let\lcr=C - \else - \if C\lcr - \global\setbox\centercolumn=\columnbox \global\let\lcr=R - \else \tripleformat \global\let\lcr=L - \fi - \fi -% \ifnum\outputpenalty>-20000 \else\dosupereject\fi - } -% -%ALTERNATIVE FOLDING GUIDES: -% -%For NO printed folding guide, comment out other \def\vdecor's and uncomment: -%\def\vdecor{\hskip .2in plus1fil} -% -%For SOLID LINE folding guide, comment out other \def\vdecor's and uncomment: -%\def\vdecor{\hskip .1in plus1fil \vrule width .1pt \hskip .1in plus1fil} -% -%For SMALL MARKS NEAR TOP AND BOTTOM as folding guide, -%comment out other \def\vdecor's and uncomment: -\def\vdecor{\hskip .1in plus1fil -\vbox to \vsize{\hbox to .1pt{\vrule height 2pt width .1pt}\vfill -\hbox to .1pt{\vrule height 2pt width .1pt}} -\hskip .1in plus1fil} -% -%END OF ALTERNATIVES FOR FOLDING GUIDES -% -\def\tripleformat{\shipout\vbox{\fulline{\box\leftcolumn\vdecor - \box\centercolumn\vdecor - \columnbox} - } - \advancepageno} -\def\columnbox{\leftline{\pagebody}} -\def\bye{\par\vfill - \supereject - \if R\lcr \null\vfill\eject\fi - \end} diff --git a/gdb/ecoff.c b/gdb/ecoff.c index 519763d..e69de29 100755 --- a/gdb/ecoff.c +++ b/gdb/ecoff.c @@ -1,336 +0,0 @@ -/* Byte swap a symbol table in MIPS' format (Third-Eye). - Copyright 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "bfd.h" -#define LANGUAGE_C /* Wierd MIPS crap */ -#include "sym.h" /* MIPS symbols */ -#include "symconst.h" /* MIPS symbols */ -#include "coff/ecoff-ext.h" /* ECOFF external struct defns */ - -void -ecoff_swap_hdr_in (abfd, ext_copy, intern) - bfd *abfd; - struct hdr_ext *ext_copy; - HDRR *intern; -{ - struct hdr_ext ext[1]; - - *ext = *ext_copy; - - intern->magic = bfd_h_get_16 (abfd, (bfd_byte *)ext->h_magic); - intern->vstamp = bfd_h_get_16 (abfd, (bfd_byte *)ext->h_vstamp); - intern->ilineMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ilineMax); - intern->cbLine = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbLine); - intern->cbLineOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbLineOffset); - intern->idnMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_idnMax); - intern->cbDnOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbDnOffset); - intern->ipdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ipdMax); - intern->cbPdOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbPdOffset); - intern->isymMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_isymMax); - intern->cbSymOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbSymOffset); - intern->ioptMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ioptMax); - intern->cbOptOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbOptOffset); - intern->iauxMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iauxMax); - intern->cbAuxOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbAuxOffset); - intern->issMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issMax); - intern->cbSsOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbSsOffset); - intern->issExtMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_issExtMax); - intern->cbSsExtOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbSsExtOffset); - intern->ifdMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_ifdMax); - intern->cbFdOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbFdOffset); - intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_crfd); - intern->cbRfdOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbRfdOffset); - intern->iextMax = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_iextMax); - intern->cbExtOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->h_cbExtOffset); - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - -/* Swap in the file descriptor record. */ - -void -ecoff_swap_fdr_in (abfd, ext_copy, intern) - bfd *abfd; - struct fdr_ext *ext_copy; - FDR *intern; -{ - struct fdr_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - intern->adr = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_adr); - intern->rss = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rss); - intern->issBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_issBase); - intern->cbSs = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cbSs); - intern->isymBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_isymBase); - intern->csym = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_csym); - intern->ilineBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ilineBase); - intern->cline = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cline); - intern->ioptBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_ioptBase); - intern->copt = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_copt); - intern->ipdFirst = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_ipdFirst); - intern->cpd = bfd_h_get_16 (abfd, (bfd_byte *)ext->f_cpd); - intern->iauxBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_iauxBase); - intern->caux = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_caux); - intern->rfdBase = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_rfdBase); - intern->crfd = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_crfd); - - /* now the fun stuff... */ - if (abfd->xvec->header_byteorder_big_p != false) { - intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_BIG) - >> FDR_BITS1_LANG_SH_BIG; - intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_BIG); - intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_BIG); - intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_BIG); - intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_BIG) - >> FDR_BITS2_GLEVEL_SH_BIG; - /* intern->reserved we ignore. */ - } else { - intern->lang = (ext->f_bits1[0] & FDR_BITS1_LANG_LITTLE) - >> FDR_BITS1_LANG_SH_LITTLE; - intern->fMerge = 0 != (ext->f_bits1[0] & FDR_BITS1_FMERGE_LITTLE); - intern->fReadin = 0 != (ext->f_bits1[0] & FDR_BITS1_FREADIN_LITTLE); - intern->fBigendian = 0 != (ext->f_bits1[0] & FDR_BITS1_FBIGENDIAN_LITTLE); - intern->glevel = (ext->f_bits2[0] & FDR_BITS2_GLEVEL_LITTLE) - >> FDR_BITS2_GLEVEL_SH_LITTLE; - /* intern->reserved we ignore. */ - } - - intern->cbLineOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cbLineOffset); - intern->cbLine = bfd_h_get_32 (abfd, (bfd_byte *)ext->f_cbLine); - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - - - -/* Swap in the procedure descriptor record. */ - -void -ecoff_swap_pdr_in (abfd, ext_copy, intern) - bfd *abfd; - struct pdr_ext *ext_copy; - PDR *intern; -{ - struct pdr_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - intern->adr = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_adr); - intern->isym = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_isym); - intern->iline = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iline); - intern->regmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regmask); - intern->regoffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_regoffset); - intern->iopt = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_iopt); - intern->fregmask = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregmask); - intern->fregoffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_fregoffset); - intern->frameoffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_frameoffset); - intern->framereg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_framereg); - intern->pcreg = bfd_h_get_16 (abfd, (bfd_byte *)ext->p_pcreg); - intern->lnLow = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnLow); - intern->lnHigh = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_lnHigh); - intern->cbLineOffset = bfd_h_get_32 (abfd, (bfd_byte *)ext->p_cbLineOffset); - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - - -/* Swap in a symbol record. */ - -void -ecoff_swap_sym_in (abfd, ext_copy, intern) - bfd *abfd; - struct sym_ext *ext_copy; - SYMR *intern; -{ - struct sym_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - intern->iss = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_iss); - intern->value = bfd_h_get_32 (abfd, (bfd_byte *)ext->s_value); - - /* now the fun stuff... */ - if (abfd->xvec->header_byteorder_big_p != false) { - intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_BIG) - >> SYM_BITS1_ST_SH_BIG; - intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_BIG) - << SYM_BITS1_SC_SH_LEFT_BIG) - | ((ext->s_bits2[0] & SYM_BITS2_SC_BIG) - >> SYM_BITS2_SC_SH_BIG); - intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_BIG); - intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_BIG) - << SYM_BITS2_INDEX_SH_LEFT_BIG) - | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_BIG) - | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_BIG); - } else { - intern->st = (ext->s_bits1[0] & SYM_BITS1_ST_LITTLE) - >> SYM_BITS1_ST_SH_LITTLE; - intern->sc = ((ext->s_bits1[0] & SYM_BITS1_SC_LITTLE) - >> SYM_BITS1_SC_SH_LITTLE) - | ((ext->s_bits2[0] & SYM_BITS2_SC_LITTLE) - << SYM_BITS2_SC_SH_LEFT_LITTLE); - intern->reserved = 0 != (ext->s_bits2[0] & SYM_BITS2_RESERVED_LITTLE); - intern->index = ((ext->s_bits2[0] & SYM_BITS2_INDEX_LITTLE) - >> SYM_BITS2_INDEX_SH_LITTLE) - | (ext->s_bits3[0] << SYM_BITS3_INDEX_SH_LEFT_LITTLE) - | (ext->s_bits4[0] << SYM_BITS4_INDEX_SH_LEFT_LITTLE); - } - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - - -/* Swap in an external symbol record. */ - -void -ecoff_swap_ext_in (abfd, ext_copy, intern) - bfd *abfd; - struct ext_ext *ext_copy; - EXTR *intern; -{ - struct ext_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ - if (abfd->xvec->header_byteorder_big_p != false) { - intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_BIG); - intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_BIG); - } else { - intern->jmptbl = 0 != (ext->es_bits1[0] & EXT_BITS1_JMPTBL_LITTLE); - intern->cobol_main = 0 != (ext->es_bits1[0] & EXT_BITS1_COBOL_MAIN_LITTLE); - } - - intern->ifd = bfd_h_get_16 (abfd, (bfd_byte *)ext->es_ifd); - ecoff_swap_sym_in (abfd, &ext->es_asym, &intern->asym); - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - -/* Swap in a type information record. - BIGEND says whether AUX symbols are big-endian or little-endian; this - info comes from the file header record (fh-fBigendian). */ - -void -ecoff_swap_tir_in (bigend, ext_copy, intern) - int bigend; - struct tir_ext *ext_copy; - TIR *intern; -{ - struct tir_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ - if (bigend) { - intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_BIG); - intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_BIG); - intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_BIG) - >> TIR_BITS1_BT_SH_BIG; - intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_BIG) - >> TIR_BITS_TQ4_SH_BIG; - intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_BIG) - >> TIR_BITS_TQ5_SH_BIG; - intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_BIG) - >> TIR_BITS_TQ0_SH_BIG; - intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_BIG) - >> TIR_BITS_TQ1_SH_BIG; - intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_BIG) - >> TIR_BITS_TQ2_SH_BIG; - intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_BIG) - >> TIR_BITS_TQ3_SH_BIG; - } else { - intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_LITTLE); - intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_LITTLE); - intern->bt = (ext->t_bits1[0] & TIR_BITS1_BT_LITTLE) - >> TIR_BITS1_BT_SH_LITTLE; - intern->tq4 = (ext->t_tq45[0] & TIR_BITS_TQ4_LITTLE) - >> TIR_BITS_TQ4_SH_LITTLE; - intern->tq5 = (ext->t_tq45[0] & TIR_BITS_TQ5_LITTLE) - >> TIR_BITS_TQ5_SH_LITTLE; - intern->tq0 = (ext->t_tq01[0] & TIR_BITS_TQ0_LITTLE) - >> TIR_BITS_TQ0_SH_LITTLE; - intern->tq1 = (ext->t_tq01[0] & TIR_BITS_TQ1_LITTLE) - >> TIR_BITS_TQ1_SH_LITTLE; - intern->tq2 = (ext->t_tq23[0] & TIR_BITS_TQ2_LITTLE) - >> TIR_BITS_TQ2_SH_LITTLE; - intern->tq3 = (ext->t_tq23[0] & TIR_BITS_TQ3_LITTLE) - >> TIR_BITS_TQ3_SH_LITTLE; - } - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} - -/* Swap in a relative symbol record. BIGEND says whether it is in - big-endian or little-endian format.*/ - -void -ecoff_swap_rndx_in (bigend, ext_copy, intern) - int bigend; - struct rndx_ext *ext_copy; - RNDXR *intern; -{ - struct rndx_ext ext[1]; - - *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ - if (bigend) { - intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_BIG) - | ((ext->r_bits[1] & RNDX_BITS1_RFD_BIG) - >> RNDX_BITS1_RFD_SH_BIG); - intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_BIG) - << RNDX_BITS1_INDEX_SH_LEFT_BIG) - | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_BIG) - | (ext->r_bits[3] << RNDX_BITS3_INDEX_SH_LEFT_BIG); - } else { - intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_LITTLE) - | ((ext->r_bits[1] & RNDX_BITS1_RFD_LITTLE) - << RNDX_BITS1_RFD_SH_LEFT_LITTLE); - intern->index = ((ext->r_bits[1] & RNDX_BITS1_INDEX_LITTLE) - >> RNDX_BITS1_INDEX_SH_LITTLE) - | (ext->r_bits[2] << RNDX_BITS2_INDEX_SH_LEFT_LITTLE) - | (ext->r_bits[3] << RNDX_BITS3_INDEX_SH_LEFT_LITTLE); - } - -#ifdef TEST - if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); -#endif -} diff --git a/gdb/expread.tab.c b/gdb/expread.tab.c deleted file mode 100755 index bb9894c..0000000 --- a/gdb/expread.tab.c +++ /dev/null @@ -1,2948 +0,0 @@ - -/* A Bison parser, made from ./expread.y */ - -#define INT 258 -#define CHAR 259 -#define UINT 260 -#define FLOAT 261 -#define STRING 262 -#define NAME 263 -#define BLOCKNAME 264 -#define TYPENAME 265 -#define NAME_OR_INT 266 -#define NAME_OR_UINT 267 -#define STRUCT 268 -#define UNION 269 -#define ENUM 270 -#define SIZEOF 271 -#define UNSIGNED 272 -#define COLONCOLON 273 -#define ERROR 274 -#define SIGNED 275 -#define LONG 276 -#define SHORT 277 -#define INT_KEYWORD 278 -#define LAST 279 -#define REGNAME 280 -#define VARIABLE 281 -#define ASSIGN_MODIFY 282 -#define THIS 283 -#define ABOVE_COMMA 284 -#define OR 285 -#define AND 286 -#define EQUAL 287 -#define NOTEQUAL 288 -#define LEQ 289 -#define GEQ 290 -#define LSH 291 -#define RSH 292 -#define UNARY 293 -#define INCREMENT 294 -#define DECREMENT 295 -#define ARROW 296 - -#line 29 "./expread.y" - -#include -#include "defs.h" -#include "param.h" -#include "symtab.h" -#include "frame.h" -#include "expression.h" -#include "value.h" -#include "command.h" - -static struct expression *expout; -static int expout_size; -static int expout_ptr; - -static int yylex (); -static void yyerror (); -static void write_exp_elt (); -static void write_exp_elt_opcode (); -static void write_exp_elt_sym (); -static void write_exp_elt_longcst (); -static void write_exp_elt_dblcst (); -static void write_exp_elt_type (); -static void write_exp_elt_intern (); -static void write_exp_string (); -static void start_arglist (); -static int end_arglist (); -static void free_funcalls (); -static char *copy_name (); -static int parse_number (); - -/* If this is nonzero, this block is used as the lexical context - for symbol names. */ - -static struct block *expression_context_block; - -/* The innermost context required by the stack and register variables - we've encountered so far. */ -struct block *innermost_block; - -/* The block in which the most recently discovered symbol was found. */ -struct block *block_found; - -/* Number of arguments seen so far in innermost function call. */ -static int arglist_len; - -/* Data structure for saving values of arglist_len - for function calls whose arguments contain other function calls. */ - -struct funcall - { - struct funcall *next; - int arglist_len; - }; - -struct funcall *funcall_chain; - -/* This kind of datum is used to represent the name - of a symbol token. */ - -struct stoken - { - char *ptr; - int length; - }; - -struct ttype - { - struct stoken stoken; - struct type *type; - }; - -struct symtoken - { - struct stoken stoken; - struct symbol *sym; - int is_a_field_of_this; - }; - -/* For parsing of complicated types. - An array should be preceded in the list by the size of the array. */ -enum type_pieces - {tp_end = -1, tp_pointer, tp_reference, tp_array, tp_function}; -/* The stack can contain either an enum type_pieces or an int. */ -union type_stack_elt { - enum type_pieces piece; - int int_val; -}; -static union type_stack_elt *type_stack; -static int type_stack_depth, type_stack_size; - -static void push_type (); -static void push_type_int (); -static enum type_pieces pop_type (); -static int pop_type_int (); - -/* Allow debugging of parsing. */ -#define YYDEBUG 1 - -#line 132 "./expread.y" -typedef union - { - LONGEST lval; - unsigned LONGEST ulval; - double dval; - struct symbol *sym; - struct type *tval; - struct stoken sval; - struct ttype tsym; - struct symtoken ssym; - int voidval; - struct block *bval; - enum exp_opcode opcode; - struct internalvar *ivar; - - struct type **tvec; - int *ivec; - } YYSTYPE; - -#ifndef YYLTYPE -typedef - struct yyltype - { - int timestamp; - int first_line; - int first_column; - int last_line; - int last_column; - char *text; - } - yyltype; - -#define YYLTYPE yyltype -#endif - -#include - -#ifndef __STDC__ -#define const -#endif - - - -#define YYFINAL 197 -#define YYFLAG -32768 -#define YYNTBASE 66 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 84) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 59, 2, 2, 2, 51, 37, 2, 58, - 62, 49, 47, 29, 48, 56, 50, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 65, 2, 40, - 31, 41, 32, 46, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 57, 2, 61, 36, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 63, 35, 64, 60, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 30, 33, 34, 38, 39, 42, 43, - 44, 45, 52, 53, 54, 55 -}; - -static const short yyprhs[] = { 0, - 0, 2, 4, 8, 11, 14, 17, 20, 23, 26, - 29, 32, 35, 38, 42, 47, 51, 56, 61, 62, - 68, 69, 71, 75, 80, 85, 89, 93, 97, 101, - 105, 109, 113, 117, 121, 125, 129, 133, 137, 141, - 145, 149, 153, 157, 161, 165, 171, 175, 179, 181, - 183, 185, 187, 189, 191, 193, 195, 197, 199, 204, - 206, 208, 210, 214, 218, 222, 227, 230, 232, 234, - 237, 239, 242, 244, 247, 249, 253, 256, 258, 261, - 263, 266, 270, 273, 275, 279, 286, 295, 305, 307, - 309, 311, 313, 316, 320, 323, 327, 331, 336, 339, - 343, 346, 349, 352, 355, 357, 360, 362, 364, 366, - 368, 370, 372, 376, 378, 380, 382, 384, 386, 388 -}; - -static const short yyrhs[] = { 67, - 0, 68, 0, 67, 29, 68, 0, 49, 68, 0, - 37, 68, 0, 48, 68, 0, 59, 68, 0, 60, - 68, 0, 53, 68, 0, 54, 68, 0, 68, 53, - 0, 68, 54, 0, 16, 68, 0, 68, 55, 82, - 0, 68, 55, 49, 68, 0, 68, 56, 82, 0, - 68, 56, 49, 68, 0, 68, 57, 67, 61, 0, - 0, 68, 58, 69, 70, 62, 0, 0, 68, 0, - 70, 29, 68, 0, 63, 78, 64, 68, 0, 58, - 78, 62, 68, 0, 58, 67, 62, 0, 68, 46, - 68, 0, 68, 49, 68, 0, 68, 50, 68, 0, - 68, 51, 68, 0, 68, 47, 68, 0, 68, 48, - 68, 0, 68, 44, 68, 0, 68, 45, 68, 0, - 68, 38, 68, 0, 68, 39, 68, 0, 68, 42, - 68, 0, 68, 43, 68, 0, 68, 40, 68, 0, - 68, 41, 68, 0, 68, 37, 68, 0, 68, 36, - 68, 0, 68, 35, 68, 0, 68, 34, 68, 0, - 68, 33, 68, 0, 68, 32, 68, 65, 68, 0, - 68, 31, 68, 0, 68, 27, 68, 0, 3, 0, - 11, 0, 5, 0, 12, 0, 4, 0, 6, 0, - 72, 0, 24, 0, 25, 0, 26, 0, 16, 58, - 78, 62, 0, 7, 0, 28, 0, 9, 0, 71, - 18, 82, 0, 71, 18, 82, 0, 79, 18, 82, - 0, 79, 18, 60, 82, 0, 18, 82, 0, 83, - 0, 79, 0, 79, 74, 0, 49, 0, 49, 74, - 0, 37, 0, 37, 74, 0, 75, 0, 58, 74, - 62, 0, 75, 76, 0, 76, 0, 75, 77, 0, - 77, 0, 57, 61, 0, 57, 3, 61, 0, 58, - 62, 0, 73, 0, 79, 18, 49, 0, 78, 58, - 79, 18, 49, 62, 0, 78, 58, 79, 18, 49, - 62, 58, 62, 0, 78, 58, 79, 18, 49, 62, - 58, 81, 62, 0, 10, 0, 23, 0, 21, 0, - 22, 0, 21, 23, 0, 17, 21, 23, 0, 21, - 21, 0, 21, 21, 23, 0, 17, 21, 21, 0, - 17, 21, 21, 23, 0, 22, 23, 0, 17, 22, - 23, 0, 13, 82, 0, 14, 82, 0, 15, 82, - 0, 17, 80, 0, 17, 0, 20, 80, 0, 20, - 0, 10, 0, 23, 0, 21, 0, 22, 0, 78, - 0, 81, 29, 78, 0, 8, 0, 9, 0, 10, - 0, 11, 0, 12, 0, 8, 0, 9, 0 -}; - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 225, 229, 230, 235, 238, 241, 245, 249, 253, 257, - 261, 265, 269, 273, 279, 283, 289, 293, 297, 301, - 307, 310, 314, 318, 324, 330, 336, 340, 344, 348, - 352, 356, 360, 364, 368, 372, 376, 380, 384, 388, - 392, 396, 400, 404, 408, 412, 416, 420, 426, 436, - 449, 461, 474, 481, 488, 491, 497, 503, 509, 516, - 523, 530, 548, 558, 570, 583, 601, 647, 741, 742, - 777, 779, 781, 783, 785, 788, 790, 795, 801, 803, - 807, 809, 813, 817, 818, 820, 822, 825, 832, 834, - 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, - 856, 859, 862, 865, 867, 869, 871, 875, 876, 882, - 888, 897, 902, 909, 910, 911, 912, 913, 916, 917 -}; - -static const char * const yytname[] = { "$", -"error","$illegal.","INT","CHAR","UINT","FLOAT","STRING","NAME","BLOCKNAME","TYPENAME", -"NAME_OR_INT","NAME_OR_UINT","STRUCT","UNION","ENUM","SIZEOF","UNSIGNED","COLONCOLON","ERROR","SIGNED", -"LONG","SHORT","INT_KEYWORD","LAST","REGNAME","VARIABLE","ASSIGN_MODIFY","THIS","','","ABOVE_COMMA", -"'='","'?'","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'", -"'>'","LEQ","GEQ","LSH","RSH","'@'","'+'","'-'","'*'","'/'", -"'%'","UNARY","INCREMENT","DECREMENT","ARROW","'.'","'['","'('","'!'","'~'", -"']'","')'","'{'","'}'","':'","start","exp1","exp","@1","arglist", -"block","variable","ptype","abs_decl","direct_abs_decl","array_mod","func_mod","type","typebase","typename", -"nonempty_typelist","name","name_not_typename","" -}; -#endif - -static const short yyr1[] = { 0, - 66, 67, 67, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 69, 68, - 70, 70, 70, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, - 68, 71, 71, 72, 72, 72, 72, 72, 73, 73, - 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, - 76, 76, 77, 78, 78, 78, 78, 78, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, - 80, 81, 81, 82, 82, 82, 82, 82, 83, 83 -}; - -static const short yyr2[] = { 0, - 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 4, 3, 4, 4, 0, 5, - 0, 1, 3, 4, 4, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 5, 3, 3, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, - 1, 1, 3, 3, 3, 4, 2, 1, 1, 2, - 1, 2, 1, 2, 1, 3, 2, 1, 2, 1, - 2, 3, 2, 1, 3, 6, 8, 9, 1, 1, - 1, 1, 2, 3, 2, 3, 3, 4, 2, 3, - 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, - 1, 1, 3, 1, 1, 1, 1, 1, 1, 1 -}; - -static const short yydefact[] = { 0, - 49, 53, 51, 54, 60, 119, 120, 89, 50, 52, - 0, 0, 0, 0, 105, 0, 107, 91, 92, 90, - 56, 57, 58, 61, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 2, 0, 55, 0, 68, 114, - 115, 116, 117, 118, 101, 102, 103, 0, 13, 108, - 110, 111, 109, 104, 67, 110, 111, 106, 95, 93, - 99, 5, 6, 4, 9, 10, 0, 84, 0, 69, - 7, 8, 0, 69, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 11, 12, 0, - 0, 0, 19, 0, 0, 0, 97, 94, 100, 96, - 26, 0, 0, 0, 73, 71, 0, 0, 70, 75, - 78, 80, 0, 0, 3, 48, 47, 0, 45, 44, - 43, 42, 41, 35, 36, 39, 40, 37, 38, 33, - 34, 27, 31, 32, 28, 29, 30, 0, 14, 0, - 16, 0, 21, 64, 0, 65, 59, 98, 0, 25, - 85, 74, 72, 0, 81, 83, 0, 0, 77, 79, - 24, 0, 15, 17, 18, 22, 0, 66, 0, 82, - 76, 46, 0, 20, 0, 23, 86, 0, 87, 112, - 0, 0, 88, 113, 0, 0, 0 -}; - -static const short yydefgoto[] = { 195, - 67, 35, 153, 177, 36, 37, 68, 119, 120, 121, - 122, 69, 38, 54, 191, 156, 39 -}; - -static const short yypact[] = { 167, --32768,-32768,-32768,-32768,-32768,-32768, 7,-32768,-32768,-32768, - 22, 22, 22, 228, 190, 22, 245, 119, -7,-32768, --32768,-32768,-32768,-32768, 167, 167, 167, 167, 167, 167, - 167, 167, 528, 60, 303, 33,-32768, 76,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768, 167, 216,-32768, - 134, 77,-32768,-32768,-32768,-32768,-32768,-32768, 78,-32768, --32768, 216, 216, 216, 216, 216, 59,-32768, -52, 75, - 216, 216, -55, 80, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167,-32768,-32768, 198, - 249, 167,-32768, 22, 138, -34, 90,-32768,-32768,-32768, --32768, 528, 167, 96, 165, 165, 26, 104,-32768, -50, --32768,-32768, 167, 47, 303, 303, 303, 268, 355, 379, - 402, 424, 445, 464, 464, 479, 479, 479, 479, 506, - 506, 518, 529, 529, 216, 216, 216, 167,-32768, 167, --32768, -2, 167, 98, 22,-32768, 32,-32768, 113, 216, --32768,-32768,-32768, 62,-32768,-32768, 82, 106,-32768,-32768, - 216, 167, 216, 216,-32768, 303, 68,-32768, 137,-32768, --32768, 330, 167,-32768, 132, 303, 139, 105,-32768, 141, - 73, 528,-32768, 141, 196, 201,-32768 -}; - -static const short yypgoto[] = {-32768, - 1, -14,-32768,-32768,-32768,-32768,-32768, 36,-32768, 83, - 85, -29, -28, 200,-32768, 10,-32768 -}; - - -#define YYLAST 587 - - -static const short yytable[] = { 49, - 34, 70, 112, 73, 74, 112, 117, 168, 123, 113, - 62, 63, 64, 65, 66, 61, 71, 72, 106, 70, - 45, 46, 47, 112, -62, 55, 75, 157, 164, 40, - 41, 42, 43, 44, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 104, 17, 18, 19, 20, 21, 22, 23, 175, 24, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 159, 28, 29, 165, 75, 75, 30, - 31, 32, 114, 105, 33, 161, 183, 124, 160, 109, - 110, 192, 152, 40, 41, 42, 43, 44, 171, 149, - 151, 115, 158, 154, 8, -63, 115, 11, 12, 13, - 111, 15, 180, 116, 17, 18, 19, 20, 116, 184, - 179, 117, 118, 173, 193, 174, 117, 118, 176, 59, - 115, 60, 160, 181, 161, 40, 41, 42, 43, 44, - 162, 163, 116, 167, 107, 155, 108, 182, 190, 74, - 117, 118, 194, 74, 178, 166, 189, 166, 186, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 185, 17, 18, 19, 20, - 21, 22, 23, 187, 24, 196, 188, 155, 112, 50, - 197, 115, 169, 25, 170, 40, 41, 42, 43, 44, - 51, 52, 53, 116, 26, 27, 58, 0, 0, 28, - 29, 117, 118, 0, 30, 31, 32, 0, 0, 33, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 148, 17, 18, 19, - 20, 21, 22, 23, 50, 24, 40, 41, 42, 43, - 44, 0, 0, 0, 25, 56, 57, 53, 98, 99, - 100, 101, 102, 103, 0, 26, 27, 0, 0, 0, - 28, 29, 0, 0, 0, 48, 31, 32, 0, 0, - 33, 0, 0, 0, 76, 0, 0, 150, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 0, - 98, 99, 100, 101, 102, 103, 0, 0, 0, 76, - 0, 0, 172, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 0, 98, 99, 100, 101, 102, - 103, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 0, 98, 99, 100, 101, 102, 103, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 0, 98, 99, 100, - 101, 102, 103, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 0, 98, 99, 100, 101, 102, 103, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 0, 98, 99, 100, 101, 102, 103, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 0, 98, 99, 100, 101, - 102, 103, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 0, 98, 99, 100, - 101, 102, 103, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 0, 98, 99, 100, 101, - 102, 103, 90, 91, 92, 93, 94, 95, 96, 97, - 0, 98, 99, 100, 101, 102, 103, 8, 0, 0, - 11, 12, 13, 0, 15, 0, 0, 17, 18, 19, - 20, 92, 93, 94, 95, 96, 97, 0, 98, 99, - 100, 101, 102, 103, 93, 94, 95, 96, 97, 0, - 98, 99, 100, 101, 102, 103, 0, 95, 96, 97, - 0, 98, 99, 100, 101, 102, 103 -}; - -static const short yycheck[] = { 14, - 0, 30, 58, 33, 33, 58, 57, 58, 64, 62, - 25, 26, 27, 28, 29, 23, 31, 32, 48, 48, - 11, 12, 13, 58, 18, 16, 29, 62, 3, 8, - 9, 10, 11, 12, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 18, 20, 21, 22, 23, 24, 25, 26, 61, 28, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 112, 53, 54, 61, 29, 29, 58, - 59, 60, 18, 18, 63, 49, 29, 18, 113, 23, - 23, 29, 102, 8, 9, 10, 11, 12, 123, 100, - 101, 37, 23, 104, 10, 18, 37, 13, 14, 15, - 62, 17, 61, 49, 20, 21, 22, 23, 49, 62, - 18, 57, 58, 148, 62, 150, 57, 58, 153, 21, - 37, 23, 157, 62, 49, 8, 9, 10, 11, 12, - 115, 116, 49, 118, 21, 60, 23, 172, 188, 188, - 57, 58, 192, 192, 155, 62, 62, 62, 183, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 49, 20, 21, 22, 23, - 24, 25, 26, 62, 28, 0, 58, 60, 58, 10, - 0, 37, 120, 37, 120, 8, 9, 10, 11, 12, - 21, 22, 23, 49, 48, 49, 17, -1, -1, 53, - 54, 57, 58, -1, 58, 59, 60, -1, -1, 63, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 49, 20, 21, 22, - 23, 24, 25, 26, 10, 28, 8, 9, 10, 11, - 12, -1, -1, -1, 37, 21, 22, 23, 53, 54, - 55, 56, 57, 58, -1, 48, 49, -1, -1, -1, - 53, 54, -1, -1, -1, 58, 59, 60, -1, -1, - 63, -1, -1, -1, 27, -1, -1, 49, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, - 53, 54, 55, 56, 57, 58, -1, -1, -1, 27, - -1, -1, 65, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, -1, 53, 54, 55, 56, 57, - 58, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, -1, 53, 54, 55, 56, 57, 58, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, -1, 53, 54, 55, - 56, 57, 58, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - -1, 53, 54, 55, 56, 57, 58, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, -1, 53, 54, 55, 56, 57, 58, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, -1, 53, 54, 55, 56, - 57, 58, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, -1, 53, 54, 55, - 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, -1, 53, 54, 55, 56, - 57, 58, 44, 45, 46, 47, 48, 49, 50, 51, - -1, 53, 54, 55, 56, 57, 58, 10, -1, -1, - 13, 14, 15, -1, 17, -1, -1, 20, 21, 22, - 23, 46, 47, 48, 49, 50, 51, -1, 53, 54, - 55, 56, 57, 58, 47, 48, 49, 50, 51, -1, - 53, 54, 55, 56, 57, 58, -1, 49, 50, 51, - -1, 53, 54, 55, 56, 57, 58 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/latest/lib/bison.simple" - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - - -#ifndef alloca -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* Not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) -#include -#else /* Not sparc */ -#ifdef MSDOS -#include -#endif /* MSDOS */ -#endif /* Not sparc. */ -#endif /* Not GNU C. */ -#endif /* alloca not defined. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#define YYLEX yylex(&yylval, &yylloc) -#else -#define YYLEX yylex(&yylval) -#endif -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_bcopy (from, to, count) - char *from; - char *to; - int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_bcopy (char *from, char *to, int count) -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif - -#line 160 "/usr/latest/lib/bison.simple" -int -yyparse() -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - -#define YYPOPSTACK (yyvsp--, yysp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yysp--) -#endif - - int yystacksize = YYINITDEPTH; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), -#ifdef YYLSP_NEEDED - &yyls1, size * sizeof (*yylsp), -#endif - &yystacksize); - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif - - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]); -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symboles being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 3: -#line 231 "./expread.y" -{ write_exp_elt_opcode (BINOP_COMMA); ; - break;} -case 4: -#line 236 "./expread.y" -{ write_exp_elt_opcode (UNOP_IND); ; - break;} -case 5: -#line 239 "./expread.y" -{ write_exp_elt_opcode (UNOP_ADDR); ; - break;} -case 6: -#line 242 "./expread.y" -{ write_exp_elt_opcode (UNOP_NEG); ; - break;} -case 7: -#line 246 "./expread.y" -{ write_exp_elt_opcode (UNOP_ZEROP); ; - break;} -case 8: -#line 250 "./expread.y" -{ write_exp_elt_opcode (UNOP_LOGNOT); ; - break;} -case 9: -#line 254 "./expread.y" -{ write_exp_elt_opcode (UNOP_PREINCREMENT); ; - break;} -case 10: -#line 258 "./expread.y" -{ write_exp_elt_opcode (UNOP_PREDECREMENT); ; - break;} -case 11: -#line 262 "./expread.y" -{ write_exp_elt_opcode (UNOP_POSTINCREMENT); ; - break;} -case 12: -#line 266 "./expread.y" -{ write_exp_elt_opcode (UNOP_POSTDECREMENT); ; - break;} -case 13: -#line 270 "./expread.y" -{ write_exp_elt_opcode (UNOP_SIZEOF); ; - break;} -case 14: -#line 274 "./expread.y" -{ write_exp_elt_opcode (STRUCTOP_PTR); - write_exp_string (yyvsp[0].sval); - write_exp_elt_opcode (STRUCTOP_PTR); ; - break;} -case 15: -#line 280 "./expread.y" -{ write_exp_elt_opcode (STRUCTOP_MPTR); ; - break;} -case 16: -#line 284 "./expread.y" -{ write_exp_elt_opcode (STRUCTOP_STRUCT); - write_exp_string (yyvsp[0].sval); - write_exp_elt_opcode (STRUCTOP_STRUCT); ; - break;} -case 17: -#line 290 "./expread.y" -{ write_exp_elt_opcode (STRUCTOP_MEMBER); ; - break;} -case 18: -#line 294 "./expread.y" -{ write_exp_elt_opcode (BINOP_SUBSCRIPT); ; - break;} -case 19: -#line 300 "./expread.y" -{ start_arglist (); ; - break;} -case 20: -#line 302 "./expread.y" -{ write_exp_elt_opcode (OP_FUNCALL); - write_exp_elt_longcst ((LONGEST) end_arglist ()); - write_exp_elt_opcode (OP_FUNCALL); ; - break;} -case 22: -#line 311 "./expread.y" -{ arglist_len = 1; ; - break;} -case 23: -#line 315 "./expread.y" -{ arglist_len++; ; - break;} -case 24: -#line 319 "./expread.y" -{ write_exp_elt_opcode (UNOP_MEMVAL); - write_exp_elt_type (yyvsp[-2].tval); - write_exp_elt_opcode (UNOP_MEMVAL); ; - break;} -case 25: -#line 325 "./expread.y" -{ write_exp_elt_opcode (UNOP_CAST); - write_exp_elt_type (yyvsp[-2].tval); - write_exp_elt_opcode (UNOP_CAST); ; - break;} -case 26: -#line 331 "./expread.y" -{ ; - break;} -case 27: -#line 337 "./expread.y" -{ write_exp_elt_opcode (BINOP_REPEAT); ; - break;} -case 28: -#line 341 "./expread.y" -{ write_exp_elt_opcode (BINOP_MUL); ; - break;} -case 29: -#line 345 "./expread.y" -{ write_exp_elt_opcode (BINOP_DIV); ; - break;} -case 30: -#line 349 "./expread.y" -{ write_exp_elt_opcode (BINOP_REM); ; - break;} -case 31: -#line 353 "./expread.y" -{ write_exp_elt_opcode (BINOP_ADD); ; - break;} -case 32: -#line 357 "./expread.y" -{ write_exp_elt_opcode (BINOP_SUB); ; - break;} -case 33: -#line 361 "./expread.y" -{ write_exp_elt_opcode (BINOP_LSH); ; - break;} -case 34: -#line 365 "./expread.y" -{ write_exp_elt_opcode (BINOP_RSH); ; - break;} -case 35: -#line 369 "./expread.y" -{ write_exp_elt_opcode (BINOP_EQUAL); ; - break;} -case 36: -#line 373 "./expread.y" -{ write_exp_elt_opcode (BINOP_NOTEQUAL); ; - break;} -case 37: -#line 377 "./expread.y" -{ write_exp_elt_opcode (BINOP_LEQ); ; - break;} -case 38: -#line 381 "./expread.y" -{ write_exp_elt_opcode (BINOP_GEQ); ; - break;} -case 39: -#line 385 "./expread.y" -{ write_exp_elt_opcode (BINOP_LESS); ; - break;} -case 40: -#line 389 "./expread.y" -{ write_exp_elt_opcode (BINOP_GTR); ; - break;} -case 41: -#line 393 "./expread.y" -{ write_exp_elt_opcode (BINOP_LOGAND); ; - break;} -case 42: -#line 397 "./expread.y" -{ write_exp_elt_opcode (BINOP_LOGXOR); ; - break;} -case 43: -#line 401 "./expread.y" -{ write_exp_elt_opcode (BINOP_LOGIOR); ; - break;} -case 44: -#line 405 "./expread.y" -{ write_exp_elt_opcode (BINOP_AND); ; - break;} -case 45: -#line 409 "./expread.y" -{ write_exp_elt_opcode (BINOP_OR); ; - break;} -case 46: -#line 413 "./expread.y" -{ write_exp_elt_opcode (TERNOP_COND); ; - break;} -case 47: -#line 417 "./expread.y" -{ write_exp_elt_opcode (BINOP_ASSIGN); ; - break;} -case 48: -#line 421 "./expread.y" -{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); - write_exp_elt_opcode (yyvsp[-1].opcode); - write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ; - break;} -case 49: -#line 427 "./expread.y" -{ write_exp_elt_opcode (OP_LONG); - if (yyvsp[0].lval == (int) yyvsp[0].lval || yyvsp[0].lval == (unsigned int) yyvsp[0].lval) - write_exp_elt_type (builtin_type_int); - else - write_exp_elt_type (BUILTIN_TYPE_LONGEST); - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - write_exp_elt_opcode (OP_LONG); ; - break;} -case 50: -#line 437 "./expread.y" -{ YYSTYPE val; - parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val); - write_exp_elt_opcode (OP_LONG); - if (val.lval == (int) val.lval || - val.lval == (unsigned int) val.lval) - write_exp_elt_type (builtin_type_int); - else - write_exp_elt_type (BUILTIN_TYPE_LONGEST); - write_exp_elt_longcst (val.lval); - write_exp_elt_opcode (OP_LONG); ; - break;} -case 51: -#line 450 "./expread.y" -{ - write_exp_elt_opcode (OP_LONG); - if (yyvsp[0].ulval == (unsigned int) yyvsp[0].ulval) - write_exp_elt_type (builtin_type_unsigned_int); - else - write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST); - write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval); - write_exp_elt_opcode (OP_LONG); - ; - break;} -case 52: -#line 462 "./expread.y" -{ YYSTYPE val; - parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val); - write_exp_elt_opcode (OP_LONG); - if (val.ulval == (unsigned int) val.ulval) - write_exp_elt_type (builtin_type_unsigned_int); - else - write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST); - write_exp_elt_longcst ((LONGEST)val.ulval); - write_exp_elt_opcode (OP_LONG); - ; - break;} -case 53: -#line 475 "./expread.y" -{ write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_char); - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - write_exp_elt_opcode (OP_LONG); ; - break;} -case 54: -#line 482 "./expread.y" -{ write_exp_elt_opcode (OP_DOUBLE); - write_exp_elt_type (builtin_type_double); - write_exp_elt_dblcst (yyvsp[0].dval); - write_exp_elt_opcode (OP_DOUBLE); ; - break;} -case 56: -#line 492 "./expread.y" -{ write_exp_elt_opcode (OP_LAST); - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - write_exp_elt_opcode (OP_LAST); ; - break;} -case 57: -#line 498 "./expread.y" -{ write_exp_elt_opcode (OP_REGISTER); - write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); - write_exp_elt_opcode (OP_REGISTER); ; - break;} -case 58: -#line 504 "./expread.y" -{ write_exp_elt_opcode (OP_INTERNALVAR); - write_exp_elt_intern (yyvsp[0].ivar); - write_exp_elt_opcode (OP_INTERNALVAR); ; - break;} -case 59: -#line 510 "./expread.y" -{ write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval)); - write_exp_elt_opcode (OP_LONG); ; - break;} -case 60: -#line 517 "./expread.y" -{ write_exp_elt_opcode (OP_STRING); - write_exp_string (yyvsp[0].sval); - write_exp_elt_opcode (OP_STRING); ; - break;} -case 61: -#line 524 "./expread.y" -{ write_exp_elt_opcode (OP_THIS); - write_exp_elt_opcode (OP_THIS); ; - break;} -case 62: -#line 531 "./expread.y" -{ - if (yyvsp[0].ssym.sym != 0) - yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym); - else - { - struct symtab *tem = - lookup_symtab (copy_name (yyvsp[0].ssym.stoken)); - if (tem) - yyval.bval = BLOCKVECTOR_BLOCK - (BLOCKVECTOR (tem), STATIC_BLOCK); - else - error ("No file or function \"%s\".", - copy_name (yyvsp[0].ssym.stoken)); - } - ; - break;} -case 63: -#line 549 "./expread.y" -{ struct symbol *tem - = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, - VAR_NAMESPACE, 0, NULL); - if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) - error ("No function \"%s\" in specified context.", - copy_name (yyvsp[0].sval)); - yyval.bval = SYMBOL_BLOCK_VALUE (tem); ; - break;} -case 64: -#line 559 "./expread.y" -{ struct symbol *sym; - sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, - VAR_NAMESPACE, 0, NULL); - if (sym == 0) - error ("No symbol \"%s\" in specified context.", - copy_name (yyvsp[0].sval)); - write_exp_elt_opcode (OP_VAR_VALUE); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); ; - break;} -case 65: -#line 571 "./expread.y" -{ - struct type *type = yyvsp[-2].tval; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) - error ("`%s' is not defined as an aggregate type.", - TYPE_NAME (type)); - - write_exp_elt_opcode (OP_SCOPE); - write_exp_elt_type (type); - write_exp_string (yyvsp[0].sval); - write_exp_elt_opcode (OP_SCOPE); - ; - break;} -case 66: -#line 584 "./expread.y" -{ - struct type *type = yyvsp[-3].tval; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) - error ("`%s' is not defined as an aggregate type.", - TYPE_NAME (type)); - - if (strcmp (type_name_no_tag (type), yyvsp[0].sval.ptr)) - error ("invalid destructor `%s::~%s'", - type_name_no_tag (type), yyvsp[0].sval.ptr); - - write_exp_elt_opcode (OP_SCOPE); - write_exp_elt_type (type); - write_exp_string (yyvsp[0].sval); - write_exp_elt_opcode (OP_SCOPE); - write_exp_elt_opcode (UNOP_LOGNOT); - ; - break;} -case 67: -#line 602 "./expread.y" -{ - char *name = copy_name (yyvsp[0].sval); - struct symbol *sym; - int i; - - sym = - lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL); - if (sym) - { - write_exp_elt_opcode (OP_VAR_VALUE); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); - break; - } - for (i = 0; i < misc_function_count; i++) - if (!strcmp (misc_function_vector[i].name, name)) - break; - - if (i < misc_function_count) - { - enum misc_function_type mft = - misc_function_vector[i].type; - - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address); - write_exp_elt_opcode (OP_LONG); - write_exp_elt_opcode (UNOP_MEMVAL); - if (mft == mf_data || mft == mf_bss) - write_exp_elt_type (builtin_type_int); - else if (mft == mf_text) - write_exp_elt_type (lookup_function_type (builtin_type_int)); - else - write_exp_elt_type (builtin_type_char); - write_exp_elt_opcode (UNOP_MEMVAL); - } - else - if (symtab_list == 0 - && partial_symtab_list == 0) - error ("No symbol table is loaded. Use the \"file\" command."); - else - error ("No symbol \"%s\" in current context.", name); - ; - break;} -case 68: -#line 648 "./expread.y" -{ struct symbol *sym = yyvsp[0].ssym.sym; - - if (sym) - { - switch (sym->class) - { - case LOC_REGISTER: - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_LOCAL: - case LOC_LOCAL_ARG: - if (innermost_block == 0 || - contained_in (block_found, - innermost_block)) - innermost_block = block_found; - case LOC_UNDEF: - case LOC_CONST: - case LOC_STATIC: - case LOC_TYPEDEF: - case LOC_LABEL: - case LOC_BLOCK: - case LOC_CONST_BYTES: - - /* In this case the expression can - be evaluated regardless of what - frame we are in, so there is no - need to check for the - innermost_block. These cases are - listed so that gcc -Wall will - report types that may not have - been considered. */ - - break; - } - write_exp_elt_opcode (OP_VAR_VALUE); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); - } - else if (yyvsp[0].ssym.is_a_field_of_this) - { - /* C++: it hangs off of `this'. Must - not inadvertently convert from a method call - to data ref. */ - if (innermost_block == 0 || - contained_in (block_found, innermost_block)) - innermost_block = block_found; - write_exp_elt_opcode (OP_THIS); - write_exp_elt_opcode (OP_THIS); - write_exp_elt_opcode (STRUCTOP_PTR); - write_exp_string (yyvsp[0].ssym.stoken); - write_exp_elt_opcode (STRUCTOP_PTR); - } - else - { - register int i; - register char *arg = copy_name (yyvsp[0].ssym.stoken); - - /* FIXME, this search is linear! At least - optimize the strcmp with a 1-char cmp... */ - for (i = 0; i < misc_function_count; i++) - if (!strcmp (misc_function_vector[i].name, arg)) - break; - - if (i < misc_function_count) - { - enum misc_function_type mft = - misc_function_vector[i].type; - - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address); - write_exp_elt_opcode (OP_LONG); - write_exp_elt_opcode (UNOP_MEMVAL); - if (mft == mf_data || mft == mf_bss) - write_exp_elt_type (builtin_type_int); - else if (mft == mf_text) - write_exp_elt_type (lookup_function_type (builtin_type_int)); - else - write_exp_elt_type (builtin_type_char); - write_exp_elt_opcode (UNOP_MEMVAL); - } - else if (symtab_list == 0 - && partial_symtab_list == 0) - error ("No symbol table is loaded. Use the \"file\" command."); - else - error ("No symbol \"%s\" in current context.", - copy_name (yyvsp[0].ssym.stoken)); - } - ; - break;} -case 70: -#line 743 "./expread.y" -{ - /* This is where the interesting stuff happens. */ - int done = 0; - int array_size; - struct type *follow_type = yyvsp[-1].tval; - - while (!done) - switch (pop_type ()) - { - case tp_end: - done = 1; - break; - case tp_pointer: - follow_type = lookup_pointer_type (follow_type); - break; - case tp_reference: - follow_type = lookup_reference_type (follow_type); - break; - case tp_array: - array_size = pop_type_int (); - if (array_size != -1) - follow_type = create_array_type (follow_type, - array_size); - else - follow_type = lookup_pointer_type (follow_type); - break; - case tp_function: - follow_type = lookup_function_type (follow_type); - break; - } - yyval.tval = follow_type; - ; - break;} -case 71: -#line 778 "./expread.y" -{ push_type (tp_pointer); yyval.voidval = 0; ; - break;} -case 72: -#line 780 "./expread.y" -{ push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ; - break;} -case 73: -#line 782 "./expread.y" -{ push_type (tp_reference); yyval.voidval = 0; ; - break;} -case 74: -#line 784 "./expread.y" -{ push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ; - break;} -case 76: -#line 789 "./expread.y" -{ yyval.voidval = yyvsp[-1].voidval; ; - break;} -case 77: -#line 791 "./expread.y" -{ - push_type_int (yyvsp[0].lval); - push_type (tp_array); - ; - break;} -case 78: -#line 796 "./expread.y" -{ - push_type_int (yyvsp[0].lval); - push_type (tp_array); - yyval.voidval = 0; - ; - break;} -case 79: -#line 802 "./expread.y" -{ push_type (tp_function); ; - break;} -case 80: -#line 804 "./expread.y" -{ push_type (tp_function); ; - break;} -case 81: -#line 808 "./expread.y" -{ yyval.lval = -1; ; - break;} -case 82: -#line 810 "./expread.y" -{ yyval.lval = yyvsp[-1].lval; ; - break;} -case 83: -#line 814 "./expread.y" -{ yyval.voidval = 0; ; - break;} -case 85: -#line 819 "./expread.y" -{ yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); ; - break;} -case 86: -#line 821 "./expread.y" -{ yyval.tval = lookup_member_type (yyvsp[-5].tval, yyvsp[-3].tval); ; - break;} -case 87: -#line 823 "./expread.y" -{ yyval.tval = lookup_member_type - (lookup_function_type (yyvsp[-7].tval), yyvsp[-5].tval); ; - break;} -case 88: -#line 826 "./expread.y" -{ yyval.tval = lookup_member_type - (lookup_function_type (yyvsp[-8].tval), yyvsp[-6].tval); - free (yyvsp[-1].tvec); ; - break;} -case 89: -#line 833 "./expread.y" -{ yyval.tval = yyvsp[0].tsym.type; ; - break;} -case 90: -#line 835 "./expread.y" -{ yyval.tval = builtin_type_int; ; - break;} -case 91: -#line 837 "./expread.y" -{ yyval.tval = builtin_type_long; ; - break;} -case 92: -#line 839 "./expread.y" -{ yyval.tval = builtin_type_short; ; - break;} -case 93: -#line 841 "./expread.y" -{ yyval.tval = builtin_type_long; ; - break;} -case 94: -#line 843 "./expread.y" -{ yyval.tval = builtin_type_unsigned_long; ; - break;} -case 95: -#line 845 "./expread.y" -{ yyval.tval = builtin_type_long_long; ; - break;} -case 96: -#line 847 "./expread.y" -{ yyval.tval = builtin_type_long_long; ; - break;} -case 97: -#line 849 "./expread.y" -{ yyval.tval = builtin_type_unsigned_long_long; ; - break;} -case 98: -#line 851 "./expread.y" -{ yyval.tval = builtin_type_unsigned_long_long; ; - break;} -case 99: -#line 853 "./expread.y" -{ yyval.tval = builtin_type_short; ; - break;} -case 100: -#line 855 "./expread.y" -{ yyval.tval = builtin_type_unsigned_short; ; - break;} -case 101: -#line 857 "./expread.y" -{ yyval.tval = lookup_struct (copy_name (yyvsp[0].sval), - expression_context_block); ; - break;} -case 102: -#line 860 "./expread.y" -{ yyval.tval = lookup_union (copy_name (yyvsp[0].sval), - expression_context_block); ; - break;} -case 103: -#line 863 "./expread.y" -{ yyval.tval = lookup_enum (copy_name (yyvsp[0].sval), - expression_context_block); ; - break;} -case 104: -#line 866 "./expread.y" -{ yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); ; - break;} -case 105: -#line 868 "./expread.y" -{ yyval.tval = builtin_type_unsigned_int; ; - break;} -case 106: -#line 870 "./expread.y" -{ yyval.tval = yyvsp[0].tsym.type; ; - break;} -case 107: -#line 872 "./expread.y" -{ yyval.tval = builtin_type_int; ; - break;} -case 109: -#line 877 "./expread.y" -{ - yyval.tsym.stoken.ptr = "int"; - yyval.tsym.stoken.length = 3; - yyval.tsym.type = builtin_type_int; - ; - break;} -case 110: -#line 883 "./expread.y" -{ - yyval.tsym.stoken.ptr = "long"; - yyval.tsym.stoken.length = 4; - yyval.tsym.type = builtin_type_long; - ; - break;} -case 111: -#line 889 "./expread.y" -{ - yyval.tsym.stoken.ptr = "short"; - yyval.tsym.stoken.length = 5; - yyval.tsym.type = builtin_type_short; - ; - break;} -case 112: -#line 898 "./expread.y" -{ yyval.tvec = (struct type **)xmalloc (sizeof (struct type *) * 2); - yyval.tvec[0] = (struct type *)0; - yyval.tvec[1] = yyvsp[0].tval; - ; - break;} -case 113: -#line 903 "./expread.y" -{ int len = sizeof (struct type *) * ++(yyvsp[-2].ivec[0]); - yyval.tvec = (struct type **)xrealloc (yyvsp[-2].tvec, len); - yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval; - ; - break;} -case 114: -#line 909 "./expread.y" -{ yyval.sval = yyvsp[0].ssym.stoken; ; - break;} -case 115: -#line 910 "./expread.y" -{ yyval.sval = yyvsp[0].ssym.stoken; ; - break;} -case 116: -#line 911 "./expread.y" -{ yyval.sval = yyvsp[0].tsym.stoken; ; - break;} -case 117: -#line 912 "./expread.y" -{ yyval.sval = yyvsp[0].ssym.stoken; ; - break;} -case 118: -#line 913 "./expread.y" -{ yyval.sval = yyvsp[0].ssym.stoken; ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 423 "/usr/latest/lib/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) xmalloc(size + 15); - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; -} -#line 928 "./expread.y" - - -/* Begin counting arguments for a function call, - saving the data about any containing call. */ - -static void -start_arglist () -{ - register struct funcall *new = (struct funcall *) xmalloc (sizeof (struct funcall)); - - new->next = funcall_chain; - new->arglist_len = arglist_len; - arglist_len = 0; - funcall_chain = new; -} - -/* Return the number of arguments in a function call just terminated, - and restore the data for the containing function call. */ - -static int -end_arglist () -{ - register int val = arglist_len; - register struct funcall *call = funcall_chain; - funcall_chain = call->next; - arglist_len = call->arglist_len; - free (call); - return val; -} - -/* Free everything in the funcall chain. - Used when there is an error inside parsing. */ - -static void -free_funcalls () -{ - register struct funcall *call, *next; - - for (call = funcall_chain; call; call = next) - { - next = call->next; - free (call); - } -} - -/* This page contains the functions for adding data to the struct expression - being constructed. */ - -/* Add one element to the end of the expression. */ - -/* To avoid a bug in the Sun 4 compiler, we pass things that can fit into - a register through here */ - -static void -write_exp_elt (expelt) - union exp_element expelt; -{ - if (expout_ptr >= expout_size) - { - expout_size *= 2; - expout = (struct expression *) xrealloc (expout, - sizeof (struct expression) - + expout_size * sizeof (union exp_element)); - } - expout->elts[expout_ptr++] = expelt; -} - -static void -write_exp_elt_opcode (expelt) - enum exp_opcode expelt; -{ - union exp_element tmp; - - tmp.opcode = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_sym (expelt) - struct symbol *expelt; -{ - union exp_element tmp; - - tmp.symbol = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_longcst (expelt) - LONGEST expelt; -{ - union exp_element tmp; - - tmp.longconst = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_dblcst (expelt) - double expelt; -{ - union exp_element tmp; - - tmp.doubleconst = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_type (expelt) - struct type *expelt; -{ - union exp_element tmp; - - tmp.type = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_intern (expelt) - struct internalvar *expelt; -{ - union exp_element tmp; - - tmp.internalvar = expelt; - - write_exp_elt (tmp); -} - -/* Add a string constant to the end of the expression. - Follow it by its length in bytes, as a separate exp_element. */ - -static void -write_exp_string (str) - struct stoken str; -{ - register int len = str.length; - register int lenelt - = (len + sizeof (union exp_element)) / sizeof (union exp_element); - - expout_ptr += lenelt; - - if (expout_ptr >= expout_size) - { - expout_size = max (expout_size * 2, expout_ptr + 10); - expout = (struct expression *) - xrealloc (expout, (sizeof (struct expression) - + (expout_size * sizeof (union exp_element)))); - } - bcopy (str.ptr, (char *) &expout->elts[expout_ptr - lenelt], len); - ((char *) &expout->elts[expout_ptr - lenelt])[len] = 0; - write_exp_elt_longcst ((LONGEST) len); -} - -/* During parsing of a C expression, the pointer to the next character - is in this variable. */ - -static char *lexptr; - -/* Tokens that refer to names do so with explicit pointer and length, - so they can share the storage that lexptr is parsing. - - When it is necessary to pass a name to a function that expects - a null-terminated string, the substring is copied out - into a block of storage that namecopy points to. - - namecopy is allocated once, guaranteed big enough, for each parsing. */ - -static char *namecopy; - -/* Current depth in parentheses within the expression. */ - -static int paren_depth; - -/* Nonzero means stop parsing on first comma (if not within parentheses). */ - -static int comma_terminates; - -/* Take care of parsing a number (anything that starts with a digit). - Set yylval and return the token type; update lexptr. - LEN is the number of characters in it. */ - -/*** Needs some error checking for the float case ***/ - -static int -parse_number (p, len, parsed_float, putithere) - register char *p; - register int len; - int parsed_float; - YYSTYPE *putithere; -{ - register LONGEST n = 0; - register int i; - register int c; - register int base = input_radix; - int unsigned_p = 0; - - extern double atof (); - - if (parsed_float) - { - /* It's a float since it contains a point or an exponent. */ - putithere->dval = atof (p); - return FLOAT; - } - - /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ - if (p[0] == '0') - switch (p[1]) - { - case 'x': - case 'X': - if (len >= 3) - { - p += 2; - base = 16; - len -= 2; - } - break; - - case 't': - case 'T': - case 'd': - case 'D': - if (len >= 3) - { - p += 2; - base = 10; - len -= 2; - } - break; - - default: - base = 8; - break; - } - - while (len-- > 0) - { - c = *p++; - if (c >= 'A' && c <= 'Z') - c += 'a' - 'A'; - if (c != 'l' && c != 'u') - n *= base; - if (c >= '0' && c <= '9') - n += i = c - '0'; - else - { - if (base > 10 && c >= 'a' && c <= 'f') - n += i = c - 'a' + 10; - else if (len == 0 && c == 'l') - ; - else if (len == 0 && c == 'u') - unsigned_p = 1; - else - return ERROR; /* Char not a digit */ - } - if (i >= base) - return ERROR; /* Invalid digit in this base */ - } - - if (unsigned_p) - { - putithere->ulval = n; - return UINT; - } - else - { - putithere->lval = n; - return INT; - } -} - -struct token -{ - char *operator; - int token; - enum exp_opcode opcode; -}; - -const static struct token tokentab3[] = - { - {">>=", ASSIGN_MODIFY, BINOP_RSH}, - {"<<=", ASSIGN_MODIFY, BINOP_LSH} - }; - -const static struct token tokentab2[] = - { - {"+=", ASSIGN_MODIFY, BINOP_ADD}, - {"-=", ASSIGN_MODIFY, BINOP_SUB}, - {"*=", ASSIGN_MODIFY, BINOP_MUL}, - {"/=", ASSIGN_MODIFY, BINOP_DIV}, - {"%=", ASSIGN_MODIFY, BINOP_REM}, - {"|=", ASSIGN_MODIFY, BINOP_LOGIOR}, - {"&=", ASSIGN_MODIFY, BINOP_LOGAND}, - {"^=", ASSIGN_MODIFY, BINOP_LOGXOR}, - {"++", INCREMENT, BINOP_END}, - {"--", DECREMENT, BINOP_END}, - {"->", ARROW, BINOP_END}, - {"&&", AND, BINOP_END}, - {"||", OR, BINOP_END}, - {"::", COLONCOLON, BINOP_END}, - {"<<", LSH, BINOP_END}, - {">>", RSH, BINOP_END}, - {"==", EQUAL, BINOP_END}, - {"!=", NOTEQUAL, BINOP_END}, - {"<=", LEQ, BINOP_END}, - {">=", GEQ, BINOP_END} - }; - -/* assign machine-independent names to certain registers - * (unless overridden by the REGISTER_NAMES table) - */ -struct std_regs { - char *name; - int regnum; -} std_regs[] = { -#ifdef PC_REGNUM - { "pc", PC_REGNUM }, -#endif -#ifdef FP_REGNUM - { "fp", FP_REGNUM }, -#endif -#ifdef SP_REGNUM - { "sp", SP_REGNUM }, -#endif -#ifdef PS_REGNUM - { "ps", PS_REGNUM }, -#endif -}; - -#define NUM_STD_REGS (sizeof std_regs / sizeof std_regs[0]) - -/* Read one token, getting characters through lexptr. */ - -static int -yylex () -{ - register int c; - register int namelen; - register unsigned i; - register char *tokstart; - - retry: - - tokstart = lexptr; - /* See if it is a special token of length 3. */ - for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) - if (!strncmp (tokstart, tokentab3[i].operator, 3)) - { - lexptr += 3; - yylval.opcode = tokentab3[i].opcode; - return tokentab3[i].token; - } - - /* See if it is a special token of length 2. */ - for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (!strncmp (tokstart, tokentab2[i].operator, 2)) - { - lexptr += 2; - yylval.opcode = tokentab2[i].opcode; - return tokentab2[i].token; - } - - switch (c = *tokstart) - { - case 0: - return 0; - - case ' ': - case '\t': - case '\n': - lexptr++; - goto retry; - - case '\'': - lexptr++; - c = *lexptr++; - if (c == '\\') - c = parse_escape (&lexptr); - yylval.lval = c; - c = *lexptr++; - if (c != '\'') - error ("Invalid character constant."); - return CHAR; - - case '(': - paren_depth++; - lexptr++; - return c; - - case ')': - if (paren_depth == 0) - return 0; - paren_depth--; - lexptr++; - return c; - - case ',': - if (comma_terminates && paren_depth == 0) - return 0; - lexptr++; - return c; - - case '.': - /* Might be a floating point number. */ - if (lexptr[1] < '0' || lexptr[1] > '9') - goto symbol; /* Nope, must be a symbol. */ - /* FALL THRU into number case. */ - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - { - /* It's a number. */ - int got_dot = 0, got_e = 0, toktype; - register char *p = tokstart; - int hex = input_radix > 10; - - if (c == '0' && (p[1] == 'x' || p[1] == 'X')) - { - p += 2; - hex = 1; - } - else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) - { - p += 2; - hex = 0; - } - - for (;; ++p) - { - if (!hex && !got_e && (*p == 'e' || *p == 'E')) - got_dot = got_e = 1; - else if (!hex && !got_dot && *p == '.') - got_dot = 1; - else if (got_e && (p[-1] == 'e' || p[-1] == 'E') - && (*p == '-' || *p == '+')) - /* This is the sign of the exponent, not the end of the - number. */ - continue; - /* We will take any letters or digits. parse_number will - complain if past the radix, or if L or U are not final. */ - else if ((*p < '0' || *p > '9') - && ((*p < 'a' || *p > 'z') - && (*p < 'A' || *p > 'Z'))) - break; - } - toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval); - if (toktype == ERROR) - { - char *err_copy = (char *) alloca (p - tokstart + 1); - - bcopy (tokstart, err_copy, p - tokstart); - err_copy[p - tokstart] = 0; - error ("Invalid number \"%s\".", err_copy); - } - lexptr = p; - return toktype; - } - - case '+': - case '-': - case '*': - case '/': - case '%': - case '|': - case '&': - case '^': - case '~': - case '!': - case '@': - case '<': - case '>': - case '[': - case ']': - case '?': - case ':': - case '=': - case '{': - case '}': - symbol: - lexptr++; - return c; - - case '"': - for (namelen = 1; (c = tokstart[namelen]) != '"'; namelen++) - if (c == '\\') - { - c = tokstart[++namelen]; - if (c >= '0' && c <= '9') - { - c = tokstart[++namelen]; - if (c >= '0' && c <= '9') - c = tokstart[++namelen]; - } - } - yylval.sval.ptr = tokstart + 1; - yylval.sval.length = namelen - 1; - lexptr += namelen + 1; - return STRING; - } - - if (!(c == '_' || c == '$' - || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) - /* We must have come across a bad character (e.g. ';'). */ - error ("Invalid character '%c' in expression.", c); - - /* It's a name. See how long it is. */ - namelen = 0; - for (c = tokstart[namelen]; - (c == '_' || c == '$' || (c >= '0' && c <= '9') - || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); - c = tokstart[++namelen]) - ; - - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') - { - return 0; - } - - lexptr += namelen; - - /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1) - and $$digits (equivalent to $<-digits> if you could type that). - Make token type LAST, and put the number (the digits) in yylval. */ - - if (*tokstart == '$') - { - register int negate = 0; - c = 1; - /* Double dollar means negate the number and add -1 as well. - Thus $$ alone means -1. */ - if (namelen >= 2 && tokstart[1] == '$') - { - negate = 1; - c = 2; - } - if (c == namelen) - { - /* Just dollars (one or two) */ - yylval.lval = - negate; - return LAST; - } - /* Is the rest of the token digits? */ - for (; c < namelen; c++) - if (!(tokstart[c] >= '0' && tokstart[c] <= '9')) - break; - if (c == namelen) - { - yylval.lval = atoi (tokstart + 1 + negate); - if (negate) - yylval.lval = - yylval.lval; - return LAST; - } - } - - /* Handle tokens that refer to machine registers: - $ followed by a register name. */ - - if (*tokstart == '$') { - for (c = 0; c < NUM_REGS; c++) - if (namelen - 1 == strlen (reg_names[c]) - && !strncmp (tokstart + 1, reg_names[c], namelen - 1)) - { - yylval.lval = c; - return REGNAME; - } - for (c = 0; c < NUM_STD_REGS; c++) - if (namelen - 1 == strlen (std_regs[c].name) - && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1)) - { - yylval.lval = std_regs[c].regnum; - return REGNAME; - } - } - /* Catch specific keywords. Should be done with a data structure. */ - switch (namelen) - { - case 8: - if (!strncmp (tokstart, "unsigned", 8)) - return UNSIGNED; - break; - case 6: - if (!strncmp (tokstart, "struct", 6)) - return STRUCT; - if (!strncmp (tokstart, "signed", 6)) - return SIGNED; - if (!strncmp (tokstart, "sizeof", 6)) - return SIZEOF; - break; - case 5: - if (!strncmp (tokstart, "union", 5)) - return UNION; - if (!strncmp (tokstart, "short", 5)) - return SHORT; - break; - case 4: - if (!strncmp (tokstart, "enum", 4)) - return ENUM; - if (!strncmp (tokstart, "long", 4)) - return LONG; - if (!strncmp (tokstart, "this", 4)) - { - static const char this_name[] = - { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' }; - - if (lookup_symbol (this_name, expression_context_block, - VAR_NAMESPACE, 0, NULL)) - return THIS; - } - break; - case 3: - if (!strncmp (tokstart, "int", 3)) - return INT_KEYWORD; - break; - default: - break; - } - - yylval.sval.ptr = tokstart; - yylval.sval.length = namelen; - - /* Any other names starting in $ are debugger internal variables. */ - - if (*tokstart == '$') - { - yylval.ivar = lookup_internalvar (copy_name (yylval.sval) + 1); - return VARIABLE; - } - - /* Use token-type BLOCKNAME for symbols that happen to be defined as - functions or symtabs. If this is not so, then ... - Use token-type TYPENAME for symbols that happen to be defined - currently as names of types; NAME for other symbols. - The caller is not constrained to care about the distinction. */ - { - char *tmp = copy_name (yylval.sval); - struct symbol *sym; - int is_a_field_of_this = 0; - int hextype; - - sym = lookup_symbol (tmp, expression_context_block, - VAR_NAMESPACE, &is_a_field_of_this, NULL); - if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) || - lookup_partial_symtab (tmp)) - { - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return BLOCKNAME; - } - if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) - { - yylval.tsym.type = SYMBOL_TYPE (sym); - return TYPENAME; - } - if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0) - return TYPENAME; - - /* Input names that aren't symbols but ARE valid hex numbers, - when the input radix permits them, can be names or numbers - depending on the parse. Note we support radixes > 16 here. */ - if (!sym && - ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) || - (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) - { - YYSTYPE newlval; /* Its value is ignored. */ - hextype = parse_number (tokstart, namelen, 0, &newlval); - if (hextype == INT) - { - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return NAME_OR_INT; - } - if (hextype == UINT) - { - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return NAME_OR_UINT; - } - } - - /* Any other kind of symbol */ - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return NAME; - } -} - -static void -yyerror (msg) - char *msg; -{ - error ("Invalid syntax in expression."); -} - -/* Return a null-terminated temporary copy of the name - of a string token. */ - -static char * -copy_name (token) - struct stoken token; -{ - bcopy (token.ptr, namecopy, token.length); - namecopy[token.length] = 0; - return namecopy; -} - -/* Reverse an expression from suffix form (in which it is constructed) - to prefix form (in which we can conveniently print or execute it). */ - -static void prefixify_subexp (); - -static void -prefixify_expression (expr) - register struct expression *expr; -{ - register int len = sizeof (struct expression) + - expr->nelts * sizeof (union exp_element); - register struct expression *temp; - register int inpos = expr->nelts, outpos = 0; - - temp = (struct expression *) alloca (len); - - /* Copy the original expression into temp. */ - bcopy (expr, temp, len); - - prefixify_subexp (temp, expr, inpos, outpos); -} - -/* Return the number of exp_elements in the subexpression of EXPR - whose last exp_element is at index ENDPOS - 1 in EXPR. */ - -static int -length_of_subexp (expr, endpos) - register struct expression *expr; - register int endpos; -{ - register int oplen = 1; - register int args = 0; - register int i; - - if (endpos < 0) - error ("?error in length_of_subexp"); - - i = (int) expr->elts[endpos - 1].opcode; - - switch (i) - { - /* C++ */ - case OP_SCOPE: - oplen = 4 + ((expr->elts[endpos - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - break; - - case OP_LONG: - case OP_DOUBLE: - oplen = 4; - break; - - case OP_VAR_VALUE: - case OP_LAST: - case OP_REGISTER: - case OP_INTERNALVAR: - oplen = 3; - break; - - case OP_FUNCALL: - oplen = 3; - args = 1 + expr->elts[endpos - 2].longconst; - break; - - case UNOP_CAST: - case UNOP_MEMVAL: - oplen = 3; - args = 1; - break; - - case STRUCTOP_STRUCT: - case STRUCTOP_PTR: - args = 1; - case OP_STRING: - oplen = 3 + ((expr->elts[endpos - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - break; - - case TERNOP_COND: - args = 3; - break; - - case BINOP_ASSIGN_MODIFY: - oplen = 3; - args = 2; - break; - - /* C++ */ - case OP_THIS: - oplen = 2; - break; - - default: - args = 1 + (i < (int) BINOP_END); - } - - while (args > 0) - { - oplen += length_of_subexp (expr, endpos - oplen); - args--; - } - - return oplen; -} - -/* Copy the subexpression ending just before index INEND in INEXPR - into OUTEXPR, starting at index OUTBEG. - In the process, convert it from suffix to prefix form. */ - -static void -prefixify_subexp (inexpr, outexpr, inend, outbeg) - register struct expression *inexpr; - struct expression *outexpr; - register int inend; - int outbeg; -{ - register int oplen = 1; - register int args = 0; - register int i; - int *arglens; - enum exp_opcode opcode; - - /* Compute how long the last operation is (in OPLEN), - and also how many preceding subexpressions serve as - arguments for it (in ARGS). */ - - opcode = inexpr->elts[inend - 1].opcode; - switch (opcode) - { - /* C++ */ - case OP_SCOPE: - oplen = 4 + ((inexpr->elts[inend - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - break; - - case OP_LONG: - case OP_DOUBLE: - oplen = 4; - break; - - case OP_VAR_VALUE: - case OP_LAST: - case OP_REGISTER: - case OP_INTERNALVAR: - oplen = 3; - break; - - case OP_FUNCALL: - oplen = 3; - args = 1 + inexpr->elts[inend - 2].longconst; - break; - - case UNOP_CAST: - case UNOP_MEMVAL: - oplen = 3; - args = 1; - break; - - case STRUCTOP_STRUCT: - case STRUCTOP_PTR: - args = 1; - case OP_STRING: - oplen = 3 + ((inexpr->elts[inend - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - - break; - - case TERNOP_COND: - args = 3; - break; - - case BINOP_ASSIGN_MODIFY: - oplen = 3; - args = 2; - break; - - /* C++ */ - case OP_THIS: - oplen = 2; - break; - - default: - args = 1 + ((int) opcode < (int) BINOP_END); - } - - /* Copy the final operator itself, from the end of the input - to the beginning of the output. */ - inend -= oplen; - bcopy (&inexpr->elts[inend], &outexpr->elts[outbeg], - oplen * sizeof (union exp_element)); - outbeg += oplen; - - /* Find the lengths of the arg subexpressions. */ - arglens = (int *) alloca (args * sizeof (int)); - for (i = args - 1; i >= 0; i--) - { - oplen = length_of_subexp (inexpr, inend); - arglens[i] = oplen; - inend -= oplen; - } - - /* Now copy each subexpression, preserving the order of - the subexpressions, but prefixifying each one. - In this loop, inend starts at the beginning of - the expression this level is working on - and marches forward over the arguments. - outbeg does similarly in the output. */ - for (i = 0; i < args; i++) - { - oplen = arglens[i]; - inend += oplen; - prefixify_subexp (inexpr, outexpr, inend, outbeg); - outbeg += oplen; - } -} - -/* This page contains the two entry points to this file. */ - -/* Read a C expression from the string *STRINGPTR points to, - parse it, and return a pointer to a struct expression that we malloc. - Use block BLOCK as the lexical context for variable names; - if BLOCK is zero, use the block of the selected stack frame. - Meanwhile, advance *STRINGPTR to point after the expression, - at the first nonwhite character that is not part of the expression - (possibly a null character). - - If COMMA is nonzero, stop if a comma is reached. */ - -struct expression * -parse_c_1 (stringptr, block, comma) - char **stringptr; - struct block *block; - int comma; -{ - struct cleanup *old_chain; - - lexptr = *stringptr; - - paren_depth = 0; - type_stack_depth = 0; - - comma_terminates = comma; - - if (lexptr == 0 || *lexptr == 0) - error_no_arg ("expression to compute"); - - old_chain = make_cleanup (free_funcalls, 0); - funcall_chain = 0; - - expression_context_block = block ? block : get_selected_block (); - - namecopy = (char *) alloca (strlen (lexptr) + 1); - expout_size = 10; - expout_ptr = 0; - expout = (struct expression *) - xmalloc (sizeof (struct expression) - + expout_size * sizeof (union exp_element)); - make_cleanup (free_current_contents, &expout); - if (yyparse ()) - yyerror (NULL); - discard_cleanups (old_chain); - expout->nelts = expout_ptr; - expout = (struct expression *) - xrealloc (expout, - sizeof (struct expression) - + expout_ptr * sizeof (union exp_element)); - prefixify_expression (expout); - *stringptr = lexptr; - return expout; -} - -/* Parse STRING as an expression, and complain if this fails - to use up all of the contents of STRING. */ - -struct expression * -parse_c_expression (string) - char *string; -{ - register struct expression *exp; - exp = parse_c_1 (&string, 0, 0); - if (*string) - error ("Junk after end of expression."); - return exp; -} - -static void -push_type (tp) - enum type_pieces tp; -{ - if (type_stack_depth == type_stack_size) - { - type_stack_size *= 2; - type_stack = (union type_stack_elt *) - xrealloc (type_stack, type_stack_size * sizeof (*type_stack)); - } - type_stack[type_stack_depth++].piece = tp; -} - -static void -push_type_int (n) - int n; -{ - if (type_stack_depth == type_stack_size) - { - type_stack_size *= 2; - type_stack = (union type_stack_elt *) - xrealloc (type_stack, type_stack_size * sizeof (*type_stack)); - } - type_stack[type_stack_depth++].int_val = n; -} - -static enum type_pieces -pop_type () -{ - if (type_stack_depth) - return type_stack[--type_stack_depth].piece; - return tp_end; -} - -static int -pop_type_int () -{ - if (type_stack_depth) - return type_stack[--type_stack_depth].int_val; - /* "Can't happen". */ - return 0; -} - -void -_initialize_expread () -{ - type_stack_size = 80; - type_stack_depth = 0; - type_stack = (union type_stack_elt *) - xmalloc (type_stack_size * sizeof (*type_stack)); -} diff --git a/gdb/expread.y b/gdb/expread.y deleted file mode 100755 index cc62554..0000000 --- a/gdb/expread.y +++ /dev/null @@ -1,1989 +0,0 @@ -/* Parse C expressions for GDB. - Copyright (C) 1986, 1989, 1990, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Parse a C expression from text in a string, - and return the result as a struct expression pointer. - That structure contains arithmetic operations in reverse polish, - with constants represented by operations that are followed by special data. - See expression.h for the details of the format. - What is important here is that it can be built up sequentially - during the process of parsing; the lower levels of the tree always - come first in the result. */ - -%{ -#include -#include "defs.h" -#include "param.h" -#include "symtab.h" -#include "frame.h" -#include "expression.h" -#include "value.h" -#include "command.h" - -static struct expression *expout; -static int expout_size; -static int expout_ptr; - -static int yylex (); -static void yyerror (); -static void write_exp_elt (); -static void write_exp_elt_opcode (); -static void write_exp_elt_sym (); -static void write_exp_elt_longcst (); -static void write_exp_elt_dblcst (); -static void write_exp_elt_type (); -static void write_exp_elt_intern (); -static void write_exp_string (); -static void start_arglist (); -static int end_arglist (); -static void free_funcalls (); -static char *copy_name (); -static int parse_number (); - -/* If this is nonzero, this block is used as the lexical context - for symbol names. */ - -static struct block *expression_context_block; - -/* The innermost context required by the stack and register variables - we've encountered so far. */ -struct block *innermost_block; - -/* The block in which the most recently discovered symbol was found. */ -struct block *block_found; - -/* Number of arguments seen so far in innermost function call. */ -static int arglist_len; - -/* Data structure for saving values of arglist_len - for function calls whose arguments contain other function calls. */ - -struct funcall - { - struct funcall *next; - int arglist_len; - }; - -struct funcall *funcall_chain; - -/* This kind of datum is used to represent the name - of a symbol token. */ - -struct stoken - { - char *ptr; - int length; - }; - -struct ttype - { - struct stoken stoken; - struct type *type; - }; - -struct symtoken - { - struct stoken stoken; - struct symbol *sym; - int is_a_field_of_this; - }; - -/* For parsing of complicated types. - An array should be preceded in the list by the size of the array. */ -enum type_pieces - {tp_end = -1, tp_pointer, tp_reference, tp_array, tp_function}; -/* The stack can contain either an enum type_pieces or an int. */ -union type_stack_elt { - enum type_pieces piece; - int int_val; -}; -static union type_stack_elt *type_stack; -static int type_stack_depth, type_stack_size; - -static void push_type (); -static void push_type_int (); -static enum type_pieces pop_type (); -static int pop_type_int (); - -/* Allow debugging of parsing. */ -#define YYDEBUG 1 -%} - -/* Although the yacc "value" of an expression is not used, - since the result is stored in the structure being created, - other node types do have values. */ - -%union - { - LONGEST lval; - unsigned LONGEST ulval; - double dval; - struct symbol *sym; - struct type *tval; - struct stoken sval; - struct ttype tsym; - struct symtoken ssym; - int voidval; - struct block *bval; - enum exp_opcode opcode; - struct internalvar *ivar; - - struct type **tvec; - int *ivec; - } - -%type exp exp1 start variable -%type type typebase -%type nonempty_typelist -%type block - -/* Fancy type parsing. */ -%type func_mod direct_abs_decl abs_decl -%type ptype -%type array_mod - -%token INT CHAR -%token UINT -%token FLOAT - -/* Both NAME and TYPENAME tokens represent symbols in the input, - and both convey their data as strings. - But a TYPENAME is a string that happens to be defined as a typedef - or builtin type name (such as int or char) - and a NAME is any other symbol. - - Contexts where this distinction is not important can use the - nonterminal "name", which matches either NAME or TYPENAME. */ - -%token STRING -%token NAME BLOCKNAME -%token TYPENAME -%type name -%type name_not_typename -%type typename - -/* A NAME_OR_INT is a symbol which is not known in the symbol table, - but which would parse as a valid number in the current input radix. - E.g. "c" when input_radix==16. Depending on the parse, it will be - turned into a name or into a number. NAME_OR_UINT ditto. */ - -%token NAME_OR_INT NAME_OR_UINT - -%token STRUCT UNION ENUM SIZEOF UNSIGNED COLONCOLON -%token ERROR - -/* Special type cases, put in to allow the parser to distinguish different - legal basetypes. */ -%token SIGNED LONG SHORT INT_KEYWORD - -%token LAST REGNAME - -%token VARIABLE - -%token ASSIGN_MODIFY - -/* C++ */ -%token THIS - -%left ',' -%left ABOVE_COMMA -%right '=' ASSIGN_MODIFY -%right '?' -%left OR -%left AND -%left '|' -%left '^' -%left '&' -%left EQUAL NOTEQUAL -%left '<' '>' LEQ GEQ -%left LSH RSH -%left '@' -%left '+' '-' -%left '*' '/' '%' -%right UNARY INCREMENT DECREMENT -%right ARROW '.' '[' '(' -%left COLONCOLON - -%% - -start : exp1 - ; - -/* Expressions, including the comma operator. */ -exp1 : exp - | exp1 ',' exp - { write_exp_elt_opcode (BINOP_COMMA); } - ; - -/* Expressions, not including the comma operator. */ -exp : '*' exp %prec UNARY - { write_exp_elt_opcode (UNOP_IND); } - -exp : '&' exp %prec UNARY - { write_exp_elt_opcode (UNOP_ADDR); } - -exp : '-' exp %prec UNARY - { write_exp_elt_opcode (UNOP_NEG); } - ; - -exp : '!' exp %prec UNARY - { write_exp_elt_opcode (UNOP_ZEROP); } - ; - -exp : '~' exp %prec UNARY - { write_exp_elt_opcode (UNOP_LOGNOT); } - ; - -exp : INCREMENT exp %prec UNARY - { write_exp_elt_opcode (UNOP_PREINCREMENT); } - ; - -exp : DECREMENT exp %prec UNARY - { write_exp_elt_opcode (UNOP_PREDECREMENT); } - ; - -exp : exp INCREMENT %prec UNARY - { write_exp_elt_opcode (UNOP_POSTINCREMENT); } - ; - -exp : exp DECREMENT %prec UNARY - { write_exp_elt_opcode (UNOP_POSTDECREMENT); } - ; - -exp : SIZEOF exp %prec UNARY - { write_exp_elt_opcode (UNOP_SIZEOF); } - ; - -exp : exp ARROW name - { write_exp_elt_opcode (STRUCTOP_PTR); - write_exp_string ($3); - write_exp_elt_opcode (STRUCTOP_PTR); } - ; - -exp : exp ARROW '*' exp - { write_exp_elt_opcode (STRUCTOP_MPTR); } - ; - -exp : exp '.' name - { write_exp_elt_opcode (STRUCTOP_STRUCT); - write_exp_string ($3); - write_exp_elt_opcode (STRUCTOP_STRUCT); } - ; - -exp : exp '.' '*' exp - { write_exp_elt_opcode (STRUCTOP_MEMBER); } - ; - -exp : exp '[' exp1 ']' - { write_exp_elt_opcode (BINOP_SUBSCRIPT); } - ; - -exp : exp '(' - /* This is to save the value of arglist_len - being accumulated by an outer function call. */ - { start_arglist (); } - arglist ')' %prec ARROW - { write_exp_elt_opcode (OP_FUNCALL); - write_exp_elt_longcst ((LONGEST) end_arglist ()); - write_exp_elt_opcode (OP_FUNCALL); } - ; - -arglist : - ; - -arglist : exp - { arglist_len = 1; } - ; - -arglist : arglist ',' exp %prec ABOVE_COMMA - { arglist_len++; } - ; - -exp : '{' type '}' exp %prec UNARY - { write_exp_elt_opcode (UNOP_MEMVAL); - write_exp_elt_type ($2); - write_exp_elt_opcode (UNOP_MEMVAL); } - ; - -exp : '(' type ')' exp %prec UNARY - { write_exp_elt_opcode (UNOP_CAST); - write_exp_elt_type ($2); - write_exp_elt_opcode (UNOP_CAST); } - ; - -exp : '(' exp1 ')' - { } - ; - -/* Binary operators in order of decreasing precedence. */ - -exp : exp '@' exp - { write_exp_elt_opcode (BINOP_REPEAT); } - ; - -exp : exp '*' exp - { write_exp_elt_opcode (BINOP_MUL); } - ; - -exp : exp '/' exp - { write_exp_elt_opcode (BINOP_DIV); } - ; - -exp : exp '%' exp - { write_exp_elt_opcode (BINOP_REM); } - ; - -exp : exp '+' exp - { write_exp_elt_opcode (BINOP_ADD); } - ; - -exp : exp '-' exp - { write_exp_elt_opcode (BINOP_SUB); } - ; - -exp : exp LSH exp - { write_exp_elt_opcode (BINOP_LSH); } - ; - -exp : exp RSH exp - { write_exp_elt_opcode (BINOP_RSH); } - ; - -exp : exp EQUAL exp - { write_exp_elt_opcode (BINOP_EQUAL); } - ; - -exp : exp NOTEQUAL exp - { write_exp_elt_opcode (BINOP_NOTEQUAL); } - ; - -exp : exp LEQ exp - { write_exp_elt_opcode (BINOP_LEQ); } - ; - -exp : exp GEQ exp - { write_exp_elt_opcode (BINOP_GEQ); } - ; - -exp : exp '<' exp - { write_exp_elt_opcode (BINOP_LESS); } - ; - -exp : exp '>' exp - { write_exp_elt_opcode (BINOP_GTR); } - ; - -exp : exp '&' exp - { write_exp_elt_opcode (BINOP_LOGAND); } - ; - -exp : exp '^' exp - { write_exp_elt_opcode (BINOP_LOGXOR); } - ; - -exp : exp '|' exp - { write_exp_elt_opcode (BINOP_LOGIOR); } - ; - -exp : exp AND exp - { write_exp_elt_opcode (BINOP_AND); } - ; - -exp : exp OR exp - { write_exp_elt_opcode (BINOP_OR); } - ; - -exp : exp '?' exp ':' exp %prec '?' - { write_exp_elt_opcode (TERNOP_COND); } - ; - -exp : exp '=' exp - { write_exp_elt_opcode (BINOP_ASSIGN); } - ; - -exp : exp ASSIGN_MODIFY exp - { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); - write_exp_elt_opcode ($2); - write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); } - ; - -exp : INT - { write_exp_elt_opcode (OP_LONG); - if ($1 == (int) $1 || $1 == (unsigned int) $1) - write_exp_elt_type (builtin_type_int); - else - write_exp_elt_type (BUILTIN_TYPE_LONGEST); - write_exp_elt_longcst ((LONGEST) $1); - write_exp_elt_opcode (OP_LONG); } - ; - -exp : NAME_OR_INT - { YYSTYPE val; - parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val); - write_exp_elt_opcode (OP_LONG); - if (val.lval == (int) val.lval || - val.lval == (unsigned int) val.lval) - write_exp_elt_type (builtin_type_int); - else - write_exp_elt_type (BUILTIN_TYPE_LONGEST); - write_exp_elt_longcst (val.lval); - write_exp_elt_opcode (OP_LONG); } - ; - -exp : UINT - { - write_exp_elt_opcode (OP_LONG); - if ($1 == (unsigned int) $1) - write_exp_elt_type (builtin_type_unsigned_int); - else - write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST); - write_exp_elt_longcst ((LONGEST) $1); - write_exp_elt_opcode (OP_LONG); - } - ; - -exp : NAME_OR_UINT - { YYSTYPE val; - parse_number ($1.stoken.ptr, $1.stoken.length, 0, &val); - write_exp_elt_opcode (OP_LONG); - if (val.ulval == (unsigned int) val.ulval) - write_exp_elt_type (builtin_type_unsigned_int); - else - write_exp_elt_type (BUILTIN_TYPE_UNSIGNED_LONGEST); - write_exp_elt_longcst ((LONGEST)val.ulval); - write_exp_elt_opcode (OP_LONG); - } - ; - -exp : CHAR - { write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_char); - write_exp_elt_longcst ((LONGEST) $1); - write_exp_elt_opcode (OP_LONG); } - ; - -exp : FLOAT - { write_exp_elt_opcode (OP_DOUBLE); - write_exp_elt_type (builtin_type_double); - write_exp_elt_dblcst ($1); - write_exp_elt_opcode (OP_DOUBLE); } - ; - -exp : variable - ; - -exp : LAST - { write_exp_elt_opcode (OP_LAST); - write_exp_elt_longcst ((LONGEST) $1); - write_exp_elt_opcode (OP_LAST); } - ; - -exp : REGNAME - { write_exp_elt_opcode (OP_REGISTER); - write_exp_elt_longcst ((LONGEST) $1); - write_exp_elt_opcode (OP_REGISTER); } - ; - -exp : VARIABLE - { write_exp_elt_opcode (OP_INTERNALVAR); - write_exp_elt_intern ($1); - write_exp_elt_opcode (OP_INTERNALVAR); } - ; - -exp : SIZEOF '(' type ')' %prec UNARY - { write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ($3)); - write_exp_elt_opcode (OP_LONG); } - ; - -exp : STRING - { write_exp_elt_opcode (OP_STRING); - write_exp_string ($1); - write_exp_elt_opcode (OP_STRING); } - ; - -/* C++. */ -exp : THIS - { write_exp_elt_opcode (OP_THIS); - write_exp_elt_opcode (OP_THIS); } - ; - -/* end of C++. */ - -block : BLOCKNAME - { - if ($1.sym != 0) - $$ = SYMBOL_BLOCK_VALUE ($1.sym); - else - { - struct symtab *tem = - lookup_symtab (copy_name ($1.stoken)); - if (tem) - $$ = BLOCKVECTOR_BLOCK - (BLOCKVECTOR (tem), STATIC_BLOCK); - else - error ("No file or function \"%s\".", - copy_name ($1.stoken)); - } - } - ; - -block : block COLONCOLON name - { struct symbol *tem - = lookup_symbol (copy_name ($3), $1, - VAR_NAMESPACE, 0, NULL); - if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) - error ("No function \"%s\" in specified context.", - copy_name ($3)); - $$ = SYMBOL_BLOCK_VALUE (tem); } - ; - -variable: block COLONCOLON name - { struct symbol *sym; - sym = lookup_symbol (copy_name ($3), $1, - VAR_NAMESPACE, 0, NULL); - if (sym == 0) - error ("No symbol \"%s\" in specified context.", - copy_name ($3)); - write_exp_elt_opcode (OP_VAR_VALUE); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); } - ; - -variable: typebase COLONCOLON name - { - struct type *type = $1; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) - error ("`%s' is not defined as an aggregate type.", - TYPE_NAME (type)); - - write_exp_elt_opcode (OP_SCOPE); - write_exp_elt_type (type); - write_exp_string ($3); - write_exp_elt_opcode (OP_SCOPE); - } - | typebase COLONCOLON '~' name - { - struct type *type = $1; - if (TYPE_CODE (type) != TYPE_CODE_STRUCT - && TYPE_CODE (type) != TYPE_CODE_UNION) - error ("`%s' is not defined as an aggregate type.", - TYPE_NAME (type)); - - if (strcmp (type_name_no_tag (type), $4.ptr)) - error ("invalid destructor `%s::~%s'", - type_name_no_tag (type), $4.ptr); - - write_exp_elt_opcode (OP_SCOPE); - write_exp_elt_type (type); - write_exp_string ($4); - write_exp_elt_opcode (OP_SCOPE); - write_exp_elt_opcode (UNOP_LOGNOT); - } - | COLONCOLON name - { - char *name = copy_name ($2); - struct symbol *sym; - int i; - - sym = - lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL); - if (sym) - { - write_exp_elt_opcode (OP_VAR_VALUE); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); - break; - } - for (i = 0; i < misc_function_count; i++) - if (!strcmp (misc_function_vector[i].name, name)) - break; - - if (i < misc_function_count) - { - enum misc_function_type mft = - misc_function_vector[i].type; - - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address); - write_exp_elt_opcode (OP_LONG); - write_exp_elt_opcode (UNOP_MEMVAL); - if (mft == mf_data || mft == mf_bss) - write_exp_elt_type (builtin_type_int); - else if (mft == mf_text) - write_exp_elt_type (lookup_function_type (builtin_type_int)); - else - write_exp_elt_type (builtin_type_char); - write_exp_elt_opcode (UNOP_MEMVAL); - } - else - if (symtab_list == 0 - && partial_symtab_list == 0) - error ("No symbol table is loaded. Use the \"file\" command."); - else - error ("No symbol \"%s\" in current context.", name); - } - ; - -variable: name_not_typename - { struct symbol *sym = $1.sym; - - if (sym) - { - switch (sym->class) - { - case LOC_REGISTER: - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_LOCAL: - case LOC_LOCAL_ARG: - if (innermost_block == 0 || - contained_in (block_found, - innermost_block)) - innermost_block = block_found; - case LOC_UNDEF: - case LOC_CONST: - case LOC_STATIC: - case LOC_TYPEDEF: - case LOC_LABEL: - case LOC_BLOCK: - case LOC_CONST_BYTES: - - /* In this case the expression can - be evaluated regardless of what - frame we are in, so there is no - need to check for the - innermost_block. These cases are - listed so that gcc -Wall will - report types that may not have - been considered. */ - - break; - } - write_exp_elt_opcode (OP_VAR_VALUE); - write_exp_elt_sym (sym); - write_exp_elt_opcode (OP_VAR_VALUE); - } - else if ($1.is_a_field_of_this) - { - /* C++: it hangs off of `this'. Must - not inadvertently convert from a method call - to data ref. */ - if (innermost_block == 0 || - contained_in (block_found, innermost_block)) - innermost_block = block_found; - write_exp_elt_opcode (OP_THIS); - write_exp_elt_opcode (OP_THIS); - write_exp_elt_opcode (STRUCTOP_PTR); - write_exp_string ($1.stoken); - write_exp_elt_opcode (STRUCTOP_PTR); - } - else - { - register int i; - register char *arg = copy_name ($1.stoken); - - /* FIXME, this search is linear! At least - optimize the strcmp with a 1-char cmp... */ - for (i = 0; i < misc_function_count; i++) - if (!strcmp (misc_function_vector[i].name, arg)) - break; - - if (i < misc_function_count) - { - enum misc_function_type mft = - misc_function_vector[i].type; - - write_exp_elt_opcode (OP_LONG); - write_exp_elt_type (builtin_type_int); - write_exp_elt_longcst ((LONGEST) misc_function_vector[i].address); - write_exp_elt_opcode (OP_LONG); - write_exp_elt_opcode (UNOP_MEMVAL); - if (mft == mf_data || mft == mf_bss) - write_exp_elt_type (builtin_type_int); - else if (mft == mf_text) - write_exp_elt_type (lookup_function_type (builtin_type_int)); - else - write_exp_elt_type (builtin_type_char); - write_exp_elt_opcode (UNOP_MEMVAL); - } - else if (symtab_list == 0 - && partial_symtab_list == 0) - error ("No symbol table is loaded. Use the \"file\" command."); - else - error ("No symbol \"%s\" in current context.", - copy_name ($1.stoken)); - } - } - ; - - -ptype : typebase - | typebase abs_decl - { - /* This is where the interesting stuff happens. */ - int done = 0; - int array_size; - struct type *follow_type = $1; - - while (!done) - switch (pop_type ()) - { - case tp_end: - done = 1; - break; - case tp_pointer: - follow_type = lookup_pointer_type (follow_type); - break; - case tp_reference: - follow_type = lookup_reference_type (follow_type); - break; - case tp_array: - array_size = pop_type_int (); - if (array_size != -1) - follow_type = create_array_type (follow_type, - array_size); - else - follow_type = lookup_pointer_type (follow_type); - break; - case tp_function: - follow_type = lookup_function_type (follow_type); - break; - } - $$ = follow_type; - } - ; - -abs_decl: '*' - { push_type (tp_pointer); $$ = 0; } - | '*' abs_decl - { push_type (tp_pointer); $$ = $2; } - | '&' - { push_type (tp_reference); $$ = 0; } - | '&' abs_decl - { push_type (tp_reference); $$ = $2; } - | direct_abs_decl - ; - -direct_abs_decl: '(' abs_decl ')' - { $$ = $2; } - | direct_abs_decl array_mod - { - push_type_int ($2); - push_type (tp_array); - } - | array_mod - { - push_type_int ($1); - push_type (tp_array); - $$ = 0; - } - | direct_abs_decl func_mod - { push_type (tp_function); } - | func_mod - { push_type (tp_function); } - ; - -array_mod: '[' ']' - { $$ = -1; } - | '[' INT ']' - { $$ = $2; } - ; - -func_mod: '(' ')' - { $$ = 0; } - ; - -type : ptype - | typebase COLONCOLON '*' - { $$ = lookup_member_type (builtin_type_int, $1); } - | type '(' typebase COLONCOLON '*' ')' - { $$ = lookup_member_type ($1, $3); } - | type '(' typebase COLONCOLON '*' ')' '(' ')' - { $$ = lookup_member_type - (lookup_function_type ($1), $3); } - | type '(' typebase COLONCOLON '*' ')' '(' nonempty_typelist ')' - { $$ = lookup_member_type - (lookup_function_type ($1), $3); - free ($8); } - ; - -typebase - : TYPENAME - { $$ = $1.type; } - | INT_KEYWORD - { $$ = builtin_type_int; } - | LONG - { $$ = builtin_type_long; } - | SHORT - { $$ = builtin_type_short; } - | LONG INT_KEYWORD - { $$ = builtin_type_long; } - | UNSIGNED LONG INT_KEYWORD - { $$ = builtin_type_unsigned_long; } - | LONG LONG - { $$ = builtin_type_long_long; } - | LONG LONG INT_KEYWORD - { $$ = builtin_type_long_long; } - | UNSIGNED LONG LONG - { $$ = builtin_type_unsigned_long_long; } - | UNSIGNED LONG LONG INT_KEYWORD - { $$ = builtin_type_unsigned_long_long; } - | SHORT INT_KEYWORD - { $$ = builtin_type_short; } - | UNSIGNED SHORT INT_KEYWORD - { $$ = builtin_type_unsigned_short; } - | STRUCT name - { $$ = lookup_struct (copy_name ($2), - expression_context_block); } - | UNION name - { $$ = lookup_union (copy_name ($2), - expression_context_block); } - | ENUM name - { $$ = lookup_enum (copy_name ($2), - expression_context_block); } - | UNSIGNED typename - { $$ = lookup_unsigned_typename (TYPE_NAME($2.type)); } - | UNSIGNED - { $$ = builtin_type_unsigned_int; } - | SIGNED typename - { $$ = $2.type; } - | SIGNED - { $$ = builtin_type_int; } - ; - -typename: TYPENAME - | INT_KEYWORD - { - $$.stoken.ptr = "int"; - $$.stoken.length = 3; - $$.type = builtin_type_int; - } - | LONG - { - $$.stoken.ptr = "long"; - $$.stoken.length = 4; - $$.type = builtin_type_long; - } - | SHORT - { - $$.stoken.ptr = "short"; - $$.stoken.length = 5; - $$.type = builtin_type_short; - } - ; - -nonempty_typelist - : type - { $$ = (struct type **)xmalloc (sizeof (struct type *) * 2); - $$[0] = (struct type *)0; - $$[1] = $1; - } - | nonempty_typelist ',' type - { int len = sizeof (struct type *) * ++($1[0]); - $$ = (struct type **)xrealloc ($1, len); - $$[$$[0]] = $3; - } - ; - -name : NAME { $$ = $1.stoken; } - | BLOCKNAME { $$ = $1.stoken; } - | TYPENAME { $$ = $1.stoken; } - | NAME_OR_INT { $$ = $1.stoken; } - | NAME_OR_UINT { $$ = $1.stoken; } - ; - -name_not_typename : NAME - | BLOCKNAME -/* These would be useful if name_not_typename was useful, but it is just - a fake for "variable", so these cause reduce/reduce conflicts because - the parser can't tell whether NAME_OR_INT is a name_not_typename (=variable, - =exp) or just an exp. If name_not_typename was ever used in an lvalue - context where only a name could occur, this might be useful. - | NAME_OR_INT - | NAME_OR_UINT - */ - ; - -%% - -/* Begin counting arguments for a function call, - saving the data about any containing call. */ - -static void -start_arglist () -{ - register struct funcall *new = (struct funcall *) xmalloc (sizeof (struct funcall)); - - new->next = funcall_chain; - new->arglist_len = arglist_len; - arglist_len = 0; - funcall_chain = new; -} - -/* Return the number of arguments in a function call just terminated, - and restore the data for the containing function call. */ - -static int -end_arglist () -{ - register int val = arglist_len; - register struct funcall *call = funcall_chain; - funcall_chain = call->next; - arglist_len = call->arglist_len; - free (call); - return val; -} - -/* Free everything in the funcall chain. - Used when there is an error inside parsing. */ - -static void -free_funcalls () -{ - register struct funcall *call, *next; - - for (call = funcall_chain; call; call = next) - { - next = call->next; - free (call); - } -} - -/* This page contains the functions for adding data to the struct expression - being constructed. */ - -/* Add one element to the end of the expression. */ - -/* To avoid a bug in the Sun 4 compiler, we pass things that can fit into - a register through here */ - -static void -write_exp_elt (expelt) - union exp_element expelt; -{ - if (expout_ptr >= expout_size) - { - expout_size *= 2; - expout = (struct expression *) xrealloc (expout, - sizeof (struct expression) - + expout_size * sizeof (union exp_element)); - } - expout->elts[expout_ptr++] = expelt; -} - -static void -write_exp_elt_opcode (expelt) - enum exp_opcode expelt; -{ - union exp_element tmp; - - tmp.opcode = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_sym (expelt) - struct symbol *expelt; -{ - union exp_element tmp; - - tmp.symbol = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_longcst (expelt) - LONGEST expelt; -{ - union exp_element tmp; - - tmp.longconst = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_dblcst (expelt) - double expelt; -{ - union exp_element tmp; - - tmp.doubleconst = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_type (expelt) - struct type *expelt; -{ - union exp_element tmp; - - tmp.type = expelt; - - write_exp_elt (tmp); -} - -static void -write_exp_elt_intern (expelt) - struct internalvar *expelt; -{ - union exp_element tmp; - - tmp.internalvar = expelt; - - write_exp_elt (tmp); -} - -/* Add a string constant to the end of the expression. - Follow it by its length in bytes, as a separate exp_element. */ - -static void -write_exp_string (str) - struct stoken str; -{ - register int len = str.length; - register int lenelt - = (len + sizeof (union exp_element)) / sizeof (union exp_element); - - expout_ptr += lenelt; - - if (expout_ptr >= expout_size) - { - expout_size = max (expout_size * 2, expout_ptr + 10); - expout = (struct expression *) - xrealloc (expout, (sizeof (struct expression) - + (expout_size * sizeof (union exp_element)))); - } - bcopy (str.ptr, (char *) &expout->elts[expout_ptr - lenelt], len); - ((char *) &expout->elts[expout_ptr - lenelt])[len] = 0; - write_exp_elt_longcst ((LONGEST) len); -} - -/* During parsing of a C expression, the pointer to the next character - is in this variable. */ - -static char *lexptr; - -/* Tokens that refer to names do so with explicit pointer and length, - so they can share the storage that lexptr is parsing. - - When it is necessary to pass a name to a function that expects - a null-terminated string, the substring is copied out - into a block of storage that namecopy points to. - - namecopy is allocated once, guaranteed big enough, for each parsing. */ - -static char *namecopy; - -/* Current depth in parentheses within the expression. */ - -static int paren_depth; - -/* Nonzero means stop parsing on first comma (if not within parentheses). */ - -static int comma_terminates; - -/* Take care of parsing a number (anything that starts with a digit). - Set yylval and return the token type; update lexptr. - LEN is the number of characters in it. */ - -/*** Needs some error checking for the float case ***/ - -static int -parse_number (p, len, parsed_float, putithere) - register char *p; - register int len; - int parsed_float; - YYSTYPE *putithere; -{ - register LONGEST n = 0; - register int i; - register int c; - register int base = input_radix; - int unsigned_p = 0; - - extern double atof (); - - if (parsed_float) - { - /* It's a float since it contains a point or an exponent. */ - putithere->dval = atof (p); - return FLOAT; - } - - /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ - if (p[0] == '0') - switch (p[1]) - { - case 'x': - case 'X': - if (len >= 3) - { - p += 2; - base = 16; - len -= 2; - } - break; - - case 't': - case 'T': - case 'd': - case 'D': - if (len >= 3) - { - p += 2; - base = 10; - len -= 2; - } - break; - - default: - base = 8; - break; - } - - while (len-- > 0) - { - c = *p++; - if (c >= 'A' && c <= 'Z') - c += 'a' - 'A'; - if (c != 'l' && c != 'u') - n *= base; - if (c >= '0' && c <= '9') - n += i = c - '0'; - else - { - if (base > 10 && c >= 'a' && c <= 'f') - n += i = c - 'a' + 10; - else if (len == 0 && c == 'l') - ; - else if (len == 0 && c == 'u') - unsigned_p = 1; - else - return ERROR; /* Char not a digit */ - } - if (i >= base) - return ERROR; /* Invalid digit in this base */ - } - - if (unsigned_p) - { - putithere->ulval = n; - return UINT; - } - else - { - putithere->lval = n; - return INT; - } -} - -struct token -{ - char *operator; - int token; - enum exp_opcode opcode; -}; - -const static struct token tokentab3[] = - { - {">>=", ASSIGN_MODIFY, BINOP_RSH}, - {"<<=", ASSIGN_MODIFY, BINOP_LSH} - }; - -const static struct token tokentab2[] = - { - {"+=", ASSIGN_MODIFY, BINOP_ADD}, - {"-=", ASSIGN_MODIFY, BINOP_SUB}, - {"*=", ASSIGN_MODIFY, BINOP_MUL}, - {"/=", ASSIGN_MODIFY, BINOP_DIV}, - {"%=", ASSIGN_MODIFY, BINOP_REM}, - {"|=", ASSIGN_MODIFY, BINOP_LOGIOR}, - {"&=", ASSIGN_MODIFY, BINOP_LOGAND}, - {"^=", ASSIGN_MODIFY, BINOP_LOGXOR}, - {"++", INCREMENT, BINOP_END}, - {"--", DECREMENT, BINOP_END}, - {"->", ARROW, BINOP_END}, - {"&&", AND, BINOP_END}, - {"||", OR, BINOP_END}, - {"::", COLONCOLON, BINOP_END}, - {"<<", LSH, BINOP_END}, - {">>", RSH, BINOP_END}, - {"==", EQUAL, BINOP_END}, - {"!=", NOTEQUAL, BINOP_END}, - {"<=", LEQ, BINOP_END}, - {">=", GEQ, BINOP_END} - }; - -/* assign machine-independent names to certain registers - * (unless overridden by the REGISTER_NAMES table) - */ -struct std_regs { - char *name; - int regnum; -} std_regs[] = { -#ifdef PC_REGNUM - { "pc", PC_REGNUM }, -#endif -#ifdef FP_REGNUM - { "fp", FP_REGNUM }, -#endif -#ifdef SP_REGNUM - { "sp", SP_REGNUM }, -#endif -#ifdef PS_REGNUM - { "ps", PS_REGNUM }, -#endif -}; - -#define NUM_STD_REGS (sizeof std_regs / sizeof std_regs[0]) - -/* Read one token, getting characters through lexptr. */ - -static int -yylex () -{ - register int c; - register int namelen; - register unsigned i; - register char *tokstart; - - retry: - - tokstart = lexptr; - /* See if it is a special token of length 3. */ - for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) - if (!strncmp (tokstart, tokentab3[i].operator, 3)) - { - lexptr += 3; - yylval.opcode = tokentab3[i].opcode; - return tokentab3[i].token; - } - - /* See if it is a special token of length 2. */ - for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (!strncmp (tokstart, tokentab2[i].operator, 2)) - { - lexptr += 2; - yylval.opcode = tokentab2[i].opcode; - return tokentab2[i].token; - } - - switch (c = *tokstart) - { - case 0: - return 0; - - case ' ': - case '\t': - case '\n': - lexptr++; - goto retry; - - case '\'': - lexptr++; - c = *lexptr++; - if (c == '\\') - c = parse_escape (&lexptr); - yylval.lval = c; - c = *lexptr++; - if (c != '\'') - error ("Invalid character constant."); - return CHAR; - - case '(': - paren_depth++; - lexptr++; - return c; - - case ')': - if (paren_depth == 0) - return 0; - paren_depth--; - lexptr++; - return c; - - case ',': - if (comma_terminates && paren_depth == 0) - return 0; - lexptr++; - return c; - - case '.': - /* Might be a floating point number. */ - if (lexptr[1] < '0' || lexptr[1] > '9') - goto symbol; /* Nope, must be a symbol. */ - /* FALL THRU into number case. */ - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - { - /* It's a number. */ - int got_dot = 0, got_e = 0, toktype; - register char *p = tokstart; - int hex = input_radix > 10; - - if (c == '0' && (p[1] == 'x' || p[1] == 'X')) - { - p += 2; - hex = 1; - } - else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) - { - p += 2; - hex = 0; - } - - for (;; ++p) - { - if (!hex && !got_e && (*p == 'e' || *p == 'E')) - got_dot = got_e = 1; - else if (!hex && !got_dot && *p == '.') - got_dot = 1; - else if (got_e && (p[-1] == 'e' || p[-1] == 'E') - && (*p == '-' || *p == '+')) - /* This is the sign of the exponent, not the end of the - number. */ - continue; - /* We will take any letters or digits. parse_number will - complain if past the radix, or if L or U are not final. */ - else if ((*p < '0' || *p > '9') - && ((*p < 'a' || *p > 'z') - && (*p < 'A' || *p > 'Z'))) - break; - } - toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval); - if (toktype == ERROR) - { - char *err_copy = (char *) alloca (p - tokstart + 1); - - bcopy (tokstart, err_copy, p - tokstart); - err_copy[p - tokstart] = 0; - error ("Invalid number \"%s\".", err_copy); - } - lexptr = p; - return toktype; - } - - case '+': - case '-': - case '*': - case '/': - case '%': - case '|': - case '&': - case '^': - case '~': - case '!': - case '@': - case '<': - case '>': - case '[': - case ']': - case '?': - case ':': - case '=': - case '{': - case '}': - symbol: - lexptr++; - return c; - - case '"': - for (namelen = 1; (c = tokstart[namelen]) != '"'; namelen++) - if (c == '\\') - { - c = tokstart[++namelen]; - if (c >= '0' && c <= '9') - { - c = tokstart[++namelen]; - if (c >= '0' && c <= '9') - c = tokstart[++namelen]; - } - } - yylval.sval.ptr = tokstart + 1; - yylval.sval.length = namelen - 1; - lexptr += namelen + 1; - return STRING; - } - - if (!(c == '_' || c == '$' - || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) - /* We must have come across a bad character (e.g. ';'). */ - error ("Invalid character '%c' in expression.", c); - - /* It's a name. See how long it is. */ - namelen = 0; - for (c = tokstart[namelen]; - (c == '_' || c == '$' || (c >= '0' && c <= '9') - || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); - c = tokstart[++namelen]) - ; - - /* The token "if" terminates the expression and is NOT - removed from the input stream. */ - if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') - { - return 0; - } - - lexptr += namelen; - - /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1) - and $$digits (equivalent to $<-digits> if you could type that). - Make token type LAST, and put the number (the digits) in yylval. */ - - if (*tokstart == '$') - { - register int negate = 0; - c = 1; - /* Double dollar means negate the number and add -1 as well. - Thus $$ alone means -1. */ - if (namelen >= 2 && tokstart[1] == '$') - { - negate = 1; - c = 2; - } - if (c == namelen) - { - /* Just dollars (one or two) */ - yylval.lval = - negate; - return LAST; - } - /* Is the rest of the token digits? */ - for (; c < namelen; c++) - if (!(tokstart[c] >= '0' && tokstart[c] <= '9')) - break; - if (c == namelen) - { - yylval.lval = atoi (tokstart + 1 + negate); - if (negate) - yylval.lval = - yylval.lval; - return LAST; - } - } - - /* Handle tokens that refer to machine registers: - $ followed by a register name. */ - - if (*tokstart == '$') { - for (c = 0; c < NUM_REGS; c++) - if (namelen - 1 == strlen (reg_names[c]) - && !strncmp (tokstart + 1, reg_names[c], namelen - 1)) - { - yylval.lval = c; - return REGNAME; - } - for (c = 0; c < NUM_STD_REGS; c++) - if (namelen - 1 == strlen (std_regs[c].name) - && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1)) - { - yylval.lval = std_regs[c].regnum; - return REGNAME; - } - } - /* Catch specific keywords. Should be done with a data structure. */ - switch (namelen) - { - case 8: - if (!strncmp (tokstart, "unsigned", 8)) - return UNSIGNED; - break; - case 6: - if (!strncmp (tokstart, "struct", 6)) - return STRUCT; - if (!strncmp (tokstart, "signed", 6)) - return SIGNED; - if (!strncmp (tokstart, "sizeof", 6)) - return SIZEOF; - break; - case 5: - if (!strncmp (tokstart, "union", 5)) - return UNION; - if (!strncmp (tokstart, "short", 5)) - return SHORT; - break; - case 4: - if (!strncmp (tokstart, "enum", 4)) - return ENUM; - if (!strncmp (tokstart, "long", 4)) - return LONG; - if (!strncmp (tokstart, "this", 4)) - { - static const char this_name[] = - { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' }; - - if (lookup_symbol (this_name, expression_context_block, - VAR_NAMESPACE, 0, NULL)) - return THIS; - } - break; - case 3: - if (!strncmp (tokstart, "int", 3)) - return INT_KEYWORD; - break; - default: - break; - } - - yylval.sval.ptr = tokstart; - yylval.sval.length = namelen; - - /* Any other names starting in $ are debugger internal variables. */ - - if (*tokstart == '$') - { - yylval.ivar = lookup_internalvar (copy_name (yylval.sval) + 1); - return VARIABLE; - } - - /* Use token-type BLOCKNAME for symbols that happen to be defined as - functions or symtabs. If this is not so, then ... - Use token-type TYPENAME for symbols that happen to be defined - currently as names of types; NAME for other symbols. - The caller is not constrained to care about the distinction. */ - { - char *tmp = copy_name (yylval.sval); - struct symbol *sym; - int is_a_field_of_this = 0; - int hextype; - - sym = lookup_symbol (tmp, expression_context_block, - VAR_NAMESPACE, &is_a_field_of_this, NULL); - if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) || - lookup_partial_symtab (tmp)) - { - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return BLOCKNAME; - } - if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) - { - yylval.tsym.type = SYMBOL_TYPE (sym); - return TYPENAME; - } - if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0) - return TYPENAME; - - /* Input names that aren't symbols but ARE valid hex numbers, - when the input radix permits them, can be names or numbers - depending on the parse. Note we support radixes > 16 here. */ - if (!sym && - ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) || - (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) - { - YYSTYPE newlval; /* Its value is ignored. */ - hextype = parse_number (tokstart, namelen, 0, &newlval); - if (hextype == INT) - { - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return NAME_OR_INT; - } - if (hextype == UINT) - { - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return NAME_OR_UINT; - } - } - - /* Any other kind of symbol */ - yylval.ssym.sym = sym; - yylval.ssym.is_a_field_of_this = is_a_field_of_this; - return NAME; - } -} - -/* ARGSUSED */ -static void -yyerror (msg) - char *msg; -{ - error ("Invalid syntax in expression."); -} - -/* Return a null-terminated temporary copy of the name - of a string token. */ - -static char * -copy_name (token) - struct stoken token; -{ - bcopy (token.ptr, namecopy, token.length); - namecopy[token.length] = 0; - return namecopy; -} - -/* Reverse an expression from suffix form (in which it is constructed) - to prefix form (in which we can conveniently print or execute it). */ - -static void prefixify_subexp (); - -static void -prefixify_expression (expr) - register struct expression *expr; -{ - register int len = sizeof (struct expression) + - expr->nelts * sizeof (union exp_element); - register struct expression *temp; - register int inpos = expr->nelts, outpos = 0; - - temp = (struct expression *) alloca (len); - - /* Copy the original expression into temp. */ - bcopy (expr, temp, len); - - prefixify_subexp (temp, expr, inpos, outpos); -} - -/* Return the number of exp_elements in the subexpression of EXPR - whose last exp_element is at index ENDPOS - 1 in EXPR. */ - -static int -length_of_subexp (expr, endpos) - register struct expression *expr; - register int endpos; -{ - register int oplen = 1; - register int args = 0; - register int i; - - if (endpos < 0) - error ("?error in length_of_subexp"); - - i = (int) expr->elts[endpos - 1].opcode; - - switch (i) - { - /* C++ */ - case OP_SCOPE: - oplen = 4 + ((expr->elts[endpos - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - break; - - case OP_LONG: - case OP_DOUBLE: - oplen = 4; - break; - - case OP_VAR_VALUE: - case OP_LAST: - case OP_REGISTER: - case OP_INTERNALVAR: - oplen = 3; - break; - - case OP_FUNCALL: - oplen = 3; - args = 1 + expr->elts[endpos - 2].longconst; - break; - - case UNOP_CAST: - case UNOP_MEMVAL: - oplen = 3; - args = 1; - break; - - case STRUCTOP_STRUCT: - case STRUCTOP_PTR: - args = 1; - case OP_STRING: - oplen = 3 + ((expr->elts[endpos - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - break; - - case TERNOP_COND: - args = 3; - break; - - case BINOP_ASSIGN_MODIFY: - oplen = 3; - args = 2; - break; - - /* C++ */ - case OP_THIS: - oplen = 2; - break; - - default: - args = 1 + (i < (int) BINOP_END); - } - - while (args > 0) - { - oplen += length_of_subexp (expr, endpos - oplen); - args--; - } - - return oplen; -} - -/* Copy the subexpression ending just before index INEND in INEXPR - into OUTEXPR, starting at index OUTBEG. - In the process, convert it from suffix to prefix form. */ - -static void -prefixify_subexp (inexpr, outexpr, inend, outbeg) - register struct expression *inexpr; - struct expression *outexpr; - register int inend; - int outbeg; -{ - register int oplen = 1; - register int args = 0; - register int i; - int *arglens; - enum exp_opcode opcode; - - /* Compute how long the last operation is (in OPLEN), - and also how many preceding subexpressions serve as - arguments for it (in ARGS). */ - - opcode = inexpr->elts[inend - 1].opcode; - switch (opcode) - { - /* C++ */ - case OP_SCOPE: - oplen = 4 + ((inexpr->elts[inend - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - break; - - case OP_LONG: - case OP_DOUBLE: - oplen = 4; - break; - - case OP_VAR_VALUE: - case OP_LAST: - case OP_REGISTER: - case OP_INTERNALVAR: - oplen = 3; - break; - - case OP_FUNCALL: - oplen = 3; - args = 1 + inexpr->elts[inend - 2].longconst; - break; - - case UNOP_CAST: - case UNOP_MEMVAL: - oplen = 3; - args = 1; - break; - - case STRUCTOP_STRUCT: - case STRUCTOP_PTR: - args = 1; - case OP_STRING: - oplen = 3 + ((inexpr->elts[inend - 2].longconst - + sizeof (union exp_element)) - / sizeof (union exp_element)); - - break; - - case TERNOP_COND: - args = 3; - break; - - case BINOP_ASSIGN_MODIFY: - oplen = 3; - args = 2; - break; - - /* C++ */ - case OP_THIS: - oplen = 2; - break; - - default: - args = 1 + ((int) opcode < (int) BINOP_END); - } - - /* Copy the final operator itself, from the end of the input - to the beginning of the output. */ - inend -= oplen; - bcopy (&inexpr->elts[inend], &outexpr->elts[outbeg], - oplen * sizeof (union exp_element)); - outbeg += oplen; - - /* Find the lengths of the arg subexpressions. */ - arglens = (int *) alloca (args * sizeof (int)); - for (i = args - 1; i >= 0; i--) - { - oplen = length_of_subexp (inexpr, inend); - arglens[i] = oplen; - inend -= oplen; - } - - /* Now copy each subexpression, preserving the order of - the subexpressions, but prefixifying each one. - In this loop, inend starts at the beginning of - the expression this level is working on - and marches forward over the arguments. - outbeg does similarly in the output. */ - for (i = 0; i < args; i++) - { - oplen = arglens[i]; - inend += oplen; - prefixify_subexp (inexpr, outexpr, inend, outbeg); - outbeg += oplen; - } -} - -/* This page contains the two entry points to this file. */ - -/* Read a C expression from the string *STRINGPTR points to, - parse it, and return a pointer to a struct expression that we malloc. - Use block BLOCK as the lexical context for variable names; - if BLOCK is zero, use the block of the selected stack frame. - Meanwhile, advance *STRINGPTR to point after the expression, - at the first nonwhite character that is not part of the expression - (possibly a null character). - - If COMMA is nonzero, stop if a comma is reached. */ - -struct expression * -parse_c_1 (stringptr, block, comma) - char **stringptr; - struct block *block; - int comma; -{ - struct cleanup *old_chain; - - lexptr = *stringptr; - - paren_depth = 0; - type_stack_depth = 0; - - comma_terminates = comma; - - if (lexptr == 0 || *lexptr == 0) - error_no_arg ("expression to compute"); - - old_chain = make_cleanup (free_funcalls, 0); - funcall_chain = 0; - - expression_context_block = block ? block : get_selected_block (); - - namecopy = (char *) alloca (strlen (lexptr) + 1); - expout_size = 10; - expout_ptr = 0; - expout = (struct expression *) - xmalloc (sizeof (struct expression) - + expout_size * sizeof (union exp_element)); - make_cleanup (free_current_contents, &expout); - if (yyparse ()) - yyerror (NULL); - discard_cleanups (old_chain); - expout->nelts = expout_ptr; - expout = (struct expression *) - xrealloc (expout, - sizeof (struct expression) - + expout_ptr * sizeof (union exp_element)); - prefixify_expression (expout); - *stringptr = lexptr; - return expout; -} - -/* Parse STRING as an expression, and complain if this fails - to use up all of the contents of STRING. */ - -struct expression * -parse_c_expression (string) - char *string; -{ - register struct expression *exp; - exp = parse_c_1 (&string, 0, 0); - if (*string) - error ("Junk after end of expression."); - return exp; -} - -static void -push_type (tp) - enum type_pieces tp; -{ - if (type_stack_depth == type_stack_size) - { - type_stack_size *= 2; - type_stack = (union type_stack_elt *) - xrealloc (type_stack, type_stack_size * sizeof (*type_stack)); - } - type_stack[type_stack_depth++].piece = tp; -} - -static void -push_type_int (n) - int n; -{ - if (type_stack_depth == type_stack_size) - { - type_stack_size *= 2; - type_stack = (union type_stack_elt *) - xrealloc (type_stack, type_stack_size * sizeof (*type_stack)); - } - type_stack[type_stack_depth++].int_val = n; -} - -static enum type_pieces -pop_type () -{ - if (type_stack_depth) - return type_stack[--type_stack_depth].piece; - return tp_end; -} - -static int -pop_type_int () -{ - if (type_stack_depth) - return type_stack[--type_stack_depth].int_val; - /* "Can't happen". */ - return 0; -} - -void -_initialize_expread () -{ - type_stack_size = 80; - type_stack_depth = 0; - type_stack = (union type_stack_elt *) - xmalloc (type_stack_size * sizeof (*type_stack)); -} diff --git a/gdb/gdb-int.texinfo b/gdb/gdb-int.texinfo deleted file mode 100755 index cc1b188..0000000 --- a/gdb/gdb-int.texinfo +++ /dev/null @@ -1,242 +0,0 @@ -\input texinfo -@setfilename gdb-internals -@ifinfo -This file documents the internals of the GNU debugger GDB. - -Copyright (C) 1990, 1991 Free Software Foundation, Inc. -Contributed by Cygnus Support. Written by John Gilmore. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@ignore -Permission is granted to process this file through Tex and print the -results, provided the printed document carries copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore -Permission is granted to copy or distribute modified versions of this -manual under the terms of the GPL (for which purpose this text may be -regarded as a program in the language TeX). -@end ifinfo - -@setchapternewpage odd -@settitle GDB Internals -@titlepage -@title{Working in GDB} -@subtitle{A guide to the internals of the GNU debugger} -@author John Gilmore -@author Cygnus Support -@page -@tex -\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$ -\xdef\manvers{\$Revision$} % For use in headers, footers too -{\parskip=0pt -\hfill Cygnus Support\par -\hfill \manvers\par -\hfill \TeX{}info \texinfoversion\par -} -@end tex - -@vskip 0pt plus 1filll -Copyright @copyright{} 1990, 1991 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -@end titlepage - -@node Top, Cleanups, (dir), (dir) - -@menu -* Cleanups:: Cleanups -* Wrapping:: Wrapping output lines -* Releases:: Configuring GDB for release -* README:: The README file -* New Architectures:: Defining a new host or target architecture -* Host versus Targt:: What features are in which files - -@end menu - -@node Cleanups, Wrapping, Top, Top -@chapter Cleanups - -Cleanups are a structured way to deal with things that need to be done -later. When your code does something (like malloc some memory, or open -a file) that needs to be undone later (e.g. free the memory or close -the file), it can make a cleanup. The cleanup will be done at some -future point: when the command is finished, when an error occurs, or -when your code decides it's time to do cleanups. - -You can also discard cleanups, that is, throw them away without doing -what they say. This is only done if you ask that it be done. - -Syntax: - -@table @code -@item old_chain = make_cleanup (function, arg); -This makes a cleanup which will cause FUNCTION to be called with ARG -(a char *) later. The result, OLD_CHAIN, is a handle that can be -passed to do_cleanups or discard_cleanups later. Unless you are -going to call do_cleanups or discard_cleanups yourself, -you can ignore the result from make_cleanup. - - -@item do_cleanups (old_chain); -Performs all cleanups done since make_cleanup returned OLD_CHAIN. -E.g.: make_cleanup (a, 0); old = make_cleanup (b, 0); do_cleanups (old); -will call b() but will not call a(). The cleanup that calls a() will remain -in the cleanup chain, and will be done later unless otherwise discarded. - -@item discard_cleanups (old_chain); -Same as do_cleanups except that it just removes the cleanups from the -chain and does not call the specified functions. - -@end table - -Some functions, e.g. @code{fputs_filtered()} or @code{error()}, specify that they -``should not be called when cleanups are not in place''. This means -that any actions you need to reverse in the case of an error or -interruption must be on the cleanup chain before you call these functions, -since they might never return to your code (they @samp{longjmp} instead). - - -@node Wrapping, Releases, Cleanups, Top -@chapter Wrapping output lines - -Output that goes through printf_filtered or fputs_filtered or -fputs_demangled needs only to have calls to wrap_here() added -in places that would be good breaking points. The utility routines -will take care of actually wrapping if the line width is exceeded. - -The argument to wrap_here() is an indentation string which is printed -ONLY if the line breaks there. This argument is saved away and used -later. It must remain valid until the next call to wrap_here() or -until a newline has been printed through the *_filtered functions. -Don't pass in a local variable and then return! - -It is usually best to call wrap_here() after printing a comma or space. -If you call it before printing a space, make sure that your indentation -properly accounts for the leading space that will print if the line wraps -there. - -Any function or set of functions that produce filtered output must finish -by printing a newline, to flush the wrap buffer, before switching to -unfiltered ("printf") output. Symbol reading routines that print -warnings are a good example. - - -@node Releases, README, Wrapping, Top -@chapter Configuring GDB for release - - -GDB should be released after doing @samp{config.gdb none} in the top level -directory. This will leave a makefile there, but no tm- or xm- files. -The makefile is needed, for example, for @samp{make gdb.tar.Z}@dots{} If you -have tm- or xm-files in the main source directory, C's include rules -cause them to be used in preference to tm- and xm-files in the -subdirectories where the user will actually configure and build the -binaries. - -@samp{config.gdb none} is also a good way to rebuild the top level Makefile -after changing Makefile.dist, alldeps.mak, etc. - - - -@node README, New Architectures, Releases, Top -@chapter The README file - - -Check the README file, it often has useful information that does not -appear anywhere else in the directory. - - - -@node New Architectures, Host versus Target, README, Top -@chapter Defining a new host or target architecture - - -When building support for a new host and/or target, this will help you -organize where to put the various parts. @var{ARCH} stands for the -architecture involved. - -Object files needed when the host system is an @var{ARCH} are listed in -the file @file{xconfig/@var{ARCH}}, in the Makefile macro @samp{XDEPFILES -= }@dots{}. You can also define XXXXXX in there. - -There are some ``generic'' versions of routines that can be used by -various host systems. If these routines work for the @var{ARCH} host, -you can just include the generic file's name (with .o, not .c) in -@code{XDEPFILES}. Otherwise, you will need to write routines that -perform the same functions as the generic file, put them into -@code{@var{ARCH}-xdep.c}, and put @code{@var{ARCH}-xdep.o} into -@code{XDEPFILES}. These generic host support files include: - -@example - coredep.c, coredep.o -@end example - -@table @code -@item fetch_core_registers() -Support for reading registers out of a core file. This routine calls -@code{register_addr(}), see below. - -@item register_addr() -If your @code{xm-@var{ARCH}.h} file defines the macro @code{REGISTER_U_ADDR(reg)} to be the -offset within the @samp{user} struct of a register (represented as a GDB -register number), @file{coredep.c} will define the @code{register_addr()} function -and use the macro in it. If you do not define @code{REGISTER_U_ADDR}, but -you are using the standard @code{fetch_core_registers}, you -will need to define your own version of @code{register_addr}, put it into -your @code{@var{ARCH}-xdep.c} file, and be sure @code{@var{ARCH}-xdep.o} is in the @code{XDEPFILES} list. -If you have your own @code{fetch_core_registers}, you only need to define -@code{register_addr} if your @code{fetch_core_registers} calls it. Many custom -@code{fetch_core_registers} implementations simply locate the registers -themselves. -@end table - -Files needed when the target system is an @var{ARCH} are listed in the file -@file{tconfig/@var{ARCH}}, in the @code{Makefile} macro @samp{TDEPFILES = }@dots{}. You can also -define XXXXXX in there. - -Similar generic support files for target systems are: - -@example - exec.c, exec.o: -@end example - -This file defines functions for accessing files that are executable -on the target system. These functions open and examine an exec file, -extract data from one, write data to one, print information about one, -etc. Now that executable files are handled with BFD, every architecture -should be able to use the generic exec.c rather than its own custom code. - -@node Host versus Target, , README, Top -@chapter What is considered ``host-dependent'' versus ``target-dependent''? - -The xconfig/*, xm-*.h and *-xdep.c files are for host support. The -question is, what features or aspects of a debugging or cross-debugging -environment are considered to be ``host'' support. - -Defines and include files needed to build on the host are host support. -Examples are tty support, system defined types, host byte order, host -float format. - -Unix child process support is considered an aspect of the host. Since -when you fork on the host you are still on the host, the various macros -needed for finding the registers in the upage, running ptrace, and such -are all in the host-dependent files. - -This is still somewhat of a grey area; I (John Gilmore) didn't do the -xm- and tm- split for gdb (it was done by Jim Kingdon) so I have had to -figure out the grounds on which it was split, and make my own choices -as I evolve it. I have moved many things out of the xdep files -actually, partly as a result of BFD and partly by removing duplicated -code. - -@contents -@bye - diff --git a/gdb/getpagesize.h b/gdb/getpagesize.h deleted file mode 100755 index 32adae6..0000000 --- a/gdb/getpagesize.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifdef BSD -#ifndef BSD4_1 -#define HAVE_GETPAGESIZE -#endif -#endif - -#ifndef HAVE_GETPAGESIZE - -#include - -#ifdef EXEC_PAGESIZE -#define getpagesize() EXEC_PAGESIZE -#else -#ifdef NBPG -#define getpagesize() NBPG * CLSIZE -#ifndef CLSIZE -#define CLSIZE 1 -#endif /* no CLSIZE */ -#else /* no NBPG */ -#define getpagesize() NBPC -#endif /* no NBPG */ -#endif /* no EXEC_PAGESIZE */ - -#endif /* not HAVE_GETPAGESIZE */ - diff --git a/gdb/gmalloc.c b/gdb/gmalloc.c deleted file mode 100755 index 8cbf4be..0000000 --- a/gdb/gmalloc.c +++ /dev/null @@ -1,1161 +0,0 @@ - -/* gmalloc.c - THIS FILE IS AUTOMAGICALLY GENERATED SO DON'T EDIT IT. */ - -/* Single-file skeleton for GNU malloc. - Copyright 1989 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define __ONEFILE - -/* DO NOT DELETE THIS LINE -- ansidecl.h INSERTED HERE. */ -/* Copyright (C) 1989 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* ANSI and traditional C compatibility macros - - ANSI C is assumed if __STDC__ is #defined. - - Macros - PTR - Generic pointer type - LONG_DOUBLE - `long double' type - CONST - `const' keyword - VOLATILE - `volatile' keyword - SIGNED - `signed' keyword - PTRCONST - Generic const pointer (void *const) - - EXFUN(name, prototype) - declare external function NAME - with prototype PROTOTYPE - DEFUN(name, arglist, args) - define function NAME with - args ARGLIST of types in ARGS - DEFUN_VOID(name) - define function NAME with no args - AND - argument separator for ARGS - NOARGS - null arglist - DOTS - `...' in args - - For example: - extern int EXFUN(printf, (CONST char *format DOTS)); - int DEFUN(fprintf, (stream, format), - FILE *stream AND CONST char *format DOTS) { ... } - void DEFUN_VOID(abort) { ... } -*/ - -#ifndef _ANSIDECL_H - -#define _ANSIDECL_H 1 - - -/* Every source file includes this file, - so they will all get the switch for lint. */ -/* LINTLIBRARY */ - - -#ifdef __STDC__ - -#define PTR void * -#define PTRCONST void *CONST -#define LONG_DOUBLE long double - -#define AND , -#define NOARGS void -#define CONST const -#define VOLATILE volatile -#define SIGNED signed -#define DOTS , ... - -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(NOARGS) - -#else /* Not ANSI C. */ - -#define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#define AND ; -#define NOARGS -#define CONST -#define VOLATILE -#define SIGNED -#define DOTS - -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() - -#endif /* ANSI C. */ - - -#endif /* ansidecl.h */ - -#ifdef __STDC__ -#include -#else -/* DO NOT DELETE THIS LINE -- limits.h INSERTED HERE. */ -/* Number of bits in a `char'. */ -#define CHAR_BIT 8 - -/* No multibyte characters supported yet. */ -#define MB_LEN_MAX 1 - -/* Minimum and maximum values a `signed char' can hold. */ -#define SCHAR_MIN -128 -#define SCHAR_MAX 127 - -/* Maximum value an `unsigned char' can hold. (Minimum is 0). */ -#define UCHAR_MAX 255U - -/* Minimum and maximum values a `char' can hold. */ -#ifdef __CHAR_UNSIGNED__ -#define CHAR_MIN 0 -#define CHAR_MAX 255U -#else -#define CHAR_MIN -128 -#define CHAR_MAX 127 -#endif - -/* Minimum and maximum values a `signed short int' can hold. */ -#define SHRT_MIN -32768 -#define SHRT_MAX 32767 - -/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ -#define USHRT_MAX 65535U - -/* Minimum and maximum values a `signed int' can hold. */ -#define INT_MIN -2147483648 -#define INT_MAX 2147483647 - -/* Maximum value an `unsigned int' can hold. (Minimum is 0). */ -#define UINT_MAX 4294967295U - -/* Minimum and maximum values a `signed long int' can hold. - (Same as `int'). */ -#define LONG_MIN (-LONG_MAX-1) -#define LONG_MAX 2147483647 - -/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ -#define ULONG_MAX 4294967295U -#endif - -#ifdef __STDC__ -#include -#else -/* DO NOT DELETE THIS LINE -- stddef.h INSERTED HERE. */ -#ifndef _STDDEF_H -#define _STDDEF_H - -/* Signed type of difference of two pointers. */ - -typedef long ptrdiff_t; - -/* Unsigned type of `sizeof' something. */ - -#ifndef _SIZE_T /* in case has defined it. */ -#define _SIZE_T -typedef unsigned long size_t; -#endif /* _SIZE_T */ - -/* A null pointer constant. */ - -#undef NULL /* in case has defined it. */ -#define NULL 0 - -/* Offset of member MEMBER in a struct of type TYPE. */ - -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - -#endif /* _STDDEF_H */ -#endif - -/* DO NOT DELETE THIS LINE -- stdlib.h INSERTED HERE. */ -/* Fake stdlib.h supplying the stuff needed by malloc. */ - -#ifndef __ONEFILE -#include -#endif - -extern void EXFUN(abort, (NOARGS)); -extern void EXFUN(free, (PTR)); -extern PTR EXFUN(malloc, (size_t)); -extern PTR EXFUN(realloc, (PTR, size_t)); - -/* DO NOT DELETE THIS LINE -- string.h INSERTED HERE. */ -/* Fake string.h supplying stuff used by malloc. */ -#ifndef __ONEFILE -#include -#endif - -extern PTR EXFUN(memcpy, (PTR, CONST PTR, size_t)); -extern PTR EXFUN(memset, (PTR, int, size_t)); -#define memmove memcpy - -#define _MALLOC_INTERNAL -/* DO NOT DELETE THIS LINE -- malloc.h INSERTED HERE. */ -/* Declarations for `malloc' and friends. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef _MALLOC_H - -#define _MALLOC_H 1 - -#ifndef __ONEFILE -#define __need_NULL -#define __need_size_t -#define __need_ptrdiff_t -#include -#endif - -#ifdef _MALLOC_INTERNAL - -#ifndef __ONEFILE -#include -#endif - -/* The allocator divides the heap into blocks of fixed size; large - requests receive one or more whole blocks, and small requests - receive a fragment of a block. Fragment sizes are powers of two, - and all fragments of a block are the same size. When all the - fragments in a block have been freed, the block itself is freed. */ -#define INT_BIT (CHAR_BIT * sizeof(int)) -#define BLOCKLOG (INT_BIT > 16 ? 12 : 9) -#define BLOCKSIZE ((unsigned int) 1 << BLOCKLOG) -#define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE) - -/* The difference between two pointers is a signed int. On machines where - the data addresses have the high bit set, we need to ensure that the - difference becomes an unsigned int when we are using the address as an - integral value. In addition, when using with the '%' operator, the - sign of the result is machine dependent for negative values, so force - it to be treated as an unsigned int. */ - -#define ADDR2UINT(addr) ((unsigned int) ((char *) (addr) - (char *) NULL)) -#define RESIDUAL(addr) ((unsigned int) (ADDR2UINT (addr) % BLOCKSIZE)) - -/* Determine the amount of memory spanned by the initial heap table - (not an absolute limit). */ -#define HEAP (INT_BIT > 16 ? 4194304 : 65536) - -/* Number of contiguous free blocks allowed to build up at the end of - memory before they will be returned to the system. */ -#define FINAL_FREE_BLOCKS 8 - -/* Where to start searching the free list when looking for new memory. - The two possible values are 0 and _heapindex. Starting at 0 seems - to reduce total memory usage, while starting at _heapindex seems to - run faster. */ -#define MALLOC_SEARCH_START _heapindex - -/* Data structure giving per-block information. */ -typedef union - { - /* Heap information for a busy block. */ - struct - { - /* Zero for a large block, or positive giving the - logarithm to the base two of the fragment size. */ - int type; - union - { - struct - { - size_t nfree; /* Free fragments in a fragmented block. */ - size_t first; /* First free fragment of the block. */ - } frag; - /* Size (in blocks) of a large cluster. */ - size_t size; - } info; - } busy; - /* Heap information for a free block (that may be the first of - a free cluster). */ - struct - { - size_t size; /* Size (in blocks) of a free cluster. */ - size_t next; /* Index of next free cluster. */ - size_t prev; /* Index of previous free cluster. */ - } free; - } malloc_info; - -/* Pointer to first block of the heap. */ -extern char *_heapbase; - -/* Table indexed by block number giving per-block information. */ -extern malloc_info *_heapinfo; - -/* Address to block number and vice versa. */ -#define BLOCK(A) (((char *) (A) - _heapbase) / BLOCKSIZE + 1) -#define ADDRESS(B) ((PTR) (((B) - 1) * BLOCKSIZE + _heapbase)) - -/* Current search index for the heap table. */ -extern size_t _heapindex; - -/* Limit of valid info table indices. */ -extern size_t _heaplimit; - -/* Doubly linked lists of free fragments. */ -struct list - { - struct list *next; - struct list *prev; - }; - -/* Free list headers for each fragment size. */ -extern struct list _fraghead[]; - -/* Instrumentation. */ -extern size_t _chunks_used; -extern size_t _bytes_used; -extern size_t _chunks_free; -extern size_t _bytes_free; - -/* Internal version of free() used in morecore(). */ -extern void EXFUN(__free, (PTR __ptr)); - -#endif /* _MALLOC_INTERNAL. */ - -/* Underlying allocation function; successive calls should - return contiguous pieces of memory. */ -extern PTR EXFUN((*__morecore), (ptrdiff_t __size)); - -/* Default value of previous. */ -extern PTR EXFUN(__default_morecore, (ptrdiff_t __size)); - -/* Flag whether malloc has been called. */ -extern int __malloc_initialized; - -/* Hooks for debugging versions. */ -extern void EXFUN((*__free_hook), (PTR __ptr)); -extern PTR EXFUN((*__malloc_hook), (size_t __size)); -extern PTR EXFUN((*__realloc_hook), (PTR __ptr, size_t __size)); - -/* Activate a standard collection of debugging hooks. */ -extern void EXFUN(mcheck, (void EXFUN((*func), (NOARGS)))); - -/* Statistics available to the user. */ -struct mstats - { - size_t bytes_total; /* Total size of the heap. */ - size_t chunks_used; /* Chunks allocated by the user. */ - size_t bytes_used; /* Byte total of user-allocated chunks. */ - size_t chunks_free; /* Chunks in the free list. */ - size_t bytes_free; /* Byte total of chunks in the free list. */ - }; - -/* Pick up the current statistics. */ -extern struct mstats EXFUN(mstats, (NOARGS)); - -#endif /* malloc.h */ - -/* DO NOT DELETE THIS LINE -- free.c INSERTED HERE. */ -/* Free a block of memory allocated by `malloc'. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __ONEFILE -#include "ansidecl.h" -#include -#include - -#define _MALLOC_INTERNAL -#include "malloc.h" -#endif /* __ONEFILE */ - -/* Debugging hook for free. */ -void EXFUN((*__free_hook), (PTR __ptr)); - -/* Return memory to the heap. Like free() but don't call a __free_hook - if there is one. */ -void -DEFUN(__free, (ptr), PTR ptr) -{ - int type; - size_t block, blocks; - register size_t i; - struct list *prev, *next; - - block = BLOCK(ptr); - - type = _heapinfo[block].busy.type; - switch (type) - { - case 0: - /* Get as many statistics as early as we can. */ - --_chunks_used; - _bytes_used -= _heapinfo[block].busy.info.size * BLOCKSIZE; - _bytes_free += _heapinfo[block].busy.info.size * BLOCKSIZE; - - /* Find the free cluster previous to this one in the free list. - Start searching at the last block referenced; this may benefit - programs with locality of allocation. */ - i = _heapindex; - if (i > block) - while (i > block) - i = _heapinfo[i].free.prev; - else - { - do - i = _heapinfo[i].free.next; - while (i > 0 && i < block); - i = _heapinfo[i].free.prev; - } - - /* Determine how to link this block into the free list. */ - if (block == i + _heapinfo[i].free.size) - { - /* Coalesce this block with its predecessor. */ - _heapinfo[i].free.size += _heapinfo[block].busy.info.size; - block = i; - } - else - { - /* Really link this block back into the free list. */ - _heapinfo[block].free.size = _heapinfo[block].busy.info.size; - _heapinfo[block].free.next = _heapinfo[i].free.next; - _heapinfo[block].free.prev = i; - _heapinfo[i].free.next = block; - _heapinfo[_heapinfo[block].free.next].free.prev = block; - ++_chunks_free; - } - - /* Now that the block is linked in, see if we can coalesce it - with its successor (by deleting its successor from the list - and adding in its size). */ - if (block + _heapinfo[block].free.size == _heapinfo[block].free.next) - { - _heapinfo[block].free.size - += _heapinfo[_heapinfo[block].free.next].free.size; - _heapinfo[block].free.next - = _heapinfo[_heapinfo[block].free.next].free.next; - _heapinfo[_heapinfo[block].free.next].free.prev = block; - --_chunks_free; - } - - /* Now see if we can return stuff to the system. */ - blocks = _heapinfo[block].free.size; - if (blocks >= FINAL_FREE_BLOCKS && block + blocks == _heaplimit - && (*__morecore)(0) == ADDRESS(block + blocks)) - { - register size_t bytes = blocks * BLOCKSIZE; - _heaplimit -= blocks; - (*__morecore)(- bytes); - _heapinfo[_heapinfo[block].free.prev].free.next - = _heapinfo[block].free.next; - _heapinfo[_heapinfo[block].free.next].free.prev - = _heapinfo[block].free.prev; - block = _heapinfo[block].free.prev; - --_chunks_free; - _bytes_free -= bytes; - } - - /* Set the next search to begin at this block. */ - _heapindex = block; - break; - - default: - /* Do some of the statistics. */ - --_chunks_used; - _bytes_used -= 1 << type; - ++_chunks_free; - _bytes_free += 1 << type; - - /* Get the address of the first free fragment in this block. */ - prev = (struct list *) ((char *) ADDRESS(block) + - (_heapinfo[block].busy.info.frag.first << type)); - - if (_heapinfo[block].busy.info.frag.nfree == (BLOCKSIZE >> type) - 1) - { - /* If all fragments of this block are free, remove them - from the fragment list and free the whole block. */ - next = prev; - for (i = 1; i < BLOCKSIZE >> type; ++i) - next = next->next; - prev->prev->next = next; - if (next != NULL) - next->prev = prev->prev; - _heapinfo[block].busy.type = 0; - _heapinfo[block].busy.info.size = 1; - - /* Keep the statistics accurate. */ - ++_chunks_used; - _bytes_used += BLOCKSIZE; - _chunks_free -= BLOCKSIZE >> type; - _bytes_free -= BLOCKSIZE; - - free(ADDRESS(block)); - } - else if (_heapinfo[block].busy.info.frag.nfree != 0) - { - /* If some fragments of this block are free, link this - fragment into the fragment list after the first free - fragment of this block. */ - next = (struct list *) ptr; - next->next = prev->next; - next->prev = prev; - prev->next = next; - if (next->next != NULL) - next->next->prev = next; - ++_heapinfo[block].busy.info.frag.nfree; - } - else - { - /* No fragments of this block are free, so link this - fragment into the fragment list and announce that - it is the first free fragment of this block. */ - prev = (struct list *) ptr; - _heapinfo[block].busy.info.frag.nfree = 1; - _heapinfo[block].busy.info.frag.first = RESIDUAL (ptr) >> type; - prev->next = _fraghead[type].next; - prev->prev = &_fraghead[type]; - prev->prev->next = prev; - if (prev->next != NULL) - prev->next->prev = prev; - } - break; - } -} - -/* Return memory to the heap. */ -void -DEFUN(free, (ptr), PTR ptr) -{ - if (ptr == NULL) - return; - - if (__free_hook != NULL) - (*__free_hook)(ptr); - else - __free (ptr); -} - -/* DO NOT DELETE THIS LINE -- malloc.c INSERTED HERE. */ -/* Memory allocator `malloc'. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __ONEFILE -#include "ansidecl.h" -#include -#include -#include - -#define _MALLOC_INTERNAL -#include "malloc.h" -#endif /* __ONEFILE */ - -/* How to really get more memory. */ -PTR EXFUN((*__morecore), (ptrdiff_t __size)) = __default_morecore; - -/* Debugging hook for `malloc'. */ -PTR EXFUN((*__malloc_hook), (size_t __size)); - -/* Pointer to the base of the first block. */ -char *_heapbase; - -/* Block information table. Allocated with align/__free (not malloc/free). */ -malloc_info *_heapinfo; - -/* Number of info entries. */ -static size_t heapsize; - -/* Search index in the info table. */ -size_t _heapindex; - -/* Limit of valid info table indices. */ -size_t _heaplimit; - -/* Free lists for each fragment size. */ -struct list _fraghead[BLOCKLOG]; - -/* Instrumentation. */ -size_t _chunks_used; -size_t _bytes_used; -size_t _chunks_free; -size_t _bytes_free; - -/* Are you experienced? */ -int __malloc_initialized; - -/* Aligned allocation. */ -static PTR -DEFUN(align, (size), size_t size) -{ - PTR result; - unsigned int adj; - - result = (*__morecore)(size); - adj = RESIDUAL (result); - if (adj != 0) - { - adj = BLOCKSIZE - adj; - (void) (*__morecore)(adj); - result = (char *) result + adj; - } - return result; -} - -/* Set everything up and remember that we have. */ -static int -DEFUN_VOID(initialize) -{ - heapsize = HEAP / BLOCKSIZE; - _heapinfo = (malloc_info *) align(heapsize * sizeof(malloc_info)); - if (_heapinfo == NULL) - return 0; - memset(_heapinfo, 0, heapsize * sizeof(malloc_info)); - _heapinfo[0].free.size = 0; - _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; - _heapindex = 0; - _heapbase = (char *) _heapinfo; - __malloc_initialized = 1; - return 1; -} - -/* Get neatly aligned memory, initializing or - growing the heap info table as necessary. */ -static PTR -DEFUN(morecore, (size), size_t size) -{ - PTR result; - malloc_info *newinfo, *oldinfo; - size_t newsize; - - result = align(size); - if (result == NULL) - return NULL; - - /* Check if we need to grow the info table. */ - if (BLOCK((char *) result + size) > heapsize) - { - newsize = heapsize; - while (BLOCK((char *) result + size) > newsize) - newsize *= 2; - newinfo = (malloc_info *) align(newsize * sizeof(malloc_info)); - if (newinfo == NULL) - { - (*__morecore)(- size); - return NULL; - } - memset(newinfo, 0, newsize * sizeof(malloc_info)); - memcpy(newinfo, _heapinfo, heapsize * sizeof(malloc_info)); - oldinfo = _heapinfo; - newinfo[BLOCK(oldinfo)].busy.type = 0; - newinfo[BLOCK(oldinfo)].busy.info.size - = BLOCKIFY(heapsize * sizeof(malloc_info)); - _heapinfo = newinfo; - __free(oldinfo); - heapsize = newsize; - } - - _heaplimit = BLOCK((char *) result + size); - return result; -} - -/* Allocate memory from the heap. */ -PTR -DEFUN(malloc, (size), size_t size) -{ - PTR result; - size_t block, blocks, lastblocks, start; - register size_t i; - struct list *next; - - if (size == 0) - return NULL; - - if (__malloc_hook != NULL) - return (*__malloc_hook)(size); - - if (!__malloc_initialized) - if (!initialize()) - return NULL; - - if (size < sizeof(struct list)) - size = sizeof(struct list); - - /* Determine the allocation policy based on the request size. */ - if (size <= BLOCKSIZE / 2) - { - /* Small allocation to receive a fragment of a block. - Determine the logarithm to base two of the fragment size. */ - register size_t log = 1; - --size; - while ((size /= 2) != 0) - ++log; - - /* Look in the fragment lists for a - free fragment of the desired size. */ - next = _fraghead[log].next; - if (next != NULL) - { - /* There are free fragments of this size. - Pop a fragment out of the fragment list and return it. - Update the block's nfree and first counters. */ - result = (PTR) next; - next->prev->next = next->next; - if (next->next != NULL) - next->next->prev = next->prev; - block = BLOCK(result); - if (--_heapinfo[block].busy.info.frag.nfree != 0) - _heapinfo[block].busy.info.frag.first = - RESIDUAL (next->next) >> log; - - /* Update the statistics. */ - ++_chunks_used; - _bytes_used += 1 << log; - --_chunks_free; - _bytes_free -= 1 << log; - } - else - { - /* No free fragments of the desired size, so get a new block - and break it into fragments, returning the first. */ - result = malloc(BLOCKSIZE); - if (result == NULL) - return NULL; - - /* Link all fragments but the first into the free list. */ - for (i = 1; i < BLOCKSIZE >> log; ++i) - { - next = (struct list *) ((char *) result + (i << log)); - next->next = _fraghead[log].next; - next->prev = &_fraghead[log]; - next->prev->next = next; - if (next->next != NULL) - next->next->prev = next; - } - - /* Initialize the nfree and first counters for this block. */ - block = BLOCK(result); - _heapinfo[block].busy.type = log; - _heapinfo[block].busy.info.frag.nfree = i - 1; - _heapinfo[block].busy.info.frag.first = i - 1; - - _chunks_free += (BLOCKSIZE >> log) - 1; - _bytes_free += BLOCKSIZE - (1 << log); - } - } - else - { - /* Large allocation to receive one or more blocks. - Search the free list in a circle starting at the last place visited. - If we loop completely around without finding a large enough - space we will have to get more memory from the system. */ - blocks = BLOCKIFY(size); - start = block = MALLOC_SEARCH_START; - while (_heapinfo[block].free.size < blocks) - { - block = _heapinfo[block].free.next; - if (block == start) - { - /* Need to get more from the system. Check to see if - the new core will be contiguous with the final free - block; if so we don't need to get as much. */ - block = _heapinfo[0].free.prev; - lastblocks = _heapinfo[block].free.size; - if (_heaplimit != 0 && block + lastblocks == _heaplimit && - (*__morecore)(0) == ADDRESS(block + lastblocks) && - (morecore((blocks - lastblocks) * BLOCKSIZE)) != NULL) - { - _heapinfo[block].free.size = blocks; - _bytes_free += (blocks - lastblocks) * BLOCKSIZE; - continue; - } - result = morecore(blocks * BLOCKSIZE); - if (result == NULL) - return NULL; - block = BLOCK(result); - _heapinfo[block].busy.type = 0; - _heapinfo[block].busy.info.size = blocks; - ++_chunks_used; - _bytes_used += blocks * BLOCKSIZE; - return result; - } - } - - /* At this point we have found a suitable free list entry. - Figure out how to remove what we need from the list. */ - result = ADDRESS(block); - if (_heapinfo[block].free.size > blocks) - { - /* The block we found has a bit left over, - so relink the tail end back into the free list. */ - _heapinfo[block + blocks].free.size - = _heapinfo[block].free.size - blocks; - _heapinfo[block + blocks].free.next - = _heapinfo[block].free.next; - _heapinfo[block + blocks].free.prev - = _heapinfo[block].free.prev; - _heapinfo[_heapinfo[block].free.prev].free.next - = _heapinfo[_heapinfo[block].free.next].free.prev - = _heapindex = block + blocks; - } - else - { - /* The block exactly matches our requirements, - so just remove it from the list. */ - _heapinfo[_heapinfo[block].free.next].free.prev - = _heapinfo[block].free.prev; - _heapinfo[_heapinfo[block].free.prev].free.next - = _heapindex = _heapinfo[block].free.next; - --_chunks_free; - } - - _heapinfo[block].busy.type = 0; - _heapinfo[block].busy.info.size = blocks; - ++_chunks_used; - _bytes_used += blocks * BLOCKSIZE; - _bytes_free -= blocks * BLOCKSIZE; - } - - return result; -} - -/* DO NOT DELETE THIS LINE -- realloc.c INSERTED HERE. */ -/* Change the size of a block allocated by `malloc'. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __ONEFILE -#include "ansidecl.h" -#include -#include - -#define _MALLOC_INTERNAL -#include "malloc.h" -#endif /* __ONEFILE */ - -#define MIN(A, B) ((A) < (B) ? (A) : (B)) - -/* Debugging hook for realloc. */ -PTR EXFUN((*__realloc_hook), (PTR __ptr, size_t __size)); - -/* Resize the given region to the new size, returning a pointer - to the (possibly moved) region. This is optimized for speed; - some benchmarks seem to indicate that greater compactness is - achieved by unconditionally allocating and copying to a - new region. This module has incestuous knowledge of the - internals of both free and malloc. */ -PTR -DEFUN(realloc, (ptr, size), PTR ptr AND size_t size) -{ - PTR result; - int type; - size_t block, blocks, oldlimit; - - if (size == 0) - { - free(ptr); - return NULL; - } - else if (ptr == NULL) - return malloc(size); - - if (__realloc_hook != NULL) - return (*__realloc_hook)(ptr, size); - - block = BLOCK(ptr); - - type = _heapinfo[block].busy.type; - switch (type) - { - case 0: - /* Maybe reallocate a large block to a small fragment. */ - if (size <= BLOCKSIZE / 2) - { - result = malloc(size); - if (result != NULL) - { - memcpy(result, ptr, size); - free(ptr); - return result; - } - } - - /* The new size is a large allocation as well; - see if we can hold it in place. */ - blocks = BLOCKIFY(size); - if (blocks < _heapinfo[block].busy.info.size) - { - /* The new size is smaller; return - excess memory to the free list. */ - _heapinfo[block + blocks].busy.type = 0; - _heapinfo[block + blocks].busy.info.size - = _heapinfo[block].busy.info.size - blocks; - _heapinfo[block].busy.info.size = blocks; - free(ADDRESS(block + blocks)); - result = ptr; - } - else if (blocks == _heapinfo[block].busy.info.size) - /* No size change necessary. */ - result = ptr; - else - { - /* Won't fit, so allocate a new region that will. - Free the old region first in case there is sufficient - adjacent free space to grow without moving. */ - blocks = _heapinfo[block].busy.info.size; - /* Prevent free from actually returning memory to the system. */ - oldlimit = _heaplimit; - _heaplimit = 0; - free(ptr); - _heaplimit = oldlimit; - result = malloc(size); - if (result == NULL) - { - (void) malloc(blocks * BLOCKSIZE); - return NULL; - } - if (ptr != result) - memmove(result, ptr, blocks * BLOCKSIZE); - } - break; - - default: - /* Old size is a fragment; type is logarithm - to base two of the fragment size. */ - if (size > 1 << (type - 1) && size <= 1 << type) - /* The new size is the same kind of fragment. */ - result = ptr; - else - { - /* The new size is different; allocate a new space, - and copy the lesser of the new size and the old. */ - result = malloc(size); - if (result == NULL) - return NULL; - memcpy(result, ptr, MIN(size, 1 << type)); - free(ptr); - } - break; - } - - return result; -} - -/* DO NOT DELETE THIS LINE -- unix.c INSERTED HERE. */ -/* unix.c - get more memory with a UNIX system call. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __ONEFILE -#include "ansidecl.h" -#include - -#define _MALLOC_INTERNAL -#include "malloc.h" -#endif /* __ONEFILE */ - -extern PTR EXFUN(sbrk, (ptrdiff_t size)); - -PTR -DEFUN(__default_morecore, (size), ptrdiff_t size) -{ - PTR result; - - result = sbrk(size); - if (result == (PTR) -1) - return NULL; - return result; -} - -#define __getpagesize getpagesize -/* DO NOT DELETE THIS LINE -- valloc.c INSERTED HERE. */ -/* Allocate memory on a page boundary. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef __ONEFILE -#include "ansidecl.h" -#include -#endif /* __ONEFILE */ - -#if defined(M_UNIX) -/* - * M_UNIX is defined by the SCO compilers, including the port of gcc. - */ - -/* On SunOS 4.1.1, typedefs size_t, which is bad since - we typedef it above. Maybe it's better just to have people compile - -Dgetpagesize()=4096. */ -/* Deal with page size. */ -#ifndef HAVE_GETPAGESIZE - -#include - -#if !defined (PAGESIZE) -#ifdef EXEC_PAGESIZE -#define PAGESIZE EXEC_PAGESIZE -#else -#ifdef NBPG -#define PAGESIZE NBPG * CLSIZE -#ifndef CLSIZE -#define CLSIZE 1 -#endif /* no CLSIZE */ -#else /* no NBPG */ -#define PAGESIZE NBPC -#endif /* no NBPG */ -#endif /* no EXEC_PAGESIZE */ -#endif /* no PAGESIZE */ - -size_t -DEFUN_VOID(__getpagesize) -{ - return PAGESIZE; -} -#endif /* not HAVE_GETPAGESIZE */ -#endif /* M_UNIX */ - -extern size_t EXFUN(__getpagesize, (NOARGS)); - -static size_t pagesize; - -PTR -DEFUN(valloc, (size), size_t size) -{ - PTR result; - unsigned int adj; - - if (pagesize == 0) - pagesize = __getpagesize(); - - result = malloc(size + pagesize); - if (result == NULL) - return NULL; - adj = (unsigned int) ((unsigned int)((char *) result - (char *) NULL)) % pagesize; - if (adj != 0) - result = (char *) result + pagesize - adj; - return result; -} diff --git a/gdb/gmalloc.h b/gdb/gmalloc.h deleted file mode 100755 index b52db6d..0000000 --- a/gdb/gmalloc.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Declarations for `malloc' and friends. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef _MALLOC_H - -#define _MALLOC_H 1 - -#ifndef __ONEFILE -#define __need_NULL -#define __need_size_t -#define __need_ptrdiff_t -#include -#endif - -#ifdef _MALLOC_INTERNAL - -#ifndef __ONEFILE -#include -#endif - -/* The allocator divides the heap into blocks of fixed size; large - requests receive one or more whole blocks, and small requests - receive a fragment of a block. Fragment sizes are powers of two, - and all fragments of a block are the same size. When all the - fragments in a block have been freed, the block itself is freed. */ -#define INT_BIT (CHAR_BIT * sizeof(int)) -#define BLOCKLOG (INT_BIT > 16 ? 12 : 9) -#define BLOCKSIZE (1 << BLOCKLOG) -#define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE) - -/* Determine the amount of memory spanned by the initial heap table - (not an absolute limit). */ -#define HEAP (INT_BIT > 16 ? 4194304 : 65536) - -/* Number of contiguous free blocks allowed to build up at the end of - memory before they will be returned to the system. */ -#define FINAL_FREE_BLOCKS 8 - -/* Where to start searching the free list when looking for new memory. - The two possible values are 0 and _heapindex. Starting at 0 seems - to reduce total memory usage, while starting at _heapindex seems to - run faster. */ -#define MALLOC_SEARCH_START _heapindex - -/* Data structure giving per-block information. */ -typedef union - { - /* Heap information for a busy block. */ - struct - { - /* Zero for a large block, or positive giving the - logarithm to the base two of the fragment size. */ - int type; - union - { - struct - { - size_t nfree; /* Free fragments in a fragmented block. */ - size_t first; /* First free fragment of the block. */ - } frag; - /* Size (in blocks) of a large cluster. */ - size_t size; - } info; - } busy; - /* Heap information for a free block (that may be the first of - a free cluster). */ - struct - { - size_t size; /* Size (in blocks) of a free cluster. */ - size_t next; /* Index of next free cluster. */ - size_t prev; /* Index of previous free cluster. */ - } free; - } malloc_info; - -/* Pointer to first block of the heap. */ -extern char *_heapbase; - -/* Table indexed by block number giving per-block information. */ -extern malloc_info *_heapinfo; - -/* Address to block number and vice versa. */ -#define BLOCK(A) (((char *) (A) - _heapbase) / BLOCKSIZE + 1) -#define ADDRESS(B) ((PTR) (((B) - 1) * BLOCKSIZE + _heapbase)) - -/* Current search index for the heap table. */ -extern size_t _heapindex; - -/* Limit of valid info table indices. */ -extern size_t _heaplimit; - -/* Doubly linked lists of free fragments. */ -struct list - { - struct list *next; - struct list *prev; - }; - -/* Free list headers for each fragment size. */ -extern struct list _fraghead[]; - -/* Instrumentation. */ -extern size_t _chunks_used; -extern size_t _bytes_used; -extern size_t _chunks_free; -extern size_t _bytes_free; - -/* Internal version of free() used in morecore(). */ -extern void EXFUN(__free, (PTR __ptr)); - -#endif /* _MALLOC_INTERNAL. */ - -/* Underlying allocation function; successive calls should - return contiguous pieces of memory. */ -extern PTR EXFUN((*__morecore), (ptrdiff_t __size)); - -/* Default value of previous. */ -extern PTR EXFUN(__default_morecore, (ptrdiff_t __size)); - -/* Flag whether malloc has been called. */ -extern int __malloc_initialized; - -/* Hooks for debugging versions. */ -extern void EXFUN((*__free_hook), (PTR __ptr)); -extern PTR EXFUN((*__malloc_hook), (size_t __size)); -extern PTR EXFUN((*__realloc_hook), (PTR __ptr, size_t __size)); - -/* Activate a standard collection of debugging hooks. */ -extern void EXFUN(mcheck, (void EXFUN((*func), (NOARGS)))); - -/* Statistics available to the user. */ -struct mstats - { - size_t bytes_total; /* Total size of the heap. */ - size_t chunks_used; /* Chunks allocated by the user. */ - size_t bytes_used; /* Byte total of user-allocated chunks. */ - size_t chunks_free; /* Chunks in the free list. */ - size_t bytes_free; /* Byte total of chunks in the free list. */ - }; - -/* Pick up the current statistics. */ -extern struct mstats EXFUN(mstats, (NOARGS)); - -#endif /* malloc.h */ diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c deleted file mode 100644 index 899c29f..0000000 --- a/gdb/go32-nat.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Native dependent code for dos running GO32 for GDB, the GNU debugger. - Copyright 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include - -static void uerror(char *s) -{ - fprintf(stderr, "Fatal: %s!\n"); - exit(1); -} - -fetch_core_registers(){uerror("attempt to call fetch_core_registers()");} - -fetch_inferior_registers(){uerror("attempt to call fetch_inferior_registers()");} -store_inferior_registers(){uerror("attempt to call store_inferior_registers()");} - -child_resume(){uerror("attempt to call child_resume()");} -child_xfer_memory(){uerror("attempt to call child_xfer_memory()");} - diff --git a/gdb/hds-tdep.c b/gdb/hds-tdep.c index 139597f..e69de29 100755 --- a/gdb/hds-tdep.c +++ b/gdb/hds-tdep.c @@ -1,2 +0,0 @@ - - diff --git a/gdb/hp300hpux-xdep.c b/gdb/hp300hpux-xdep.c deleted file mode 100755 index f7f1cf0..0000000 --- a/gdb/hp300hpux-xdep.c +++ /dev/null @@ -1,230 +0,0 @@ -/* HP/UX interface for HP 300's, for GDB when running under Unix. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include "defs.h" -#include "param.h" -#include "frame.h" -#include "inferior.h" - -/* Defining this means some system include files define some extra stuff. */ -#define WOPR -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "gdbcore.h" - -#include -#include - -#define INFERIOR_AR0(u) \ - ((ptrace \ - (PT_RUAREA, inferior_pid, ((char *) &u.u_ar0 - (char *) &u), 0)) \ - - KERNEL_U_ADDR) - -static void -fetch_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; -{ -#ifndef HPUX_VERSION_5 - if (regno == PS_REGNUM) - { - union { int i; short s[2]; } ps_val; - int regval; - - ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0)); - regval = ps_val.s[0]; - supply_register (regno, ®val); - } - else -#endif /* not HPUX_VERSION_5 */ - { - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - return; -} - -static void -store_inferior_register_1 (regno, regaddr, value) - int regno; - unsigned int regaddr; - int value; -{ - errno = 0; - ptrace (PT_WUAREA, inferior_pid, regaddr, value); -#if 0 - /* HP-UX randomly sets errno to non-zero for regno == 25. - However, the value is correctly written, so ignore errno. */ - if (errno != 0) - { - char string_buf[64]; - - sprintf (string_buf, "writing register number %d", regno); - perror_with_name (string_buf); - } -#endif - return; -} - -static void -store_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; -{ -#ifndef HPUX_VERSION_5 - if (regno == PS_REGNUM) - { - union { int i; short s[2]; } ps_val; - - ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0)); - ps_val.s[0] = (read_register (regno)); - store_inferior_register_1 (regno, regaddr, ps_val.i); - } - else -#endif /* not HPUX_VERSION_5 */ - { - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - extern char registers[]; - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - store_inferior_register_1 - (regno, regaddr, - (*(int *) ®isters[(REGISTER_BYTE (regno)) + i])); - regaddr += sizeof (int); - } - } - return; -} - -void -fetch_inferior_registers (regno) - int regno; -{ - struct user u; - register int regno; - register unsigned int ar0_offset; - - ar0_offset = (INFERIOR_AR0 (u)); - if (regno == -1) - { - for (regno = 0; (regno < FP0_REGNUM); regno++) - fetch_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - for (; (regno < NUM_REGS); regno++) - fetch_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); - } - else - fetch_inferior_register (regno, - (regno < FP0_REGNUM - ? REGISTER_ADDR (ar0_offset, regno) - : FP_REGISTER_ADDR (u, regno))); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -store_inferior_registers (regno) - register int regno; -{ - struct user u; - register unsigned int ar0_offset; - extern char registers[]; - - if (regno >= FP0_REGNUM) - { - store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); - return; - } - - ar0_offset = (INFERIOR_AR0 (u)); - if (regno >= 0) - { - store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - return; - } - - for (regno = 0; (regno < FP0_REGNUM); regno++) - store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - for (; (regno < NUM_REGS); regno++) - store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); - return; -} - - -/* Take the register values out of a core file and store - them where `read_register' will find them. */ - -#ifdef HPUX_VERSION_5 -#define e_PS e_regs[PS] -#define e_PC e_regs[PC] -#endif /* HPUX_VERSION_5 */ - -void -fetch_core_registers (core_reg_sect, core_reg_size, which) - char *core_reg_sect; - int core_reg_size; - int which; -{ - int val, regno; - struct user u; - struct exception_stack *pes = (struct exception_stack *) core_reg_sect; -#define es (*pes) - char *buf; - - if (which == 0) { - if (core_reg_size < - ((char *) &es.e_offset - (char *) &es.e_regs[R0])) - error ("Not enough registers in core file"); - for (regno = 0; (regno < PS_REGNUM); regno++) - supply_register (regno, &es.e_regs[regno + R0]); - val = es.e_PS; - supply_register (regno++, &val); - supply_register (regno++, &es.e_PC); - - } else if (which == 2) { - - /* FIXME: This may not work if the float regs and control regs are - discontinuous. */ - for (regno = FP0_REGNUM, buf = core_reg_sect; - (regno < NUM_REGS); - buf += REGISTER_RAW_SIZE (regno), regno++) - { - supply_register (regno, buf); - } - } -} diff --git a/gdb/hp300ux-xdep.c b/gdb/hp300ux-xdep.c deleted file mode 100644 index f043acc..0000000 --- a/gdb/hp300ux-xdep.c +++ /dev/null @@ -1,233 +0,0 @@ -/* HP/UX interface for HP 300's, for GDB when running under Unix. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" - -/* Defining this means some system include files define some extra stuff. */ -#define WOPR -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "gdbcore.h" - -#include -#include - -#define INFERIOR_AR0(u) \ - ((ptrace \ - (PT_RUAREA, inferior_pid, \ - (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0)) \ - - KERNEL_U_ADDR) - -static void -fetch_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; -{ -#ifndef HPUX_VERSION_5 - if (regno == PS_REGNUM) - { - union { int i; short s[2]; } ps_val; - int regval; - - ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - 0)); - regval = ps_val.s[0]; - supply_register (regno, ®val); - } - else -#endif /* not HPUX_VERSION_5 */ - { - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - return; -} - -static void -store_inferior_register_1 (regno, regaddr, value) - int regno; - unsigned int regaddr; - int value; -{ - errno = 0; - ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value); -#if 0 - /* HP-UX randomly sets errno to non-zero for regno == 25. - However, the value is correctly written, so ignore errno. */ - if (errno != 0) - { - char string_buf[64]; - - sprintf (string_buf, "writing register number %d", regno); - perror_with_name (string_buf); - } -#endif - return; -} - -static void -store_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; -{ -#ifndef HPUX_VERSION_5 - if (regno == PS_REGNUM) - { - union { int i; short s[2]; } ps_val; - - ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - 0)); - ps_val.s[0] = (read_register (regno)); - store_inferior_register_1 (regno, regaddr, ps_val.i); - } - else -#endif /* not HPUX_VERSION_5 */ - { - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - extern char registers[]; - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - store_inferior_register_1 - (regno, regaddr, - (*(int *) ®isters[(REGISTER_BYTE (regno)) + i])); - regaddr += sizeof (int); - } - } - return; -} - -void -fetch_inferior_registers (regno) - int regno; -{ - struct user u; - register unsigned int ar0_offset; - - ar0_offset = (INFERIOR_AR0 (u)); - if (regno == -1) - { - for (regno = 0; (regno < FP0_REGNUM); regno++) - fetch_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - for (; (regno < NUM_REGS); regno++) - fetch_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); - } - else - fetch_inferior_register (regno, - (regno < FP0_REGNUM - ? REGISTER_ADDR (ar0_offset, regno) - : FP_REGISTER_ADDR (u, regno))); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - register int regno; -{ - struct user u; - register unsigned int ar0_offset; - extern char registers[]; - - if (regno >= FP0_REGNUM) - { - store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); - return; - } - - ar0_offset = (INFERIOR_AR0 (u)); - if (regno >= 0) - { - store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - return; - } - - for (regno = 0; (regno < FP0_REGNUM); regno++) - store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - for (; (regno < NUM_REGS); regno++) - store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); - return; -} - - -/* Take the register values out of a core file and store - them where `read_register' will find them. */ - -#ifdef HPUX_VERSION_5 -#define e_PS e_regs[PS] -#define e_PC e_regs[PC] -#endif /* HPUX_VERSION_5 */ - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - int core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ - int val, regno; - struct user u; - struct exception_stack *pes = (struct exception_stack *) core_reg_sect; -#define es (*pes) - char *buf; - - if (which == 0) { - if (core_reg_size < - ((char *) &es.e_offset - (char *) &es.e_regs[R0])) - error ("Not enough registers in core file"); - for (regno = 0; (regno < PS_REGNUM); regno++) - supply_register (regno, &es.e_regs[regno + R0]); - val = es.e_PS; - supply_register (regno++, &val); - supply_register (regno++, &es.e_PC); - - } else if (which == 2) { - - /* FIXME: This may not work if the float regs and control regs are - discontinuous. */ - for (regno = FP0_REGNUM, buf = core_reg_sect; - (regno < NUM_REGS); - buf += REGISTER_RAW_SIZE (regno), regno++) - { - supply_register (regno, buf); - } - } -} diff --git a/gdb/hppa-coredep.c b/gdb/hppa-coredep.c index 56bb2d5..e69de29 100644 --- a/gdb/hppa-coredep.c +++ b/gdb/hppa-coredep.c @@ -1,121 +0,0 @@ -/* Extract registers from an HP-PA core file, for GDB. - Copyright (C) 1988, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* core.c is supposed to be the more machine-independent aspects of this; - this file is more machine-specific. */ - -#include "defs.h" -#include "gdbcore.h" - -/* These are needed on various systems to expand REGISTER_U_ADDR. */ -/* FIXME: Remove any not needed on HP-PA. */ -#include -#include -#include -#include -#include -#include -#ifndef USG -#include -#endif - - -/* Extract the register values out of the core file and store - them where `read_register' will find them. - - CORE_REG_SECT points to the register values themselves, read into memory. - CORE_REG_SIZE is the size of that area. - WHICH says which set of registers we are handling (0 = int, 2 = float - on machines where they are discontiguous). - REG_ADDR is the offset from u.u_ar0 to the register values relative to - core_reg_sect. This is used with old-fashioned core files to - locate the registers in a large upage-plus-stack ".reg" section. - Original upage address X is at location core_reg_sect+x+reg_addr. - */ - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned reg_addr; -{ - register int regno; - register unsigned int addr; - int bad_reg = -1; - register reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */ - - /* If u.u_ar0 was an absolute address in the core file, relativize it now, - so we can use it as an offset into core_reg_sect. When we're done, - "register 0" will be at core_reg_sect+reg_ptr, and we can use - register_addr to offset to the other registers. If this is a modern - core file without a upage, reg_ptr will be zero and this is all a big - NOP. */ - if (reg_ptr > core_reg_size) - reg_ptr -= KERNEL_U_ADDR; - if (reg_ptr > core_reg_size) - fprintf (stderr, "Can't find registers in core file\n"); - - for (regno = 0; regno < NUM_REGS; regno++) - { - addr = register_addr (regno, reg_ptr); - if (addr >= core_reg_size) { - if (bad_reg < 0) - bad_reg = regno; - } else { - if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM) - core_reg_sect[addr +3] &= ~0x3; - supply_register (regno, core_reg_sect + addr); - } - } - if (bad_reg > 0) - { - error ("Register %s not found in core file.", reg_names[bad_reg]); - } -} - - -#ifdef REGISTER_U_ADDR - -/* Return the address in the core dump or inferior of register REGNO. - BLOCKEND is the address of the end of the user structure. */ - -unsigned int -register_addr (regno, blockend) - int regno; - int blockend; -{ - int addr; - - if (regno < 0 || regno >= NUM_REGS) - error ("Invalid register number %d.", regno); - - REGISTER_U_ADDR (addr, blockend, regno); - - return addr; -} - -#endif /* REGISTER_U_ADDR */ - - - - - - - diff --git a/gdb/hppab-xdep.c b/gdb/hppab-xdep.c index 01d7404..e69de29 100644 --- a/gdb/hppab-xdep.c +++ b/gdb/hppab-xdep.c @@ -1,406 +0,0 @@ -/* Host-dependent code for HP PA-RISC running BSD Unix, for GDB. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "target.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include -#ifndef USG -#include -#endif - - -#ifndef PT_ATTACH -#define PT_ATTACH PTRACE_ATTACH -#endif -#ifndef PT_DETACH -#define PT_DETACH PTRACE_DETACH -#endif - -#include "gdbcore.h" -#include /* After a.out.h */ -#include -#include - -/* This function simply calls ptrace with the given arguments. - It exists so that all calls to ptrace are isolated in this - machine-dependent file. */ -int -call_ptrace (request, pid, addr, data) - int request, pid; - PTRACE_ARG3_TYPE addr; - int data; -{ - return ptrace (request, pid, addr, data); -} - -#ifdef DEBUG_PTRACE -/* For the rest of the file, use an extra level of indirection */ -/* This lets us breakpoint usefully on call_ptrace. */ -#define ptrace call_ptrace -#endif - -void -kill_inferior () -{ - if (inferior_pid == 0) - return; - ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0); - wait ((int *)0); - target_mourn_inferior (); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (step, signal) - int step; - int signal; -{ - errno = 0; - - /* An address of (PTRACE_ARG3_TYPE) 1 tells ptrace to continue from where - it was. (If GDB wanted it to start some other way, we have already - written a new PC value to the child.) */ - - if (step) - ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); - else - ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); - - if (errno) - perror_with_name ("ptrace"); -} - -#ifdef ATTACH_DETACH -/* Nonzero if we are debugging an attached process rather than - an inferior. */ -extern int attach_flag; - -/* Start debugging the process whose number is PID. */ -int -attach (pid) - int pid; -{ - errno = 0; - ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 1; - return pid; -} - -/* Stop debugging the process whose number is PID - and continue it with signal number SIGNAL. - SIGNAL = 0 means just continue it. */ - -void -detach (signal) - int signal; -{ - errno = 0; - ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 0; -} -#endif /* ATTACH_DETACH */ - -#if !defined (FETCH_INFERIOR_REGISTERS) - -/* KERNEL_U_ADDR is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#if defined (KERNEL_U_ADDR_BSD) -/* Get kernel_u_addr using BSD-style nlist(). */ -CORE_ADDR kernel_u_addr; - -#include /* For struct nlist */ - -void -_initialize_kernel_u_addr () -{ - struct nlist names[2]; - - names[0].n_un.n_name = "_u"; - names[1].n_un.n_name = NULL; - if (nlist ("/vmunix", names) == 0) - kernel_u_addr = names[0].n_value; - else - fatal ("Unable to get kernel u area address."); -} -#endif /* KERNEL_U_ADDR_BSD. */ - -#if defined (KERNEL_U_ADDR_HPUX) -/* Get kernel_u_addr using HPUX-style nlist(). */ -CORE_ADDR kernel_u_addr; - -struct hpnlist { - char * n_name; - long n_value; - unsigned char n_type; - unsigned char n_length; - short n_almod; - short n_unused; -}; -static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }}; - -/* read the value of the u area from the hp-ux kernel */ -void _initialize_kernel_u_addr () -{ - struct user u; - nlist ("/hp-ux", &nl); - kernel_u_addr = nl[0].n_value; -} -#endif /* KERNEL_U_ADDR_HPUX. */ - -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* U_REGS_OFFSET is the offset of the registers within the u area. */ -#if !defined (U_REGS_OFFSET) -#define U_REGS_OFFSET \ - ptrace (PT_READ_U, inferior_pid, \ - (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \ - - KERNEL_U_ADDR -#endif - -/* Registers we shouldn't try to fetch. */ -#if !defined (CANNOT_FETCH_REGISTER) -#define CANNOT_FETCH_REGISTER(regno) 0 -#endif - -/* Fetch one register. */ - -static void -fetch_register (regno) - int regno; -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - char mess[128]; /* For messages */ - register int i; - - /* Offset of registers within the u area. */ - unsigned int offset; - - if (CANNOT_FETCH_REGISTER (regno)) - { - bzero (buf, REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ - supply_register (regno, buf); - return; - } - - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - errno = 0; - *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - if (errno != 0) - { - sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno); - perror_with_name (mess); - } - } - supply_register (regno, buf); -} - - -/* Fetch all registers, or just one, from the child process. */ - -void -fetch_inferior_registers (regno) - int regno; -{ - if (regno == -1) - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); - else - fetch_register (regno); -} - -/* Registers we shouldn't try to store. */ -#if !defined (CANNOT_STORE_REGISTER) -#define CANNOT_STORE_REGISTER(regno) 0 -#endif - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - extern char registers[]; - register int i; - - unsigned int offset = U_REGS_OFFSET; - - if (regno >= 0) - { - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - if (CANNOT_STORE_REGISTER (regno)) - continue; - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - } - return; -} -#endif /* !defined (FETCH_INFERIOR_REGISTERS). */ - -/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory - in the NEW_SUN_PTRACE case. - It ought to be straightforward. But it appears that writing did - not write the data that I specified. I cannot understand where - it got the data that it actually did write. */ - -/* Copy LEN bytes to or from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. Copy to inferior if - WRITE is nonzero. - - Returns the length copied, which is either the LEN argument or zero. - This xfer function does not do partial moves, since child_ops - doesn't allow memory operations to cross below us in the target stack - anyway. */ - -int -child_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (int); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - /* Allocate buffer of that many longwords. */ - register int *buffer = (int *) alloca (count * sizeof (int)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int)sizeof (int)) { - /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, - 0); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = ptrace (PT_READ_I, inferior_pid, - (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)), - 0); - } - - /* Copy data to be written over corresponding part of buffer */ - - bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i]); - if (errno) - { - /* Using the appropriate one (I or D) is necessary for - Gould NP1, at least. */ - errno = 0; - ptrace (PT_WRITE_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i]); - } - if (errno) - return 0; - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - buffer[i] = ptrace (PT_READ_I, inferior_pid, - (PTRACE_ARG3_TYPE) addr, 0); - if (errno) - return 0; - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); - } - return len; -} diff --git a/gdb/hppabsd-core.c b/gdb/hppabsd-core.c index 5ca5f9b..e69de29 100644 --- a/gdb/hppabsd-core.c +++ b/gdb/hppabsd-core.c @@ -1,251 +0,0 @@ -/* Machine-dependent code which would otherwise be in core.c - for GDB, the GNU debugger. This code is for the HP PA-RISC cpu. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include -/* #include Can we live without this? */ - -#ifndef hpux -#include -#include -#include -#include "/usr/src/sys/hpux/hpux.h" -#define USRSTACK 0x68FF3000 -#else -#include /* After a.out.h */ -#endif - -#include -#include -#include - -#ifndef hpux -#undef USIZE -#undef UPAGES - -#define USIZE 3 -#define UPAGES 7 -#endif - -extern int errno; - -/* File names of core file and executable file. */ - -extern char *corefile; -extern char *execfile; - -/* Descriptors on which core file and executable file are open. - Note that the execchan is closed when an inferior is created - and reopened if the inferior dies or is killed. */ - -extern int corechan; -extern int execchan; - -/* Last modification time of executable file. - Also used in source.c to compare against mtime of a source file. */ - -extern int exec_mtime; - -/* Virtual addresses of bounds of the two areas of memory in the core file. */ - -extern CORE_ADDR data_start; -extern CORE_ADDR data_end; -extern CORE_ADDR stack_start; -extern CORE_ADDR stack_end; - -/* Virtual addresses of bounds of two areas of memory in the exec file. - Note that the data area in the exec file is used only when there is no core file. */ - -extern CORE_ADDR text_start; -extern CORE_ADDR text_end; - -extern CORE_ADDR exec_data_start; -extern CORE_ADDR exec_data_end; - -/* Address in executable file of start of text area data. */ - -extern int text_offset; - -/* Address in executable file of start of data area data. */ - -extern int exec_data_offset; - -/* Address in core file of start of data area data. */ - -extern int data_offset; - -/* Address in core file of start of stack area data. */ - -extern int stack_offset; - -extern struct header file_hdr; -extern struct som_exec_auxhdr exec_hdr; - -extern int (*core_file_hook)(); - -#ifdef KERNELDEBUG - -extern int kernel_debugging; -extern int kernel_core_file_hook(); - -#endif - -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - extern char registers[]; -#ifdef KERNELDEBUG - struct stat stb; -#endif - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - core_file_hook = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the inferior with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - -#ifdef KERNELDEBUG - fstat(corechan, &stb); - - if (kernel_debugging) { - setup_kernel_debugging(); - core_file_hook = kernel_core_file_hook; - set_kernel_boundaries(); - } else if ((stb.st_mode & S_IFMT) == S_IFCHR && - stb.st_rdev == makedev(2, 1)) { - /* looking at /dev/kmem */ - data_offset = data_start = KERNBASE; - data_end = ~0; /* XXX */ - stack_end = stack_start = data_end; - set_kernel_boundaries(); - } else -#endif - { - /* HP PA-RISC style corefile. */ -#ifndef hpux - struct hpuxuser u; -#else - struct user u; -#endif - - unsigned int reg_offset; - - val = myread (corechan, &u, sizeof u); - if (val < 0) - perror_with_name ("Not a core file: reading upage"); - if (val != sizeof u) - error ("Not a core file: could only read %d bytes", val); - - /* We are depending on exec_file_command having been called - previously to set exec_data_start. Since the executable - and the core file share the same text segment, the address - of the data segment will be the same in both. */ - data_start = exec_data_start; - - data_end = data_start + NBPG * u.u_dsize; - stack_start = USRSTACK; /* from sys/param.h */ - stack_end = stack_start + NBPG * u.u_ssize; - data_offset = NBPG * UPAGES; - stack_offset = NBPG * (UPAGES + u.u_dsize); - - /* Some machines put an absolute address in here and some put - the offset in the upage of the regs. */ - reg_offset = NBPG * USIZE; - /* Read the register values out of the core file and store - them where `read_register' will find them. */ - - { - register int regno; - - for (regno = 0; regno < NUM_REGS; regno++) - { - unsigned char buf[MAX_REGISTER_RAW_SIZE]; - - val = lseek (corechan, register_addr (regno, reg_offset), 0); - if (val < 0 - || (val = myread (corechan, buf, sizeof buf)) < 0) - { - char * buffer = (char *) alloca (strlen (reg_names[regno]) - + 30); - strcpy (buffer, "Reading register "); - strcat (buffer, reg_names[regno]); - - perror_with_name (buffer); - } - if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM) - buf[3] &= ~0x3; - supply_register (regno, buf); - } - } - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename); - } - - set_current_frame ( create_new_frame (read_register (FP_REGNUM), - read_pc ())); - select_frame (get_current_frame (), 0); - validate_files (); - } - else if (from_tty) - printf ("No core file now.\n"); -} diff --git a/gdb/hppabsd-tdep.c b/gdb/hppabsd-tdep.c deleted file mode 100644 index 8fe6d28..0000000 --- a/gdb/hppabsd-tdep.c +++ /dev/null @@ -1,1422 +0,0 @@ -/* Machine-dependent code which would otherwise be in inflow.c and core.c, - for GDB, the GNU debugger. This code is for the HP PA-RISC cpu. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "value.h" - -/* For argument passing to the inferior */ -#include "symtab.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include - -#ifdef COFF_ENCAPSULATE -#include "a.out.encap.h" -#else -#include -#endif -#ifndef N_SET_MAGIC -#define N_SET_MAGIC(exec, val) ((exec).a_magic = (val)) -#endif - -/*#include After a.out.h */ -#include -#include -#include -#include - -#ifdef KERNELDEBUG -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern int kernel_debugging; -extern CORE_ADDR startup_file_start; -extern CORE_ADDR startup_file_end; - -#define KERNOFF ((unsigned)KERNBASE) -#define INKERNEL(x) ((x) >= KERNOFF && (x) < KERNOFF + ctob(slr)) - -static int ok_to_cache(); -static void set_kernel_boundaries(); - -int devmem = 0; -int vtophys_ready = 0; -int kerneltype; -#define OS_BSD 1 -#define OS_MACH 2 -#endif - -#include "gdbcore.h" -#include "gdbcmd.h" - -extern int errno; - - - - - - -/* Last modification time of executable file. - Also used in source.c to compare against mtime of a source file. */ - -extern int exec_mtime; - -/* Virtual addresses of bounds of the two areas of memory in the core file. */ - -/* extern CORE_ADDR data_start; */ -extern CORE_ADDR data_end; -extern CORE_ADDR stack_start; -extern CORE_ADDR stack_end; - -/* Virtual addresses of bounds of two areas of memory in the exec file. - Note that the data area in the exec file is used only when there is no core file. */ - -extern CORE_ADDR text_start; -extern CORE_ADDR text_end; - -extern CORE_ADDR exec_data_start; -extern CORE_ADDR exec_data_end; - -/* Address in executable file of start of text area data. */ - -extern int text_offset; - -/* Address in executable file of start of data area data. */ - -extern int exec_data_offset; - -/* Address in core file of start of data area data. */ - -extern int data_offset; - -/* Address in core file of start of stack area data. */ - -extern int stack_offset; - -struct header file_hdr; -struct som_exec_auxhdr exec_hdr; - -#ifdef KERNELDEBUG -/* - * Kernel debugging routines. - */ - -static struct pcb pcb; -static struct pde *pdir; -static struct hte *htbl; -static u_int npdir, nhtbl; - -static CORE_ADDR -ksym_lookup(name) - char *name; -{ - struct symbol *sym; - int i; - - if ((i = lookup_misc_func(name)) < 0) - error("kernel symbol `%s' not found.", name); - - return (misc_function_vector[i].address); -} - -/* - * (re-)set the variables that tell "inside_entry_file" where to end - * a stack backtrace. - */ -void -set_kernel_boundaries() -{ - switch (kerneltype) { - case OS_MACH: - startup_file_start = ksym_lookup("$syscall"); - startup_file_end = ksym_lookup("trap"); - break; - case OS_BSD: - startup_file_start = ksym_lookup("syscallinit"); - startup_file_end = ksym_lookup("$syscallexit"); - break; - } -} - -/* - * return true if 'len' bytes starting at 'addr' can be read out as - * longwords and/or locally cached (this is mostly for memory mapped - * i/o register access when debugging remote kernels). - */ -static int -ok_to_cache(addr, len) -{ - static CORE_ADDR ioptr; - - if (! ioptr) - ioptr = ksym_lookup("ioptr"); - - if (addr >= ioptr && addr < SPA_HIGH) - return (0); - - return (1); -} - -static -physrd(addr, dat, len) - u_int addr; - char *dat; -{ - if (lseek(corechan, addr, L_SET) == -1) - return (-1); - if (read(corechan, dat, len) != len) - return (-1); - - return (0); -} - -/* - * When looking at kernel data space through /dev/mem or with a core file, do - * virtual memory mapping. - */ -static CORE_ADDR -vtophys(space, addr) - unsigned space; - CORE_ADDR addr; -{ - struct pde *pptr; - u_int hindx, vpageno, ppageno; - CORE_ADDR phys = ~0; - - if (!vtophys_ready) { - phys = addr; /* XXX for kvread */ - } else if (kerneltype == OS_BSD) { - /* make offset into a virtual page no */ - vpageno = btop(addr); - /* - * Determine index into hash table, initialize pptr to this - * entry (since first word of pte & hte are same), and set - * physical page number for first entry in chain. - */ - hindx = pdirhash(space, addr) & (nhtbl-1); - pptr = (struct pde *) &htbl[hindx]; - ppageno = pptr->pde_next; - while (1) { - if (pptr->pde_end) - break; - pptr = &pdir[ppageno]; - /* - * If space id & virtual page number match, return - * "next PDIR entry of previous PDIR entry" as the - * physical page or'd with offset into page. - */ - if (pptr->pde_space == space && - pptr->pde_page == vpageno) { - phys = (CORE_ADDR) ((u_int)ptob(ppageno) | - (addr & PGOFSET)); - break; - } - ppageno = pptr->pde_next; - } - } -#ifdef MACHKERNELDEBUG - else if (kerneltype == OS_MACH) { - mach_vtophys(space, addr, &phys); - } -#endif -#if 0 - printf("vtophys(%x.%x) -> %x\n", space, addr, phys); -#endif - return (phys); -} - -static -kvread(addr) - CORE_ADDR addr; -{ - CORE_ADDR paddr; - - paddr = vtophys(0, addr); - if (paddr != ~0) - if (physrd(paddr, (char *)&addr, sizeof(addr)) == 0) - return (addr); - - return (~0); -} - -static void -read_pcb(addr) - u_int addr; -{ - int i, off; - extern char registers[]; - static int reg2pcb[] = { - /* RPB */ - -1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 45, 52, 51, 75, 74, 49, 53, 54, 55, 56, -1, 70, 66, 67, 68, 69, - 71, 72, 73, 34, 42, 43, 44, 46, 47, 58, 59, 60, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, - /* BSD */ - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 43, 64, 67, 68, 67, 47, 51, 52, 53, 54, -1, 35, 31, 32, 33, 34, - 36, 37, 38, 39, 40, 41, 42, 44, 45, 56, 57, 58,102,103,104, -1, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 82, 84, 86, 88, 90, 92, - 94, 96, 98, 100, - /* Mach */ - -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, 18, -1, - 25, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, 20, -1, -1, -1, 19, - 21, 22, 23, 24, 26, 27, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, - 34, 35, 36, 37, 38, 39, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, - 42, 44, 46, 48 - }; - static struct rpb *rpbaddr = (struct rpb *) 0; - static u_int rpbpcbaddr = 0; - - if (!remote_debugging) { - /* - * If we are debugging a post-mortem and this is the first - * call of read_pcb, read the RPB. Also assoicate the - * thread/proc running at the time with the RPB. - */ - if (!devmem && rpbpcbaddr == 0) { - CORE_ADDR raddr = ksym_lookup("rpb"); - int usepcb = 1; - - if (raddr != ~0) { - rpbaddr = (struct rpb *) malloc(sizeof *rpbaddr); - if (!physrd(raddr, (char *)rpbaddr, sizeof *rpbaddr)) { - rpbpcbaddr = addr; - usepcb = 0; - } - } - if (usepcb) { - error("cannot read rpb, using pcb for registers\n"); - if (rpbaddr) - free((char *)rpbaddr); - rpbpcbaddr = ~0; - } - } - if (physrd (addr, (char *)&pcb, sizeof pcb)) - error ("cannot read pcb at %x.\n", addr); - } else { - if (remote_read_inferior_memory(addr, (char *)&pcb, sizeof pcb)) - error ("cannot read pcb at %x.\n", addr); - } - - if (kerneltype == OS_BSD) { - printf("p0br %lx p0lr %lx p1br %lx p1lr %lx\n", - pcb.pcb_p0br, pcb.pcb_p0lr, pcb.pcb_p1br, pcb.pcb_p1lr); - off = NUM_REGS; - } else { - printf("pcb %lx psw %lx ksp %lx\n", - addr, ((int *)&pcb)[31], ((int *)&pcb)[32]); - off = NUM_REGS * 2; - } - /* - * get the register values out of the sys pcb and - * store them where `read_register' will find them. - */ - bzero(registers, REGISTER_BYTES); - for (i = 0; i < NUM_REGS; ++i) - if (reg2pcb[i+off] != -1) - supply_register(i, &((int *)&pcb)[reg2pcb[i+off]]); - /* - * If the RPB is valid for this thread/proc use the register values - * contained there. - */ - if (addr == rpbpcbaddr) { - off = 0; - for (i = 0; i < NUM_REGS; ++i) - if (reg2pcb[i+off] != -1) - supply_register(i, &((int *)rpbaddr)[reg2pcb[i+off]]); - } -} - -void -setup_kernel_debugging() -{ - struct stat stb; - CORE_ADDR addr; - - fstat(corechan, &stb); - devmem = 0; - if ((stb.st_mode & S_IFMT) == S_IFCHR && stb.st_rdev == makedev(2, 0)) - devmem = 1; - - /* XXX */ - if (lookup_misc_func("Sysmap") < 0) - kerneltype = OS_MACH; - else - kerneltype = OS_BSD; - - if (kerneltype == OS_BSD) { - int len, err = 0; - - /* - * Hash table and PDIR are equivalently mapped - */ - nhtbl = kvread(ksym_lookup("nhtbl")); - if (nhtbl != ~0) { - len = nhtbl * sizeof(*htbl); - htbl = (struct hte *) malloc(len); - if (htbl) { - addr = kvread(ksym_lookup("htbl")); - if (physrd(addr, (char *)htbl, len)) - err++; - } else - err++; - } else - err++; - npdir = kvread(ksym_lookup("npdir")); - if (npdir != ~0) { - len = npdir * sizeof(*pdir); - pdir = (struct pde *) malloc(len); - if (pdir) { - addr = kvread(ksym_lookup("pdir")); - if (physrd(addr, (char *)pdir, len)) - err++; - } else - err++; - } else - err++; - if (err) { - error("cannot read PDIR/HTBL"); - return; - } - vtophys_ready = 1; - - /* - * pcb where "panic" saved registers in first thing in - * current u-area. The current u-area is pointed to by - * "uptr". - */ - addr = kvread(ksym_lookup("uptr")); - if (addr == ~0) { - error("cannot read current u-area address"); - return; - } - read_pcb(vtophys(0, addr)); /* XXX space */ - if (!devmem) { - /* find stack frame */ - CORE_ADDR panicstr; - char buf[256]; - register char *cp; - - panicstr = kvread(ksym_lookup("panicstr")); - if (panicstr == ~0) - return; - kernel_core_file_hook(panicstr, buf, sizeof(buf)); - for (cp = buf; cp < &buf[sizeof(buf)] && *cp; cp++) - if (!isascii(*cp) || (!isprint(*cp) && !isspace(*cp))) - *cp = '?'; - if (*cp) - *cp = '\0'; - printf("panic: %s\n", buf); - } - } -#ifdef MACHKERNELDEBUG - else { - int *thread; - - /* - * Set up address translation - */ - if (mach_vtophys_init() == 0) { - error("cannot initialize vtophys for Mach"); - return; - } - vtophys_ready = 1; - - /* - * Locate active thread and read PCB - * XXX MAJOR HACK - * - assumes uni-processor - * - assumes position of pcb to avoid mach includes - */ - thread = (int *)kvread(ksym_lookup("active_threads")); - addr = kvread(&thread[9]); /* XXX: pcb addr */ - read_pcb(vtophys(0, addr)); - } -#endif -} - -vtop_command(arg) - char *arg; -{ - u_int sp, off, pa; - - if (!arg) - error_no_arg("kernel virtual address"); - if (!kernel_debugging) - error("not debugging kernel"); - - sp = 0; /* XXX */ - off = (u_int) parse_and_eval_address(arg); - pa = vtophys(sp, off); - printf("%lx.%lx -> ", sp, off); - if (pa == ~0) - printf("\n"); - else - printf("%lx\n", pa); -} - -set_paddr_command(arg) - char *arg; -{ - u_int addr; - - if (!arg) { - if (kerneltype == OS_BSD) - error_no_arg("ps-style address for new process"); - else - error_no_arg("thread structure virtual address"); - } - if (!kernel_debugging) - error("not debugging kernel"); - - addr = (u_int) parse_and_eval_address(arg); - if (kerneltype == OS_BSD) - addr = ctob(addr); - else { - addr = kvread(&(((int *)addr)[9])); /* XXX: pcb addr */ - addr = vtophys(0, addr); /* XXX space */ - } - read_pcb(addr); - - flush_cached_frames(); - set_current_frame(create_new_frame(read_register(FP_REGNUM), read_pc())); - select_frame(get_current_frame(), 0); -} - -/* - * read len bytes from kernel virtual address 'addr' into local - * buffer 'buf'. Return 0 if read ok, 1 otherwise. On read - * errors, portion of buffer not read is zeroed. - */ -kernel_core_file_hook(addr, buf, len) - CORE_ADDR addr; - char *buf; - int len; -{ - int i; - CORE_ADDR paddr; - - while (len > 0) { - paddr = vtophys(0, addr); /* XXX space */ - if (paddr == ~0) { - bzero(buf, len); - return (1); - } - /* we can't read across a page boundary */ - i = min(len, NBPG - (addr & PGOFSET)); - if (physrd(paddr, buf, i)) { - bzero(buf, len); - return (1); - } - buf += i; - addr += i; - len -= i; - } - return (0); -} -#endif - - - - - -/* Routines to extract various sized constants out of hppa - instructions. */ - -/* This assumes that no garbage lies outside of the lower bits of - value. */ - -int -sign_extend (val, bits) - unsigned val, bits; -{ - return (int)(val >> bits - 1 ? (-1 << bits) | val : val); -} - -/* For many immediate values the sign bit is the low bit! */ - -int -low_sign_extend (val, bits) - unsigned val, bits; -{ - return (int)((val & 0x1 ? (-1 << (bits - 1)) : 0) | val >> 1); -} -/* extract the immediate field from a ld{bhw}s instruction */ - - - -unsigned -get_field (val, from, to) - unsigned val, from, to; -{ - val = val >> 31 - to; - return val & ((1 << 32 - from) - 1); -} - -unsigned -set_field (val, from, to, new_val) - unsigned *val, from, to; -{ - unsigned mask = ~((1 << (to - from + 1)) << (31 - from)); - return *val = *val & mask | (new_val << (31 - from)); -} - -/* extract a 3-bit space register number from a be, ble, mtsp or mfsp */ - -extract_3 (word) - unsigned word; -{ - return GET_FIELD (word, 18, 18) << 2 | GET_FIELD (word, 16, 17); -} - -extract_5_load (word) - unsigned word; -{ - return low_sign_extend (word >> 16 & MASK_5, 5); -} - -/* extract the immediate field from a st{bhw}s instruction */ - -int -extract_5_store (word) - unsigned word; -{ - return low_sign_extend (word & MASK_5, 5); -} - -/* extract an 11 bit immediate field */ - -int -extract_11 (word) - unsigned word; -{ - return low_sign_extend (word & MASK_11, 11); -} - -/* extract a 14 bit immediate field */ - -int -extract_14 (word) - unsigned word; -{ - return low_sign_extend (word & MASK_14, 14); -} - -/* deposit a 14 bit constant in a word */ - -unsigned -deposit_14 (opnd, word) - int opnd; - unsigned word; -{ - unsigned sign = (opnd < 0 ? 1 : 0); - - return word | ((unsigned)opnd << 1 & MASK_14) | sign; -} - -/* extract a 21 bit constant */ - -int -extract_21 (word) - unsigned word; -{ - int val; - - word &= MASK_21; - word <<= 11; - val = GET_FIELD (word, 20, 20); - val <<= 11; - val |= GET_FIELD (word, 9, 19); - val <<= 2; - val |= GET_FIELD (word, 5, 6); - val <<= 5; - val |= GET_FIELD (word, 0, 4); - val <<= 2; - val |= GET_FIELD (word, 7, 8); - return sign_extend (val, 21) << 11; -} - -/* deposit a 21 bit constant in a word. Although 21 bit constants are - usually the top 21 bits of a 32 bit constant, we assume that only - the low 21 bits of opnd are relevant */ - -unsigned -deposit_21 (opnd, word) - unsigned opnd, word; -{ - unsigned val = 0; - - val |= GET_FIELD (opnd, 11 + 14, 11 + 18); - val <<= 2; - val |= GET_FIELD (opnd, 11 + 12, 11 + 13); - val <<= 2; - val |= GET_FIELD (opnd, 11 + 19, 11 + 20); - val <<= 11; - val |= GET_FIELD (opnd, 11 + 1, 11 + 11); - val <<= 1; - val |= GET_FIELD (opnd, 11 + 0, 11 + 0); - return word | val; -} - -/* extract a 12 bit constant from branch instructions */ - -int -extract_12 (word) - unsigned word; -{ - return sign_extend (GET_FIELD (word, 19, 28) | - GET_FIELD (word, 29, 29) << 10 | - (word & 0x1) << 11, 12) << 2; -} - -/* extract a 17 bit constant from branch instructions, returning the - 19 bit signed value. */ - -int -extract_17 (word) - unsigned word; -{ - return sign_extend (GET_FIELD (word, 19, 28) | - GET_FIELD (word, 29, 29) << 10 | - GET_FIELD (word, 11, 15) << 11 | - (word & 0x1) << 16, 17) << 2; -} - - -CORE_ADDR -frame_saved_pc (frame) - FRAME frame; -{ - if (get_current_frame () == frame) - { - struct frame_saved_regs saved_regs; - - get_frame_saved_regs (frame, &saved_regs); - if (saved_regs.regs[RP_REGNUM]) - return read_memory_integer (saved_regs.regs[RP_REGNUM], 4); - else - return read_register (RP_REGNUM); - } - return read_memory_integer (frame->frame - 20, 4) & ~0x3; -} - -/* To see if a frame chain is valid, see if the caller looks like it - was compiled with gcc. */ - -int frame_chain_valid (chain, thisframe) - FRAME_ADDR chain; - FRAME thisframe; -{ - if (chain && (chain > 0x60000000 - /* || remote_debugging -this is no longer used */ -#ifdef KERNELDEBUG - || kernel_debugging -#endif - )) - { - CORE_ADDR pc = get_pc_function_start (FRAME_SAVED_PC (thisframe)); - - if (!inside_entry_file (pc)) - return 0; - /* look for stw rp, -20(0,sp); copy 4,1; copy sp, 4 */ - if (read_memory_integer (pc, 4) == 0x6BC23FD9) - pc = pc + 4; - - if (read_memory_integer (pc, 4) == 0x8040241 && - read_memory_integer (pc + 4, 4) == 0x81E0244) - return 1; - else - return 0; - } - else - return 0; -} - -/* Some helper functions. gcc_p returns 1 if the function beginning at - pc appears to have been compiled with gcc. hpux_cc_p returns 1 if - fn was compiled with hpux cc. gcc functions look like : - - stw rp,-0x14(sp) ; optional - or r4,r0,r1 - or sp,r0,r4 - stwm r1,framesize(sp) - - hpux cc functions look like: - - stw rp,-0x14(sp) ; optional. - stwm r3,framesiz(sp) - */ - -gcc_p (pc) - CORE_ADDR pc; -{ - if (read_memory_integer (pc, 4) == 0x6BC23FD9) - pc = pc + 4; - - if (read_memory_integer (pc, 4) == 0x8040241 && - read_memory_integer (pc + 4, 4) == 0x81E0244) - return 1; - return 0; -} - - -find_dummy_frame_regs (frame, frame_saved_regs) - struct frame_info *frame; - struct frame_saved_regs *frame_saved_regs; -{ - CORE_ADDR fp = frame->frame; - int i; - - frame_saved_regs->regs[RP_REGNUM] = fp - 20 & ~0x3; - frame_saved_regs->regs[FP_REGNUM] = fp; - frame_saved_regs->regs[1] = fp + 8; - frame_saved_regs->regs[3] = fp + 12; - for (fp += 16, i = 3; i < 30; fp += 4, i++) - frame_saved_regs->regs[i] = fp; - frame_saved_regs->regs[31] = fp; - fp += 4; - for (i = FP0_REGNUM; i < NUM_REGS; i++, fp += 8) - frame_saved_regs->regs[i] = fp; - /* depend on last increment of fp */ - frame_saved_regs->regs[IPSW_REGNUM] = fp - 4; - frame_saved_regs->regs[SAR_REGNUM] = fp; - fp += 4; - frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp; - frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp; -} - -CORE_ADDR -hp_push_arguments (nargs, args, sp, struct_return, struct_addr) - int nargs; - value *args; - CORE_ADDR sp; - int struct_return; - CORE_ADDR struct_addr; -{ - /* array of arguments' offsets */ - int *offset = (int *)alloca(nargs); - int cum = 0; - int i, alignment; - - for (i = 0; i < nargs; i++) - { - cum += TYPE_LENGTH (VALUE_TYPE (args[i])); - /* value must go at proper alignment. Assume alignment is a - power of two.*/ - alignment = hp_alignof (VALUE_TYPE (args[i])); - if (cum % alignment) - cum = (cum + alignment) & -alignment; - offset[i] = -cum; - } - for (i == 0; i < nargs; i++) - { - write_memory (sp + offset[i], VALUE_CONTENTS (args[i]), sizeof(int)); - } - sp += min ((cum + 7) & -8, 48); - if (struct_return) - write_register (28, struct_addr); - return sp + 48; -} - -/* return the alignment of a type in bytes. Structures have the maximum - alignment required by their fields. */ - -int -hp_alignof (arg) - struct type *arg; -{ - int max_align, align, i; - switch (TYPE_CODE (arg)) - { - case TYPE_CODE_PTR: - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - return TYPE_LENGTH (arg); - case TYPE_CODE_ARRAY: - return hp_alignof (TYPE_FIELD_TYPE (arg, 0)); - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - max_align = 2; - for (i = 0; i < TYPE_NFIELDS (arg); i++) - { - /* Bit fields have no real alignment. */ - if (!TYPE_FIELD_BITPOS (arg, i)) - { - align = hp_alignof (TYPE_FIELD_TYPE (arg, i)); - max_align = max (max_align, align); - } - } - return max_align; - default: - return 4; - } -} - -/* Print the register regnum, or all registers if regnum is -1 */ - -pa_do_registers_info (regnum, fpregs) - int regnum; - int fpregs; -{ - char raw_regs [REGISTER_BYTES]; - int i; - - for (i = 0; i < NUM_REGS; i++) - read_relative_register_raw_bytes (i, raw_regs + REGISTER_BYTE (i)); - if (regnum = -1) - pa_print_registers (raw_regs, regnum); - else if (regnum < FP0_REGNUM) - { - printf ("%s %x\n", reg_names[regnum], *(long *)(raw_regs + - REGISTER_BYTE (regnum))); - } - else - pa_print_fp_reg (regnum); -} - -pa_print_registers (raw_regs, regnum) - char *raw_regs; - int regnum; -{ - int i; - - for (i = 0; i < 18; i++) - printf ("%8.8s: %8x %8.8s: %8x %8.8s: %8x %8.8s: %8x\n", - reg_names[i], - *(int *)(raw_regs + REGISTER_BYTE (i)), - reg_names[i + 18], - *(int *)(raw_regs + REGISTER_BYTE (i + 18)), - reg_names[i + 36], - *(int *)(raw_regs + REGISTER_BYTE (i + 36)), - reg_names[i + 54], - *(int *)(raw_regs + REGISTER_BYTE (i + 54))); - for (i = 72; i < NUM_REGS; i++) - pa_print_fp_reg (i); -} - -pa_print_fp_reg (i) - int i; -{ - unsigned char raw_buffer[MAX_REGISTER_RAW_SIZE]; - unsigned char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE]; - REGISTER_TYPE val; - - /* Get the data in raw format, then convert also to virtual format. */ - read_relative_register_raw_bytes (i, raw_buffer); - REGISTER_CONVERT_TO_VIRTUAL (i, raw_buffer, virtual_buffer); - - fputs_filtered (reg_names[i], stdout); - print_spaces_filtered (15 - strlen (reg_names[i]), stdout); - - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, stdout, 0, - 1, 0, Val_pretty_default); - printf_filtered ("\n"); - -} - -/* - * Virtual to physical translation routines for Utah's Mach 3.0 - */ -#ifdef MACHKERNELDEBUG - -#define STATIC - -#if 0 /* too many includes to resolve, too much crap */ -#include -#include -#include -#else -/* queue.h */ -struct queue_entry { - struct queue_entry *next; /* next element */ - struct queue_entry *prev; /* previous element */ -}; - -typedef struct queue_entry *queue_t; -typedef struct queue_entry queue_head_t; -typedef struct queue_entry queue_chain_t; -typedef struct queue_entry *queue_entry_t; - -/* pmap.h */ -#define HP800_HASHSIZE 1024 -#define HP800_HASHSIZE_LOG2 10 - -#define pmap_hash(space, offset) \ - (((unsigned) (space) << 5 ^ \ - ((unsigned) (offset) >> 19 | (unsigned) (space) << 13) ^ \ - (unsigned) (offset) >> 11) & (HP800_HASHSIZE-1)) - -struct mapping { - queue_head_t hash_link; /* hash table links */ - queue_head_t phys_link; /* for mappings of a given PA */ - space_t space; /* virtual space */ - unsigned offset; /* virtual page number */ - unsigned tlbpage; /* physical page (for TLB load) */ - unsigned tlbprot; /* prot/access rights (for TLB load) */ - struct pmap *pmap; /* pmap mapping belongs to */ -}; - -struct phys_entry { - queue_head_t phys_link; /* head of mappings of a given PA */ - struct mapping *writer; /* mapping with R/W access */ - unsigned tlbprot; /* TLB format protection */ -}; - -#endif - -#define atop(a) ((unsigned)(a) >> 11) -#define ptoa(p) ((unsigned)(p) << 11) -#define trunc_page(a) ((unsigned)(a) & ~2047) - -STATIC long equiv_end; -STATIC queue_head_t *Ovtop_table, *vtop_table, *Ofree_mapping, free_mapping; -STATIC struct phys_entry *Ophys_table, *phys_table; -STATIC long vm_last_phys, vm_first_phys; -STATIC struct mapping *firstmap, *lastmap, *Omap_table, *map_table; -STATIC unsigned Omlow, Omhigh, Omhead, Ovlow, Ovhigh, Oplow, Ophigh; -STATIC unsigned mlow, mhigh, mhead, vlow, vhigh, plow, phigh; -STATIC int vtopsize, physsize, mapsize; -STATIC int kmemfd; - -#define IS_OVTOPPTR(p) ((unsigned)(p) >= Ovlow && (unsigned)(p) < Ovhigh) -#define IS_OMAPPTR(p) ((unsigned)(p) >= Omlow && (unsigned)(p) < Omhigh) -#define IS_OPHYSPTR(p) ((unsigned)(p) >= Oplow && (unsigned)(p) < Ophigh) -#define IS_VTOPPTR(p) ((unsigned)(p) >= vlow && (unsigned)(p) < vhigh) -#define IS_MAPPTR(p) ((unsigned)(p) >= mlow && (unsigned)(p) < mhigh) -#define IS_PHYSPTR(p) ((unsigned)(p) >= plow && (unsigned)(p) < phigh) - -struct mapstate { - char unused; - char flags; - short hashix; - short physix; -} *mapstate; - -/* flags */ -#define M_ISFREE 1 -#define M_ISHASH 2 -#define M_ISPHYS 4 - -mach_vtophys_init() -{ - int errors = 0; - - if (!readdata()) - errors++; - if (!verifydata()) - errors++; - if (!errors) - return(1); - fflush(stdout); - fprintf(stderr, - "translate: may not be able to translate all addresses\n"); - return(0); -} - -mach_vtophys(space, off, pa) - unsigned space, off, *pa; -{ - register int i; - register queue_t qp; - register struct mapping *mp; - int poff; - - /* - * Kernel IO or equivilently mapped, one to one. - */ - if (space == 0 && (long)off < equiv_end) { - *pa = off; - return(1); - } - /* - * Else look it up in specified space - */ - poff = off - trunc_page(off); - off = trunc_page(off); - qp = &vtop_table[pmap_hash(space, off)]; - for (mp = (struct mapping *)qp->next; - qp != (queue_entry_t)mp; - mp = (struct mapping *)mp->hash_link.next) { - if (mp->space == space && mp->offset == off) { - *pa = (mp->tlbpage << 7) | poff; - return(1); - } - } - return(0); -} - -STATIC -readdata() -{ - char *tmp, *mach_malloc(); - long size; - - /* easy scalars */ - mach_read("equiv_end", ~0, (char *)&equiv_end, sizeof equiv_end); - mach_read("vm_first_phys", ~0, - (char *)&vm_first_phys, sizeof vm_first_phys); - mach_read("vm_last_phys", ~0, - (char *)&vm_last_phys, sizeof vm_last_phys); - mach_read("firstmap", ~0, (char *)&firstmap, sizeof firstmap); - mach_read("lastmap", ~0, (char *)&lastmap, sizeof lastmap); - - /* virtual to physical hash table */ - vtopsize = HP800_HASHSIZE; - size = vtopsize * sizeof(queue_head_t); - tmp = mach_malloc("vtop table", size); - mach_read("vtop_table", ~0, (char *)&Ovtop_table, sizeof Ovtop_table); - mach_read("vtop table", (CORE_ADDR)Ovtop_table, tmp, size); - vtop_table = (queue_head_t *) tmp; - - /* inverted page table */ - physsize = atop(vm_last_phys - vm_first_phys); - size = physsize * sizeof(struct phys_entry); - tmp = mach_malloc("phys table", size); - mach_read("phys_table", ~0, (char *)&Ophys_table, sizeof Ophys_table); - mach_read("phys table", (CORE_ADDR)Ophys_table, tmp, size); - phys_table = (struct phys_entry *) tmp; - - /* mapping structures */ - Ofree_mapping = (queue_head_t *) ksym_lookup("free_mapping"); - mach_read("free mapping", (CORE_ADDR)Ofree_mapping, - (char *) &free_mapping, sizeof free_mapping); - Omap_table = firstmap; - mapsize = lastmap - firstmap; - size = mapsize * sizeof(struct mapping); - tmp = mach_malloc("mapping table", size); - mach_read("mapping table", (CORE_ADDR)Omap_table, tmp, size); - map_table = (struct mapping *) tmp; - - /* set limits */ - Ovlow = (unsigned) Ovtop_table; - Ovhigh = (unsigned) &Ovtop_table[vtopsize]; - Oplow = (unsigned) Ophys_table; - Ophigh = (unsigned) &Ophys_table[physsize]; - Omhead = (unsigned) Ofree_mapping; - Omlow = (unsigned) firstmap; - Omhigh = (unsigned) lastmap; - mlow = (unsigned) map_table; - mhigh = (unsigned) &map_table[mapsize]; - mhead = (unsigned) &free_mapping; - vlow = (unsigned) vtop_table; - vhigh = (unsigned) &vtop_table[vtopsize]; - plow = (unsigned) phys_table; - phigh = (unsigned) &phys_table[physsize]; - -#if 0 - fprintf(stderr, "Ovtop [%#x-%#x) Ophys [%#x-%#x) Omap %#x [%#x-%#x)\n", - Ovlow, Ovhigh, Oplow, Ophigh, Omhead, Omlow, Omhigh); - fprintf(stderr, "vtop [%#x-%#x) phys [%#x-%#x) map %#x [%#x-%#x)\n", - vlow, vhigh, plow, phigh, mhead, mlow, mhigh); -#endif - return(adjustdata()); -} - -STATIC unsigned -ptrcvt(ptr) - unsigned ptr; -{ - unsigned ret; - char *str; - - if (ptr == 0) { - ret = ptr; - str = "null"; - } else if (IS_OVTOPPTR(ptr)) { - ret = vlow + (ptr - Ovlow); - str = "vtop"; - } else if (IS_OPHYSPTR(ptr)) { - ret = plow + (ptr - Oplow); - str = "phys"; - } else if (IS_OMAPPTR(ptr)) { - ret = mlow + (ptr - Omlow); - str = "map"; - } else if (ptr == Omhead) { - ret = mhead; - str = "maphead"; - } else { - error("bogus pointer %#x", ptr); - str = "wild"; - ret = ptr; - } -#if 0 - fprintf(stderr, "%x (%s) -> %x\n", ptr, str, ret); -#endif - return(ret); -} - -STATIC int -adjustdata() -{ - register int i, lim; - queue_head_t *nq; - struct phys_entry *np; - struct mapping *nm; - - /* hash table */ - lim = vtopsize; - for (nq = vtop_table; nq < &vtop_table[lim]; nq++) { - nq->next = (queue_entry_t) ptrcvt((unsigned)nq->next); - nq->prev = (queue_entry_t) ptrcvt((unsigned)nq->prev); - } - - /* IPT */ - lim = physsize; - for (np = phys_table; np < &phys_table[lim]; np++) { - np->phys_link.next = (queue_entry_t) - ptrcvt((unsigned)np->phys_link.next); - np->phys_link.prev = (queue_entry_t) - ptrcvt((unsigned)np->phys_link.prev); - np->writer = (struct mapping *) ptrcvt((unsigned)np->writer); - } - - /* mapping table */ - free_mapping.next = (queue_entry_t)ptrcvt((unsigned)free_mapping.next); - free_mapping.prev = (queue_entry_t)ptrcvt((unsigned)free_mapping.prev); - lim = mapsize; - for (nm = map_table; nm < &map_table[lim]; nm++) { - nm->hash_link.next = (queue_entry_t) - ptrcvt((unsigned)nm->hash_link.next); - nm->hash_link.prev = (queue_entry_t) - ptrcvt((unsigned)nm->hash_link.prev); - nm->phys_link.next = (queue_entry_t) - ptrcvt((unsigned)nm->phys_link.next); - nm->phys_link.prev = (queue_entry_t) - ptrcvt((unsigned)nm->phys_link.prev); - } - return(1); -} - -/* - * Consistency checks, make sure: - * - * 1. all mappings are accounted for - * 2. no cycles - * 3. no wild pointers - * 4. consisent TLB state - */ -STATIC int -verifydata() -{ - register struct mapstate *ms; - register int i; - int errors = 0; - - mapstate = (struct mapstate *) - mach_malloc("map state", mapsize * sizeof(struct mapstate)); - for (ms = mapstate; ms < &mapstate[mapsize]; ms++) { - ms->flags = 0; - ms->hashix = ms->physix = -2; - } - - /* - * Check the free list - */ - checkhashchain(&free_mapping, M_ISFREE, -1); - /* - * Check every hash chain - */ - for (i = 0; i < vtopsize; i++) - checkhashchain(&vtop_table[i], M_ISHASH, i); - /* - * Check every phys chain - */ - for (i = 0; i < physsize; i++) - checkphyschain(&phys_table[i].phys_link, M_ISPHYS, i); - /* - * Cycle through mapstate looking for anomolies - */ - ms = mapstate; - for (i = 0; i < mapsize; i++) { - switch (ms->flags) { - case M_ISFREE: - case M_ISHASH|M_ISPHYS: - break; - case 0: - merror(ms, "not found"); - errors++; - break; - case M_ISHASH: - merror(ms, "in vtop but not phys"); - errors++; - break; - case M_ISPHYS: - merror(ms, "in phys but not vtop"); - errors++; - break; - default: - merror(ms, "totally bogus"); - errors++; - break; - } - ms++; - } - return(errors ? 0 : 1); -} - -STATIC void -checkhashchain(qhp, flag, ix) - queue_entry_t qhp; -{ - register queue_entry_t qp, pqp; - register struct mapping *mp; - struct mapstate *ms; - - qp = qhp->next; - /* - * First element is not a mapping structure, - * chain must be empty. - */ - if (!IS_MAPPTR(qp)) { - if (qp != qhp || qp != qhp->prev) - fatal("bad vtop_table header pointer"); - } else { - pqp = qhp; - do { - mp = (struct mapping *) qp; - qp = &mp->hash_link; - if (qp->prev != pqp) - fatal("bad hash_link prev pointer"); - ms = &mapstate[mp-map_table]; - ms->flags |= flag; - ms->hashix = ix; - pqp = (queue_entry_t) mp; - qp = qp->next; - } while (IS_MAPPTR(qp)); - if (qp != qhp) - fatal("bad hash_link next pointer"); - } -} - -STATIC void -checkphyschain(qhp, flag, ix) - queue_entry_t qhp; -{ - register queue_entry_t qp, pqp; - register struct mapping *mp; - struct mapstate *ms; - - qp = qhp->next; - /* - * First element is not a mapping structure, - * chain must be empty. - */ - if (!IS_MAPPTR(qp)) { - if (qp != qhp || qp != qhp->prev) - fatal("bad phys_table header pointer"); - } else { - pqp = qhp; - do { - mp = (struct mapping *) qp; - qp = &mp->phys_link; - if (qp->prev != pqp) - fatal("bad phys_link prev pointer"); - ms = &mapstate[mp-map_table]; - ms->flags |= flag; - ms->physix = ix; - pqp = (queue_entry_t) mp; - qp = qp->next; - } while (IS_MAPPTR(qp)); - if (qp != qhp) - fatal("bad phys_link next pointer"); - } -} - -STATIC void -merror(ms, str) - struct mapstate *ms; - char *str; -{ - terminal_ours(); - fflush(stdout); - fprintf(stderr, - "vtophys: %s: %c%c%c, hashix %d, physix %d, mapping %x\n", - str, - (ms->flags & M_ISFREE) ? 'F' : '-', - (ms->flags & M_ISHASH) ? 'H' : '-', - (ms->flags & M_ISPHYS) ? 'P' : '-', - ms->hashix, ms->physix, &map_table[ms-mapstate]); - return_to_top_level(); -} - -STATIC int -mach_read(str, from, top, size) - char *str; - CORE_ADDR from; - char *top; - int size; -{ - CORE_ADDR paddr; - - if (from == ~0) - from = ksym_lookup(str); - paddr = vtophys(0, from); - if (paddr == ~0 || physrd(paddr, top, size) != 0) - fatal("cannot read %s", str); -} - -STATIC char * -mach_malloc(str, size) - char *str; - int size; -{ - char *ptr = (char *) malloc(size); - - if (ptr == 0) - fatal("no memory for %s", str); - return(ptr); -} -#endif - -#ifdef KERNELDEBUG -void -_initialize_hp9k8_dep() -{ - add_com ("process-address", class_obscure, set_paddr_command, -"The process identified by (ps-style) ADDR becomes the\n\ -\"current\" process context for kernel debugging."); - add_com_alias ("paddr", "process-address", class_obscure, 0); - add_com ("virtual-to-physical", class_obscure, vtop_command, -"Translates the kernel virtual address ADDR into a physical address."); - add_com_alias ("vtop", "virtual-to-physical", class_obscure, 0); -} -#endif diff --git a/gdb/hppabsd-xdep.c b/gdb/hppabsd-xdep.c index bec14c4..e69de29 100644 --- a/gdb/hppabsd-xdep.c +++ b/gdb/hppabsd-xdep.c @@ -1,413 +0,0 @@ -/* Machine-dependent code which would otherwise be in infptrace.c, - for GDB, the GNU debugger. This code is for the HP PA-RISC cpu. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -/* Low level Unix child interface to ptrace, for GDB when running under Unix. - Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "target.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include -#ifndef USG -#include -#endif - - -#ifndef PT_ATTACH -#define PT_ATTACH PTRACE_ATTACH -#endif -#ifndef PT_DETACH -#define PT_DETACH PTRACE_DETACH -#endif - -#include "gdbcore.h" -#include /* After a.out.h */ -#include -#include - -/* This function simply calls ptrace with the given arguments. - It exists so that all calls to ptrace are isolated in this - machine-dependent file. */ -int -call_ptrace (request, pid, addr, data) - int request, pid; - PTRACE_ARG3_TYPE addr; - int data; -{ - return ptrace (request, pid, addr, data); -} - -#ifdef DEBUG_PTRACE -/* For the rest of the file, use an extra level of indirection */ -/* This lets us breakpoint usefully on call_ptrace. */ -#define ptrace call_ptrace -#endif - -void -kill_inferior () -{ - if (inferior_pid == 0) - return; - ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0); - wait ((int *)0); - target_mourn_inferior (); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (step, signal) - int step; - int signal; -{ - errno = 0; - - /* An address of (PTRACE_ARG3_TYPE) 1 tells ptrace to continue from where - it was. (If GDB wanted it to start some other way, we have already - written a new PC value to the child.) */ - - if (step) - ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); - else - ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); - - if (errno) - perror_with_name ("ptrace"); -} - -#ifdef ATTACH_DETACH -/* Nonzero if we are debugging an attached process rather than - an inferior. */ -extern int attach_flag; - -/* Start debugging the process whose number is PID. */ -int -attach (pid) - int pid; -{ - errno = 0; - ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 1; - return pid; -} - -/* Stop debugging the process whose number is PID - and continue it with signal number SIGNAL. - SIGNAL = 0 means just continue it. */ - -void -detach (signal) - int signal; -{ - errno = 0; - ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 0; -} -#endif /* ATTACH_DETACH */ - -#if !defined (FETCH_INFERIOR_REGISTERS) - -/* KERNEL_U_ADDR is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#if defined (KERNEL_U_ADDR_BSD) -/* Get kernel_u_addr using BSD-style nlist(). */ -CORE_ADDR kernel_u_addr; - -#include /* For struct nlist */ - -void -_initialize_kernel_u_addr () -{ - struct nlist names[2]; - - names[0].n_un.n_name = "_u"; - names[1].n_un.n_name = NULL; - if (nlist ("/vmunix", names) == 0) - kernel_u_addr = names[0].n_value; - else - fatal ("Unable to get kernel u area address."); -} -#endif /* KERNEL_U_ADDR_BSD. */ - -#if defined (KERNEL_U_ADDR_HPUX) -/* Get kernel_u_addr using HPUX-style nlist(). */ -CORE_ADDR kernel_u_addr; - -struct hpnlist { - char * n_name; - long n_value; - unsigned char n_type; - unsigned char n_length; - short n_almod; - short n_unused; -}; -static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }}; - -/* read the value of the u area from the hp-ux kernel */ -void _initialize_kernel_u_addr () -{ - struct user u; - nlist ("/hp-ux", &nl); - kernel_u_addr = nl[0].n_value; -} -#endif /* KERNEL_U_ADDR_HPUX. */ - -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* U_REGS_OFFSET is the offset of the registers within the u area. */ -#if !defined (U_REGS_OFFSET) -#define U_REGS_OFFSET \ - ptrace (PT_READ_U, inferior_pid, \ - (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \ - - KERNEL_U_ADDR -#endif - -/* Registers we shouldn't try to fetch. */ -#if !defined (CANNOT_FETCH_REGISTER) -#define CANNOT_FETCH_REGISTER(regno) 0 -#endif - -/* Fetch one register. */ - -static void -fetch_register (regno) - int regno; -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - char mess[128]; /* For messages */ - register int i; - - /* Offset of registers within the u area. */ - unsigned int offset; - - if (CANNOT_FETCH_REGISTER (regno)) - { - bzero (buf, REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ - supply_register (regno, buf); - return; - } - - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - errno = 0; - *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - if (errno != 0) - { - sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno); - perror_with_name (mess); - } - } - if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM) - buf[3] &= ~0x3; - supply_register (regno, buf); -} - - -/* Fetch all registers, or just one, from the child process. */ - -void -fetch_inferior_registers (regno) - int regno; -{ - if (regno == -1) - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); - else - fetch_register (regno); -} - -/* Registers we shouldn't try to store. */ -#if !defined (CANNOT_STORE_REGISTER) -#define CANNOT_STORE_REGISTER(regno) 0 -#endif - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - extern char registers[]; - register int i; - - unsigned int offset = U_REGS_OFFSET; - - if (regno >= 0) - { - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - if (CANNOT_STORE_REGISTER (regno)) - continue; - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - } - return; -} -#endif /* !defined (FETCH_INFERIOR_REGISTERS). */ - -/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory - in the NEW_SUN_PTRACE case. - It ought to be straightforward. But it appears that writing did - not write the data that I specified. I cannot understand where - it got the data that it actually did write. */ - -/* Copy LEN bytes to or from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. Copy to inferior if - WRITE is nonzero. - - Returns the length copied, which is either the LEN argument or zero. - This xfer function does not do partial moves, since child_ops - doesn't allow memory operations to cross below us in the target stack - anyway. */ - -int -child_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (int); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - /* Allocate buffer of that many longwords. */ - register int *buffer = (int *) alloca (count * sizeof (int)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int)sizeof (int)) { - /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, - 0); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = ptrace (PT_READ_I, inferior_pid, - (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)), - 0); - } - - /* Copy data to be written over corresponding part of buffer */ - - bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i]); - if (errno) - { - /* Using the appropriate one (I or D) is necessary for - Gould NP1, at least. */ - errno = 0; - ptrace (PT_WRITE_I, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i]); - } - if (errno) - return 0; - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - buffer[i] = ptrace (PT_READ_I, inferior_pid, - (PTRACE_ARG3_TYPE) addr, 0); - if (errno) - return 0; - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); - } - return len; -} diff --git a/gdb/hppah-xdep.c b/gdb/hppah-xdep.c index a556998..e69de29 100644 --- a/gdb/hppah-xdep.c +++ b/gdb/hppah-xdep.c @@ -1,417 +0,0 @@ -/* Host-dependent code for HP PA-RISC runing HP/UX, for GDB. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "target.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include - -#include - - -#ifndef PT_ATTACH -#define PT_ATTACH PTRACE_ATTACH -#endif -#ifndef PT_DETACH -#define PT_DETACH PTRACE_DETACH -#endif - -#include "gdbcore.h" - -/* This function simply calls ptrace with the given arguments. - It exists so that all calls to ptrace are isolated in this - machine-dependent file. */ -int -call_ptrace (request, pid, addr, data) - int request, pid; - PTRACE_ARG3_TYPE addr; - int data; -{ - return ptrace (request, pid, addr, data, 0); -} - -#ifdef DEBUG_PTRACE -/* For the rest of the file, use an extra level of indirection */ -/* This lets us breakpoint usefully on call_ptrace. */ -#define ptrace call_ptrace -#endif - -void -kill_inferior () -{ - if (inferior_pid == 0) - return; - ptrace (PT_EXIT, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0, 0); /* PT_EXIT = PT_KILL ? */ - wait ((int *)0); - target_mourn_inferior (); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (step, signal) - int step; - int signal; -{ - errno = 0; - - /* An address of (PTRACE_ARG3_TYPE) 1 tells ptrace to continue from where - it was. (If GDB wanted it to start some other way, we have already - written a new PC value to the child.) */ - - if (step) - ptrace (PT_SINGLE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); - else - ptrace (PT_CONTIN, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); - - if (errno) - perror_with_name ("ptrace"); -} - -#ifdef ATTACH_DETACH -/* Nonzero if we are debugging an attached process rather than - an inferior. */ -extern int attach_flag; - -/* Start debugging the process whose number is PID. */ -int -attach (pid) - int pid; -{ - errno = 0; - ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0, 0); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 1; - return pid; -} - -/* Stop debugging the process whose number is PID - and continue it with signal number SIGNAL. - SIGNAL = 0 means just continue it. */ - -void -detach (signal) - int signal; -{ - errno = 0; - ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 0; -} -#endif /* ATTACH_DETACH */ - -#if !defined (FETCH_INFERIOR_REGISTERS) - -/* KERNEL_U_ADDR is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#if defined (KERNEL_U_ADDR_BSD) -/* Get kernel_u_addr using BSD-style nlist(). */ -CORE_ADDR kernel_u_addr; - -#include /* For struct nlist */ - -void -_initialize_kernel_u_addr () -{ - struct nlist names[2]; - - names[0].n_un.n_name = "_u"; - names[1].n_un.n_name = NULL; - if (nlist ("/vmunix", names) == 0) - kernel_u_addr = names[0].n_value; - else - fatal ("Unable to get kernel u area address."); -} -#endif /* KERNEL_U_ADDR_BSD. */ - -#if defined (KERNEL_U_ADDR_HPUX) -/* Get kernel_u_addr using HPUX-style nlist(). */ -CORE_ADDR kernel_u_addr; - -struct hpnlist { - char * n_name; - long n_value; - unsigned char n_type; - unsigned char n_length; - short n_almod; - short n_unused; -}; -static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }}; - -/* read the value of the u area from the hp-ux kernel */ -void _initialize_kernel_u_addr () -{ - struct user u; - nlist ("/hp-ux", &nl); - kernel_u_addr = nl[0].n_value; -} -#endif /* KERNEL_U_ADDR_HPUX. */ - -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* U_REGS_OFFSET is the offset of the registers within the u area. */ -#if !defined (U_REGS_OFFSET) -#define U_REGS_OFFSET \ - ptrace (PT_READ_U, inferior_pid, \ - (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0, 0) \ - - KERNEL_U_ADDR -#endif - -/* Registers we shouldn't try to fetch. */ -#if !defined (CANNOT_FETCH_REGISTER) -#define CANNOT_FETCH_REGISTER(regno) 0 -#endif - -/* Fetch one register. */ - -static void -fetch_register (regno) - int regno; -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - char mess[128]; /* For messages */ - register int i; - - /* Offset of registers within the u area. */ - unsigned int offset; - - if (CANNOT_FETCH_REGISTER (regno)) - { - bzero (buf, REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ - supply_register (regno, buf); - return; - } - - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - errno = 0; - *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0, 0); - regaddr += sizeof (int); - if (errno != 0) - { - sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno); - perror_with_name (mess); - } - } - supply_register (regno, buf); -} - - -/* Fetch all registers, or just one, from the child process. */ - -void -fetch_inferior_registers (regno) - int regno; -{ - if (regno == -1) - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); - else - fetch_register (regno); -} - -/* Registers we shouldn't try to store. */ -#if !defined (CANNOT_STORE_REGISTER) -#define CANNOT_STORE_REGISTER(regno) 0 -#endif - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - extern char registers[]; - register int i; - - unsigned int offset = U_REGS_OFFSET; - - if (regno >= 0) - { - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i], 0); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - if (CANNOT_STORE_REGISTER (regno)) - continue; - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i], 0); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - } - return; -} -#endif /* !defined (FETCH_INFERIOR_REGISTERS). */ - -/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory - in the NEW_SUN_PTRACE case. - It ought to be straightforward. But it appears that writing did - not write the data that I specified. I cannot understand where - it got the data that it actually did write. */ - -/* Copy LEN bytes to or from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. Copy to inferior if - WRITE is nonzero. - - Returns the length copied, which is either the LEN argument or zero. - This xfer function does not do partial moves, since child_ops - doesn't allow memory operations to cross below us in the target stack - anyway. */ - -int -child_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (int); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - /* Allocate buffer of that many longwords. */ - register int *buffer = (int *) alloca (count * sizeof (int)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int)sizeof (int)) { - /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_RIUSER, inferior_pid, - (PTRACE_ARG3_TYPE) addr, 0, 0); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = ptrace (PT_RIUSER, inferior_pid, - (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)), - 0, 0); - } - - /* Copy data to be written over corresponding part of buffer */ - - bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (int)) - { -#if 0 -/* The HP-UX kernel crashes if you use PT_WDUSER to write into the text - segment. FIXME -- does it work to write into the data segment using - WIUSER, or do these idiots really expect us to figure out which segment - the address is in, so we can use a separate system call for it??! */ - errno = 0; - ptrace (PT_WDUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i], 0); - if (errno) -#endif - { - /* Using the appropriate one (I or D) is necessary for - Gould NP1, at least. */ - errno = 0; - ptrace (PT_WIUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i], 0); - } - if (errno) - return 0; - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - buffer[i] = ptrace (PT_RIUSER, inferior_pid, - (PTRACE_ARG3_TYPE) addr, 0, 0); - if (errno) - return 0; - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); - } - return len; -} - - - - -int -getpagesize() -{ - return(4096); -} diff --git a/gdb/hppahpux-tdep.c b/gdb/hppahpux-tdep.c index 27bf9e9..e69de29 100644 --- a/gdb/hppahpux-tdep.c +++ b/gdb/hppahpux-tdep.c @@ -1,1427 +0,0 @@ -/* Machine-dependent code which would otherwise be in inflow.c and core.c, - for GDB, the GNU debugger. This code is for the HP PA-RISC cpu. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "value.h" - -/* For argument passing to the inferior */ -#include "symtab.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include - -#ifdef COFF_ENCAPSULATE -#include "a.out.encap.h" -#else -#include -#endif -#ifndef N_SET_MAGIC -#define N_SET_MAGIC(exec, val) ((exec).a_magic = (val)) -#endif - -/*#include After a.out.h */ -#include -#include -#include -#include - -#ifdef KERNELDEBUG -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern int kernel_debugging; -extern CORE_ADDR startup_file_start; -extern CORE_ADDR startup_file_end; - -#define KERNOFF ((unsigned)KERNBASE) -#define INKERNEL(x) ((x) >= KERNOFF && (x) < KERNOFF + ctob(slr)) - -static int ok_to_cache(); -static void set_kernel_boundaries(); - -int devmem = 0; -int vtophys_ready = 0; -int kerneltype; -#define OS_BSD 1 -#define OS_MACH 2 -#endif - -#include "gdbcore.h" -#include "gdbcmd.h" - -extern int errno; - - - - - - -/* Last modification time of executable file. - Also used in source.c to compare against mtime of a source file. */ - -extern int exec_mtime; - -/* Virtual addresses of bounds of the two areas of memory in the core file. */ - -/* extern CORE_ADDR data_start; */ -extern CORE_ADDR data_end; -extern CORE_ADDR stack_start; -extern CORE_ADDR stack_end; - -/* Virtual addresses of bounds of two areas of memory in the exec file. - Note that the data area in the exec file is used only when there is no core file. */ - -extern CORE_ADDR text_start; -extern CORE_ADDR text_end; - -extern CORE_ADDR exec_data_start; -extern CORE_ADDR exec_data_end; - -/* Address in executable file of start of text area data. */ - -extern int text_offset; - -/* Address in executable file of start of data area data. */ - -extern int exec_data_offset; - -/* Address in core file of start of data area data. */ - -extern int data_offset; - -/* Address in core file of start of stack area data. */ - -extern int stack_offset; - -struct header file_hdr; -struct som_exec_auxhdr exec_hdr; - -#ifdef KERNELDEBUG -/* - * Kernel debugging routines. - */ - -static struct pcb pcb; -static struct pde *pdir; -static struct hte *htbl; -static u_int npdir, nhtbl; - -static CORE_ADDR -ksym_lookup(name) - char *name; -{ - struct symbol *sym; - int i; - - if ((i = lookup_misc_func(name)) < 0) - error("kernel symbol `%s' not found.", name); - - return (misc_function_vector[i].address); -} - -/* - * (re-)set the variables that tell "inside_entry_file" where to end - * a stack backtrace. - */ -void -set_kernel_boundaries() -{ - switch (kerneltype) { - case OS_MACH: - startup_file_start = ksym_lookup("$syscall"); - startup_file_end = ksym_lookup("trap"); - break; - case OS_BSD: - startup_file_start = ksym_lookup("syscallinit"); - startup_file_end = ksym_lookup("$syscallexit"); - break; - } -} - -/* - * return true if 'len' bytes starting at 'addr' can be read out as - * longwords and/or locally cached (this is mostly for memory mapped - * i/o register access when debugging remote kernels). - */ -static int -ok_to_cache(addr, len) -{ - static CORE_ADDR ioptr; - - if (! ioptr) - ioptr = ksym_lookup("ioptr"); - - if (addr >= ioptr && addr < SPA_HIGH) - return (0); - - return (1); -} - -static -physrd(addr, dat, len) - u_int addr; - char *dat; -{ - if (lseek(corechan, addr, L_SET) == -1) - return (-1); - if (read(corechan, dat, len) != len) - return (-1); - - return (0); -} - -/* - * When looking at kernel data space through /dev/mem or with a core file, do - * virtual memory mapping. - */ -static CORE_ADDR -vtophys(space, addr) - unsigned space; - CORE_ADDR addr; -{ - struct pde *pptr; - u_int hindx, vpageno, ppageno; - CORE_ADDR phys = ~0; - - if (!vtophys_ready) { - phys = addr; /* XXX for kvread */ - } else if (kerneltype == OS_BSD) { - /* make offset into a virtual page no */ - vpageno = btop(addr); - /* - * Determine index into hash table, initialize pptr to this - * entry (since first word of pte & hte are same), and set - * physical page number for first entry in chain. - */ - hindx = pdirhash(space, addr) & (nhtbl-1); - pptr = (struct pde *) &htbl[hindx]; - ppageno = pptr->pde_next; - while (1) { - if (pptr->pde_end) - break; - pptr = &pdir[ppageno]; - /* - * If space id & virtual page number match, return - * "next PDIR entry of previous PDIR entry" as the - * physical page or'd with offset into page. - */ - if (pptr->pde_space == space && - pptr->pde_page == vpageno) { - phys = (CORE_ADDR) ((u_int)ptob(ppageno) | - (addr & PGOFSET)); - break; - } - ppageno = pptr->pde_next; - } - } -#ifdef MACHKERNELDEBUG - else if (kerneltype == OS_MACH) { - mach_vtophys(space, addr, &phys); - } -#endif -#if 0 - printf("vtophys(%x.%x) -> %x\n", space, addr, phys); -#endif - return (phys); -} - -static -kvread(addr) - CORE_ADDR addr; -{ - CORE_ADDR paddr; - - paddr = vtophys(0, addr); - if (paddr != ~0) - if (physrd(paddr, (char *)&addr, sizeof(addr)) == 0) - return (addr); - - return (~0); -} - -static void -read_pcb(addr) - u_int addr; -{ - int i, off; - extern char registers[]; - static int reg2pcb[] = { - /* RPB */ - -1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 45, 52, 51, 75, 74, 49, 53, 54, 55, 56, -1, 70, 66, 67, 68, 69, - 71, 72, 73, 34, 42, 43, 44, 46, 47, 58, 59, 60, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, - /* BSD */ - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 43, 64, 67, 68, 67, 47, 51, 52, 53, 54, -1, 35, 31, 32, 33, 34, - 36, 37, 38, 39, 40, 41, 42, 44, 45, 56, 57, 58,102,103,104, -1, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 82, 84, 86, 88, 90, 92, - 94, 96, 98, 100, - /* Mach */ - -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, 18, -1, - 25, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, 20, -1, -1, -1, 19, - 21, 22, 23, 24, 26, 27, -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, - 34, 35, 36, 37, 38, 39, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, - 42, 44, 46, 48 - }; - static struct rpb *rpbaddr = (struct rpb *) 0; - static u_int rpbpcbaddr = 0; - - if (!remote_debugging) { - /* - * If we are debugging a post-mortem and this is the first - * call of read_pcb, read the RPB. Also assoicate the - * thread/proc running at the time with the RPB. - */ - if (!devmem && rpbpcbaddr == 0) { - CORE_ADDR raddr = ksym_lookup("rpb"); - int usepcb = 1; - - if (raddr != ~0) { - rpbaddr = (struct rpb *) malloc(sizeof *rpbaddr); - if (!physrd(raddr, (char *)rpbaddr, sizeof *rpbaddr)) { - rpbpcbaddr = addr; - usepcb = 0; - } - } - if (usepcb) { - error("cannot read rpb, using pcb for registers\n"); - if (rpbaddr) - free((char *)rpbaddr); - rpbpcbaddr = ~0; - } - } - if (physrd (addr, (char *)&pcb, sizeof pcb)) - error ("cannot read pcb at %x.\n", addr); - } else { - if (remote_read_inferior_memory(addr, (char *)&pcb, sizeof pcb)) - error ("cannot read pcb at %x.\n", addr); - } - - if (kerneltype == OS_BSD) { - printf("p0br %lx p0lr %lx p1br %lx p1lr %lx\n", - pcb.pcb_p0br, pcb.pcb_p0lr, pcb.pcb_p1br, pcb.pcb_p1lr); - off = NUM_REGS; - } else { - printf("pcb %lx psw %lx ksp %lx\n", - addr, ((int *)&pcb)[31], ((int *)&pcb)[32]); - off = NUM_REGS * 2; - } - /* - * get the register values out of the sys pcb and - * store them where `read_register' will find them. - */ - bzero(registers, REGISTER_BYTES); - for (i = 0; i < NUM_REGS; ++i) - if (reg2pcb[i+off] != -1) - supply_register(i, &((int *)&pcb)[reg2pcb[i+off]]); - /* - * If the RPB is valid for this thread/proc use the register values - * contained there. - */ - if (addr == rpbpcbaddr) { - off = 0; - for (i = 0; i < NUM_REGS; ++i) - if (reg2pcb[i+off] != -1) - supply_register(i, &((int *)rpbaddr)[reg2pcb[i+off]]); - } -} - -void -setup_kernel_debugging() -{ - struct stat stb; - CORE_ADDR addr; - - fstat(corechan, &stb); - devmem = 0; - if ((stb.st_mode & S_IFMT) == S_IFCHR && stb.st_rdev == makedev(2, 0)) - devmem = 1; - - /* XXX */ - if (lookup_misc_func("Sysmap") < 0) - kerneltype = OS_MACH; - else - kerneltype = OS_BSD; - - if (kerneltype == OS_BSD) { - int len, err = 0; - - /* - * Hash table and PDIR are equivalently mapped - */ - nhtbl = kvread(ksym_lookup("nhtbl")); - if (nhtbl != ~0) { - len = nhtbl * sizeof(*htbl); - htbl = (struct hte *) malloc(len); - if (htbl) { - addr = kvread(ksym_lookup("htbl")); - if (physrd(addr, (char *)htbl, len)) - err++; - } else - err++; - } else - err++; - npdir = kvread(ksym_lookup("npdir")); - if (npdir != ~0) { - len = npdir * sizeof(*pdir); - pdir = (struct pde *) malloc(len); - if (pdir) { - addr = kvread(ksym_lookup("pdir")); - if (physrd(addr, (char *)pdir, len)) - err++; - } else - err++; - } else - err++; - if (err) { - error("cannot read PDIR/HTBL"); - return; - } - vtophys_ready = 1; - - /* - * pcb where "panic" saved registers in first thing in - * current u-area. The current u-area is pointed to by - * "uptr". - */ - addr = kvread(ksym_lookup("uptr")); - if (addr == ~0) { - error("cannot read current u-area address"); - return; - } - read_pcb(vtophys(0, addr)); /* XXX space */ - if (!devmem) { - /* find stack frame */ - CORE_ADDR panicstr; - char buf[256]; - register char *cp; - - panicstr = kvread(ksym_lookup("panicstr")); - if (panicstr == ~0) - return; - kernel_core_file_hook(panicstr, buf, sizeof(buf)); - for (cp = buf; cp < &buf[sizeof(buf)] && *cp; cp++) - if (!isascii(*cp) || (!isprint(*cp) && !isspace(*cp))) - *cp = '?'; - if (*cp) - *cp = '\0'; - printf("panic: %s\n", buf); - } - } -#ifdef MACHKERNELDEBUG - else { - int *thread; - - /* - * Set up address translation - */ - if (mach_vtophys_init() == 0) { - error("cannot initialize vtophys for Mach"); - return; - } - vtophys_ready = 1; - - /* - * Locate active thread and read PCB - * XXX MAJOR HACK - * - assumes uni-processor - * - assumes position of pcb to avoid mach includes - */ - thread = (int *)kvread(ksym_lookup("active_threads")); - addr = kvread(&thread[9]); /* XXX: pcb addr */ - read_pcb(vtophys(0, addr)); - } -#endif -} - -vtop_command(arg) - char *arg; -{ - u_int sp, off, pa; - - if (!arg) - error_no_arg("kernel virtual address"); - if (!kernel_debugging) - error("not debugging kernel"); - - sp = 0; /* XXX */ - off = (u_int) parse_and_eval_address(arg); - pa = vtophys(sp, off); - printf("%lx.%lx -> ", sp, off); - if (pa == ~0) - printf("\n"); - else - printf("%lx\n", pa); -} - -set_paddr_command(arg) - char *arg; -{ - u_int addr; - - if (!arg) { - if (kerneltype == OS_BSD) - error_no_arg("ps-style address for new process"); - else - error_no_arg("thread structure virtual address"); - } - if (!kernel_debugging) - error("not debugging kernel"); - - addr = (u_int) parse_and_eval_address(arg); - if (kerneltype == OS_BSD) - addr = ctob(addr); - else { - addr = kvread(&(((int *)addr)[9])); /* XXX: pcb addr */ - addr = vtophys(0, addr); /* XXX space */ - } - read_pcb(addr); - - flush_cached_frames(); - set_current_frame(create_new_frame(read_register(FP_REGNUM), read_pc())); - select_frame(get_current_frame(), 0); -} - -/* - * read len bytes from kernel virtual address 'addr' into local - * buffer 'buf'. Return 0 if read ok, 1 otherwise. On read - * errors, portion of buffer not read is zeroed. - */ -kernel_core_file_hook(addr, buf, len) - CORE_ADDR addr; - char *buf; - int len; -{ - int i; - CORE_ADDR paddr; - - while (len > 0) { - paddr = vtophys(0, addr); /* XXX space */ - if (paddr == ~0) { - bzero(buf, len); - return (1); - } - /* we can't read across a page boundary */ - i = min(len, NBPG - (addr & PGOFSET)); - if (physrd(paddr, buf, i)) { - bzero(buf, len); - return (1); - } - buf += i; - addr += i; - len -= i; - } - return (0); -} -#endif - - - - - - -/* Routines to extract various sized constants out of hppa - instructions. */ - -/* This assumes that no garbage lies outside of the lower bits of - value. */ - -int -sign_extend (val, bits) - unsigned val, bits; -{ - return (int)(val >> bits - 1 ? (-1 << bits) | val : val); -} - -/* For many immediate values the sign bit is the low bit! */ - -int -low_sign_extend (val, bits) - unsigned val, bits; -{ - return (int)((val & 0x1 ? (-1 << (bits - 1)) : 0) | val >> 1); -} -/* extract the immediate field from a ld{bhw}s instruction */ - - - -unsigned -get_field (val, from, to) - unsigned val, from, to; -{ - val = val >> 31 - to; - return val & ((1 << 32 - from) - 1); -} - -unsigned -set_field (val, from, to, new_val) - unsigned *val, from, to; -{ - unsigned mask = ~((1 << (to - from + 1)) << (31 - from)); - return *val = *val & mask | (new_val << (31 - from)); -} - -/* extract a 3-bit space register number from a be, ble, mtsp or mfsp */ - -extract_3 (word) - unsigned word; -{ - return GET_FIELD (word, 18, 18) << 2 | GET_FIELD (word, 16, 17); -} - -extract_5_load (word) - unsigned word; -{ - return low_sign_extend (word >> 16 & MASK_5, 5); -} - -/* extract the immediate field from a st{bhw}s instruction */ - -int -extract_5_store (word) - unsigned word; -{ - return low_sign_extend (word & MASK_5, 5); -} - -/* extract an 11 bit immediate field */ - -int -extract_11 (word) - unsigned word; -{ - return low_sign_extend (word & MASK_11, 11); -} - -/* extract a 14 bit immediate field */ - -int -extract_14 (word) - unsigned word; -{ - return low_sign_extend (word & MASK_14, 14); -} - -/* deposit a 14 bit constant in a word */ - -unsigned -deposit_14 (opnd, word) - int opnd; - unsigned word; -{ - unsigned sign = (opnd < 0 ? 1 : 0); - - return word | ((unsigned)opnd << 1 & MASK_14) | sign; -} - -/* extract a 21 bit constant */ - -int -extract_21 (word) - unsigned word; -{ - int val; - - word &= MASK_21; - word <<= 11; - val = GET_FIELD (word, 20, 20); - val <<= 11; - val |= GET_FIELD (word, 9, 19); - val <<= 2; - val |= GET_FIELD (word, 5, 6); - val <<= 5; - val |= GET_FIELD (word, 0, 4); - val <<= 2; - val |= GET_FIELD (word, 7, 8); - return sign_extend (val, 21) << 11; -} - -/* deposit a 21 bit constant in a word. Although 21 bit constants are - usually the top 21 bits of a 32 bit constant, we assume that only - the low 21 bits of opnd are relevant */ - -unsigned -deposit_21 (opnd, word) - unsigned opnd, word; -{ - unsigned val = 0; - - val |= GET_FIELD (opnd, 11 + 14, 11 + 18); - val <<= 2; - val |= GET_FIELD (opnd, 11 + 12, 11 + 13); - val <<= 2; - val |= GET_FIELD (opnd, 11 + 19, 11 + 20); - val <<= 11; - val |= GET_FIELD (opnd, 11 + 1, 11 + 11); - val <<= 1; - val |= GET_FIELD (opnd, 11 + 0, 11 + 0); - return word | val; -} - -/* extract a 12 bit constant from branch instructions */ - -int -extract_12 (word) - unsigned word; -{ - return sign_extend (GET_FIELD (word, 19, 28) | - GET_FIELD (word, 29, 29) << 10 | - (word & 0x1) << 11, 12) << 2; -} - -/* extract a 17 bit constant from branch instructions, returning the - 19 bit signed value. */ - -int -extract_17 (word) - unsigned word; -{ - return sign_extend (GET_FIELD (word, 19, 28) | - GET_FIELD (word, 29, 29) << 10 | - GET_FIELD (word, 11, 15) << 11 | - (word & 0x1) << 16, 17) << 2; -} - - -CORE_ADDR -frame_saved_pc (frame) - FRAME frame; -{ - if (get_current_frame () == frame) - { - struct frame_saved_regs saved_regs; - CORE_ADDR pc = get_frame_pc (frame); - - get_frame_saved_regs (frame, &saved_regs); - if (pc >= millicode_start && pc < millicode_end) - return read_register (31); - else if (saved_regs.regs[RP_REGNUM]) - return read_memory_integer (saved_regs.regs[RP_REGNUM], 4); - else - return read_register (RP_REGNUM); - } - return read_memory_integer (frame->frame - 20, 4) & ~0x3; -} - - -/* To see if a frame chain is valid, see if the caller looks like it - was compiled with gcc. */ - -int frame_chain_valid (chain, thisframe) - FRAME_ADDR chain; - FRAME thisframe; -{ - if (chain && (chain > 0x60000000 - /* || remote_debugging -this is no longer used */ -#ifdef KERNELDEBUG - || kernel_debugging -#endif - )) - { - CORE_ADDR pc = get_pc_function_start (FRAME_SAVED_PC (thisframe)); - - if (!inside_entry_file (pc)) - return 0; - /* look for stw rp, -20(0,sp); copy 4,1; copy sp, 4 */ - if (read_memory_integer (pc, 4) == 0x6BC23FD9) - pc = pc + 4; - - if (read_memory_integer (pc, 4) == 0x8040241 && - read_memory_integer (pc + 4, 4) == 0x81E0244) - return 1; - else - return 0; - } - else - return 0; -} - -/* Some helper functions. gcc_p returns 1 if the function beginning at - pc appears to have been compiled with gcc. hpux_cc_p returns 1 if - fn was compiled with hpux cc. gcc functions look like : - - stw rp,-0x14(sp) ; optional - or r4,r0,r1 - or sp,r0,r4 - stwm r1,framesize(sp) - - hpux cc functions look like: - - stw rp,-0x14(sp) ; optional. - stwm r3,framesiz(sp) - */ - -gcc_p (pc) - CORE_ADDR pc; -{ - if (read_memory_integer (pc, 4) == 0x6BC23FD9) - pc = pc + 4; - - if (read_memory_integer (pc, 4) == 0x8040241 && - read_memory_integer (pc + 4, 4) == 0x81E0244) - return 1; - return 0; -} - - -find_dummy_frame_regs (frame, frame_saved_regs) - struct frame_info *frame; - struct frame_saved_regs *frame_saved_regs; -{ - CORE_ADDR fp = frame->frame; - int i; - - frame_saved_regs->regs[RP_REGNUM] = fp - 20 & ~0x3; - frame_saved_regs->regs[FP_REGNUM] = fp; - frame_saved_regs->regs[1] = fp + 8; - frame_saved_regs->regs[3] = fp + 12; - for (fp += 16, i = 3; i < 30; fp += 4, i++) - frame_saved_regs->regs[i] = fp; - frame_saved_regs->regs[31] = fp; - fp += 4; - for (i = FP0_REGNUM; i < NUM_REGS; i++, fp += 8) - frame_saved_regs->regs[i] = fp; - /* depend on last increment of fp */ - frame_saved_regs->regs[IPSW_REGNUM] = fp - 4; - frame_saved_regs->regs[SAR_REGNUM] = fp; - fp += 4; - frame_saved_regs->regs[PCOQ_TAIL_REGNUM] = fp; - frame_saved_regs->regs[PCSQ_TAIL_REGNUM] = fp; -} - -CORE_ADDR -hp_push_arguments (nargs, args, sp, struct_return, struct_addr) - int nargs; - value *args; - CORE_ADDR sp; - int struct_return; - CORE_ADDR struct_addr; -{ - /* array of arguments' offsets */ - int *offset = (int *)alloca(nargs); - int cum = 0; - int i, alignment; - - for (i = 0; i < nargs; i++) - { - cum += TYPE_LENGTH (VALUE_TYPE (args[i])); - /* value must go at proper alignment. Assume alignment is a - power of two.*/ - alignment = hp_alignof (VALUE_TYPE (args[i])); - if (cum % alignment) - cum = (cum + alignment) & -alignment; - offset[i] = -cum; - } - for (i == 0; i < nargs; i++) - { - write_memory (sp + offset[i], VALUE_CONTENTS (args[i]), sizeof(int)); - } - sp += min ((cum + 7) & -8, 48); - if (struct_return) - write_register (28, struct_addr); - return sp + 48; -} - -/* return the alignment of a type in bytes. Structures have the maximum - alignment required by their fields. */ - -int -hp_alignof (arg) - struct type *arg; -{ - int max_align, align, i; - switch (TYPE_CODE (arg)) - { - case TYPE_CODE_PTR: - case TYPE_CODE_INT: - case TYPE_CODE_FLT: - return TYPE_LENGTH (arg); - case TYPE_CODE_ARRAY: - return hp_alignof (TYPE_FIELD_TYPE (arg, 0)); - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - max_align = 2; - for (i = 0; i < TYPE_NFIELDS (arg); i++) - { - /* Bit fields have no real alignment. */ - if (!TYPE_FIELD_BITPOS (arg, i)) - { - align = hp_alignof (TYPE_FIELD_TYPE (arg, i)); - max_align = max (max_align, align); - } - } - return max_align; - default: - return 4; - } -} - -/* Print the register regnum, or all registers if regnum is -1 */ - -pa_do_registers_info (regnum, fpregs) - int regnum; - int fpregs; -{ - char raw_regs [REGISTER_BYTES]; - int i; - - for (i = 0; i < NUM_REGS; i++) - read_relative_register_raw_bytes (i, raw_regs + REGISTER_BYTE (i)); - if (regnum = -1) - pa_print_registers (raw_regs, regnum); - else if (regnum < FP0_REGNUM) - { - printf ("%s %x\n", reg_names[regnum], *(long *)(raw_regs + - REGISTER_BYTE (regnum))); - } - else - pa_print_fp_reg (regnum); -} - -pa_print_registers (raw_regs, regnum) - char *raw_regs; - int regnum; -{ - int i; - - for (i = 0; i < 18; i++) - printf ("%8.8s: %8x %8.8s: %8x %8.8s: %8x %8.8s: %8x\n", - reg_names[i], - *(int *)(raw_regs + REGISTER_BYTE (i)), - reg_names[i + 18], - *(int *)(raw_regs + REGISTER_BYTE (i + 18)), - reg_names[i + 36], - *(int *)(raw_regs + REGISTER_BYTE (i + 36)), - reg_names[i + 54], - *(int *)(raw_regs + REGISTER_BYTE (i + 54))); - for (i = 72; i < NUM_REGS; i++) - pa_print_fp_reg (i); -} - -pa_print_fp_reg (i) - int i; -{ - unsigned char raw_buffer[MAX_REGISTER_RAW_SIZE]; - unsigned char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE]; - REGISTER_TYPE val; - - /* Get the data in raw format, then convert also to virtual format. */ - read_relative_register_raw_bytes (i, raw_buffer); - REGISTER_CONVERT_TO_VIRTUAL (i, raw_buffer, virtual_buffer); - - fputs_filtered (reg_names[i], stdout); - print_spaces_filtered (15 - strlen (reg_names[i]), stdout); - - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, stdout, 0, - 1, 0, Val_pretty_default); - printf_filtered ("\n"); - -} - -/* - * Virtual to physical translation routines for Utah's Mach 3.0 - */ -#ifdef MACHKERNELDEBUG - -#define STATIC - -#if 0 /* too many includes to resolve, too much crap */ -#include -#include -#include -#else -/* queue.h */ -struct queue_entry { - struct queue_entry *next; /* next element */ - struct queue_entry *prev; /* previous element */ -}; - -typedef struct queue_entry *queue_t; -typedef struct queue_entry queue_head_t; -typedef struct queue_entry queue_chain_t; -typedef struct queue_entry *queue_entry_t; - -/* pmap.h */ -#define HP800_HASHSIZE 1024 -#define HP800_HASHSIZE_LOG2 10 - -#define pmap_hash(space, offset) \ - (((unsigned) (space) << 5 ^ \ - ((unsigned) (offset) >> 19 | (unsigned) (space) << 13) ^ \ - (unsigned) (offset) >> 11) & (HP800_HASHSIZE-1)) - -struct mapping { - queue_head_t hash_link; /* hash table links */ - queue_head_t phys_link; /* for mappings of a given PA */ - space_t space; /* virtual space */ - unsigned offset; /* virtual page number */ - unsigned tlbpage; /* physical page (for TLB load) */ - unsigned tlbprot; /* prot/access rights (for TLB load) */ - struct pmap *pmap; /* pmap mapping belongs to */ -}; - -struct phys_entry { - queue_head_t phys_link; /* head of mappings of a given PA */ - struct mapping *writer; /* mapping with R/W access */ - unsigned tlbprot; /* TLB format protection */ -}; - -#endif - -#define atop(a) ((unsigned)(a) >> 11) -#define ptoa(p) ((unsigned)(p) << 11) -#define trunc_page(a) ((unsigned)(a) & ~2047) - -STATIC long equiv_end; -STATIC queue_head_t *Ovtop_table, *vtop_table, *Ofree_mapping, free_mapping; -STATIC struct phys_entry *Ophys_table, *phys_table; -STATIC long vm_last_phys, vm_first_phys; -STATIC struct mapping *firstmap, *lastmap, *Omap_table, *map_table; -STATIC unsigned Omlow, Omhigh, Omhead, Ovlow, Ovhigh, Oplow, Ophigh; -STATIC unsigned mlow, mhigh, mhead, vlow, vhigh, plow, phigh; -STATIC int vtopsize, physsize, mapsize; -STATIC int kmemfd; - -#define IS_OVTOPPTR(p) ((unsigned)(p) >= Ovlow && (unsigned)(p) < Ovhigh) -#define IS_OMAPPTR(p) ((unsigned)(p) >= Omlow && (unsigned)(p) < Omhigh) -#define IS_OPHYSPTR(p) ((unsigned)(p) >= Oplow && (unsigned)(p) < Ophigh) -#define IS_VTOPPTR(p) ((unsigned)(p) >= vlow && (unsigned)(p) < vhigh) -#define IS_MAPPTR(p) ((unsigned)(p) >= mlow && (unsigned)(p) < mhigh) -#define IS_PHYSPTR(p) ((unsigned)(p) >= plow && (unsigned)(p) < phigh) - -struct mapstate { - char unused; - char flags; - short hashix; - short physix; -} *mapstate; - -/* flags */ -#define M_ISFREE 1 -#define M_ISHASH 2 -#define M_ISPHYS 4 - -mach_vtophys_init() -{ - int errors = 0; - - if (!readdata()) - errors++; - if (!verifydata()) - errors++; - if (!errors) - return(1); - fflush(stdout); - fprintf(stderr, - "translate: may not be able to translate all addresses\n"); - return(0); -} - -mach_vtophys(space, off, pa) - unsigned space, off, *pa; -{ - register int i; - register queue_t qp; - register struct mapping *mp; - int poff; - - /* - * Kernel IO or equivilently mapped, one to one. - */ - if (space == 0 && (long)off < equiv_end) { - *pa = off; - return(1); - } - /* - * Else look it up in specified space - */ - poff = off - trunc_page(off); - off = trunc_page(off); - qp = &vtop_table[pmap_hash(space, off)]; - for (mp = (struct mapping *)qp->next; - qp != (queue_entry_t)mp; - mp = (struct mapping *)mp->hash_link.next) { - if (mp->space == space && mp->offset == off) { - *pa = (mp->tlbpage << 7) | poff; - return(1); - } - } - return(0); -} - -STATIC -readdata() -{ - char *tmp, *mach_malloc(); - long size; - - /* easy scalars */ - mach_read("equiv_end", ~0, (char *)&equiv_end, sizeof equiv_end); - mach_read("vm_first_phys", ~0, - (char *)&vm_first_phys, sizeof vm_first_phys); - mach_read("vm_last_phys", ~0, - (char *)&vm_last_phys, sizeof vm_last_phys); - mach_read("firstmap", ~0, (char *)&firstmap, sizeof firstmap); - mach_read("lastmap", ~0, (char *)&lastmap, sizeof lastmap); - - /* virtual to physical hash table */ - vtopsize = HP800_HASHSIZE; - size = vtopsize * sizeof(queue_head_t); - tmp = mach_malloc("vtop table", size); - mach_read("vtop_table", ~0, (char *)&Ovtop_table, sizeof Ovtop_table); - mach_read("vtop table", (CORE_ADDR)Ovtop_table, tmp, size); - vtop_table = (queue_head_t *) tmp; - - /* inverted page table */ - physsize = atop(vm_last_phys - vm_first_phys); - size = physsize * sizeof(struct phys_entry); - tmp = mach_malloc("phys table", size); - mach_read("phys_table", ~0, (char *)&Ophys_table, sizeof Ophys_table); - mach_read("phys table", (CORE_ADDR)Ophys_table, tmp, size); - phys_table = (struct phys_entry *) tmp; - - /* mapping structures */ - Ofree_mapping = (queue_head_t *) ksym_lookup("free_mapping"); - mach_read("free mapping", (CORE_ADDR)Ofree_mapping, - (char *) &free_mapping, sizeof free_mapping); - Omap_table = firstmap; - mapsize = lastmap - firstmap; - size = mapsize * sizeof(struct mapping); - tmp = mach_malloc("mapping table", size); - mach_read("mapping table", (CORE_ADDR)Omap_table, tmp, size); - map_table = (struct mapping *) tmp; - - /* set limits */ - Ovlow = (unsigned) Ovtop_table; - Ovhigh = (unsigned) &Ovtop_table[vtopsize]; - Oplow = (unsigned) Ophys_table; - Ophigh = (unsigned) &Ophys_table[physsize]; - Omhead = (unsigned) Ofree_mapping; - Omlow = (unsigned) firstmap; - Omhigh = (unsigned) lastmap; - mlow = (unsigned) map_table; - mhigh = (unsigned) &map_table[mapsize]; - mhead = (unsigned) &free_mapping; - vlow = (unsigned) vtop_table; - vhigh = (unsigned) &vtop_table[vtopsize]; - plow = (unsigned) phys_table; - phigh = (unsigned) &phys_table[physsize]; - -#if 0 - fprintf(stderr, "Ovtop [%#x-%#x) Ophys [%#x-%#x) Omap %#x [%#x-%#x)\n", - Ovlow, Ovhigh, Oplow, Ophigh, Omhead, Omlow, Omhigh); - fprintf(stderr, "vtop [%#x-%#x) phys [%#x-%#x) map %#x [%#x-%#x)\n", - vlow, vhigh, plow, phigh, mhead, mlow, mhigh); -#endif - return(adjustdata()); -} - -STATIC unsigned -ptrcvt(ptr) - unsigned ptr; -{ - unsigned ret; - char *str; - - if (ptr == 0) { - ret = ptr; - str = "null"; - } else if (IS_OVTOPPTR(ptr)) { - ret = vlow + (ptr - Ovlow); - str = "vtop"; - } else if (IS_OPHYSPTR(ptr)) { - ret = plow + (ptr - Oplow); - str = "phys"; - } else if (IS_OMAPPTR(ptr)) { - ret = mlow + (ptr - Omlow); - str = "map"; - } else if (ptr == Omhead) { - ret = mhead; - str = "maphead"; - } else { - error("bogus pointer %#x", ptr); - str = "wild"; - ret = ptr; - } -#if 0 - fprintf(stderr, "%x (%s) -> %x\n", ptr, str, ret); -#endif - return(ret); -} - -STATIC int -adjustdata() -{ - register int i, lim; - queue_head_t *nq; - struct phys_entry *np; - struct mapping *nm; - - /* hash table */ - lim = vtopsize; - for (nq = vtop_table; nq < &vtop_table[lim]; nq++) { - nq->next = (queue_entry_t) ptrcvt((unsigned)nq->next); - nq->prev = (queue_entry_t) ptrcvt((unsigned)nq->prev); - } - - /* IPT */ - lim = physsize; - for (np = phys_table; np < &phys_table[lim]; np++) { - np->phys_link.next = (queue_entry_t) - ptrcvt((unsigned)np->phys_link.next); - np->phys_link.prev = (queue_entry_t) - ptrcvt((unsigned)np->phys_link.prev); - np->writer = (struct mapping *) ptrcvt((unsigned)np->writer); - } - - /* mapping table */ - free_mapping.next = (queue_entry_t)ptrcvt((unsigned)free_mapping.next); - free_mapping.prev = (queue_entry_t)ptrcvt((unsigned)free_mapping.prev); - lim = mapsize; - for (nm = map_table; nm < &map_table[lim]; nm++) { - nm->hash_link.next = (queue_entry_t) - ptrcvt((unsigned)nm->hash_link.next); - nm->hash_link.prev = (queue_entry_t) - ptrcvt((unsigned)nm->hash_link.prev); - nm->phys_link.next = (queue_entry_t) - ptrcvt((unsigned)nm->phys_link.next); - nm->phys_link.prev = (queue_entry_t) - ptrcvt((unsigned)nm->phys_link.prev); - } - return(1); -} - -/* - * Consistency checks, make sure: - * - * 1. all mappings are accounted for - * 2. no cycles - * 3. no wild pointers - * 4. consisent TLB state - */ -STATIC int -verifydata() -{ - register struct mapstate *ms; - register int i; - int errors = 0; - - mapstate = (struct mapstate *) - mach_malloc("map state", mapsize * sizeof(struct mapstate)); - for (ms = mapstate; ms < &mapstate[mapsize]; ms++) { - ms->flags = 0; - ms->hashix = ms->physix = -2; - } - - /* - * Check the free list - */ - checkhashchain(&free_mapping, M_ISFREE, -1); - /* - * Check every hash chain - */ - for (i = 0; i < vtopsize; i++) - checkhashchain(&vtop_table[i], M_ISHASH, i); - /* - * Check every phys chain - */ - for (i = 0; i < physsize; i++) - checkphyschain(&phys_table[i].phys_link, M_ISPHYS, i); - /* - * Cycle through mapstate looking for anomolies - */ - ms = mapstate; - for (i = 0; i < mapsize; i++) { - switch (ms->flags) { - case M_ISFREE: - case M_ISHASH|M_ISPHYS: - break; - case 0: - merror(ms, "not found"); - errors++; - break; - case M_ISHASH: - merror(ms, "in vtop but not phys"); - errors++; - break; - case M_ISPHYS: - merror(ms, "in phys but not vtop"); - errors++; - break; - default: - merror(ms, "totally bogus"); - errors++; - break; - } - ms++; - } - return(errors ? 0 : 1); -} - -STATIC void -checkhashchain(qhp, flag, ix) - queue_entry_t qhp; -{ - register queue_entry_t qp, pqp; - register struct mapping *mp; - struct mapstate *ms; - - qp = qhp->next; - /* - * First element is not a mapping structure, - * chain must be empty. - */ - if (!IS_MAPPTR(qp)) { - if (qp != qhp || qp != qhp->prev) - fatal("bad vtop_table header pointer"); - } else { - pqp = qhp; - do { - mp = (struct mapping *) qp; - qp = &mp->hash_link; - if (qp->prev != pqp) - fatal("bad hash_link prev pointer"); - ms = &mapstate[mp-map_table]; - ms->flags |= flag; - ms->hashix = ix; - pqp = (queue_entry_t) mp; - qp = qp->next; - } while (IS_MAPPTR(qp)); - if (qp != qhp) - fatal("bad hash_link next pointer"); - } -} - -STATIC void -checkphyschain(qhp, flag, ix) - queue_entry_t qhp; -{ - register queue_entry_t qp, pqp; - register struct mapping *mp; - struct mapstate *ms; - - qp = qhp->next; - /* - * First element is not a mapping structure, - * chain must be empty. - */ - if (!IS_MAPPTR(qp)) { - if (qp != qhp || qp != qhp->prev) - fatal("bad phys_table header pointer"); - } else { - pqp = qhp; - do { - mp = (struct mapping *) qp; - qp = &mp->phys_link; - if (qp->prev != pqp) - fatal("bad phys_link prev pointer"); - ms = &mapstate[mp-map_table]; - ms->flags |= flag; - ms->physix = ix; - pqp = (queue_entry_t) mp; - qp = qp->next; - } while (IS_MAPPTR(qp)); - if (qp != qhp) - fatal("bad phys_link next pointer"); - } -} - -STATIC void -merror(ms, str) - struct mapstate *ms; - char *str; -{ - terminal_ours(); - fflush(stdout); - fprintf(stderr, - "vtophys: %s: %c%c%c, hashix %d, physix %d, mapping %x\n", - str, - (ms->flags & M_ISFREE) ? 'F' : '-', - (ms->flags & M_ISHASH) ? 'H' : '-', - (ms->flags & M_ISPHYS) ? 'P' : '-', - ms->hashix, ms->physix, &map_table[ms-mapstate]); - return_to_top_level(); -} - -STATIC int -mach_read(str, from, top, size) - char *str; - CORE_ADDR from; - char *top; - int size; -{ - CORE_ADDR paddr; - - if (from == ~0) - from = ksym_lookup(str); - paddr = vtophys(0, from); - if (paddr == ~0 || physrd(paddr, top, size) != 0) - fatal("cannot read %s", str); -} - -STATIC char * -mach_malloc(str, size) - char *str; - int size; -{ - char *ptr = (char *) malloc(size); - - if (ptr == 0) - fatal("no memory for %s", str); - return(ptr); -} -#endif - -#ifdef KERNELDEBUG -void -_initialize_hp9k8_dep() -{ - add_com ("process-address", class_obscure, set_paddr_command, -"The process identified by (ps-style) ADDR becomes the\n\ -\"current\" process context for kernel debugging."); - add_com_alias ("paddr", "process-address", class_obscure, 0); - add_com ("virtual-to-physical", class_obscure, vtop_command, -"Translates the kernel virtual address ADDR into a physical address."); - add_com_alias ("vtop", "virtual-to-physical", class_obscure, 0); -} -#endif diff --git a/gdb/hppahpux-xdep.c b/gdb/hppahpux-xdep.c index 8c8c33f..e69de29 100644 --- a/gdb/hppahpux-xdep.c +++ b/gdb/hppahpux-xdep.c @@ -1,424 +0,0 @@ -/* Machine-dependent code which would otherwise be in infptrace.c, - for GDB, the GNU debugger. This code is for the HP PA-RISC cpu. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "target.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include - -#include - - -#ifndef PT_ATTACH -#define PT_ATTACH PTRACE_ATTACH -#endif -#ifndef PT_DETACH -#define PT_DETACH PTRACE_DETACH -#endif - -#include "gdbcore.h" -#include /* After a.out.h */ -#include -#include - -/* This function simply calls ptrace with the given arguments. - It exists so that all calls to ptrace are isolated in this - machine-dependent file. */ -int -call_ptrace (request, pid, addr, data) - int request, pid; - PTRACE_ARG3_TYPE addr; - int data; -{ - return ptrace (request, pid, addr, data, 0); -} - -#ifdef DEBUG_PTRACE -/* For the rest of the file, use an extra level of indirection */ -/* This lets us breakpoint usefully on call_ptrace. */ -#define ptrace call_ptrace -#endif - -void -kill_inferior () -{ - if (inferior_pid == 0) - return; - ptrace (PT_EXIT, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0, 0); /* PT_EXIT = PT_KILL ? */ - wait ((int *)0); - target_mourn_inferior (); -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -void -child_resume (step, signal) - int step; - int signal; -{ - errno = 0; - - /* An address of (PTRACE_ARG3_TYPE) 1 tells ptrace to continue from where - it was. (If GDB wanted it to start some other way, we have already - written a new PC value to the child.) */ - - if (step) - ptrace (PT_SINGLE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); - else - ptrace (PT_CONTIN, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); - - if (errno) - perror_with_name ("ptrace"); -} - -#ifdef ATTACH_DETACH -/* Nonzero if we are debugging an attached process rather than - an inferior. */ -extern int attach_flag; - -/* Start debugging the process whose number is PID. */ -int -attach (pid) - int pid; -{ - errno = 0; - ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0, 0); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 1; - return pid; -} - -/* Stop debugging the process whose number is PID - and continue it with signal number SIGNAL. - SIGNAL = 0 means just continue it. */ - -void -detach (signal) - int signal; -{ - errno = 0; - ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0); - if (errno) - perror_with_name ("ptrace"); - attach_flag = 0; -} -#endif /* ATTACH_DETACH */ - -#if !defined (FETCH_INFERIOR_REGISTERS) - -/* KERNEL_U_ADDR is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ -#if defined (KERNEL_U_ADDR_BSD) -/* Get kernel_u_addr using BSD-style nlist(). */ -CORE_ADDR kernel_u_addr; - -#include /* For struct nlist */ - -void -_initialize_kernel_u_addr () -{ - struct nlist names[2]; - - names[0].n_un.n_name = "_u"; - names[1].n_un.n_name = NULL; - if (nlist ("/vmunix", names) == 0) - kernel_u_addr = names[0].n_value; - else - fatal ("Unable to get kernel u area address."); -} -#endif /* KERNEL_U_ADDR_BSD. */ - -#if defined (KERNEL_U_ADDR_HPUX) -/* Get kernel_u_addr using HPUX-style nlist(). */ -CORE_ADDR kernel_u_addr; - -struct hpnlist { - char * n_name; - long n_value; - unsigned char n_type; - unsigned char n_length; - short n_almod; - short n_unused; -}; -static struct hpnlist nl[] = {{ "_u", -1, }, { (char *) 0, }}; - -/* read the value of the u area from the hp-ux kernel */ -void _initialize_kernel_u_addr () -{ - struct user u; - nlist ("/hp-ux", &nl); - kernel_u_addr = nl[0].n_value; -} -#endif /* KERNEL_U_ADDR_HPUX. */ - -#if !defined (offsetof) -#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) -#endif - -/* U_REGS_OFFSET is the offset of the registers within the u area. */ -#if !defined (U_REGS_OFFSET) -#define U_REGS_OFFSET \ - ptrace (PT_READ_U, inferior_pid, \ - (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0, 0) \ - - KERNEL_U_ADDR -#endif - -/* Registers we shouldn't try to fetch. */ -#if !defined (CANNOT_FETCH_REGISTER) -#define CANNOT_FETCH_REGISTER(regno) 0 -#endif - -/* Fetch one register. */ - -static void -fetch_register (regno) - int regno; -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - char mess[128]; /* For messages */ - register int i; - - /* Offset of registers within the u area. */ - unsigned int offset; - - if (CANNOT_FETCH_REGISTER (regno)) - { - bzero (buf, REGISTER_RAW_SIZE (regno)); /* Supply zeroes */ - supply_register (regno, buf); - return; - } - - offset = U_REGS_OFFSET; - - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - errno = 0; - *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0, 0); - regaddr += sizeof (int); - if (errno != 0) - { - sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno); - perror_with_name (mess); - } - } - if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM) - buf[3] &= ~0x3; - supply_register (regno, buf); -} - - -/* Fetch all registers, or just one, from the child process. */ - -void -fetch_inferior_registers (regno) - int regno; -{ - if (regno == -1) - for (regno = 0; regno < NUM_REGS; regno++) - fetch_register (regno); - else - fetch_register (regno); -} - -/* Registers we shouldn't try to store. */ -#if !defined (CANNOT_STORE_REGISTER) -#define CANNOT_STORE_REGISTER(regno) 0 -#endif - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - extern char registers[]; - register int i; - - unsigned int offset = U_REGS_OFFSET; - - if (regno >= 0) - { - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i], 0); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - if (CANNOT_STORE_REGISTER (regno)) - continue; - regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i], 0); - if (errno != 0) - { - sprintf (buf, "writing register number %d(%d)", regno, i); - perror_with_name (buf); - } - regaddr += sizeof(int); - } - } - } - return; -} -#endif /* !defined (FETCH_INFERIOR_REGISTERS). */ - -/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory - in the NEW_SUN_PTRACE case. - It ought to be straightforward. But it appears that writing did - not write the data that I specified. I cannot understand where - it got the data that it actually did write. */ - -/* Copy LEN bytes to or from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. Copy to inferior if - WRITE is nonzero. - - Returns the length copied, which is either the LEN argument or zero. - This xfer function does not do partial moves, since child_ops - doesn't allow memory operations to cross below us in the target stack - anyway. */ - -int -child_xfer_memory (memaddr, myaddr, len, write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int write; - struct target_ops *target; /* ignored */ -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (int); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - /* Allocate buffer of that many longwords. */ - register int *buffer = (int *) alloca (count * sizeof (int)); - - if (write) - { - /* Fill start and end extra bytes of buffer with existing memory data. */ - - if (addr != memaddr || len < (int)sizeof (int)) { - /* Need part of initial word -- fetch it. */ - buffer[0] = ptrace (PT_RIUSER, inferior_pid, - (PTRACE_ARG3_TYPE) addr, 0, 0); - } - - if (count > 1) /* FIXME, avoid if even boundary */ - { - buffer[count - 1] - = ptrace (PT_RIUSER, inferior_pid, - (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)), - 0, 0); - } - - /* Copy data to be written over corresponding part of buffer */ - - bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (int)) - { -#if 0 -/* The HP-UX kernel crashes if you use PT_WDUSER to write into the text - segment. FIXME -- does it work to write into the data segment using - WIUSER, or do these idiots really expect us to figure out which segment - the address is in, so we can use a separate system call for it??! */ - errno = 0; - ptrace (PT_WDUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i], 0); - if (errno) -#endif - { - /* Using the appropriate one (I or D) is necessary for - Gould NP1, at least. */ - errno = 0; - ptrace (PT_WIUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr, - buffer[i], 0); - } - if (errno) - return 0; - } - } - else - { - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - buffer[i] = ptrace (PT_RIUSER, inferior_pid, - (PTRACE_ARG3_TYPE) addr, 0, 0); - if (errno) - return 0; - QUIT; - } - - /* Copy appropriate bytes out of the buffer. */ - bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); - } - return len; -} - - - - -int -getpagesize() -{ - return(4096); -} diff --git a/gdb/i386-xdep.c b/gdb/i386-xdep.c deleted file mode 100644 index 67e904b..0000000 --- a/gdb/i386-xdep.c +++ /dev/null @@ -1,250 +0,0 @@ -/* Intel 386 stuff. - Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "language.h" -#include "gdbcore.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include "ieee-float.h" - -#include "target.h" - -extern struct ext_format ext_format_i387; - -/* this table must line up with REGISTER_NAMES in tm-i386v.h */ -/* symbols like 'EAX' come from */ -static int regmap[] = -{ - EAX, ECX, EDX, EBX, - UESP, EBP, ESI, EDI, - EIP, EFL, CS, SS, - DS, ES, FS, GS, -}; - -/* blockend is the value of u.u_ar0, and points to the - * place where GS is stored - */ - -int -i386_register_u_addr (blockend, regnum) - int blockend; - int regnum; -{ -#if 0 - /* this will be needed if fp registers are reinstated */ - /* for now, you can look at them with 'info float' - * sys5 wont let you change them with ptrace anyway - */ - if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM) - { - int ubase, fpstate; - struct user u; - ubase = blockend + 4 * (SS + 1) - KSTKSZ; - fpstate = ubase + ((char *)&u.u_fpstate - (char *)&u); - return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM)); - } - else -#endif - return (blockend + 4 * regmap[regnum]); - -} - -#if 0 -/* mauro@olympus 1991.10.20 -- compiling the following code causes - undefined symbols at link time, specifically: corechan, have_inferior_p */ -struct env387 -{ - unsigned short control; - unsigned short r0; - unsigned short status; - unsigned short r1; - unsigned short tag; - unsigned short r2; - unsigned long eip; - unsigned short code_seg; - unsigned short opcode; - unsigned long operand; - unsigned short operand_seg; - unsigned short r3; - unsigned char regs[8][10]; -}; - -static -print_387_status (status, ep) - unsigned short status; - struct env387 *ep; -{ - int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - - bothstatus = ((status != 0) && (ep->status != 0)); - if (status != 0) - { - if (bothstatus) - printf ("u: "); - print_387_status_word (status); - } - - if (ep->status != 0) - { - if (bothstatus) - printf ("e: "); - print_387_status_word (ep->status); - } - - print_387_control_word (ep->control); - printf ("last exception: "); - printf ("opcode %s; ", local_hex_string(ep->opcode)); - printf ("pc %s:", local_hex_string(ep->code_seg)); - printf ("%s; ", local_hex_string(ep->eip)); - printf ("operand %s", local_hex_string(ep->operand_seg)); - printf (":%s\n", local_hex_string(ep->operand)); - - top = (ep->status >> 11) & 7; - - printf ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) - { - double val; - - printf ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep->tag >> (fpreg * 2)) & 3) - { - case 0: printf ("valid "); break; - case 1: printf ("zero "); break; - case 2: printf ("trap "); break; - case 3: printf ("empty "); break; - } - for (i = 9; i >= 0; i--) - printf ("%02x", ep->regs[fpreg][i]); - - ieee_extended_to_double (&ext_format_i387, (char *)ep->regs[fpreg], - &val); - printf (" %g\n", val); - } - if (ep->r0) - warning ("reserved0 is %s\n", local_hex_string(ep->r0)); - if (ep->r1) - warning ("reserved1 is %s\n", local_hex_string(ep->r1)); - if (ep->r2) - warning ("reserved2 is %s\n", local_hex_string(ep->r2)); - if (ep->r3) - warning ("reserved3 is %s\n", local_hex_string(ep->r3)); -} - -#ifndef U_FPSTATE -#define U_FPSTATE(u) u.u_fpstate -#endif - -i386_float_info () -{ - struct user u; /* just for address computations */ - int i; - /* fpstate defined in */ - struct fpstate *fpstatep; - char buf[sizeof (struct fpstate) + 2 * sizeof (int)]; - unsigned int uaddr; - char fpvalid = 0; - unsigned int rounded_addr; - unsigned int rounded_size; - extern int corechan; - int skip; - - uaddr = (char *)&u.u_fpvalid - (char *)&u; - if (target_has_execution) - { - unsigned int data; - unsigned int mask; - - rounded_addr = uaddr & -sizeof (int); - data = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - mask = 0xff << ((uaddr - rounded_addr) * 8); - - fpvalid = ((data & mask) != 0); - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror ("seek on core file"); - if (myread (corechan, &fpvalid, 1) < 0) - perror ("read on core file"); - - } -#endif /* no core support yet */ - - if (fpvalid == 0) - { - printf ("no floating point status saved\n"); - return; - } - - uaddr = (char *)&U_FPSTATE(u) - (char *)&u; - if (target_has_execution) - { - int *ip; - - rounded_addr = uaddr & -sizeof (int); - rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) + - sizeof (int) - 1) / sizeof (int); - skip = uaddr - rounded_addr; - - ip = (int *)buf; - for (i = 0; i < rounded_size; i++) - { - *ip++ = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0); - rounded_addr += sizeof (int); - } - } -#if 0 - else - { - if (lseek (corechan, uaddr, 0) < 0) - perror_with_name ("seek on core file"); - if (myread (corechan, buf, sizeof (struct fpstate)) < 0) - perror_with_name ("read from core file"); - skip = 0; - } - #endif /* 0 */ - - fpstatep = (struct fpstate *)(buf + skip); - print_387_status (fpstatep->status, (struct env387 *)fpstatep->state); -} -#endif /* mauro@olympus 1991.10.20 */ diff --git a/gdb/m68k-opcode.h b/gdb/m68k-opcode.h deleted file mode 100755 index 1a8f7d2..0000000 --- a/gdb/m68k-opcode.h +++ /dev/null @@ -1,1679 +0,0 @@ -/* Opcode table for m68000/m68020 and m68881. - Copyright (C) 1989, Free Software Foundation. - -This file is part of GDB, the GNU Debugger and GAS, the GNU Assembler. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -struct m68k_opcode -{ - char *name; - unsigned long opcode; - unsigned long match; - char *args; -}; - -/* We store four bytes of opcode for all opcodes because that - is the most any of them need. The actual length of an instruction - is always at least 2 bytes, and is as much longer as necessary to - hold the operands it has. - - The match component is a mask saying which bits must match - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing two characters - for each operand of the instruction. The first specifies - the kind of operand; the second, the place it is stored. */ - -/* Kinds of operands: - D data register only. Stored as 3 bits. - A address register only. Stored as 3 bits. - R either kind of register. Stored as 4 bits. - F floating point coprocessor register only. Stored as 3 bits. - O an offset (or width): immediate data 0-31 or data register. - Stored as 6 bits in special format for BF... insns. - + autoincrement only. Stored as 3 bits (number of the address register). - - autodecrement only. Stored as 3 bits (number of the address register). - Q quick immediate data. Stored as 3 bits. - This matches an immediate operand only when value is in range 1 .. 8. - M moveq immediate data. Stored as 8 bits. - This matches an immediate operand only when value is in range -128..127 - T trap vector immediate data. Stored as 4 bits. - - k K-factor for fmove.p instruction. Stored as a 7-bit constant or - a three bit register offset, depending on the field type. - - # immediate data. Stored in special places (b, w or l) - which say how many bits to store. - ^ immediate data for floating point instructions. Special places - are offset by 2 bytes from '#'... - B pc-relative address, converted to an offset - that is treated as immediate data. - d displacement and register. Stores the register as 3 bits - and stores the displacement in the entire second word. - - C the CCR. No need to store it; this is just for filtering validity. - S the SR. No need to store, just as with CCR. - U the USP. No need to store, just as with CCR. - - I Coprocessor ID. Not printed if 1. The Coprocessor ID is always - extracted from the 'd' field of word one, which means that an extended - coprocessor opcode can be skipped using the 'i' place, if needed. - - s System Control register for the floating point coprocessor. - S List of system control registers for floating point coprocessor. - - J Misc register for movec instruction, stored in 'j' format. - Possible values: - 000 SFC Source Function Code reg - 001 DFC Data Function Code reg - 002 CACR Cache Control Register - 800 USP User Stack Pointer - 801 VBR Vector Base reg - 802 CAAR Cache Address Register - 803 MSP Master Stack Pointer - 804 ISP Interrupt Stack Pointer - - L Register list of the type d0-d7/a0-a7 etc. - (New! Improved! Can also hold fp0-fp7, as well!) - The assembler tries to see if the registers match the insn by - looking at where the insn wants them stored. - - l Register list like L, but with all the bits reversed. - Used for going the other way. . . - - They are all stored as 6 bits using an address mode and a register number; - they differ in which addressing modes they match. - - * all (modes 0-6,7.*) - ~ alterable memory (modes 2-6,7.0,7.1)(not 0,1,7.~) - % alterable (modes 0-6,7.0,7.1)(not 7.~) - ; data (modes 0,2-6,7.*)(not 1) - @ data, but not immediate (modes 0,2-6,7.? ? ?)(not 1,7.?) This may really be ;, the 68020 book says it is - ! control (modes 2,5,6,7.*-)(not 0,1,3,4,7.4) - & alterable control (modes 2,5,6,7.0,7.1)(not 0,1,7.? ? ?) - $ alterable data (modes 0,2-6,7.0,7.1)(not 1,7.~) - ? alterable control, or data register (modes 0,2,5,6,7.0,7.1)(not 1,3,4,7.~) - / control, or data register (modes 0,2,5,6,7.0,7.1,7.2,7.3)(not 1,3,4,7.4) -*/ - -/* JF: for the 68851 */ -/* - I didn't use much imagination in choosing the - following codes, so many of them aren't very - mnemonic. -rab - - P pmmu register - Possible values: - 000 TC Translation Control reg - 100 CAL Current Access Level - 101 VAL Validate Access Level - 110 SCC Stack Change Control - 111 AC Access Control - - W wide pmmu registers - Possible values: - 001 DRP Dma Root Pointer - 010 SRP Supervisor Root Pointer - 011 CRP Cpu Root Pointer - - f function code register - 0 SFC - 1 DFC - - V VAL register only - - X BADx, BACx - 100 BAD Breakpoint Acknowledge Data - 101 BAC Breakpoint Acknowledge Control - - Y PSR - Z PCSR - - | memory (modes 2-6, 7.*) - -*/ - -/* Places to put an operand, for non-general operands: - s source, low bits of first word. - d dest, shifted 9 in first word - 1 second word, shifted 12 - 2 second word, shifted 6 - 3 second word, shifted 0 - 4 third word, shifted 12 - 5 third word, shifted 6 - 6 third word, shifted 0 - 7 second word, shifted 7 - 8 second word, shifted 10 - D store in both place 1 and place 3; for divul and divsl. - b second word, low byte - w second word (entire) - l second and third word (entire) - g branch offset for bra and similar instructions. - The place to store depends on the magnitude of offset. - t store in both place 7 and place 8; for floating point operations - c branch offset for cpBcc operations. - The place to store is word two if bit six of word one is zero, - and words two and three if bit six of word one is one. - i Increment by two, to skip over coprocessor extended operands. Only - works with the 'I' format. - k Dynamic K-factor field. Bits 6-4 of word 2, used as a register number. - Also used for dynamic fmovem instruction. - C floating point coprocessor constant - 7 bits. Also used for static - K-factors... - j Movec register #, stored in 12 low bits of second word. - - Places to put operand, for general operands: - d destination, shifted 6 bits in first word - b source, at low bit of first word, and immediate uses one byte - w source, at low bit of first word, and immediate uses two bytes - l source, at low bit of first word, and immediate uses four bytes - s source, at low bit of first word. - Used sometimes in contexts where immediate is not allowed anyway. - f single precision float, low bit of 1st word, immediate uses 4 bytes - F double precision float, low bit of 1st word, immediate uses 8 bytes - x extended precision float, low bit of 1st word, immediate uses 12 bytes - p packed float, low bit of 1st word, immediate uses 12 bytes -*/ - -#define one(x) ((x) << 16) -#define two(x, y) (((x) << 16) + y) - -/* - *** DANGER WILL ROBINSON *** - - The assembler requires that all instances of the same mnemonic must be - consecutive. If they aren't, the assembler will bomb at runtime - */ -struct m68k_opcode m68k_opcodes[] = -{ -{"abcd", one(0140400), one(0170770), "DsDd"}, -{"abcd", one(0140410), one(0170770), "-s-d"}, - - /* Add instructions */ -{"addal", one(0150700), one(0170700), "*lAd"}, -{"addaw", one(0150300), one(0170700), "*wAd"}, -{"addib", one(0003000), one(0177700), "#b$b"}, -{"addil", one(0003200), one(0177700), "#l$l"}, -{"addiw", one(0003100), one(0177700), "#w$w"}, -{"addqb", one(0050000), one(0170700), "Qd$b"}, -{"addql", one(0050200), one(0170700), "Qd%l"}, -{"addqw", one(0050100), one(0170700), "Qd%w"}, - -{"addb", one(0050000), one(0170700), "Qd$b"}, /* addq written as add */ -{"addb", one(0003000), one(0177700), "#b$b"}, /* addi written as add */ -{"addb", one(0150000), one(0170700), ";bDd"}, /* addb , Dd */ -{"addb", one(0150400), one(0170700), "Dd~b"}, /* addb Dd, */ - -{"addw", one(0050100), one(0170700), "Qd%w"}, /* addq written as add */ -{"addw", one(0003100), one(0177700), "#w$w"}, /* addi written as add */ -{"addw", one(0150300), one(0170700), "*wAd"}, /* adda written as add */ -{"addw", one(0150100), one(0170700), "*wDd"}, /* addw , Dd */ -{"addw", one(0150500), one(0170700), "Dd~w"}, /* addw Dd, */ - -{"addl", one(0050200), one(0170700), "Qd%l"}, /* addq written as add */ -{"addl", one(0003200), one(0177700), "#l$l"}, /* addi written as add */ -{"addl", one(0150700), one(0170700), "*lAd"}, /* adda written as add */ -{"addl", one(0150200), one(0170700), "*lDd"}, /* addl , Dd */ -{"addl", one(0150600), one(0170700), "Dd~l"}, /* addl Dd, */ - -{"addxb", one(0150400), one(0170770), "DsDd"}, -{"addxb", one(0150410), one(0170770), "-s-d"}, -{"addxl", one(0150600), one(0170770), "DsDd"}, -{"addxl", one(0150610), one(0170770), "-s-d"}, -{"addxw", one(0150500), one(0170770), "DsDd"}, -{"addxw", one(0150510), one(0170770), "-s-d"}, - -{"andib", one(0001000), one(0177700), "#b$b"}, -{"andib", one(0001074), one(0177777), "#bCb"}, /* andi to ccr */ -{"andiw", one(0001100), one(0177700), "#w$w"}, -{"andiw", one(0001174), one(0177777), "#wSw"}, /* andi to sr */ -{"andil", one(0001200), one(0177700), "#l$l"}, - -{"andb", one(0001000), one(0177700), "#b$b"}, /* andi written as or */ -{"andb", one(0001074), one(0177777), "#bCb"}, /* andi to ccr */ -{"andb", one(0140000), one(0170700), ";bDd"}, /* memory to register */ -{"andb", one(0140400), one(0170700), "Dd~b"}, /* register to memory */ -{"andw", one(0001100), one(0177700), "#w$w"}, /* andi written as or */ -{"andw", one(0001174), one(0177777), "#wSw"}, /* andi to sr */ -{"andw", one(0140100), one(0170700), ";wDd"}, /* memory to register */ -{"andw", one(0140500), one(0170700), "Dd~w"}, /* register to memory */ -{"andl", one(0001200), one(0177700), "#l$l"}, /* andi written as or */ -{"andl", one(0140200), one(0170700), ";lDd"}, /* memory to register */ -{"andl", one(0140600), one(0170700), "Dd~l"}, /* register to memory */ - -{"aslb", one(0160400), one(0170770), "QdDs"}, -{"aslb", one(0160440), one(0170770), "DdDs"}, -{"asll", one(0160600), one(0170770), "QdDs"}, -{"asll", one(0160640), one(0170770), "DdDs"}, -{"aslw", one(0160500), one(0170770), "QdDs"}, -{"aslw", one(0160540), one(0170770), "DdDs"}, -{"aslw", one(0160700), one(0177700), "~s"}, /* Shift memory */ -{"asrb", one(0160000), one(0170770), "QdDs"}, -{"asrb", one(0160040), one(0170770), "DdDs"}, -{"asrl", one(0160200), one(0170770), "QdDs"}, -{"asrl", one(0160240), one(0170770), "DdDs"}, -{"asrw", one(0160100), one(0170770), "QdDs"}, -{"asrw", one(0160140), one(0170770), "DdDs"}, -{"asrw", one(0160300), one(0177700), "~s"}, /* Shift memory */ - -{"bhi", one(0061000), one(0177400), "Bg"}, -{"bls", one(0061400), one(0177400), "Bg"}, -{"bcc", one(0062000), one(0177400), "Bg"}, -{"bcs", one(0062400), one(0177400), "Bg"}, -{"bne", one(0063000), one(0177400), "Bg"}, -{"beq", one(0063400), one(0177400), "Bg"}, -{"bvc", one(0064000), one(0177400), "Bg"}, -{"bvs", one(0064400), one(0177400), "Bg"}, -{"bpl", one(0065000), one(0177400), "Bg"}, -{"bmi", one(0065400), one(0177400), "Bg"}, -{"bge", one(0066000), one(0177400), "Bg"}, -{"blt", one(0066400), one(0177400), "Bg"}, -{"bgt", one(0067000), one(0177400), "Bg"}, -{"ble", one(0067400), one(0177400), "Bg"}, - -{"bchg", one(0000500), one(0170700), "Dd$s"}, -{"bchg", one(0004100), one(0177700), "#b$s"}, -{"bclr", one(0000600), one(0170700), "Dd$s"}, -{"bclr", one(0004200), one(0177700), "#b$s"}, -{"bfchg", two(0165300, 0), two(0177700, 0170000), "?sO2O3"}, -{"bfclr", two(0166300, 0), two(0177700, 0170000), "?sO2O3"}, -{"bfexts", two(0165700, 0), two(0177700, 0100000), "/sO2O3D1"}, -{"bfextu", two(0164700, 0), two(0177700, 0100000), "/sO2O3D1"}, -{"bfffo", two(0166700, 0), two(0177700, 0100000), "/sO2O3D1"}, -{"bfins", two(0167700, 0), two(0177700, 0100000), "D1?sO2O3"}, -{"bfset", two(0167300, 0), two(0177700, 0170000), "?sO2O3"}, -{"bftst", two(0164300, 0), two(0177700, 0170000), "/sO2O3"}, -{"bset", one(0000700), one(0170700), "Dd$s"}, -{"bset", one(0004300), one(0177700), "#b$s"}, -{"btst", one(0000400), one(0170700), "Dd@s"}, -{"btst", one(0004000), one(0177700), "#b@s"}, - -{"bkpt", one(0044110), one(0177770), "Qs"}, -{"bra", one(0060000), one(0177400), "Bg"}, -{"bras", one(0060000), one(0177400), "Bw"}, -{"bsr", one(0060400), one(0177400), "Bg"}, -{"bsrs", one(0060400), one(0177400), "Bw"}, - -{"callm", one(0003300), one(0177700), "#b!s"}, -{"cas2l", two(0007374, 0), two(0177777, 0107070), "D3D6D2D5R1R4"}, /* JF FOO this is really a 3 word ins */ -{"cas2w", two(0006374, 0), two(0177777, 0107070), "D3D6D2D5R1R4"}, /* JF ditto */ -{"casb", two(0005300, 0), two(0177700, 0177070), "D3D2~s"}, -{"casl", two(0007300, 0), two(0177700, 0177070), "D3D2~s"}, -{"casw", two(0006300, 0), two(0177700, 0177070), "D3D2~s"}, - -/* {"chk", one(0040600), one(0170700), ";wDd"}, JF FOO this looks wrong */ -{"chk2b", two(0000300, 0004000), two(0177700, 07777), "!sR1"}, -{"chk2l", two(0002300, 0004000), two(0177700, 07777), "!sR1"}, -{"chk2w", two(0001300, 0004000), two(0177700, 07777), "!sR1"}, -{"chkl", one(0040400), one(0170700), ";lDd"}, -{"chkw", one(0040600), one(0170700), ";wDd"}, -{"clrb", one(0041000), one(0177700), "$s"}, -{"clrl", one(0041200), one(0177700), "$s"}, -{"clrw", one(0041100), one(0177700), "$s"}, - -{"cmp2b", two(0000300, 0), two(0177700, 07777), "!sR1"}, -{"cmp2l", two(0002300, 0), two(0177700, 07777), "!sR1"}, -{"cmp2w", two(0001300, 0), two(0177700, 07777), "!sR1"}, -{"cmpal", one(0130700), one(0170700), "*lAd"}, -{"cmpaw", one(0130300), one(0170700), "*wAd"}, -{"cmpib", one(0006000), one(0177700), "#b;b"}, -{"cmpil", one(0006200), one(0177700), "#l;l"}, -{"cmpiw", one(0006100), one(0177700), "#w;w"}, -{"cmpb", one(0006000), one(0177700), "#b;b"}, /* cmpi written as cmp */ -{"cmpb", one(0130000), one(0170700), ";bDd"}, -{"cmpw", one(0006100), one(0177700), "#w;w"}, -{"cmpw", one(0130100), one(0170700), "*wDd"}, -{"cmpw", one(0130300), one(0170700), "*wAd"}, /* cmpa written as cmp */ -{"cmpl", one(0006200), one(0177700), "#l;l"}, -{"cmpl", one(0130200), one(0170700), "*lDd"}, -{"cmpl", one(0130700), one(0170700), "*lAd"}, -{"cmpmb", one(0130410), one(0170770), "+s+d"}, -{"cmpml", one(0130610), one(0170770), "+s+d"}, -{"cmpmw", one(0130510), one(0170770), "+s+d"}, - -{"dbcc", one(0052310), one(0177770), "DsBw"}, -{"dbcs", one(0052710), one(0177770), "DsBw"}, -{"dbeq", one(0053710), one(0177770), "DsBw"}, -{"dbf", one(0050710), one(0177770), "DsBw"}, -{"dbge", one(0056310), one(0177770), "DsBw"}, -{"dbgt", one(0057310), one(0177770), "DsBw"}, -{"dbhi", one(0051310), one(0177770), "DsBw"}, -{"dble", one(0057710), one(0177770), "DsBw"}, -{"dbls", one(0051710), one(0177770), "DsBw"}, -{"dblt", one(0056710), one(0177770), "DsBw"}, -{"dbmi", one(0055710), one(0177770), "DsBw"}, -{"dbne", one(0053310), one(0177770), "DsBw"}, -{"dbpl", one(0055310), one(0177770), "DsBw"}, -{"dbra", one(0050710), one(0177770), "DsBw"}, -{"dbt", one(0050310), one(0177770), "DsBw"}, -{"dbvc", one(0054310), one(0177770), "DsBw"}, -{"dbvs", one(0054710), one(0177770), "DsBw"}, - -{"divsl", two(0046100, 0006000), two(0177700, 0107770), ";lD3D1"}, -{"divsl", two(0046100, 0004000), two(0177700, 0107770), ";lDD"}, -{"divsll", two(0046100, 0004000), two(0177700, 0107770), ";lD3D1"}, -{"divsw", one(0100700), one(0170700), ";wDd"}, -{"divs", one(0100700), one(0170700), ";wDd"}, -{"divul", two(0046100, 0002000), two(0177700, 0107770), ";lD3D1"}, -{"divul", two(0046100, 0000000), two(0177700, 0107770), ";lDD"}, -{"divull", two(0046100, 0000000), two(0177700, 0107770), ";lD3D1"}, -{"divuw", one(0100300), one(0170700), ";wDd"}, -{"divu", one(0100300), one(0170700), ";wDd"}, -{"eorb", one(0005000), one(0177700), "#b$s"}, /* eori written as or */ -{"eorb", one(0005074), one(0177777), "#bCs"}, /* eori to ccr */ -{"eorb", one(0130400), one(0170700), "Dd$s"}, /* register to memory */ -{"eorib", one(0005000), one(0177700), "#b$s"}, -{"eorib", one(0005074), one(0177777), "#bCs"}, /* eori to ccr */ -{"eoril", one(0005200), one(0177700), "#l$s"}, -{"eoriw", one(0005100), one(0177700), "#w$s"}, -{"eoriw", one(0005174), one(0177777), "#wSs"}, /* eori to sr */ -{"eorl", one(0005200), one(0177700), "#l$s"}, -{"eorl", one(0130600), one(0170700), "Dd$s"}, -{"eorw", one(0005100), one(0177700), "#w$s"}, -{"eorw", one(0005174), one(0177777), "#wSs"}, /* eori to sr */ -{"eorw", one(0130500), one(0170700), "Dd$s"}, - -{"exg", one(0140500), one(0170770), "DdDs"}, -{"exg", one(0140510), one(0170770), "AdAs"}, -{"exg", one(0140610), one(0170770), "DdAs"}, -{"exg", one(0140610), one(0170770), "AsDd"}, - -{"extw", one(0044200), one(0177770), "Ds"}, -{"extl", one(0044300), one(0177770), "Ds"}, -{"extbl", one(0044700), one(0177770), "Ds"}, -{"extb.l", one(0044700), one(0177770), "Ds"}, /* Not sure we should support this one*/ - -{"illegal", one(0045374), one(0177777), ""}, -{"jmp", one(0047300), one(0177700), "!s"}, -{"jsr", one(0047200), one(0177700), "!s"}, -{"lea", one(0040700), one(0170700), "!sAd"}, -{"linkw", one(0047120), one(0177770), "As#w"}, -{"linkl", one(0044010), one(0177770), "As#l"}, -{"link", one(0047120), one(0177770), "As#w"}, -{"link", one(0044010), one(0177770), "As#l"}, - -{"lslb", one(0160410), one(0170770), "QdDs"}, /* lsrb #Q, Ds */ -{"lslb", one(0160450), one(0170770), "DdDs"}, /* lsrb Dd, Ds */ -{"lslw", one(0160510), one(0170770), "QdDs"}, /* lsrb #Q, Ds */ -{"lslw", one(0160550), one(0170770), "DdDs"}, /* lsrb Dd, Ds */ -{"lslw", one(0161700), one(0177700), "~s"}, /* Shift memory */ -{"lsll", one(0160610), one(0170770), "QdDs"}, /* lsrb #Q, Ds */ -{"lsll", one(0160650), one(0170770), "DdDs"}, /* lsrb Dd, Ds */ - -{"lsrb", one(0160010), one(0170770), "QdDs"} /* lsrb #Q, Ds */, -{"lsrb", one(0160050), one(0170770), "DdDs"}, /* lsrb Dd, Ds */ -{"lsrl", one(0160210), one(0170770), "QdDs"}, /* lsrb #Q, Ds */ -{"lsrl", one(0160250), one(0170770), "DdDs"}, /* lsrb #Q, Ds */ -{"lsrw", one(0160110), one(0170770), "QdDs"}, /* lsrb #Q, Ds */ -{"lsrw", one(0160150), one(0170770), "DdDs"}, /* lsrb #Q, Ds */ -{"lsrw", one(0161300), one(0177700), "~s"}, /* Shift memory */ - -{"moveal", one(0020100), one(0170700), "*lAd"}, -{"moveaw", one(0030100), one(0170700), "*wAd"}, -{"moveb", one(0010000), one(0170000), ";b$d"}, /* move */ -{"movel", one(0070000), one(0170400), "MsDd"}, /* moveq written as move */ -{"movel", one(0020000), one(0170000), "*l$d"}, -{"movel", one(0020100), one(0170700), "*lAd"}, -{"movel", one(0047140), one(0177770), "AsUd"}, /* move to USP */ -{"movel", one(0047150), one(0177770), "UdAs"}, /* move from USP */ - -{"movec", one(0047173), one(0177777), "R1Jj"}, -{"movec", one(0047173), one(0177777), "R1#j"}, -{"movec", one(0047172), one(0177777), "JjR1"}, -{"movec", one(0047172), one(0177777), "#jR1"}, - -/* JF added these next four for the assembler */ -{"moveml", one(0044300), one(0177700), "Lw&s"}, /* movem reg to mem. */ -{"moveml", one(0044340), one(0177770), "lw-s"}, /* movem reg to autodecrement. */ -{"moveml", one(0046300), one(0177700), "!sLw"}, /* movem mem to reg. */ -{"moveml", one(0046330), one(0177770), "+sLw"}, /* movem autoinc to reg. */ - -{"moveml", one(0044300), one(0177700), "#w&s"}, /* movem reg to mem. */ -{"moveml", one(0044340), one(0177770), "#w-s"}, /* movem reg to autodecrement. */ -{"moveml", one(0046300), one(0177700), "!s#w"}, /* movem mem to reg. */ -{"moveml", one(0046330), one(0177770), "+s#w"}, /* movem autoinc to reg. */ - -/* JF added these next four for the assembler */ -{"movemw", one(0044200), one(0177700), "Lw&s"}, /* movem reg to mem. */ -{"movemw", one(0044240), one(0177770), "lw-s"}, /* movem reg to autodecrement. */ -{"movemw", one(0046200), one(0177700), "!sLw"}, /* movem mem to reg. */ -{"movemw", one(0046230), one(0177770), "+sLw"}, /* movem autoinc to reg. */ - -{"movemw", one(0044200), one(0177700), "#w&s"}, /* movem reg to mem. */ -{"movemw", one(0044240), one(0177770), "#w-s"}, /* movem reg to autodecrement. */ -{"movemw", one(0046200), one(0177700), "!s#w"}, /* movem mem to reg. */ -{"movemw", one(0046230), one(0177770), "+s#w"}, /* movem autoinc to reg. */ - -{"movepl", one(0000510), one(0170770), "dsDd"}, /* memory to register */ -{"movepl", one(0000710), one(0170770), "Ddds"}, /* register to memory */ -{"movepw", one(0000410), one(0170770), "dsDd"}, /* memory to register */ -{"movepw", one(0000610), one(0170770), "Ddds"}, /* register to memory */ -{"moveq", one(0070000), one(0170400), "MsDd"}, -{"movew", one(0030000), one(0170000), "*w$d"}, -{"movew", one(0030100), one(0170700), "*wAd"}, /* movea, written as move */ -{"movew", one(0040300), one(0177700), "Ss$s"}, /* Move from sr */ -{"movew", one(0041300), one(0177700), "Cs$s"}, /* Move from ccr */ -{"movew", one(0042300), one(0177700), ";wCd"}, /* move to ccr */ -{"movew", one(0043300), one(0177700), ";wSd"}, /* move to sr */ - -{"movesb", two(0007000, 0), two(0177700, 07777), "~sR1"}, /* moves from memory */ -{"movesb", two(0007000, 04000), two(0177700, 07777), "R1~s"}, /* moves to memory */ -{"movesl", two(0007200, 0), two(0177700, 07777), "~sR1"}, /* moves from memory */ -{"movesl", two(0007200, 04000), two(0177700, 07777), "R1~s"}, /* moves to memory */ -{"movesw", two(0007100, 0), two(0177700, 07777), "~sR1"}, /* moves from memory */ -{"movesw", two(0007100, 04000), two(0177700, 07777), "R1~s"}, /* moves to memory */ - -{"mulsl", two(0046000, 004000), two(0177700, 0107770), ";lD1"}, -{"mulsl", two(0046000, 006000), two(0177700, 0107770), ";lD3D1"}, -{"mulsw", one(0140700), one(0170700), ";wDd"}, -{"muls", one(0140700), one(0170700), ";wDd"}, -{"mulul", two(0046000, 000000), two(0177700, 0107770), ";lD1"}, -{"mulul", two(0046000, 002000), two(0177700, 0107770), ";lD3D1"}, -{"muluw", one(0140300), one(0170700), ";wDd"}, -{"mulu", one(0140300), one(0170700), ";wDd"}, -{"nbcd", one(0044000), one(0177700), "$s"}, -{"negb", one(0042000), one(0177700), "$s"}, -{"negl", one(0042200), one(0177700), "$s"}, -{"negw", one(0042100), one(0177700), "$s"}, -{"negxb", one(0040000), one(0177700), "$s"}, -{"negxl", one(0040200), one(0177700), "$s"}, -{"negxw", one(0040100), one(0177700), "$s"}, -{"nop", one(0047161), one(0177777), ""}, -{"notb", one(0043000), one(0177700), "$s"}, -{"notl", one(0043200), one(0177700), "$s"}, -{"notw", one(0043100), one(0177700), "$s"}, - -{"orb", one(0000000), one(0177700), "#b$s"}, /* ori written as or */ -{"orb", one(0000074), one(0177777), "#bCs"}, /* ori to ccr */ -{"orb", one(0100000), one(0170700), ";bDd"}, /* memory to register */ -{"orb", one(0100400), one(0170700), "Dd~s"}, /* register to memory */ -{"orib", one(0000000), one(0177700), "#b$s"}, -{"orib", one(0000074), one(0177777), "#bCs"}, /* ori to ccr */ -{"oril", one(0000200), one(0177700), "#l$s"}, -{"oriw", one(0000100), one(0177700), "#w$s"}, -{"oriw", one(0000174), one(0177777), "#wSs"}, /* ori to sr */ -{"orl", one(0000200), one(0177700), "#l$s"}, -{"orl", one(0100200), one(0170700), ";lDd"}, /* memory to register */ -{"orl", one(0100600), one(0170700), "Dd~s"}, /* register to memory */ -{"orw", one(0000100), one(0177700), "#w$s"}, -{"orw", one(0000174), one(0177777), "#wSs"}, /* ori to sr */ -{"orw", one(0100100), one(0170700), ";wDd"}, /* memory to register */ -{"orw", one(0100500), one(0170700), "Dd~s"}, /* register to memory */ - -{"pack", one(0100500), one(0170770), "DsDd#w"}, /* pack Ds, Dd, #w */ -{"pack", one(0100510), one(0170770), "-s-d#w"}, /* pack -(As), -(Ad), #w */ -{"pea", one(0044100), one(0177700), "!s"}, -{"reset", one(0047160), one(0177777), ""}, - -{"rolb", one(0160430), one(0170770), "QdDs"}, /* rorb #Q, Ds */ -{"rolb", one(0160470), one(0170770), "DdDs"}, /* rorb Dd, Ds */ -{"roll", one(0160630), one(0170770), "QdDs"}, /* rorb #Q, Ds */ -{"roll", one(0160670), one(0170770), "DdDs"}, /* rorb Dd, Ds */ -{"rolw", one(0160530), one(0170770), "QdDs"}, /* rorb #Q, Ds */ -{"rolw", one(0160570), one(0170770), "DdDs"}, /* rorb Dd, Ds */ -{"rolw", one(0163700), one(0177700), "~s"}, /* Rotate memory */ -{"rorb", one(0160030), one(0170770), "QdDs"}, /* rorb #Q, Ds */ -{"rorb", one(0160070), one(0170770), "DdDs"}, /* rorb Dd, Ds */ -{"rorl", one(0160230), one(0170770), "QdDs"}, /* rorb #Q, Ds */ -{"rorl", one(0160270), one(0170770), "DdDs"}, /* rorb Dd, Ds */ -{"rorw", one(0160130), one(0170770), "QdDs"}, /* rorb #Q, Ds */ -{"rorw", one(0160170), one(0170770), "DdDs"}, /* rorb Dd, Ds */ -{"rorw", one(0163300), one(0177700), "~s"}, /* Rotate memory */ - -{"roxlb", one(0160420), one(0170770), "QdDs"}, /* roxrb #Q, Ds */ -{"roxlb", one(0160460), one(0170770), "DdDs"}, /* roxrb Dd, Ds */ -{"roxll", one(0160620), one(0170770), "QdDs"}, /* roxrb #Q, Ds */ -{"roxll", one(0160660), one(0170770), "DdDs"}, /* roxrb Dd, Ds */ -{"roxlw", one(0160520), one(0170770), "QdDs"}, /* roxrb #Q, Ds */ -{"roxlw", one(0160560), one(0170770), "DdDs"}, /* roxrb Dd, Ds */ -{"roxlw", one(0162700), one(0177700), "~s"}, /* Rotate memory */ -{"roxrb", one(0160020), one(0170770), "QdDs"}, /* roxrb #Q, Ds */ -{"roxrb", one(0160060), one(0170770), "DdDs"}, /* roxrb Dd, Ds */ -{"roxrl", one(0160220), one(0170770), "QdDs"}, /* roxrb #Q, Ds */ -{"roxrl", one(0160260), one(0170770), "DdDs"}, /* roxrb Dd, Ds */ -{"roxrw", one(0160120), one(0170770), "QdDs"}, /* roxrb #Q, Ds */ -{"roxrw", one(0160160), one(0170770), "DdDs"}, /* roxrb Dd, Ds */ -{"roxrw", one(0162300), one(0177700), "~s"}, /* Rotate memory */ - -{"rtd", one(0047164), one(0177777), "#w"}, -{"rte", one(0047163), one(0177777), ""}, -{"rtm", one(0003300), one(0177760), "Rs"}, -{"rtr", one(0047167), one(0177777), ""}, -{"rts", one(0047165), one(0177777), ""}, - -{"scc", one(0052300), one(0177700), "$s"}, -{"scs", one(0052700), one(0177700), "$s"}, -{"seq", one(0053700), one(0177700), "$s"}, -{"sf", one(0050700), one(0177700), "$s"}, -{"sge", one(0056300), one(0177700), "$s"}, -{"sgt", one(0057300), one(0177700), "$s"}, -{"shi", one(0051300), one(0177700), "$s"}, -{"sle", one(0057700), one(0177700), "$s"}, -{"sls", one(0051700), one(0177700), "$s"}, -{"slt", one(0056700), one(0177700), "$s"}, -{"smi", one(0055700), one(0177700), "$s"}, -{"sne", one(0053300), one(0177700), "$s"}, -{"spl", one(0055300), one(0177700), "$s"}, -{"st", one(0050300), one(0177700), "$s"}, -{"svc", one(0054300), one(0177700), "$s"}, -{"svs", one(0054700), one(0177700), "$s"}, - -{"sbcd", one(0100400), one(0170770), "DsDd"}, -{"sbcd", one(0100410), one(0170770), "-s-d"}, -{"stop", one(0047162), one(0177777), "#w"}, - -{"subal", one(0110700), one(0170700), "*lAd"}, -{"subaw", one(0110300), one(0170700), "*wAd"}, -{"subb", one(0050400), one(0170700), "Qd%s"}, /* subq written as sub */ -{"subb", one(0002000), one(0177700), "#b$s"}, /* subi written as sub */ -{"subb", one(0110000), one(0170700), ";bDd"}, /* subb ? ?, Dd */ -{"subb", one(0110400), one(0170700), "Dd~s"}, /* subb Dd, ? ? */ -{"subib", one(0002000), one(0177700), "#b$s"}, -{"subil", one(0002200), one(0177700), "#l$s"}, -{"subiw", one(0002100), one(0177700), "#w$s"}, -{"subl", one(0050600), one(0170700), "Qd%s"}, -{"subl", one(0002200), one(0177700), "#l$s"}, -{"subl", one(0110700), one(0170700), "*lAd"}, -{"subl", one(0110200), one(0170700), "*lDd"}, -{"subl", one(0110600), one(0170700), "Dd~s"}, -{"subqb", one(0050400), one(0170700), "Qd%s"}, -{"subql", one(0050600), one(0170700), "Qd%s"}, -{"subqw", one(0050500), one(0170700), "Qd%s"}, -{"subw", one(0050500), one(0170700), "Qd%s"}, -{"subw", one(0002100), one(0177700), "#w$s"}, -{"subw", one(0110100), one(0170700), "*wDd"}, -{"subw", one(0110300), one(0170700), "*wAd"}, /* suba written as sub */ -{"subw", one(0110500), one(0170700), "Dd~s"}, -{"subxb", one(0110400), one(0170770), "DsDd"}, /* subxb Ds, Dd */ -{"subxb", one(0110410), one(0170770), "-s-d"}, /* subxb -(As), -(Ad) */ -{"subxl", one(0110600), one(0170770), "DsDd"}, -{"subxl", one(0110610), one(0170770), "-s-d"}, -{"subxw", one(0110500), one(0170770), "DsDd"}, -{"subxw", one(0110510), one(0170770), "-s-d"}, - -{"swap", one(0044100), one(0177770), "Ds"}, - -{"tas", one(0045300), one(0177700), "$s"}, -{"trap", one(0047100), one(0177760), "Ts"}, - -{"trapcc", one(0052374), one(0177777), ""}, -{"trapcs", one(0052774), one(0177777), ""}, -{"trapeq", one(0053774), one(0177777), ""}, -{"trapf", one(0050774), one(0177777), ""}, -{"trapge", one(0056374), one(0177777), ""}, -{"trapgt", one(0057374), one(0177777), ""}, -{"traphi", one(0051374), one(0177777), ""}, -{"traple", one(0057774), one(0177777), ""}, -{"trapls", one(0051774), one(0177777), ""}, -{"traplt", one(0056774), one(0177777), ""}, -{"trapmi", one(0055774), one(0177777), ""}, -{"trapne", one(0053374), one(0177777), ""}, -{"trappl", one(0055374), one(0177777), ""}, -{"trapt", one(0050374), one(0177777), ""}, -{"trapvc", one(0054374), one(0177777), ""}, -{"trapvs", one(0054774), one(0177777), ""}, - -{"trapcc.w", one(0052372), one(0177777), ""}, -{"trapcs.w", one(0052772), one(0177777), ""}, -{"trapeq.w", one(0053772), one(0177777), ""}, -{"trapf.w", one(0050772), one(0177777), ""}, -{"trapge.w", one(0056372), one(0177777), ""}, -{"trapgt.w", one(0057372), one(0177777), ""}, -{"traphi.w", one(0051372), one(0177777), ""}, -{"traple.w", one(0057772), one(0177777), ""}, -{"trapls.w", one(0051772), one(0177777), ""}, -{"traplt.w", one(0056772), one(0177777), ""}, -{"trapmi.w", one(0055772), one(0177777), ""}, -{"trapne.w", one(0053372), one(0177777), ""}, -{"trappl.w", one(0055372), one(0177777), ""}, -{"trapt.w", one(0050372), one(0177777), ""}, -{"trapvc.w", one(0054372), one(0177777), ""}, -{"trapvs.w", one(0054772), one(0177777), ""}, - -{"trapcc.l", one(0052373), one(0177777), ""}, -{"trapcs.l", one(0052773), one(0177777), ""}, -{"trapeq.l", one(0053773), one(0177777), ""}, -{"trapf.l", one(0050773), one(0177777), ""}, -{"trapge.l", one(0056373), one(0177777), ""}, -{"trapgt.l", one(0057373), one(0177777), ""}, -{"traphi.l", one(0051373), one(0177777), ""}, -{"traple.l", one(0057773), one(0177777), ""}, -{"trapls.l", one(0051773), one(0177777), ""}, -{"traplt.l", one(0056773), one(0177777), ""}, -{"trapmi.l", one(0055773), one(0177777), ""}, -{"trapne.l", one(0053373), one(0177777), ""}, -{"trappl.l", one(0055373), one(0177777), ""}, -{"trapt.l", one(0050373), one(0177777), ""}, -{"trapvc.l", one(0054373), one(0177777), ""}, -{"trapvs.l", one(0054773), one(0177777), ""}, - -{"trapv", one(0047166), one(0177777), ""}, - -{"tstb", one(0045000), one(0177700), ";b"}, -{"tstw", one(0045100), one(0177700), "*w"}, -{"tstl", one(0045200), one(0177700), "*l"}, - -{"unlk", one(0047130), one(0177770), "As"}, -{"unpk", one(0100600), one(0170770), "DsDd#w"}, -{"unpk", one(0100610), one(0170770), "-s-d#w"}, - /* JF floating pt stuff moved down here */ - -{"fabsb", two(0xF000, 0x5818), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fabsd", two(0xF000, 0x5418), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fabsl", two(0xF000, 0x4018), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fabsp", two(0xF000, 0x4C18), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fabss", two(0xF000, 0x4418), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fabsw", two(0xF000, 0x5018), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fabsx", two(0xF000, 0x0018), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fabsx", two(0xF000, 0x4818), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fabsx", two(0xF000, 0x0018), two(0xF1C0, 0xE07F), "IiFt"}, - -{"facosb", two(0xF000, 0x581C), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"facosd", two(0xF000, 0x541C), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"facosl", two(0xF000, 0x401C), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"facosp", two(0xF000, 0x4C1C), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"facoss", two(0xF000, 0x441C), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"facosw", two(0xF000, 0x501C), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"facosx", two(0xF000, 0x001C), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"facosx", two(0xF000, 0x481C), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"facosx", two(0xF000, 0x001C), two(0xF1C0, 0xE07F), "IiFt"}, - -{"faddb", two(0xF000, 0x5822), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"faddd", two(0xF000, 0x5422), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"faddl", two(0xF000, 0x4022), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"faddp", two(0xF000, 0x4C22), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fadds", two(0xF000, 0x4422), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"faddw", two(0xF000, 0x5022), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"faddx", two(0xF000, 0x0022), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"faddx", two(0xF000, 0x4822), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -/* {"faddx", two(0xF000, 0x0022), two(0xF1C0, 0xE07F), "IiFt"}, JF removed */ - -{"fasinb", two(0xF000, 0x580C), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fasind", two(0xF000, 0x540C), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fasinl", two(0xF000, 0x400C), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fasinp", two(0xF000, 0x4C0C), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fasins", two(0xF000, 0x440C), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fasinw", two(0xF000, 0x500C), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fasinx", two(0xF000, 0x000C), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fasinx", two(0xF000, 0x480C), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fasinx", two(0xF000, 0x000C), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fatanb", two(0xF000, 0x580A), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fatand", two(0xF000, 0x540A), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fatanl", two(0xF000, 0x400A), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fatanp", two(0xF000, 0x4C0A), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fatans", two(0xF000, 0x440A), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fatanw", two(0xF000, 0x500A), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fatanx", two(0xF000, 0x000A), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fatanx", two(0xF000, 0x480A), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fatanx", two(0xF000, 0x000A), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fatanhb", two(0xF000, 0x580D), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fatanhd", two(0xF000, 0x540D), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fatanhl", two(0xF000, 0x400D), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fatanhp", two(0xF000, 0x4C0D), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fatanhs", two(0xF000, 0x440D), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fatanhw", two(0xF000, 0x500D), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fatanhx", two(0xF000, 0x000D), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fatanhx", two(0xF000, 0x480D), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fatanhx", two(0xF000, 0x000D), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fbeq", one(0xF081), one(0xF1BF), "IdBc"}, -{"fbf", one(0xF080), one(0xF1BF), "IdBc"}, -{"fbge", one(0xF093), one(0xF1BF), "IdBc"}, -{"fbgl", one(0xF096), one(0xF1BF), "IdBc"}, -{"fbgle", one(0xF097), one(0xF1BF), "IdBc"}, -{"fbgt", one(0xF092), one(0xF1BF), "IdBc"}, -{"fble", one(0xF095), one(0xF1BF), "IdBc"}, -{"fblt", one(0xF094), one(0xF1BF), "IdBc"}, -{"fbne", one(0xF08E), one(0xF1BF), "IdBc"}, -{"fbnge", one(0xF09C), one(0xF1BF), "IdBc"}, -{"fbngl", one(0xF099), one(0xF1BF), "IdBc"}, -{"fbngle", one(0xF098), one(0xF1BF), "IdBc"}, -{"fbngt", one(0xF09D), one(0xF1BF), "IdBc"}, -{"fbnle", one(0xF09A), one(0xF1BF), "IdBc"}, -{"fbnlt", one(0xF09B), one(0xF1BF), "IdBc"}, -{"fboge", one(0xF083), one(0xF1BF), "IdBc"}, -{"fbogl", one(0xF086), one(0xF1BF), "IdBc"}, -{"fbogt", one(0xF082), one(0xF1BF), "IdBc"}, -{"fbole", one(0xF085), one(0xF1BF), "IdBc"}, -{"fbolt", one(0xF084), one(0xF1BF), "IdBc"}, -{"fbor", one(0xF087), one(0xF1BF), "IdBc"}, -{"fbseq", one(0xF091), one(0xF1BF), "IdBc"}, -{"fbsf", one(0xF090), one(0xF1BF), "IdBc"}, -{"fbsne", one(0xF09E), one(0xF1BF), "IdBc"}, -{"fbst", one(0xF09F), one(0xF1BF), "IdBc"}, -{"fbt", one(0xF08F), one(0xF1BF), "IdBc"}, -{"fbueq", one(0xF089), one(0xF1BF), "IdBc"}, -{"fbuge", one(0xF08B), one(0xF1BF), "IdBc"}, -{"fbugt", one(0xF08A), one(0xF1BF), "IdBc"}, -{"fbule", one(0xF08D), one(0xF1BF), "IdBc"}, -{"fbult", one(0xF08C), one(0xF1BF), "IdBc"}, -{"fbun", one(0xF088), one(0xF1BF), "IdBc"}, - -{"fcmpb", two(0xF000, 0x5838), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fcmpd", two(0xF000, 0x5438), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fcmpl", two(0xF000, 0x4038), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fcmpp", two(0xF000, 0x4C38), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fcmps", two(0xF000, 0x4438), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fcmpw", two(0xF000, 0x5038), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fcmpx", two(0xF000, 0x0038), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fcmpx", two(0xF000, 0x4838), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -/* {"fcmpx", two(0xF000, 0x0038), two(0xF1C0, 0xE07F), "IiFt"}, JF removed */ - -{"fcosb", two(0xF000, 0x581D), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fcosd", two(0xF000, 0x541D), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fcosl", two(0xF000, 0x401D), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fcosp", two(0xF000, 0x4C1D), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fcoss", two(0xF000, 0x441D), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fcosw", two(0xF000, 0x501D), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fcosx", two(0xF000, 0x001D), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fcosx", two(0xF000, 0x481D), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fcosx", two(0xF000, 0x001D), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fcoshb", two(0xF000, 0x5819), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fcoshd", two(0xF000, 0x5419), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fcoshl", two(0xF000, 0x4019), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fcoshp", two(0xF000, 0x4C19), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fcoshs", two(0xF000, 0x4419), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fcoshw", two(0xF000, 0x5019), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fcoshx", two(0xF000, 0x0019), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fcoshx", two(0xF000, 0x4819), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fcoshx", two(0xF000, 0x0019), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fdbeq", two(0xF048, 0x0001), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbf", two(0xF048, 0x0000), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbge", two(0xF048, 0x0013), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbgl", two(0xF048, 0x0016), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbgle", two(0xF048, 0x0017), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbgt", two(0xF048, 0x0012), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdble", two(0xF048, 0x0015), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdblt", two(0xF048, 0x0014), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbne", two(0xF048, 0x000E), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbnge", two(0xF048, 0x001C), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbngl", two(0xF048, 0x0019), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbngle", two(0xF048, 0x0018), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbngt", two(0xF048, 0x001D), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbnle", two(0xF048, 0x001A), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbnlt", two(0xF048, 0x001B), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdboge", two(0xF048, 0x0003), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbogl", two(0xF048, 0x0006), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbogt", two(0xF048, 0x0002), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbole", two(0xF048, 0x0005), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbolt", two(0xF048, 0x0004), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbor", two(0xF048, 0x0007), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbseq", two(0xF048, 0x0011), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbsf", two(0xF048, 0x0010), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbsne", two(0xF048, 0x001E), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbst", two(0xF048, 0x001F), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbt", two(0xF048, 0x000F), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbueq", two(0xF048, 0x0009), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbuge", two(0xF048, 0x000B), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbugt", two(0xF048, 0x000A), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbule", two(0xF048, 0x000D), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbult", two(0xF048, 0x000C), two(0xF1F8, 0xFFFF), "IiDsBw"}, -{"fdbun", two(0xF048, 0x0008), two(0xF1F8, 0xFFFF), "IiDsBw"}, - -{"fdivb", two(0xF000, 0x5820), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fdivd", two(0xF000, 0x5420), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fdivl", two(0xF000, 0x4020), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fdivp", two(0xF000, 0x4C20), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fdivs", two(0xF000, 0x4420), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fdivw", two(0xF000, 0x5020), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fdivx", two(0xF000, 0x0020), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fdivx", two(0xF000, 0x4820), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -/* {"fdivx", two(0xF000, 0x0020), two(0xF1C0, 0xE07F), "IiFt"}, JF */ - -{"fetoxb", two(0xF000, 0x5810), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fetoxd", two(0xF000, 0x5410), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fetoxl", two(0xF000, 0x4010), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fetoxp", two(0xF000, 0x4C10), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fetoxs", two(0xF000, 0x4410), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fetoxw", two(0xF000, 0x5010), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fetoxx", two(0xF000, 0x0010), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fetoxx", two(0xF000, 0x4810), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fetoxx", two(0xF000, 0x0010), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fetoxm1b", two(0xF000, 0x5808), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fetoxm1d", two(0xF000, 0x5408), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fetoxm1l", two(0xF000, 0x4008), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fetoxm1p", two(0xF000, 0x4C08), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fetoxm1s", two(0xF000, 0x4408), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fetoxm1w", two(0xF000, 0x5008), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fetoxm1x", two(0xF000, 0x0008), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fetoxm1x", two(0xF000, 0x4808), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fetoxm1x", two(0xF000, 0x0008), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fgetexpb", two(0xF000, 0x581E), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fgetexpd", two(0xF000, 0x541E), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fgetexpl", two(0xF000, 0x401E), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fgetexpp", two(0xF000, 0x4C1E), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fgetexps", two(0xF000, 0x441E), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fgetexpw", two(0xF000, 0x501E), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fgetexpx", two(0xF000, 0x001E), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fgetexpx", two(0xF000, 0x481E), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fgetexpx", two(0xF000, 0x001E), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fgetmanb", two(0xF000, 0x581F), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fgetmand", two(0xF000, 0x541F), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fgetmanl", two(0xF000, 0x401F), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fgetmanp", two(0xF000, 0x4C1F), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fgetmans", two(0xF000, 0x441F), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fgetmanw", two(0xF000, 0x501F), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fgetmanx", two(0xF000, 0x001F), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fgetmanx", two(0xF000, 0x481F), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fgetmanx", two(0xF000, 0x001F), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fintb", two(0xF000, 0x5801), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fintd", two(0xF000, 0x5401), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fintl", two(0xF000, 0x4001), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fintp", two(0xF000, 0x4C01), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fints", two(0xF000, 0x4401), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fintw", two(0xF000, 0x5001), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fintx", two(0xF000, 0x0001), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fintx", two(0xF000, 0x4801), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fintx", two(0xF000, 0x0001), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fintrzb", two(0xF000, 0x5803), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fintrzd", two(0xF000, 0x5403), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fintrzl", two(0xF000, 0x4003), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fintrzp", two(0xF000, 0x4C03), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fintrzs", two(0xF000, 0x4403), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fintrzw", two(0xF000, 0x5003), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fintrzx", two(0xF000, 0x0003), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fintrzx", two(0xF000, 0x4803), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fintrzx", two(0xF000, 0x0003), two(0xF1C0, 0xE07F), "IiFt"}, - -{"flog10b", two(0xF000, 0x5815), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"flog10d", two(0xF000, 0x5415), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"flog10l", two(0xF000, 0x4015), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"flog10p", two(0xF000, 0x4C15), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"flog10s", two(0xF000, 0x4415), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"flog10w", two(0xF000, 0x5015), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"flog10x", two(0xF000, 0x0015), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"flog10x", two(0xF000, 0x4815), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"flog10x", two(0xF000, 0x0015), two(0xF1C0, 0xE07F), "IiFt"}, - -{"flog2b", two(0xF000, 0x5816), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"flog2d", two(0xF000, 0x5416), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"flog2l", two(0xF000, 0x4016), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"flog2p", two(0xF000, 0x4C16), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"flog2s", two(0xF000, 0x4416), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"flog2w", two(0xF000, 0x5016), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"flog2x", two(0xF000, 0x0016), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"flog2x", two(0xF000, 0x4816), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"flog2x", two(0xF000, 0x0016), two(0xF1C0, 0xE07F), "IiFt"}, - -{"flognb", two(0xF000, 0x5814), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"flognd", two(0xF000, 0x5414), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"flognl", two(0xF000, 0x4014), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"flognp", two(0xF000, 0x4C14), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"flogns", two(0xF000, 0x4414), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"flognw", two(0xF000, 0x5014), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"flognx", two(0xF000, 0x0014), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"flognx", two(0xF000, 0x4814), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"flognx", two(0xF000, 0x0014), two(0xF1C0, 0xE07F), "IiFt"}, - -{"flognp1b", two(0xF000, 0x5806), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"flognp1d", two(0xF000, 0x5406), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"flognp1l", two(0xF000, 0x4006), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"flognp1p", two(0xF000, 0x4C06), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"flognp1s", two(0xF000, 0x4406), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"flognp1w", two(0xF000, 0x5006), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"flognp1x", two(0xF000, 0x0006), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"flognp1x", two(0xF000, 0x4806), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"flognp1x", two(0xF000, 0x0006), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fmodb", two(0xF000, 0x5821), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fmodd", two(0xF000, 0x5421), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fmodl", two(0xF000, 0x4021), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fmodp", two(0xF000, 0x4C21), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fmods", two(0xF000, 0x4421), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fmodw", two(0xF000, 0x5021), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fmodx", two(0xF000, 0x0021), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fmodx", two(0xF000, 0x4821), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -/* {"fmodx", two(0xF000, 0x0021), two(0xF1C0, 0xE07F), "IiFt"}, JF */ - -{"fmoveb", two(0xF000, 0x5800), two(0xF1C0, 0xFC7F), "Ii;bF7"}, /* fmove from to fp */ -{"fmoveb", two(0xF000, 0x7800), two(0xF1C0, 0xFC7F), "IiF7@b"}, /* fmove from fp to */ -{"fmoved", two(0xF000, 0x5400), two(0xF1C0, 0xFC7F), "Ii;FF7"}, /* fmove from to fp */ -{"fmoved", two(0xF000, 0x7400), two(0xF1C0, 0xFC7F), "IiF7@F"}, /* fmove from fp to */ -{"fmovel", two(0xF000, 0x4000), two(0xF1C0, 0xFC7F), "Ii;lF7"}, /* fmove from to fp */ -{"fmovel", two(0xF000, 0x6000), two(0xF1C0, 0xFC7F), "IiF7@l"}, /* fmove from fp to */ -/* Warning: The addressing modes on these are probably not right: - esp, Areg direct is only allowed for FPI */ - /* fmove.l from/to system control registers: */ -{"fmovel", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8@s"}, -{"fmovel", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ls8"}, - -/* {"fmovel", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8@s"}, -{"fmovel", two(0xF000, 0x8000), two(0xF2C0, 0xE3FF), "Ii*ss8"}, */ - -{"fmovep", two(0xF000, 0x4C00), two(0xF1C0, 0xFC7F), "Ii;pF7"}, /* fmove from to fp */ -{"fmovep", two(0xF000, 0x6C00), two(0xF1C0, 0xFC00), "IiF7@pkC"}, /* fmove.p with k-factors: */ -{"fmovep", two(0xF000, 0x7C00), two(0xF1C0, 0xFC0F), "IiF7@pDk"}, /* fmove.p with k-factors: */ - -{"fmoves", two(0xF000, 0x4400), two(0xF1C0, 0xFC7F), "Ii;fF7"}, /* fmove from to fp */ -{"fmoves", two(0xF000, 0x6400), two(0xF1C0, 0xFC7F), "IiF7@f"}, /* fmove from fp to */ -{"fmovew", two(0xF000, 0x5000), two(0xF1C0, 0xFC7F), "Ii;wF7"}, /* fmove from to fp */ -{"fmovew", two(0xF000, 0x7000), two(0xF1C0, 0xFC7F), "IiF7@w"}, /* fmove from fp to */ -{"fmovex", two(0xF000, 0x0000), two(0xF1C0, 0xE07F), "IiF8F7"}, /* fmove from to fp */ -{"fmovex", two(0xF000, 0x4800), two(0xF1C0, 0xFC7F), "Ii;xF7"}, /* fmove from to fp */ -{"fmovex", two(0xF000, 0x6800), two(0xF1C0, 0xFC7F), "IiF7@x"}, /* fmove from fp to */ -/* JF removed {"fmovex", two(0xF000, 0x0000), two(0xF1C0, 0xE07F), "IiFt"}, / * fmove from to fp */ - -{"fmovecrx", two(0xF000, 0x5C00), two(0xF1FF, 0xFC00), "Ii#CF7"}, /* fmovecr.x #ccc, FPn */ -{"fmovecr", two(0xF000, 0x5C00), two(0xF1FF, 0xFC00), "Ii#CF7"}, - -/* Other fmovemx. */ -{"fmovemx", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "IdL3-s"}, /* fmovem.x to autodecrement, static and dynamic */ -{"fmovemx", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "Id#3-s"}, /* fmovem.x to autodecrement, static and dynamic */ - -{"fmovemx", two(0xF020, 0xE800), two(0xF1F8, 0xFF8F), "IiDk-s"}, /* fmovem.x to autodecrement, static and dynamic */ - -{"fmovemx", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Id#3&s"}, /* fmovem.x to control, static and dynamic: */ -{"fmovemx", two(0xF000, 0xF800), two(0xF1C0, 0xFF8F), "IiDk&s"}, /* fmovem.x to control, static and dynamic: */ -{"fmovemx", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&s#3"}, /* fmovem.x from control, static and dynamic: */ -{"fmovemx", two(0xF000, 0xD800), two(0xF1C0, 0xFF8F), "Ii&sDk"}, /* fmovem.x from control, static and dynamic: */ -{"fmovemx", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Idl3&s"}, /* fmovem.x to control, static and dynamic: */ -{"fmovemx", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&sl3"}, /* fmovem.x from control, static and dynamic: */ - -{"fmovemx", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+sl3"}, /* fmovem.x from autoincrement, static and dynamic: */ -{"fmovemx", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+s#3"}, /* fmovem.x from autoincrement, static and dynamic: */ -{"fmovemx", two(0xF018, 0xD800), two(0xF1F8, 0xFF8F), "Ii+sDk"}, /* fmovem.x from autoincrement, static and dynamic: */ - -{"fmoveml", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "IiL8@s"}, -{"fmoveml", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Ii#8@s"}, -{"fmoveml", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8@s"}, - -{"fmoveml", two(0xF000, 0x8000), two(0xF2C0, 0xE3FF), "Ii*sL8"}, -{"fmoveml", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*s#8"}, -{"fmoveml", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ss8"}, - -/* fmovemx with register lists */ -{"fmovem", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "IdL3-s"}, /* fmovem.x to autodecrement, static and dynamic */ -{"fmovem", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Idl3&s"}, /* fmovem.x to control, static and dynamic: */ -{"fmovem", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+sl3"}, /* fmovem.x from autoincrement, static and dynamic: */ -{"fmovem", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&sl3"}, /* fmovem.x from control, static and dynamic: */ - - /* Alternate mnemonics for GNU as and GNU CC */ -{"fmovem", two(0xF020, 0xE000), two(0xF1F8, 0xFF00), "Id#3-s"}, /* fmovem.x to autodecrement, static and dynamic */ -{"fmovem", two(0xF020, 0xE800), two(0xF1F8, 0xFF8F), "IiDk-s"}, /* fmovem.x to autodecrement, static and dynamic */ - -{"fmovem", two(0xF000, 0xF000), two(0xF1C0, 0xFF00), "Id#3&s"}, /* fmovem.x to control, static and dynamic: */ -{"fmovem", two(0xF000, 0xF800), two(0xF1C0, 0xFF8F), "IiDk&s"}, /* fmovem.x to control, static and dynamic: */ - -{"fmovem", two(0xF018, 0xD000), two(0xF1F8, 0xFF00), "Id+s#3"}, /* fmovem.x from autoincrement, static and dynamic: */ -{"fmovem", two(0xF018, 0xD800), two(0xF1F8, 0xFF8F), "Ii+sDk"}, /* fmovem.x from autoincrement, static and dynamic: */ - -{"fmovem", two(0xF000, 0xD000), two(0xF1C0, 0xFF00), "Id&s#3"}, /* fmovem.x from control, static and dynamic: */ -{"fmovem", two(0xF000, 0xD800), two(0xF1C0, 0xFF8F), "Ii&sDk"}, /* fmovem.x from control, static and dynamic: */ - -/* fmoveml a FP-control register */ -{"fmovem", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "Iis8@s"}, -{"fmovem", two(0xF000, 0x8000), two(0xF1C0, 0xE3FF), "Ii*ss8"}, - -/* fmoveml a FP-control reglist */ -{"fmovem", two(0xF000, 0xA000), two(0xF1C0, 0xE3FF), "IiL8@s"}, -{"fmovem", two(0xF000, 0x8000), two(0xF2C0, 0xE3FF), "Ii*sL8"}, - -{"fmulb", two(0xF000, 0x5823), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fmuld", two(0xF000, 0x5423), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fmull", two(0xF000, 0x4023), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fmulp", two(0xF000, 0x4C23), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fmuls", two(0xF000, 0x4423), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fmulw", two(0xF000, 0x5023), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fmulx", two(0xF000, 0x0023), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fmulx", two(0xF000, 0x4823), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -/* {"fmulx", two(0xF000, 0x0023), two(0xF1C0, 0xE07F), "IiFt"}, JF */ - -{"fnegb", two(0xF000, 0x581A), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fnegd", two(0xF000, 0x541A), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fnegl", two(0xF000, 0x401A), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fnegp", two(0xF000, 0x4C1A), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fnegs", two(0xF000, 0x441A), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fnegw", two(0xF000, 0x501A), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fnegx", two(0xF000, 0x001A), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fnegx", two(0xF000, 0x481A), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fnegx", two(0xF000, 0x001A), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fnop", two(0xF280, 0x0000), two(0xFFFF, 0xFFFF), "Ii"}, - -{"fremb", two(0xF000, 0x5825), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fremd", two(0xF000, 0x5425), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"freml", two(0xF000, 0x4025), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fremp", two(0xF000, 0x4C25), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"frems", two(0xF000, 0x4425), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fremw", two(0xF000, 0x5025), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fremx", two(0xF000, 0x0025), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fremx", two(0xF000, 0x4825), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -/* {"fremx", two(0xF000, 0x0025), two(0xF1C0, 0xE07F), "IiFt"}, JF */ - -{"frestore", one(0xF140), one(0xF1C0), "Id&s"}, -{"frestore", one(0xF158), one(0xF1F8), "Id+s"}, -{"fsave", one(0xF100), one(0xF1C0), "Id&s"}, -{"fsave", one(0xF120), one(0xF1F8), "Id-s"}, - -{"fsincosb", two(0xF000, 0x5830), two(0xF1C0, 0xFC78), "Ii;bF7FC"}, -{"fsincosd", two(0xF000, 0x5430), two(0xF1C0, 0xFC78), "Ii;FF7FC"}, -{"fsincosl", two(0xF000, 0x4030), two(0xF1C0, 0xFC78), "Ii;lF7FC"}, -{"fsincosp", two(0xF000, 0x4C30), two(0xF1C0, 0xFC78), "Ii;pF7FC"}, -{"fsincoss", two(0xF000, 0x4430), two(0xF1C0, 0xFC78), "Ii;fF7FC"}, -{"fsincosw", two(0xF000, 0x5030), two(0xF1C0, 0xFC78), "Ii;wF7FC"}, -{"fsincosx", two(0xF000, 0x0030), two(0xF1C0, 0xE078), "IiF8F7FC"}, -{"fsincosx", two(0xF000, 0x4830), two(0xF1C0, 0xFC78), "Ii;xF7FC"}, - -{"fscaleb", two(0xF000, 0x5826), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fscaled", two(0xF000, 0x5426), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fscalel", two(0xF000, 0x4026), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fscalep", two(0xF000, 0x4C26), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fscales", two(0xF000, 0x4426), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fscalew", two(0xF000, 0x5026), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fscalex", two(0xF000, 0x0026), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fscalex", two(0xF000, 0x4826), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -/* {"fscalex", two(0xF000, 0x0026), two(0xF1C0, 0xE07F), "IiFt"}, JF */ - -/* $ is necessary to prevent the assembler from using PC-relative. - If @ were used, "label: fseq label" could produce "ftrapeq", - because "label" became "pc@label". */ -{"fseq", two(0xF040, 0x0001), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsf", two(0xF040, 0x0000), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsge", two(0xF040, 0x0013), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsgl", two(0xF040, 0x0016), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsgle", two(0xF040, 0x0017), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsgt", two(0xF040, 0x0012), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsle", two(0xF040, 0x0015), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fslt", two(0xF040, 0x0014), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsne", two(0xF040, 0x000E), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsnge", two(0xF040, 0x001C), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsngl", two(0xF040, 0x0019), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsngle", two(0xF040, 0x0018), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsngt", two(0xF040, 0x001D), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsnle", two(0xF040, 0x001A), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsnlt", two(0xF040, 0x001B), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsoge", two(0xF040, 0x0003), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsogl", two(0xF040, 0x0006), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsogt", two(0xF040, 0x0002), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsole", two(0xF040, 0x0005), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsolt", two(0xF040, 0x0004), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsor", two(0xF040, 0x0007), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsseq", two(0xF040, 0x0011), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fssf", two(0xF040, 0x0010), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fssne", two(0xF040, 0x001E), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsst", two(0xF040, 0x001F), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fst", two(0xF040, 0x000F), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsueq", two(0xF040, 0x0009), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsuge", two(0xF040, 0x000B), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsugt", two(0xF040, 0x000A), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsule", two(0xF040, 0x000D), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsult", two(0xF040, 0x000C), two(0xF1C0, 0xFFFF), "Ii$s"}, -{"fsun", two(0xF040, 0x0008), two(0xF1C0, 0xFFFF), "Ii$s"}, - -{"fsgldivb", two(0xF000, 0x5824), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fsgldivd", two(0xF000, 0x5424), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fsgldivl", two(0xF000, 0x4024), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fsgldivp", two(0xF000, 0x4C24), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fsgldivs", two(0xF000, 0x4424), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fsgldivw", two(0xF000, 0x5024), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fsgldivx", two(0xF000, 0x0024), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fsgldivx", two(0xF000, 0x4824), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fsgldivx", two(0xF000, 0x0024), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fsglmulb", two(0xF000, 0x5827), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fsglmuld", two(0xF000, 0x5427), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fsglmull", two(0xF000, 0x4027), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fsglmulp", two(0xF000, 0x4C27), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fsglmuls", two(0xF000, 0x4427), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fsglmulw", two(0xF000, 0x5027), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fsglmulx", two(0xF000, 0x0027), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fsglmulx", two(0xF000, 0x4827), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fsglmulx", two(0xF000, 0x0027), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fsinb", two(0xF000, 0x580E), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fsind", two(0xF000, 0x540E), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fsinl", two(0xF000, 0x400E), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fsinp", two(0xF000, 0x4C0E), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fsins", two(0xF000, 0x440E), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fsinw", two(0xF000, 0x500E), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fsinx", two(0xF000, 0x000E), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fsinx", two(0xF000, 0x480E), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fsinx", two(0xF000, 0x000E), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fsinhb", two(0xF000, 0x5802), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fsinhd", two(0xF000, 0x5402), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fsinhl", two(0xF000, 0x4002), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fsinhp", two(0xF000, 0x4C02), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fsinhs", two(0xF000, 0x4402), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fsinhw", two(0xF000, 0x5002), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fsinhx", two(0xF000, 0x0002), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fsinhx", two(0xF000, 0x4802), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fsinhx", two(0xF000, 0x0002), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fsqrtb", two(0xF000, 0x5804), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fsqrtd", two(0xF000, 0x5404), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fsqrtl", two(0xF000, 0x4004), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fsqrtp", two(0xF000, 0x4C04), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fsqrts", two(0xF000, 0x4404), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fsqrtw", two(0xF000, 0x5004), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fsqrtx", two(0xF000, 0x0004), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fsqrtx", two(0xF000, 0x4804), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fsqrtx", two(0xF000, 0x0004), two(0xF1C0, 0xE07F), "IiFt"}, - -{"fsubb", two(0xF000, 0x5828), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"fsubd", two(0xF000, 0x5428), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"fsubl", two(0xF000, 0x4028), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"fsubp", two(0xF000, 0x4C28), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"fsubs", two(0xF000, 0x4428), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"fsubw", two(0xF000, 0x5028), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"fsubx", two(0xF000, 0x0028), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"fsubx", two(0xF000, 0x4828), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"fsubx", two(0xF000, 0x0028), two(0xF1C0, 0xE07F), "IiFt"}, - -{"ftanb", two(0xF000, 0x580F), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"ftand", two(0xF000, 0x540F), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"ftanl", two(0xF000, 0x400F), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"ftanp", two(0xF000, 0x4C0F), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"ftans", two(0xF000, 0x440F), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"ftanw", two(0xF000, 0x500F), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"ftanx", two(0xF000, 0x000F), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"ftanx", two(0xF000, 0x480F), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"ftanx", two(0xF000, 0x000F), two(0xF1C0, 0xE07F), "IiFt"}, - -{"ftanhb", two(0xF000, 0x5809), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"ftanhd", two(0xF000, 0x5409), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"ftanhl", two(0xF000, 0x4009), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"ftanhp", two(0xF000, 0x4C09), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"ftanhs", two(0xF000, 0x4409), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"ftanhw", two(0xF000, 0x5009), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"ftanhx", two(0xF000, 0x0009), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"ftanhx", two(0xF000, 0x4809), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"ftanhx", two(0xF000, 0x0009), two(0xF1C0, 0xE07F), "IiFt"}, - -{"ftentoxb", two(0xF000, 0x5812), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"ftentoxd", two(0xF000, 0x5412), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"ftentoxl", two(0xF000, 0x4012), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"ftentoxp", two(0xF000, 0x4C12), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"ftentoxs", two(0xF000, 0x4412), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"ftentoxw", two(0xF000, 0x5012), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"ftentoxx", two(0xF000, 0x0012), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"ftentoxx", two(0xF000, 0x4812), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"ftentoxx", two(0xF000, 0x0012), two(0xF1C0, 0xE07F), "IiFt"}, - -{"ftrapeq", two(0xF07C, 0x0001), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapf", two(0xF07C, 0x0000), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapge", two(0xF07C, 0x0013), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapgl", two(0xF07C, 0x0016), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapgle", two(0xF07C, 0x0017), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapgt", two(0xF07C, 0x0012), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftraple", two(0xF07C, 0x0015), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftraplt", two(0xF07C, 0x0014), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapne", two(0xF07C, 0x000E), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapnge", two(0xF07C, 0x001C), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapngl", two(0xF07C, 0x0019), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapngle", two(0xF07C, 0x0018), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapngt", two(0xF07C, 0x001D), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapnle", two(0xF07C, 0x001A), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapnlt", two(0xF07C, 0x001B), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapoge", two(0xF07C, 0x0003), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapogl", two(0xF07C, 0x0006), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapogt", two(0xF07C, 0x0002), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapole", two(0xF07C, 0x0005), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapolt", two(0xF07C, 0x0004), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapor", two(0xF07C, 0x0007), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapseq", two(0xF07C, 0x0011), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapsf", two(0xF07C, 0x0010), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapsne", two(0xF07C, 0x001E), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapst", two(0xF07C, 0x001F), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapt", two(0xF07C, 0x000F), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapueq", two(0xF07C, 0x0009), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapuge", two(0xF07C, 0x000B), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapugt", two(0xF07C, 0x000A), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapule", two(0xF07C, 0x000D), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapult", two(0xF07C, 0x000C), two(0xF1FF, 0xFFFF), "Ii"}, -{"ftrapun", two(0xF07C, 0x0008), two(0xF1FF, 0xFFFF), "Ii"}, - -{"ftrapeqw", two(0xF07A, 0x0001), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapfw", two(0xF07A, 0x0000), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapgew", two(0xF07A, 0x0013), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapglw", two(0xF07A, 0x0016), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapglew", two(0xF07A, 0x0017), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapgtw", two(0xF07A, 0x0012), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftraplew", two(0xF07A, 0x0015), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapltw", two(0xF07A, 0x0014), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapnew", two(0xF07A, 0x000E), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapngew", two(0xF07A, 0x001C), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapnglw", two(0xF07A, 0x0019), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapnglew", two(0xF07A, 0x0018), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapngtw", two(0xF07A, 0x001D), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapnlew", two(0xF07A, 0x001A), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapnltw", two(0xF07A, 0x001B), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapogew", two(0xF07A, 0x0003), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapoglw", two(0xF07A, 0x0006), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapogtw", two(0xF07A, 0x0002), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapolew", two(0xF07A, 0x0005), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapoltw", two(0xF07A, 0x0004), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftraporw", two(0xF07A, 0x0007), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapseqw", two(0xF07A, 0x0011), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapsfw", two(0xF07A, 0x0010), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapsnew", two(0xF07A, 0x001E), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapstw", two(0xF07A, 0x001F), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftraptw", two(0xF07A, 0x000F), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapueqw", two(0xF07A, 0x0009), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapugew", two(0xF07A, 0x000B), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapugtw", two(0xF07A, 0x000A), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapulew", two(0xF07A, 0x000D), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapultw", two(0xF07A, 0x000C), two(0xF1FF, 0xFFFF), "Ii^w"}, -{"ftrapunw", two(0xF07A, 0x0008), two(0xF1FF, 0xFFFF), "Ii^w"}, - -{"ftrapeql", two(0xF07B, 0x0001), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapfl", two(0xF07B, 0x0000), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapgel", two(0xF07B, 0x0013), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapgll", two(0xF07B, 0x0016), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapglel", two(0xF07B, 0x0017), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapgtl", two(0xF07B, 0x0012), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftraplel", two(0xF07B, 0x0015), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapltl", two(0xF07B, 0x0014), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapnel", two(0xF07B, 0x000E), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapngel", two(0xF07B, 0x001C), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapngll", two(0xF07B, 0x0019), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapnglel", two(0xF07B, 0x0018), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapngtl", two(0xF07B, 0x001D), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapnlel", two(0xF07B, 0x001A), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapnltl", two(0xF07B, 0x001B), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapogel", two(0xF07B, 0x0003), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapogll", two(0xF07B, 0x0006), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapogtl", two(0xF07B, 0x0002), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapolel", two(0xF07B, 0x0005), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapoltl", two(0xF07B, 0x0004), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftraporl", two(0xF07B, 0x0007), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapseql", two(0xF07B, 0x0011), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapsfl", two(0xF07B, 0x0010), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapsnel", two(0xF07B, 0x001E), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapstl", two(0xF07B, 0x001F), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftraptl", two(0xF07B, 0x000F), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapueql", two(0xF07B, 0x0009), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapugel", two(0xF07B, 0x000B), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapugtl", two(0xF07B, 0x000A), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapulel", two(0xF07B, 0x000D), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapultl", two(0xF07B, 0x000C), two(0xF1FF, 0xFFFF), "Ii^l"}, -{"ftrapunl", two(0xF07B, 0x0008), two(0xF1FF, 0xFFFF), "Ii^l"}, - -{"ftstb", two(0xF000, 0x583A), two(0xF1C0, 0xFC7F), "Ii;b"}, -{"ftstd", two(0xF000, 0x543A), two(0xF1C0, 0xFC7F), "Ii;F"}, -{"ftstl", two(0xF000, 0x403A), two(0xF1C0, 0xFC7F), "Ii;l"}, -{"ftstp", two(0xF000, 0x4C3A), two(0xF1C0, 0xFC7F), "Ii;p"}, -{"ftsts", two(0xF000, 0x443A), two(0xF1C0, 0xFC7F), "Ii;f"}, -{"ftstw", two(0xF000, 0x503A), two(0xF1C0, 0xFC7F), "Ii;w"}, -{"ftstx", two(0xF000, 0x003A), two(0xF1C0, 0xE07F), "IiF8"}, -{"ftstx", two(0xF000, 0x483A), two(0xF1C0, 0xFC7F), "Ii;x"}, - -{"ftwotoxb", two(0xF000, 0x5811), two(0xF1C0, 0xFC7F), "Ii;bF7"}, -{"ftwotoxd", two(0xF000, 0x5411), two(0xF1C0, 0xFC7F), "Ii;FF7"}, -{"ftwotoxl", two(0xF000, 0x4011), two(0xF1C0, 0xFC7F), "Ii;lF7"}, -{"ftwotoxp", two(0xF000, 0x4C11), two(0xF1C0, 0xFC7F), "Ii;pF7"}, -{"ftwotoxs", two(0xF000, 0x4411), two(0xF1C0, 0xFC7F), "Ii;fF7"}, -{"ftwotoxw", two(0xF000, 0x5011), two(0xF1C0, 0xFC7F), "Ii;wF7"}, -{"ftwotoxx", two(0xF000, 0x0011), two(0xF1C0, 0xE07F), "IiF8F7"}, -{"ftwotoxx", two(0xF000, 0x4811), two(0xF1C0, 0xFC7F), "Ii;xF7"}, -{"ftwotoxx", two(0xF000, 0x0011), two(0xF1C0, 0xE07F), "IiFt"}, - - -{"fjeq", one(0xF081), one(0xF1FF), "IdBc"}, -{"fjf", one(0xF080), one(0xF1FF), "IdBc"}, -{"fjge", one(0xF093), one(0xF1FF), "IdBc"}, -{"fjgl", one(0xF096), one(0xF1FF), "IdBc"}, -{"fjgle", one(0xF097), one(0xF1FF), "IdBc"}, -{"fjgt", one(0xF092), one(0xF1FF), "IdBc"}, -{"fjle", one(0xF095), one(0xF1FF), "IdBc"}, -{"fjlt", one(0xF094), one(0xF1FF), "IdBc"}, -{"fjne", one(0xF08E), one(0xF1FF), "IdBc"}, -{"fjnge", one(0xF09C), one(0xF1FF), "IdBc"}, -{"fjngl", one(0xF099), one(0xF1FF), "IdBc"}, -{"fjngle", one(0xF098), one(0xF1FF), "IdBc"}, -{"fjngt", one(0xF09D), one(0xF1FF), "IdBc"}, -{"fjnle", one(0xF09A), one(0xF1FF), "IdBc"}, -{"fjnlt", one(0xF09B), one(0xF1FF), "IdBc"}, -{"fjoge", one(0xF083), one(0xF1FF), "IdBc"}, -{"fjogl", one(0xF086), one(0xF1FF), "IdBc"}, -{"fjogt", one(0xF082), one(0xF1FF), "IdBc"}, -{"fjole", one(0xF085), one(0xF1FF), "IdBc"}, -{"fjolt", one(0xF084), one(0xF1FF), "IdBc"}, -{"fjor", one(0xF087), one(0xF1FF), "IdBc"}, -{"fjseq", one(0xF091), one(0xF1FF), "IdBc"}, -{"fjsf", one(0xF090), one(0xF1FF), "IdBc"}, -{"fjsne", one(0xF09E), one(0xF1FF), "IdBc"}, -{"fjst", one(0xF09F), one(0xF1FF), "IdBc"}, -{"fjt", one(0xF08F), one(0xF1FF), "IdBc"}, -{"fjueq", one(0xF089), one(0xF1FF), "IdBc"}, -{"fjuge", one(0xF08B), one(0xF1FF), "IdBc"}, -{"fjugt", one(0xF08A), one(0xF1FF), "IdBc"}, -{"fjule", one(0xF08D), one(0xF1FF), "IdBc"}, -{"fjult", one(0xF08C), one(0xF1FF), "IdBc"}, -{"fjun", one(0xF088), one(0xF1FF), "IdBc"}, - -/* The assembler will ignore attempts to force a short offset */ - -{"bhis", one(0061000), one(0177400), "Bg"}, -{"blss", one(0061400), one(0177400), "Bg"}, -{"bccs", one(0062000), one(0177400), "Bg"}, -{"bcss", one(0062400), one(0177400), "Bg"}, -{"bnes", one(0063000), one(0177400), "Bg"}, -{"beqs", one(0063400), one(0177400), "Bg"}, -{"bvcs", one(0064000), one(0177400), "Bg"}, -{"bvss", one(0064400), one(0177400), "Bg"}, -{"bpls", one(0065000), one(0177400), "Bg"}, -{"bmis", one(0065400), one(0177400), "Bg"}, -{"bges", one(0066000), one(0177400), "Bg"}, -{"blts", one(0066400), one(0177400), "Bg"}, -{"bgts", one(0067000), one(0177400), "Bg"}, -{"bles", one(0067400), one(0177400), "Bg"}, - -/* Alternate mnemonics for SUN */ - -{"jbsr", one(0060400), one(0177400), "Bg"}, -{"jbsr", one(0047200), one(0177700), "!s"}, -{"jra", one(0060000), one(0177400), "Bg"}, -{"jra", one(0047300), one(0177700), "!s"}, - -{"jhi", one(0061000), one(0177400), "Bg"}, -{"jls", one(0061400), one(0177400), "Bg"}, -{"jcc", one(0062000), one(0177400), "Bg"}, -{"jcs", one(0062400), one(0177400), "Bg"}, -{"jne", one(0063000), one(0177400), "Bg"}, -{"jeq", one(0063400), one(0177400), "Bg"}, -{"jvc", one(0064000), one(0177400), "Bg"}, -{"jvs", one(0064400), one(0177400), "Bg"}, -{"jpl", one(0065000), one(0177400), "Bg"}, -{"jmi", one(0065400), one(0177400), "Bg"}, -{"jge", one(0066000), one(0177400), "Bg"}, -{"jlt", one(0066400), one(0177400), "Bg"}, -{"jgt", one(0067000), one(0177400), "Bg"}, -{"jle", one(0067400), one(0177400), "Bg"}, - -/* Short offsets are ignored */ - -{"jbsrs", one(0060400), one(0177400), "Bg"}, -{"jras", one(0060000), one(0177400), "Bg"}, -{"jhis", one(0061000), one(0177400), "Bg"}, -{"jlss", one(0061400), one(0177400), "Bg"}, -{"jccs", one(0062000), one(0177400), "Bg"}, -{"jcss", one(0062400), one(0177400), "Bg"}, -{"jnes", one(0063000), one(0177400), "Bg"}, -{"jeqs", one(0063400), one(0177400), "Bg"}, -{"jvcs", one(0064000), one(0177400), "Bg"}, -{"jvss", one(0064400), one(0177400), "Bg"}, -{"jpls", one(0065000), one(0177400), "Bg"}, -{"jmis", one(0065400), one(0177400), "Bg"}, -{"jges", one(0066000), one(0177400), "Bg"}, -{"jlts", one(0066400), one(0177400), "Bg"}, -{"jgts", one(0067000), one(0177400), "Bg"}, -{"jles", one(0067400), one(0177400), "Bg"}, - -{"movql", one(0070000), one(0170400), "MsDd"}, -{"moveql", one(0070000), one(0170400), "MsDd"}, -{"moval", one(0020100), one(0170700), "*lAd"}, -{"movaw", one(0030100), one(0170700), "*wAd"}, -{"movb", one(0010000), one(0170000), ";b$d"}, /* mov */ -{"movl", one(0070000), one(0170400), "MsDd"}, /* movq written as mov */ -{"movl", one(0020000), one(0170000), "*l$d"}, -{"movl", one(0020100), one(0170700), "*lAd"}, -{"movl", one(0047140), one(0177770), "AsUd"}, /* mov to USP */ -{"movl", one(0047150), one(0177770), "UdAs"}, /* mov from USP */ -{"movc", one(0047173), one(0177777), "R1Jj"}, -{"movc", one(0047173), one(0177777), "R1#j"}, -{"movc", one(0047172), one(0177777), "JjR1"}, -{"movc", one(0047172), one(0177777), "#jR1"}, -{"movml", one(0044300), one(0177700), "#w&s"}, /* movm reg to mem. */ -{"movml", one(0044340), one(0177770), "#w-s"}, /* movm reg to autodecrement. */ -{"movml", one(0046300), one(0177700), "!s#w"}, /* movm mem to reg. */ -{"movml", one(0046330), one(0177770), "+s#w"}, /* movm autoinc to reg. */ -{"movml", one(0044300), one(0177700), "Lw&s"}, /* movm reg to mem. */ -{"movml", one(0044340), one(0177770), "lw-s"}, /* movm reg to autodecrement. */ -{"movml", one(0046300), one(0177700), "!sLw"}, /* movm mem to reg. */ -{"movml", one(0046330), one(0177770), "+sLw"}, /* movm autoinc to reg. */ -{"movmw", one(0044200), one(0177700), "#w&s"}, /* movm reg to mem. */ -{"movmw", one(0044240), one(0177770), "#w-s"}, /* movm reg to autodecrement. */ -{"movmw", one(0046200), one(0177700), "!s#w"}, /* movm mem to reg. */ -{"movmw", one(0046230), one(0177770), "+s#w"}, /* movm autoinc to reg. */ -{"movmw", one(0044200), one(0177700), "Lw&s"}, /* movm reg to mem. */ -{"movmw", one(0044240), one(0177770), "lw-s"}, /* movm reg to autodecrement. */ -{"movmw", one(0046200), one(0177700), "!sLw"}, /* movm mem to reg. */ -{"movmw", one(0046230), one(0177770), "+sLw"}, /* movm autoinc to reg. */ -{"movpl", one(0000510), one(0170770), "dsDd"}, /* memory to register */ -{"movpl", one(0000710), one(0170770), "Ddds"}, /* register to memory */ -{"movpw", one(0000410), one(0170770), "dsDd"}, /* memory to register */ -{"movpw", one(0000610), one(0170770), "Ddds"}, /* register to memory */ -{"movq", one(0070000), one(0170400), "MsDd"}, -{"movw", one(0030000), one(0170000), "*w$d"}, -{"movw", one(0030100), one(0170700), "*wAd"}, /* mova, written as mov */ -{"movw", one(0040300), one(0177700), "Ss$s"}, /* Move from sr */ -{"movw", one(0041300), one(0177700), "Cs$s"}, /* Move from ccr */ -{"movw", one(0042300), one(0177700), ";wCd"}, /* mov to ccr */ -{"movw", one(0043300), one(0177700), ";wSd"}, /* mov to sr */ - -{"movsb", two(0007000, 0), two(0177700, 07777), "~sR1"}, -{"movsb", two(0007000, 04000), two(0177700, 07777), "R1~s"}, -{"movsl", two(0007200, 0), two(0177700, 07777), "~sR1"}, -{"movsl", two(0007200, 04000), two(0177700, 07777), "R1~s"}, -{"movsw", two(0007100, 0), two(0177700, 07777), "~sR1"}, -{"movsw", two(0007100, 04000), two(0177700, 07777), "R1~s"}, - -#ifdef m68851 - /* name */ /* opcode */ /* match */ /* args */ - -{"pbac", one(0xf0c7), one(0xffbf), "Bc"}, -{"pbacw", one(0xf087), one(0xffbf), "Bc"}, -{"pbas", one(0xf0c6), one(0xffbf), "Bc"}, -{"pbasw", one(0xf086), one(0xffbf), "Bc"}, -{"pbbc", one(0xf0c1), one(0xffbf), "Bc"}, -{"pbbcw", one(0xf081), one(0xffbf), "Bc"}, -{"pbbs", one(0xf0c0), one(0xffbf), "Bc"}, -{"pbbsw", one(0xf080), one(0xffbf), "Bc"}, -{"pbcc", one(0xf0cf), one(0xffbf), "Bc"}, -{"pbccw", one(0xf08f), one(0xffbf), "Bc"}, -{"pbcs", one(0xf0ce), one(0xffbf), "Bc"}, -{"pbcsw", one(0xf08e), one(0xffbf), "Bc"}, -{"pbgc", one(0xf0cd), one(0xffbf), "Bc"}, -{"pbgcw", one(0xf08d), one(0xffbf), "Bc"}, -{"pbgs", one(0xf0cc), one(0xffbf), "Bc"}, -{"pbgsw", one(0xf08c), one(0xffbf), "Bc"}, -{"pbic", one(0xf0cb), one(0xffbf), "Bc"}, -{"pbicw", one(0xf08b), one(0xffbf), "Bc"}, -{"pbis", one(0xf0ca), one(0xffbf), "Bc"}, -{"pbisw", one(0xf08a), one(0xffbf), "Bc"}, -{"pblc", one(0xf0c3), one(0xffbf), "Bc"}, -{"pblcw", one(0xf083), one(0xffbf), "Bc"}, -{"pbls", one(0xf0c2), one(0xffbf), "Bc"}, -{"pblsw", one(0xf082), one(0xffbf), "Bc"}, -{"pbsc", one(0xf0c5), one(0xffbf), "Bc"}, -{"pbscw", one(0xf085), one(0xffbf), "Bc"}, -{"pbss", one(0xf0c4), one(0xffbf), "Bc"}, -{"pbssw", one(0xf084), one(0xffbf), "Bc"}, -{"pbwc", one(0xf0c9), one(0xffbf), "Bc"}, -{"pbwcw", one(0xf089), one(0xffbf), "Bc"}, -{"pbws", one(0xf0c8), one(0xffbf), "Bc"}, -{"pbwsw", one(0xf088), one(0xffbf), "Bc"}, - - -{"pdbac", two(0xf048, 0x0007), two(0xfff8, 0xffff), "DsBw"}, -{"pdbas", two(0xf048, 0x0006), two(0xfff8, 0xffff), "DsBw"}, -{"pdbbc", two(0xf048, 0x0001), two(0xfff8, 0xffff), "DsBw"}, -{"pdbbs", two(0xf048, 0x0000), two(0xfff8, 0xffff), "DsBw"}, -{"pdbcc", two(0xf048, 0x000f), two(0xfff8, 0xffff), "DsBw"}, -{"pdbcs", two(0xf048, 0x000e), two(0xfff8, 0xffff), "DsBw"}, -{"pdbgc", two(0xf048, 0x000d), two(0xfff8, 0xffff), "DsBw"}, -{"pdbgs", two(0xf048, 0x000c), two(0xfff8, 0xffff), "DsBw"}, -{"pdbic", two(0xf048, 0x000b), two(0xfff8, 0xffff), "DsBw"}, -{"pdbis", two(0xf048, 0x000a), two(0xfff8, 0xffff), "DsBw"}, -{"pdblc", two(0xf048, 0x0003), two(0xfff8, 0xffff), "DsBw"}, -{"pdbls", two(0xf048, 0x0002), two(0xfff8, 0xffff), "DsBw"}, -{"pdbsc", two(0xf048, 0x0005), two(0xfff8, 0xffff), "DsBw"}, -{"pdbss", two(0xf048, 0x0004), two(0xfff8, 0xffff), "DsBw"}, -{"pdbwc", two(0xf048, 0x0009), two(0xfff8, 0xffff), "DsBw"}, -{"pdbws", two(0xf048, 0x0008), two(0xfff8, 0xffff), "DsBw"}, - -{"pflusha", two(0xf000, 0x2400), two(0xffff, 0xffff), "" }, - -{"pflush", two(0xf000, 0x3010), two(0xffc0, 0xfe10), "T3T9" }, -{"pflush", two(0xf000, 0x3810), two(0xffc0, 0xfe10), "T3T9&s" }, -{"pflush", two(0xf000, 0x3008), two(0xffc0, 0xfe18), "D3T9" }, -{"pflush", two(0xf000, 0x3808), two(0xffc0, 0xfe18), "D3T9&s" }, -{"pflush", two(0xf000, 0x3000), two(0xffc0, 0xfe1e), "f3T9" }, -{"pflush", two(0xf000, 0x3800), two(0xffc0, 0xfe1e), "f3T9&s" }, - -{"pflushs", two(0xf000, 0x3410), two(0xfff8, 0xfe10), "T3T9" }, -{"pflushs", two(0xf000, 0x3c00), two(0xfff8, 0xfe00), "T3T9&s" }, -{"pflushs", two(0xf000, 0x3408), two(0xfff8, 0xfe18), "D3T9" }, -{"pflushs", two(0xf000, 0x3c08), two(0xfff8, 0xfe18), "D3T9&s" }, -{"pflushs", two(0xf000, 0x3400), two(0xfff8, 0xfe1e), "f3T9" }, -{"pflushs", two(0xf000, 0x3c00), two(0xfff8, 0xfe1e), "f3T9&s"}, - -{"pflushr", two(0xf000, 0xa000), two(0xffc0, 0xffff), "|s" }, - -{"ploadr", two(0xf000, 0x2210), two(0xffc0, 0xfff0), "T3&s" }, -{"ploadr", two(0xf000, 0x2208), two(0xffc0, 0xfff8), "D3&s" }, -{"ploadr", two(0xf000, 0x2200), two(0xffc0, 0xfffe), "f3&s" }, -{"ploadw", two(0xf000, 0x2010), two(0xffc0, 0xfff0), "T3&s" }, -{"ploadw", two(0xf000, 0x2008), two(0xffc0, 0xfff8), "D3&s" }, -{"ploadw", two(0xf000, 0x2000), two(0xffc0, 0xfffe), "f3&s" }, - -/* TC, CRP, DRP, SRP, CAL, VAL, SCC, AC */ -{"pmove", two(0xf000, 0x4000), two(0xffc0, 0xe3ff), "*sP8" }, -{"pmove", two(0xf000, 0x4200), two(0xffc0, 0xe3ff), "P8%s" }, -{"pmove", two(0xf000, 0x4000), two(0xffc0, 0xe3ff), "|sW8" }, -{"pmove", two(0xf000, 0x4200), two(0xffc0, 0xe3ff), "W8~s" }, - -/* BADx, BACx */ -{"pmove", two(0xf000, 0x6200), two(0xffc0, 0xe3e3), "*sX3" }, -{"pmove", two(0xf000, 0x6000), two(0xffc0, 0xe3e3), "X3%s" }, - -/* PSR, PCSR */ -/* {"pmove", two(0xf000, 0x6100), two(oxffc0, oxffff), "*sZ8" }, */ -{"pmove", two(0xf000, 0x6000), two(0xffc0, 0xffff), "*sY8" }, -{"pmove", two(0xf000, 0x6200), two(0xffc0, 0xffff), "Y8%s" }, -{"pmove", two(0xf000, 0x6600), two(0xffc0, 0xffff), "Z8%s" }, - -{"prestore", one(0xf140), one(0xffc0), "&s"}, -{"prestore", one(0xf158), one(0xfff8), "+s"}, -{"psave", one(0xf100), one(0xffc0), "&s"}, -{"psave", one(0xf100), one(0xffc0), "+s"}, - -{"psac", two(0xf040, 0x0007), two(0xffc0, 0xffff), "@s"}, -{"psas", two(0xf040, 0x0006), two(0xffc0, 0xffff), "@s"}, -{"psbc", two(0xf040, 0x0001), two(0xffc0, 0xffff), "@s"}, -{"psbs", two(0xf040, 0x0000), two(0xffc0, 0xffff), "@s"}, -{"pscc", two(0xf040, 0x000f), two(0xffc0, 0xffff), "@s"}, -{"pscs", two(0xf040, 0x000e), two(0xffc0, 0xffff), "@s"}, -{"psgc", two(0xf040, 0x000d), two(0xffc0, 0xffff), "@s"}, -{"psgs", two(0xf040, 0x000c), two(0xffc0, 0xffff), "@s"}, -{"psic", two(0xf040, 0x000b), two(0xffc0, 0xffff), "@s"}, -{"psis", two(0xf040, 0x000a), two(0xffc0, 0xffff), "@s"}, -{"pslc", two(0xf040, 0x0003), two(0xffc0, 0xffff), "@s"}, -{"psls", two(0xf040, 0x0002), two(0xffc0, 0xffff), "@s"}, -{"pssc", two(0xf040, 0x0005), two(0xffc0, 0xffff), "@s"}, -{"psss", two(0xf040, 0x0004), two(0xffc0, 0xffff), "@s"}, -{"pswc", two(0xf040, 0x0009), two(0xffc0, 0xffff), "@s"}, -{"psws", two(0xf040, 0x0008), two(0xffc0, 0xffff), "@s"}, - -{"ptestr", two(0xf000, 0x8210), two(0xffc0, 0xe3f0), "T3&sQ8" }, -{"ptestr", two(0xf000, 0x8310), two(0xffc0, 0xe310), "T3&sQ8A9" }, -{"ptestr", two(0xf000, 0x8208), two(0xffc0, 0xe3f8), "D3&sQ8" }, -{"ptestr", two(0xf000, 0x8308), two(0xffc0, 0xe318), "D3&sQ8A9" }, -{"ptestr", two(0xf000, 0x8200), two(0xffc0, 0xe3fe), "f3&sQ8" }, -{"ptestr", two(0xf000, 0x8300), two(0xffc0, 0xe31e), "f3&sQ8A9" }, - -{"ptestw", two(0xf000, 0x8010), two(0xffc0, 0xe3f0), "T3&sQ8" }, -{"ptestw", two(0xf000, 0x8110), two(0xffc0, 0xe310), "T3&sQ8A9" }, -{"ptestw", two(0xf000, 0x8008), two(0xffc0, 0xe3f8), "D3&sQ8" }, -{"ptestw", two(0xf000, 0x8108), two(0xffc0, 0xe318), "D3&sQ8A9" }, -{"ptestw", two(0xf000, 0x8000), two(0xffc0, 0xe3fe), "f3&sQ8" }, -{"ptestw", two(0xf000, 0x8100), two(0xffc0, 0xe31e), "f3&sQ8A9" }, - -{"ptrapacw", two(0xf07a, 0x0007), two(0xffff, 0xffff), "#w"}, -{"ptrapacl", two(0xf07b, 0x0007), two(0xffff, 0xffff), "#l"}, -{"ptrapac", two(0xf07c, 0x0007), two(0xffff, 0xffff), ""}, - -{"ptrapasw", two(0xf07a, 0x0006), two(0xffff, 0xffff), "#w"}, -{"ptrapasl", two(0xf07b, 0x0006), two(0xffff, 0xffff), "#l"}, -{"ptrapas", two(0xf07c, 0x0006), two(0xffff, 0xffff), ""}, - -{"ptrapbcw", two(0xf07a, 0x0001), two(0xffff, 0xffff), "#w"}, -{"ptrapbcl", two(0xf07b, 0x0001), two(0xffff, 0xffff), "#l"}, -{"ptrapbc", two(0xf07c, 0x0001), two(0xffff, 0xffff), ""}, - -{"ptrapbsw", two(0xf07a, 0x0000), two(0xffff, 0xffff), "#w"}, -{"ptrapbsl", two(0xf07b, 0x0000), two(0xffff, 0xffff), "#l"}, -{"ptrapbs", two(0xf07c, 0x0000), two(0xffff, 0xffff), ""}, - -{"ptrapccw", two(0xf07a, 0x000f), two(0xffff, 0xffff), "#w"}, -{"ptrapccl", two(0xf07b, 0x000f), two(0xffff, 0xffff), "#l"}, -{"ptrapcc", two(0xf07c, 0x000f), two(0xffff, 0xffff), ""}, - -{"ptrapcsw", two(0xf07a, 0x000e), two(0xffff, 0xffff), "#w"}, -{"ptrapcsl", two(0xf07b, 0x000e), two(0xffff, 0xffff), "#l"}, -{"ptrapcs", two(0xf07c, 0x000e), two(0xffff, 0xffff), ""}, - -{"ptrapgcw", two(0xf07a, 0x000d), two(0xffff, 0xffff), "#w"}, -{"ptrapgcl", two(0xf07b, 0x000d), two(0xffff, 0xffff), "#l"}, -{"ptrapgc", two(0xf07c, 0x000d), two(0xffff, 0xffff), ""}, - -{"ptrapgsw", two(0xf07a, 0x000c), two(0xffff, 0xffff), "#w"}, -{"ptrapgsl", two(0xf07b, 0x000c), two(0xffff, 0xffff), "#l"}, -{"ptrapgs", two(0xf07c, 0x000c), two(0xffff, 0xffff), ""}, - -{"ptrapicw", two(0xf07a, 0x000b), two(0xffff, 0xffff), "#w"}, -{"ptrapicl", two(0xf07b, 0x000b), two(0xffff, 0xffff), "#l"}, -{"ptrapic", two(0xf07c, 0x000b), two(0xffff, 0xffff), ""}, - -{"ptrapisw", two(0xf07a, 0x000a), two(0xffff, 0xffff), "#w"}, -{"ptrapisl", two(0xf07b, 0x000a), two(0xffff, 0xffff), "#l"}, -{"ptrapis", two(0xf07c, 0x000a), two(0xffff, 0xffff), ""}, - -{"ptraplcw", two(0xf07a, 0x0003), two(0xffff, 0xffff), "#w"}, -{"ptraplcl", two(0xf07b, 0x0003), two(0xffff, 0xffff), "#l"}, -{"ptraplc", two(0xf07c, 0x0003), two(0xffff, 0xffff), ""}, - -{"ptraplsw", two(0xf07a, 0x0002), two(0xffff, 0xffff), "#w"}, -{"ptraplsl", two(0xf07b, 0x0002), two(0xffff, 0xffff), "#l"}, -{"ptrapls", two(0xf07c, 0x0002), two(0xffff, 0xffff), ""}, - -{"ptrapscw", two(0xf07a, 0x0005), two(0xffff, 0xffff), "#w"}, -{"ptrapscl", two(0xf07b, 0x0005), two(0xffff, 0xffff), "#l"}, -{"ptrapsc", two(0xf07c, 0x0005), two(0xffff, 0xffff), ""}, - -{"ptrapssw", two(0xf07a, 0x0004), two(0xffff, 0xffff), "#w"}, -{"ptrapssl", two(0xf07b, 0x0004), two(0xffff, 0xffff), "#l"}, -{"ptrapss", two(0xf07c, 0x0004), two(0xffff, 0xffff), ""}, - -{"ptrapwcw", two(0xf07a, 0x0009), two(0xffff, 0xffff), "#w"}, -{"ptrapwcl", two(0xf07b, 0x0009), two(0xffff, 0xffff), "#l"}, -{"ptrapwc", two(0xf07c, 0x0009), two(0xffff, 0xffff), ""}, - -{"ptrapwsw", two(0xf07a, 0x0008), two(0xffff, 0xffff), "#w"}, -{"ptrapwsl", two(0xf07b, 0x0008), two(0xffff, 0xffff), "#l"}, -{"ptrapws", two(0xf07c, 0x0008), two(0xffff, 0xffff), ""}, - -{"pvalid", two(0xf000, 0x2800), two(0xffc0, 0xffff), "Vs&s"}, -{"pvalid", two(0xf000, 0x2c00), two(0xffc0, 0xfff8), "A3&s" }, - -#endif /* m68851 */ - -}; - -int numopcodes=sizeof(m68k_opcodes)/sizeof(m68k_opcodes[0]); - -struct m68k_opcode *endop = m68k_opcodes+sizeof(m68k_opcodes)/sizeof(m68k_opcodes[0]); diff --git a/gdb/m88k-opcode.h b/gdb/m88k-opcode.h index c5e643a..e69de29 100755 --- a/gdb/m88k-opcode.h +++ b/gdb/m88k-opcode.h @@ -1,585 +0,0 @@ -/* This file has been modified by Data General Corporation, November 1989. */ - - -/* -* Disassembler Instruction Table -* -* The first field of the table is the opcode field. If an opcode -* is specified which has any non-opcode bits on, a system error -* will occur when the system attempts the install it into the -* instruction table. The second parameter is a pointer to the -* instruction mnemonic. Each operand is specified by offset, width, -* and type. The offset is the bit number of the least significant -* bit of the operand with bit 0 being the least significant bit of -* the instruction. The width is the number of bits used to specify -* the operand. The type specifies the output format to be used for -* the operand. The valid formats are: register, register indirect, -* hex constant, and bit field specification. The last field is a -* pointer to the next instruction in the linked list. These pointers -* are initialized by init_disasm(). -* -* Structure Format -* -* struct INSTAB { -* UPINT opcode; -* char *mnemonic; -* struct OPSPEC op1,op2,op3; -* struct SIM_FLAGS flgs; -* struct INSTAB *next; -* } -* -* struct OPSPEC { -* UPINT offset:5; -* UPINT width:6; -* UPINT type:5; -* } -* -* Revision History -* -* Revision 1.0 11/08/85 Creation date -* 1.1 02/05/86 Updated instruction mnemonic table MD -* 1.2 06/16/86 Updated SIM_FLAGS for floating point -* 1.3 09/20/86 Updated for new encoding -* 05/11/89 R. Trawick adapted from Motorola disassembler -*/ - -#include - - -/* - * This file contains the structures and constants needed to build the M88000 - * simulator. It is the main include file, containing all the - * structures, macros and definitions except for the floating point - * instruction set. - */ - -/* - * The following flag informs the Simulator as to what type of byte ordering - * will be used. For instance, a BOFLAG = 1 indicates a DEC VAX and IBM type - * of ordering shall be used. -*/ - -/* # define BOFLAG 1 /* BYTE ORDERING FLAG */ - -/* define the number of bits in the primary opcode field of the instruction, - * the destination field, the source 1 and source 2 fields. - */ -# define OP 8 /* size of opcode field */ -# define DEST 6 /* size of destination */ -# define SOURCE1 6 /* size of source1 */ -# define SOURCE2 6 /* size of source2 */ - -# define REGs 32 /* number of registers */ - -# define WORD long -# define FLAG unsigned -# define STATE short - -# define TRUE 1 -# define FALSE 0 - -# define READ 0 -# define WRITE 1 - -/* The next four equates define the priorities that the various classes - * of instructions have regarding writing results back into registers and - * signalling exceptions. - */ - -# define PINT 0 /* Integer Priority */ -# define PFLT 1 /* Floating Point Priority */ -# define PMEM 2 /* Memory Priority */ -# define NA 3 /* Not Applicable, instruction doesnt write to regs */ -# define HIPRI 3 /* highest of these priorities */ - -/* The instruction registers are an artificial mechanism to speed up - * simulator execution. In the real processor, an instruction register - * is 32 bits wide. In the simulator, the 32 bit instruction is kept in - * a structure field called rawop, and the instruction is partially decoded, - * and split into various fields and flags which make up the other fields - * of the structure. - * The partial decode is done when the instructions are initially loaded - * into simulator memory. The simulator code memory is not an array of - * 32 bit words, but is an array of instruction register structures. - * Yes this wastes memory, but it executes much quicker. - */ - -struct IR_FIELDS { - unsigned long op:OP, - dest: DEST, - src1: SOURCE1, - src2: SOURCE2; - int ltncy, - extime, - wb_pri; /* writeback priority */ - unsigned short imm_flags:2,/* immediate size */ - rs1_used:1, /* register source 1 used */ - rs2_used:1, /* register source 2 used */ - rsd_used:1, /* register source/dest. used */ - c_flag:1, /* complement */ - u_flag:1, /* upper half word */ - n_flag:1, /* execute next */ - wb_flag:1, /* uses writeback slot */ - dest_64:1, /* dest size */ - s1_64:1, /* source 1 size */ - s2_64:1, /* source 2 size */ - scale_flag:1, /* scaled register */ - brk_flg:1; - }; - -struct mem_segs { - struct mem_wrd *seg; /* pointer (returned by calloc) to segment */ - unsigned long baseaddr; /* base load address from file headers */ - unsigned long endaddr; /* Ending address of segment */ - int flags; /* segment control flags (none defined 12/5/86) */ -}; - -#define MAXSEGS (10) /* max number of segment allowed */ -#define MEMSEGSIZE (sizeof(struct mem_segs))/* size of mem_segs structure */ - - -#define BRK_RD (0x01) /* break on memory read */ -#define BRK_WR (0x02) /* break on memory write */ -#define BRK_EXEC (0x04) /* break on execution */ -#define BRK_CNT (0x08) /* break on terminal count */ - - -struct mem_wrd { - struct IR_FIELDS opcode; /* simulator instruction break down */ - union { - unsigned long l; /* memory element break down */ - unsigned short s[2]; - unsigned char c[4]; - } mem; -}; - -#define MEMWRDSIZE (sizeof(struct mem_wrd)) /* size of each 32 bit memory model */ - -/* External declarations */ - -extern struct mem_segs memory[]; -extern struct PROCESSOR m78000; - -struct PROCESSOR { - unsigned WORD - ip, /* execute instruction pointer */ - vbr, /* vector base register */ - psr; /* processor status register */ - - WORD S1bus, /* source 1 */ - S2bus, /* source 2 */ - Dbus, /* destination */ - DAbus, /* data address bus */ - ALU, - Regs[REGs], /* data registers */ - time_left[REGs], /* max clocks before reg is available */ - wb_pri[REGs], /* writeback priority of reg */ - SFU0_regs[REGs], /* integer unit control regs */ - SFU1_regs[REGs], /* floating point control regs */ - Scoreboard[REGs], - Vbr; - unsigned WORD scoreboard, - Psw, - Tpsw; - FLAG jump_pending:1; /* waiting for a jump instr. */ - }; - -# define i26bit 1 /* size of immediate field */ -# define i16bit 2 -# define i10bit 3 - -/* Definitions for fields in psr */ - -# define mode 31 -# define rbo 30 -# define ser 29 -# define carry 28 -# define sf7m 11 -# define sf6m 10 -# define sf5m 9 -# define sf4m 8 -# define sf3m 7 -# define sf2m 6 -# define sf1m 5 -# define mam 4 -# define inm 3 -# define exm 2 -# define trm 1 -# define ovfm 0 - -#define MODEMASK (1<<(mode-1)) -# define SILENT 0 /* simulate without output to crt */ -# define VERBOSE 1 /* simulate in verbose mode */ -# define PR_INSTR 2 /* only print instructions */ - -# define RESET 16 /* reset phase */ - -# define PHASE1 0 /* data path phases */ -# define PHASE2 1 - -/* the 1 clock operations */ - -# define ADDU 1 -# define ADDC 2 -# define ADDUC 3 -# define ADD 4 - -# define SUBU ADD+1 -# define SUBB ADD+2 -# define SUBUB ADD+3 -# define SUB ADD+4 - -# define AND ADD+5 -# define OR ADD+6 -# define XOR ADD+7 -# define CMP ADD+8 - -/* the LOADS */ - -# define LDAB CMP+1 -# define LDAH CMP+2 -# define LDA CMP+3 -# define LDAD CMP+4 - -# define LDB LDAD+1 -# define LDH LDAD+2 -# define LD LDAD+3 -# define LDD LDAD+4 -# define LDBU LDAD+5 -# define LDHU LDAD+6 - -/* the STORES */ - -# define STB LDHU+1 -# define STH LDHU+2 -# define ST LDHU+3 -# define STD LDHU+4 - -/* the exchange */ - -# define XMEMBU LDHU+5 -# define XMEM LDHU+6 - -/* the branches */ -# define JSR STD+1 -# define BSR STD+2 -# define BR STD+3 -# define JMP STD+4 -# define BB1 STD+5 -# define BB0 STD+6 -# define RTN STD+7 -# define BCND STD+8 - -/* the TRAPS */ -# define TB1 BCND+1 -# define TB0 BCND+2 -# define TCND BCND+3 -# define RTE BCND+4 -# define TBND BCND+5 - -/* the MISC instructions */ -# define MUL TBND + 1 -# define DIV MUL +2 -# define DIVU MUL +3 -# define MASK MUL +4 -# define FF0 MUL +5 -# define FF1 MUL +6 -# define CLR MUL +7 -# define SET MUL +8 -# define EXT MUL +9 -# define EXTU MUL +10 -# define MAK MUL +11 -# define ROT MUL +12 - -/* control register manipulations */ - -# define LDCR ROT +1 -# define STCR ROT +2 -# define XCR ROT +3 - -# define FLDCR ROT +4 -# define FSTCR ROT +5 -# define FXCR ROT +6 - - -# define NOP XCR +1 - -/* floating point instructions */ - -# define FADD NOP +1 -# define FSUB NOP +2 -# define FMUL NOP +3 -# define FDIV NOP +4 -# define FSQRT NOP +5 -# define FCMP NOP +6 -# define FIP NOP +7 -# define FLT NOP +8 -# define INT NOP +9 -# define NINT NOP +10 -# define TRNC NOP +11 -# define FLDC NOP +12 -# define FSTC NOP +13 -# define FXC NOP +14 - -# define UEXT(src,off,wid) ((((unsigned int)(src))>>(off)) & ((1<<(wid)) - 1)) -# define SEXT(src,off,wid) (((((int)(src))<<(32-((off)+(wid)))) >>(32-(wid))) ) -# define MAKE(src,off,wid) \ - ((((unsigned int)(src)) & ((1<<(wid)) - 1)) << (off)) - -# define opword(n) (unsigned long) (memaddr->mem.l) - -/* Constants and Masks */ - -#define SFU0 0x80000000 -#define SFU1 0x84000000 -#define SFU7 0x9c000000 -#define RRI10 0xf0000000 -#define RRR 0xf4000000 -#define SFUMASK 0xfc00ffe0 -#define RRRMASK 0xfc00ffe0 -#define RRI10MASK 0xfc00fc00 -#define DEFMASK 0xfc000000 -#define CTRL 0x0000f000 -#define CTRLMASK 0xfc00f800 - -/* Operands types */ - -#define HEX 1 -#define REG 2 -#define IND 3 -#define CONT 3 -#define IND 3 -#define BF 4 -#define REGSC 5 /* scaled register */ -#define CRREG 6 /* control register */ -#define FCRREG 7 /* floating point control register */ -#define PCREL 8 -#define CONDMASK 9 - -/* Hashing Specification */ - -#define HASHVAL 79 - -/* Type definitions */ - -typedef unsigned int UINT; - -/* Structure templates */ - -typedef struct { - unsigned int offset:5; - unsigned int width:6; - unsigned int type:5; -} OPSPEC; - - struct SIM_FLAGS { - int ltncy, /* latency (max number of clocks needed to execute) */ - extime, /* execution time (min number of clocks needed to execute) */ - wb_pri; /* writeback slot priority */ - unsigned long op:OP, /* simulator version of opcode */ - imm_flags:2, /* 10,16 or 26 bit immediate flags */ - rs1_used:1, /* register source 1 used */ - rs2_used:1, /* register source 2 used */ - rsd_used:1, /* register source/dest used */ - c_flag:1, /* complement */ - u_flag:1, /* upper half word */ - n_flag:1, /* execute next */ - wb_flag:1, /* uses writeback slot */ - dest_64:1, /* double precision dest */ - s1_64:1, /* double precision source 1 */ - s2_64:1, /* double precision source 2 */ - scale_flag:1; /* register is scaled */ -}; - -typedef struct INSTRUCTAB { - unsigned int opcode; - char *mnemonic; - OPSPEC op1,op2,op3; - struct SIM_FLAGS flgs; - struct INSTRUCTAB *next; -} INSTAB; - - -/* Opcode Mnemonic Op 1 Spec Op 2 Spec Op 3 Spec Simflags Next */ - -static INSTAB instructions[] = -{0xf400c800,"jsr ",{0,5,REG} ,{0,0,0} ,{0,0,0} , {2,2,NA,JSR , 0,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xf400cc00,"jsr.n ",{0,5,REG} ,{0,0,0} ,{0,0,0} , {1,1,NA,JSR , 0,0,1,0,0,0,1,1,0,0,0,0}, NULL, - 0xf400c000,"jmp ",{0,5,REG} ,{0,0,0} ,{0,0,0} , {2,2,NA,JMP , 0,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xf400c400,"jmp.n ",{0,5,REG} ,{0,0,0} ,{0,0,0} , {1,1,NA,JMP , 0,0,1,0,0,0,1,1,0,0,0,0}, NULL, - 0xc8000000,"bsr ",{0,26,PCREL},{0,0,0} ,{0,0,0} , {2,2,NA,BSR , i26bit,0,0,0,0,0,0,1,0,0,0,0}, NULL, - 0xcc000000,"bsr.n ",{0,26,PCREL},{0,0,0} ,{0,0,0} , {1,1,NA,BSR , i26bit,0,0,0,0,0,1,1,0,0,0,0}, NULL, - 0xc0000000,"br ",{0,26,PCREL},{0,0,0} ,{0,0,0} , {2,2,NA,BR , i26bit,0,0,0,0,0,0,1,0,0,0,0}, NULL, - 0xc4000000,"br.n ",{0,26,PCREL},{0,0,0} ,{0,0,0} , {1,1,NA,BR , i26bit,0,0,0,0,0,1,1,0,0,0,0}, NULL, - 0xd0000000,"bb0 ",{21,5,HEX} ,{16,5,REG} ,{0,16,PCREL},{2,2,NA,BB0, i16bit,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xd4000000,"bb0.n ",{21,5,HEX} ,{16,5,REG} ,{0,16,PCREL},{1,1,NA,BB0, i16bit,0,1,0,0,0,1,1,0,0,0,0}, NULL, - 0xd8000000,"bb1 ",{21,5,HEX},{16,5,REG} ,{0,16,PCREL},{2,2,NA,BB1, i16bit,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xdc000000,"bb1.n ",{21,5,HEX},{16,5,REG} ,{0,16,PCREL},{1,1,NA,BB1, i16bit,0,1,0,0,0,1,1,0,0,0,0}, NULL, - 0xf000d000,"tb0 ",{21,5,HEX} ,{16,5,REG} ,{0,10,HEX}, {2,2,NA,TB0 , i10bit,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xf000d800,"tb1 ",{21,5,HEX} ,{16,5,REG} ,{0,10,HEX}, {2,2,NA,TB1 , i10bit,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xe8000000,"bcnd ",{21,5,CONDMASK},{16,5,REG},{0,16,PCREL},{2,2,NA,BCND, i16bit,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xec000000,"bcnd.n ",{21,5,CONDMASK},{16,5,REG},{0,16,PCREL},{1,1,NA,BCND, i16bit,0,1,0,0,0,1,1,0,0,0,0}, NULL, - 0xf000e800,"tcnd ",{21,5,CONDMASK},{16,5,REG},{0,10,HEX}, {2,2,NA,TCND, i10bit,0,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xf8000000,"tbnd ",{16,5,REG} ,{0,16,HEX} ,{0,0,0} , {2,2,NA,TBND, i10bit,1,0,0,0,0,0,1,0,0,0,0}, NULL, - 0xf400f800,"tbnd ",{16,5,REG} ,{0,5,REG} ,{0,0,0} , {2,2,NA,TBND, 0,1,1,0,0,0,0,1,0,0,0,0}, NULL, - 0xf400fc00,"rte ",{0,0,0} ,{0,0,0} ,{0,0,0} , {2,2,NA,RTE , 0,0,0,0,0,0,0,1,0,0,0,0}, NULL, - 0x1c000000,"ld.b ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDB ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001c00,"ld.b ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDB , 0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0x0c000000,"ld.bu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDBU, i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4000c00,"ld.bu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDBU ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0x18000000,"ld.h ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDH ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001800,"ld.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDH ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001a00,"ld.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LDH ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL, - 0x08000000,"ld.hu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDHU, i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4000800,"ld.hu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDHU ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4000a00,"ld.hu ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LDHU ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL, - 0x14000000,"ld ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LD ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001400,"ld ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001600,"ld ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL, - 0x10000000,"ld.d ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,LDD ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001000,"ld.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LDD ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001200,"ld.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LDD ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL, - 0xf4001500,"ld.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4001700,"ld.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,LD ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL, - 0x2c000000,"st.b ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,STB ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4002c00,"st.b ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,STB ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0x28000000,"st.h ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,STH ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4002800,"st.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,STH ,0,1,1,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4002a00,"st.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,STH ,0,1,1,1,0,0,0,1,0,0,0,1}, NULL, - 0x24000000,"st ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,ST ,i16bit,1,0,1,0,0,0,1,0,0,0,0}, NULL, - 0xf4002400,"st ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0xf4002600,"st ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL, - 0x20000000,"st.d ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,NA,STD ,i16bit,0,1,0,0,0,0,1,0,0,0,0} ,NULL, - 0xf4002000,"st.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,STD ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0xf4002200,"st.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,STD ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL, - 0xf4002500,"st.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0xf4002700,"st.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,NA,ST ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL, - 0x00000000,"xmem.bu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,XMEMBU ,i16bit,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0xf4000000,"xmem.bu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x04000000,"xmem ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {3,1,PMEM,XMEM ,i16bit,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0xf4000400,"xmem ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0xf4000600,"xmem ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL, - 0xf4000500,"xmem.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0xf4000700,"xmem.usr ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{3,1,PMEM,XMEM ,0,1,1,1,0,0,0,1,0,0,0,1} ,NULL, - 0xf4003e00,"lda.b ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDAH, 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL, - 0xf4003a00,"lda.h ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDAH, 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL, - 0xf4003600,"lda ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDA , 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL, - 0xf4003200,"lda.d ",{21,5,REG} ,{16,5,REG} ,{0,5,REGSC},{1,1,PINT,LDAD, 0,1,1,1,0,0,0,0,0,0,0,1} ,NULL, - - 0x80004000,"ldcr ",{21,5,REG} ,{5,6,CRREG} ,{0,0,0} ,{1,1,PINT,LDCR, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0x80008000,"stcr ",{16,5,REG} ,{5,6,CRREG} ,{0,0,0} ,{1,1,PINT,STCR, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0x8000c000,"xcr ",{21,5,REG} ,{16,5,REG} ,{5,6,CRREG},{1,1,PINT,XCR, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - - 0xf4006000,"addu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006200,"addu.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006100,"addu.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006300,"addu.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADDU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006400,"subu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006600,"subu.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006500,"subu.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006700,"subu.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUBU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006900,"divu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {32,32,PINT,DIVU, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4006d00,"mul ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,4,PINT,MUL, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007000,"add ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007200,"add.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007100,"add.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007300,"add.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ADD , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007400,"sub ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007600,"sub.ci ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007500,"sub.co ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007700,"sub.cio ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SUB , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007900,"div ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {32,32,PINT,DIV , 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4007d00,"cmp ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,CMP, 0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - - 0x60000000,"addu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,ADDU, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x64000000,"subu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,SUBU, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - - 0x68000000,"divu ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {32,32,PINT,DIVU, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x6c000000,"mul ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {4,1,PINT,MUL, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x70000000,"add ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,ADD, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x74000000,"sub ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,SUB, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x78000000,"div ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {32,32,PINT,DIV, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x7c000000,"cmp ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,CMP, i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - - 0xf4004000,"and ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,AND ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4004400,"and.c ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,AND ,0,1,1,1,1,0,0,0,0,0,0,0} ,NULL, - 0xf4005800,"or ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,OR ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4005c00,"or.c ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,OR ,0,1,1,1,1,0,0,0,0,0,0,0} ,NULL, - 0xf4005000,"xor ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,XOR ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4005400,"xor.c ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,XOR ,0,1,1,1,1,0,0,0,0,0,0,0} ,NULL, - 0x40000000,"and ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,AND ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x44000000,"and.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,AND ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL, - 0x58000000,"or ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,OR ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x5c000000,"or.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,OR ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL, - 0x50000000,"xor ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,XOR ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x54000000,"xor.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,XOR ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL, - 0x48000000,"mask ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,MASK ,i16bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0x4c000000,"mask.u ",{21,5,REG} ,{16,5,REG} ,{0,16,HEX}, {1,1,PINT,MASK ,i16bit,1,0,1,0,1,0,0,0,0,0,0} ,NULL, - 0xf400ec00,"ff0 ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {1,1,PINT,FF0 ,0,0,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf400e800,"ff1 ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {1,1,PINT,FF1 ,0,0,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf0008000,"clr ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,CLR ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf0008800,"set ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,SET ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf0009000,"ext ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,EXT ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf0009800,"extu ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,EXTU ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf000a000,"mak ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,MAK ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf000a800,"rot ",{21,5,REG} ,{16,5,REG} ,{0,10,BF} , {1,1,PINT,ROT ,i10bit,1,0,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4008000,"clr ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,CLR ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4008800,"set ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,SET ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4009000,"ext ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,EXT ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf4009800,"extu ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,EXTU ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf400a000,"mak ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,MAK ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - 0xf400a800,"rot ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {1,1,PINT,ROT ,0,1,1,1,0,0,0,0,0,0,0,0} ,NULL, - - 0x84002800,"fadd.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {5,1,PFLT,FADD ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84002880,"fadd.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL, - 0x84002a00,"fadd.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL, - 0x84002a80,"fadd.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL, - 0x84002820,"fadd.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x840028a0,"fadd.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL, - 0x84002a20,"fadd.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL, - 0x84002aa0,"fadd.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FADD ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL, - 0x84003000,"fsub.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {5,1,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84003080,"fsub.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL, - 0x84003200,"fsub.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL, - 0x84003280,"fsub.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL, - 0x84003020,"fsub.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x840030a0,"fsub.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL, - 0x84003220,"fsub.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL, - 0x840032a0,"fsub.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,2,PFLT,FSUB ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL, - 0x84000000,"fmul.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84000080,"fmul.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL, - 0x84000200,"fmul.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL, - 0x84000280,"fmul.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL, - 0x84000020,"fmul.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x840000a0,"fmul.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL, - 0x84000220,"fmul.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL, - 0x840002a0,"fmul.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {9,2,PFLT,FMUL ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL, - 0x84007000,"fdiv.sss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {30,30,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84007080,"fdiv.ssd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,0,1,0} ,NULL, - 0x84007200,"fdiv.sds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL, - 0x84007280,"fdiv.sdd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,0,1,1,0} ,NULL, - 0x84007020,"fdiv.dss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x840070a0,"fdiv.dsd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,0,1,0} ,NULL, - 0x84007220,"fdiv.dds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL, - 0x840072a0,"fdiv.ddd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {60,60,PFLT,FDIV ,0,1,1,1,0,0,0,1,1,1,1,0} ,NULL, - 0x84007800,"fsqrt.ss ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84007880,"fsqrt.sd ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84007820,"fsqrt.ds ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x840078a0,"fsqrt.dd ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {6,1,PFLT,FLT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x84003800,"fcmp.ss ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {5,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84003880,"fcmp.sd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,0,1,0,0} ,NULL, - 0x84003a00,"fcmp.ds ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x84003a80,"fcmp.dd ",{21,5,REG} ,{16,5,REG} ,{0,5,REG} , {6,1,PFLT,FCMP ,0,1,1,1,0,0,0,1,1,1,0,0} ,NULL, - 0x84002000,"flt.s ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {5,1,PFLT,FLT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84002020,"flt.d ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {6,1,PFLT,FLT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x84004800,"int.s ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {5,1,PFLT,INT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84004880,"int.d ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {6,1,PFLT,INT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x84005000,"nint.s ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {5,1,PFLT,INT ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84005080,"nint.d ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {6,1,PFLT,INT ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL, - 0x84005800,"trnc.s ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {5,1,PFLT,TRNC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x84005880,"trnc.d ",{21,5,REG} ,{0,5,REG} ,{0,0,0} , {6,1,PFLT,TRNC ,0,0,1,1,0,0,0,1,1,0,0,0} ,NULL, - - 0x80004800,"fldcr ",{21,5,REG} ,{5,6,FCRREG} ,{0,0,0} , {1,1,PFLT,FLDC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x80008800,"fstcr ",{16,5,REG} ,{5,6,FCRREG} ,{0,0,0} , {1,1,PFLT,FSTC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL, - 0x8000c800,"fxcr ",{21,5,REG} ,{16,5,REG} ,{5,6,FCRREG} , {1,1,PFLT,FXC ,0,0,1,1,0,0,0,1,0,0,0,0} ,NULL}; - diff --git a/gdb/m88k-xdep.c b/gdb/m88k-xdep.c index 9c4d1c5..e69de29 100644 --- a/gdb/m88k-xdep.c +++ b/gdb/m88k-xdep.c @@ -1,342 +0,0 @@ -/* Host-dependent Motorola 88xxx support for GDB, the GNU Debugger. - Copyright 1988, 1990, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" - -#ifdef USG -#include -#endif - -#include -#include -#include -#include "gdbcore.h" -#include - -#ifndef USER /* added to support BCS ptrace_user */ -#define USER ptrace_user -#endif -#include -#include -#include -#include - -#include "symtab.h" -#include "setjmp.h" -#include "value.h" - -#ifdef DELTA88 -#include - -/* define offsets to the pc instruction offsets in ptrace_user struct */ -#define SXIP_OFFSET (char *)&u.pt_sigframe.sig_sxip - (char *)&u -#define SNIP_OFFSET (char *)&u.pt_sigframe.sig_snip - (char *)&u -#define SFIP_OFFSET (char *)&u.pt_sigframe.sig_sfip - (char *)&u -#else -/* define offsets to the pc instruction offsets in ptrace_user struct */ -#define SXIP_OFFSET (char *)&u.pt_sigframe.dg_sigframe.sc_sxip - (char *)&u -#define SNIP_OFFSET (char *)&u.pt_sigframe.dg_sigframe.sc_snip - (char *)&u -#define SFIP_OFFSET (char *)&u.pt_sigframe.dg_sigframe.sc_sfip - (char *)&u -#endif - -extern int have_symbol_file_p(); - -extern jmp_buf stack_jmp; - -extern int errno; -extern char registers[REGISTER_BYTES]; - -void -fetch_inferior_registers (regno) - int regno; /* Original value discarded */ -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - struct USER u; - unsigned int offset; - - offset = (char *) &u.pt_r0 - (char *) &u; - regaddr = offset; /* byte offset to r0;*/ - -/* offset = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ - for (regno = 0; regno < NUM_REGS; regno++) - { - /*regaddr = register_addr (regno, offset);*/ - /* 88k enhancement */ - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - /* now load up registers 36 - 38; special pc registers */ - *(int *) &buf[0] = ptrace (3,inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET ,0); - supply_register (SXIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET,0); - supply_register (SNIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET,0); - supply_register (SFIP_REGNUM, buf); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[80]; - - struct USER u; - - - unsigned int offset = (char *) &u.pt_r0 - (char *) &u; - - regaddr = offset; - - if (regno >= 0) - { -/* regaddr = register_addr (regno, offset); */ - if (regno < PC_REGNUM) - { - regaddr = offset + regno * sizeof (int); - errno = 0; - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else if (regno == SXIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno)); - else if (regno == SNIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno)); - else if (regno == SFIP_REGNUM) - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno)); - else printf ("Bad register number for store_inferior routine\n"); - } - else { - for (regno = 0; regno < NUM_REGS - 3; regno++) - { - /* regaddr = register_addr (regno, offset); */ - errno = 0; - regaddr = offset + regno * sizeof (int); - ptrace (6, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM)); - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM)); - ptrace (6,inferior_pid, - (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM)); - } - - -} - -#if 0 -/* Core files are now a function of BFD. */ - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - extern char registers[]; - - /* Need symbol file and one with tdesc info for corefiles to work */ - if (!have_symbol_file_p()) - error ("Requires symbol-file and exec-file"); - if (!execfile) - error ("Requires exec-file and symbol-file"); - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the inferior with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - /* 4.2-style (and perhaps also sysV-style) core dump file. */ - { - struct USER u; - - int reg_offset; - - val = myread (corechan, &u, sizeof u); - if (val < 0) - perror_with_name (filename); - data_start = u.pt_o_data_start; - - data_end = data_start + u.pt_dsize; - stack_start = stack_end - u.pt_ssize; - data_offset = u.pt_dataptr; - stack_offset = data_offset + u.pt_dsize; - -#if defined(BCS) -#if defined(DGUX) - - reg_offset = 2048; - - -#endif /* defined (DGUX) */ -#else - - /* original code: */ - reg_offset = (int) u.pt_r0 - KERNEL_U_ADDR; - -#endif /* defined(BCS) */ - - /* I don't know where to find this info. - So, for now, mark it as not available. */ -/* N_SET_MAGIC (core_aouthdr, 0); */ - bzero ((char *) &core_aouthdr, sizeof core_aouthdr); - - /* Read the register values out of the core file and store - them where `read_register' will find them. */ - - { - register int regno; - - for (regno = 0; regno < NUM_REGS; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - - val = lseek (corechan, register_addr (regno, reg_offset), 0); - if (val < 0) - perror_with_name (filename); - - val = myread (corechan, buf, sizeof buf); - if (val < 0) - perror_with_name (filename); - supply_register (regno, buf); - } - } - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename, NULL); - } - init_tdesc(); - current_context = init_dcontext(); - set_current_frame ( create_new_frame(get_frame_base (read_pc()), - read_pc ())); - select_frame (get_current_frame (), 0); - validate_files (); - } - else if (from_tty) - printf ("No core file now.\n"); -} -#endif - -/* blockend is the address of the end of the user structure */ -m88k_register_u_addr (blockend, regnum) -{ - struct USER u; - int ustart = blockend - sizeof (struct USER); - switch (regnum) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: return (ustart + ((int) &u.pt_r0 - (int) &u) + sizeof(REGISTER_TYPE) * regnum); - case PSR_REGNUM: return (ustart + ((int) &u.pt_psr - (int) &u)); - case FPSR_REGNUM: return (ustart + ((int) &u.pt_fpsr - (int) &u)); - case FPCR_REGNUM: return (ustart + ((int) &u.pt_fpcr - (int) &u)); - case SXIP_REGNUM: return (ustart + SXIP_OFFSET); - case SNIP_REGNUM: return (ustart + SNIP_OFFSET); - case SFIP_REGNUM: return (ustart + SFIP_OFFSET); - default: return (blockend + sizeof (REGISTER_TYPE) * regnum); - } -} diff --git a/gdb/mach386-xdep.c b/gdb/mach386-xdep.c index 8f7ca16..e69de29 100644 --- a/gdb/mach386-xdep.c +++ b/gdb/mach386-xdep.c @@ -1,164 +0,0 @@ -/* Machine-dependent code for host Mach 386's for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "gdbcore.h" - -#if defined (GDB_TARGET_IS_MACH386) - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -void -fetch_inferior_registers (regno) - int regno; /* Original value discarded */ -{ - struct regs inferior_registers; - struct fp_state inferior_fp_registers; - extern char registers[]; - - registers_fetched (); - - ptrace (PTRACE_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); - - bcopy (&inferior_registers, registers, sizeof inferior_registers); - - bcopy (inferior_fp_registers.f_st,®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.f_st); - bcopy (&inferior_fp_registers.f_ctrl, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_state inferior_fp_registers; - extern char registers[]; - - bcopy (registers, &inferior_registers, 20 * 4); - - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)],inferior_fp_registers.f_st, - sizeof inferior_fp_registers.f_st); - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &inferior_fp_registers.f_ctrl, - sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st); - -#ifdef PTRACE_FP_BUG - if (regno == FP_REGNUM || regno == -1) - /* Storing the frame pointer requires a gross hack, in which an - instruction that moves eax into ebp gets single-stepped. */ - { - int stack = inferior_registers.r_reg[SP_REGNUM]; - int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, - (PTRACE_ARG3_TYPE) stack); - int reg = inferior_registers.r_reg[EAX]; - inferior_registers.r_reg[EAX] = - inferior_registers.r_reg[FP_REGNUM]; - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0xc589); - ptrace (PTRACE_SINGLESTEP, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0); - wait (0); - ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, stuff); - inferior_registers.r_reg[EAX] = reg; - } -#endif - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); -} - -#else /* Not mach386 target. */ - -/* These functions shouldn't be called when we're cross-debugging. */ - -/* ARGSUSED */ -void -fetch_inferior_registers (regno) - int regno; -{ -} - -/* ARGSUSED */ -void -store_inferior_registers (regno) - int regno; -{ -} - -#endif /* Not mach386 target. */ - -/* Work with core files, for GDB. */ - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ - int val; - extern char registers[]; - - switch (which) { - case 0: - case 1: - bcopy (core_reg_sect, registers, core_reg_size); - break; - - case 2: -#ifdef FP0_REGNUM - bcopy (core_reg_sect, - ®isters[REGISTER_BYTE (FP0_REGNUM)], - core_reg_size); /* FIXME, probably bogus */ -#endif -#ifdef FPC_REGNUM - bcopy (&corestr.c_fpu.f_fpstatus.f_ctrl, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof corestr.c_fpu.f_fpstatus - - sizeof corestr.c_fpu.f_fpstatus.f_st); -#endif - break; - } -} diff --git a/gdb/mcheck.c b/gdb/mcheck.c deleted file mode 100755 index 38b997a..0000000 --- a/gdb/mcheck.c +++ /dev/null @@ -1,124 +0,0 @@ -/* Standard debugging hooks for `malloc'. - Copyright 1990 Free Software Foundation - Written May 1989 by Mike Haertel. - - The author may be reached (Email) at the address mike@ai.mit.edu, - or (US mail) as Mike Haertel c/o Free Software Foundation. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "ansidecl.h" -#define size_t unsigned int -#define ptrdiff_t int -#define NULL 0 -#define __ONEFILE -#include "gmalloc.h" - -/* Old hook values. */ -static void EXFUN((*old_free_hook), (PTR ptr)); -static PTR EXFUN((*old_malloc_hook), (size_t size)); -static PTR EXFUN((*old_realloc_hook), (PTR ptr, size_t size)); - - -/* Function to call when something awful happens. */ -extern void abort(); -static void EXFUN((*abortfunc), (NOARGS)) = (void (*)()) abort; - -/* Arbitrary magical numbers. */ -#define MAGICWORD 0xfedabeeb -#define MAGICBYTE ((char) 0xd7) - -struct hdr - { - size_t size; /* Exact size requested by user. */ - unsigned int magic; /* Magic number to check header integrity. */ - }; - -static void -DEFUN(checkhdr, (hdr), CONST struct hdr *hdr) -{ - if (hdr->magic != MAGICWORD || ((char *) &hdr[1])[hdr->size] != MAGICBYTE) - (*abortfunc)(); -} - -static void -DEFUN(freehook, (ptr), PTR ptr) -{ - struct hdr *hdr = ((struct hdr *) ptr) - 1; - checkhdr(hdr); - hdr->magic = 0; - __free_hook = old_free_hook; - free(hdr); - __free_hook = freehook; -} - -static PTR -DEFUN(mallochook, (size), size_t size) -{ - struct hdr *hdr; - - __malloc_hook = old_malloc_hook; - hdr = (struct hdr *) malloc(sizeof(struct hdr) + size + 1); - __malloc_hook = mallochook; - if (hdr == NULL) - return NULL; - - hdr->size = size; - hdr->magic = MAGICWORD; - ((char *) &hdr[1])[size] = MAGICBYTE; - return (PTR) (hdr + 1); -} - -static PTR -DEFUN(reallochook, (ptr, size), PTR ptr AND size_t size) -{ - struct hdr *hdr = ((struct hdr *) ptr) - 1; - - checkhdr(hdr); - __free_hook = old_free_hook; - __malloc_hook = old_malloc_hook; - __realloc_hook = old_realloc_hook; - hdr = (struct hdr *) realloc((PTR) hdr, sizeof(struct hdr) + size + 1); - __free_hook = freehook; - __malloc_hook = mallochook; - __realloc_hook = reallochook; - if (hdr == NULL) - return NULL; - - hdr->size = size; - ((char *) &hdr[1])[size] = MAGICBYTE; - return (PTR) (hdr + 1); -} - -void -DEFUN(mcheck, (func), void EXFUN((*func), (NOARGS))) -{ - static int mcheck_used = 0; - - if (func) - abortfunc = func; - - /* These hooks may not be safely inserted if malloc is already in use. */ - if (!__malloc_initialized && !mcheck_used) - { - old_free_hook = __free_hook; - __free_hook = freehook; - old_malloc_hook = __malloc_hook; - __malloc_hook = mallochook; - old_realloc_hook = __realloc_hook; - __realloc_hook = reallochook; - mcheck_used = 1; - } -} diff --git a/gdb/mips-opcode.h b/gdb/mips-opcode.h deleted file mode 100755 index f75d34e..0000000 --- a/gdb/mips-opcode.h +++ /dev/null @@ -1,363 +0,0 @@ -/* Mips opcde list for GDB, the GNU debugger. - Copyright (C) 1989 Free Software Foundation, Inc. - Contributed by Nobuyuki Hikichi(hikichi@sra.junet) - Made to work for little-endian machines, and debugged - by Per Bothner (bothner@cs.wisc.edu). - Many fixes contributed by Frank Yellin (fy@lucid.com). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#if BITS_BIG_ENDIAN -#define BIT_FIELDS_2(a,b) a;b; -#define BIT_FIELDS_4(a,b,c,d) a;b;c;d; -#define BIT_FIELDS_6(a,b,c,d,e,f) a;b;c;d;e;f; -#else -#define BIT_FIELDS_2(a,b) b;a; -#define BIT_FIELDS_4(a,b,c,d) d;c;b;a; -#define BIT_FIELDS_6(a,b,c,d,e,f) f;e;d;c;b;a; -#endif - -struct op_i_fmt -{ -BIT_FIELDS_4( - unsigned op : 6, - unsigned rs : 5, - unsigned rt : 5, - unsigned immediate : 16) -}; - -struct op_j_fmt -{ -BIT_FIELDS_2( - unsigned op : 6, - unsigned target : 26) -}; - -struct op_r_fmt -{ -BIT_FIELDS_6( - unsigned op : 6, - unsigned rs : 5, - unsigned rt : 5, - unsigned rd : 5, - unsigned shamt : 5, - unsigned funct : 6) -}; - - -struct fop_i_fmt -{ -BIT_FIELDS_4( - unsigned op : 6, - unsigned rs : 5, - unsigned rt : 5, - unsigned immediate : 16) -}; - -struct op_b_fmt -{ -BIT_FIELDS_4( - unsigned op : 6, - unsigned rs : 5, - unsigned rt : 5, - short delta : 16) -}; - -struct fop_r_fmt -{ -BIT_FIELDS_6( - unsigned op : 6, - unsigned fmt : 5, - unsigned ft : 5, - unsigned fs : 5, - unsigned fd : 5, - unsigned funct : 6) -}; - -struct mips_opcode -{ - char *name; - unsigned long opcode; - unsigned long match; - char *args; - int bdelay; /* Nonzero if delayed branch. */ -}; - -/* args format; - - "s" rs: source register specifier - "t" rt: target register - "i" immediate - "a" target address - "c" branch condition - "d" rd: destination register specifier - "h" shamt: shift amount - "f" funct: function field - - for fpu - "S" fs source 1 register - "T" ft source 2 register - "D" distination register -*/ - -#define one(x) (x << 26) -#define op_func(x, y) ((x << 26) | y) -#define op_cond(x, y) ((x << 26) | (y << 16)) -#define op_rs_func(x, y, z) ((x << 26) | (y << 21) | z) -#define op_rs_b11(x, y, z) ((x << 26) | (y << 21) | z) -#define op_o16(x, y) ((x << 26) | (y << 16)) -#define op_bc(x, y, z) ((x << 26) | (y << 21) | (z << 16)) - -struct mips_opcode mips_opcodes[] = -{ -/* These first opcodes are special cases of the ones in the comments */ - {"nop", 0, 0xffffffff, /*li*/ "", 0}, - {"li", op_bc(9,0,0), op_bc(0x3f,31,0), /*addiu*/ "t,j", 0}, - {"b", one(4), 0xffff0000, /*beq*/ "b", 1}, - {"move", op_func(0, 33), op_cond(0x3f,31)|0x7ff,/*addu*/ "d,s", 0}, - - {"sll", op_func(0, 0), op_func(0x3f, 0x3f), "d,t,h", 0}, - {"srl", op_func(0, 2), op_func(0x3f, 0x3f), "d,t,h", 0}, - {"sra", op_func(0, 3), op_func(0x3f, 0x3f), "d,t,h", 0}, - {"sllv", op_func(0, 4), op_func(0x3f, 0x7ff), "d,t,s", 0}, - {"srlv", op_func(0, 6), op_func(0x3f, 0x7ff), "d,t,s", 0}, - {"srav", op_func(0, 7), op_func(0x3f, 0x7ff), "d,t,s", 0}, - {"jr", op_func(0, 8), op_func(0x3f, 0x1fffff), "s", 1}, - {"jalr", op_func(0, 9), op_func(0x3f, 0x1f07ff), "d,s", 1}, - {"syscall", op_func(0, 12), op_func(0x3f, 0x3f), "", 0}, - {"break", op_func(0, 13), op_func(0x3f, 0x3f), "", 0}, - {"mfhi", op_func(0, 16), op_func(0x3f, 0x03ff07ff), "d", 0}, - {"mthi", op_func(0, 17), op_func(0x3f, 0x1fffff), "s", 0}, - {"mflo", op_func(0, 18), op_func(0x3f, 0x03ff07ff), "d", 0}, - {"mtlo", op_func(0, 19), op_func(0x3f, 0x1fffff), "s", 0}, - {"mult", op_func(0, 24), op_func(0x3f, 0xffff), "s,t", 0}, - {"multu", op_func(0, 25), op_func(0x3f, 0xffff), "s,t", 0}, - {"div", op_func(0, 26), op_func(0x3f, 0xffff), "s,t", 0}, - {"divu", op_func(0, 27), op_func(0x3f, 0xffff), "s,t", 0}, - {"add", op_func(0, 32), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"addu", op_func(0, 33), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"sub", op_func(0, 34), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"subu", op_func(0, 35), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"and", op_func(0, 36), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"or", op_func(0, 37), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"xor", op_func(0, 38), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"nor", op_func(0, 39), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"slt", op_func(0, 42), op_func(0x3f, 0x7ff), "d,s,t", 0}, - {"sltu", op_func(0, 43), op_func(0x3f, 0x7ff), "d,s,t", 0}, - - {"bltz", op_cond (1, 0), op_cond(0x3f, 0x1f), "s,b", 1}, - {"bgez", op_cond (1, 1), op_cond(0x3f, 0x1f), "s,b", 1}, - {"bltzal", op_cond (1, 16),op_cond(0x3f, 0x1f), "s,b", 1}, - {"bgezal", op_cond (1, 17),op_cond(0x3f, 0x1f), "s,b", 1}, - - - {"j", one(2), one(0x3f), "a", 1}, - {"jal", one(3), one(0x3f), "a", 1}, - {"beq", one(4), one(0x3f), "s,t,b", 1}, - {"bne", one(5), one(0x3f), "s,t,b", 1}, - {"blez", one(6), one(0x3f) | 0x1f0000, "s,b", 1}, - {"bgtz", one(7), one(0x3f) | 0x1f0000, "s,b", 1}, - {"addi", one(8), one(0x3f), "t,s,j", 0}, - {"addiu", one(9), one(0x3f), "t,s,j", 0}, - {"slti", one(10), one(0x3f), "t,s,j", 0}, - {"sltiu", one(11), one(0x3f), "t,s,j", 0}, - {"andi", one(12), one(0x3f), "t,s,i", 0}, - {"ori", one(13), one(0x3f), "t,s,i", 0}, - {"xori", one(14), one(0x3f), "t,s,i", 0}, - /* rs field is don't care field? */ - {"lui", one(15), one(0x3f), "t,i", 0}, - -/* co processor 0 instruction */ - {"mfc0", op_rs_b11 (16, 0, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"cfc0", op_rs_b11 (16, 2, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"mtc0", op_rs_b11 (16, 4, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"ctc0", op_rs_b11 (16, 6, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - - {"bc0f", op_o16(16, 0x100), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc0f", op_o16(16, 0x180), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc0t", op_o16(16, 0x101), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc0t", op_o16(16, 0x181), op_o16(0x3f, 0x3ff), "b", 1}, - - {"tlbr", op_rs_func(16, 0x10, 1), ~0, "", 0}, - {"tlbwi", op_rs_func(16, 0x10, 2), ~0, "", 0}, - {"tlbwr", op_rs_func(16, 0x10, 6), ~0, "", 0}, - {"tlbp", op_rs_func(16, 0x10, 8), ~0, "", 0}, - {"rfe", op_rs_func(16, 0x10, 16), ~0, "", 0}, - - {"mfc1", op_rs_b11 (17, 0, 0), op_rs_b11(0x3f, 0x1f, 0),"t,S", 0}, - {"cfc1", op_rs_b11 (17, 2, 0), op_rs_b11(0x3f, 0x1f, 0),"t,S", 0}, - {"mtc1", op_rs_b11 (17, 4, 0), op_rs_b11(0x3f, 0x1f, 0),"t,S", 0}, - {"ctc1", op_rs_b11 (17, 6, 0), op_rs_b11(0x3f, 0x1f, 0),"t,S", 0}, - - {"bc1f", op_o16(17, 0x100), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc1f", op_o16(17, 0x180), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc1t", op_o16(17, 0x101), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc1t", op_o16(17, 0x181), op_o16(0x3f, 0x3ff), "b", 1}, - -/* fpu instruction */ - {"add.s", op_rs_func(17, 0x10, 0), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"add.d", op_rs_func(17, 0x11, 0), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"sub.s", op_rs_func(17, 0x10, 1), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"sub.d", op_rs_func(17, 0x11, 1), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"mul.s", op_rs_func(17, 0x10, 2), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"mul.d", op_rs_func(17, 0x11, 2), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"div.s", op_rs_func(17, 0x10, 3), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"div.d", op_rs_func(17, 0x11, 3), - op_rs_func(0x3f, 0x1f, 0x3f), "D,S,T", 0}, - {"abs.s", op_rs_func(17, 0x10, 5), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"abs.d", op_rs_func(17, 0x11, 5), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"mov.s", op_rs_func(17, 0x10, 6), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"mov.d", op_rs_func(17, 0x11, 6), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"neg.s", op_rs_func(17, 0x10, 7), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"neg.d", op_rs_func(17, 0x11, 7), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.s.s", op_rs_func(17, 0x10, 32), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.s.d", op_rs_func(17, 0x11, 32), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.s.w", op_rs_func(17, 0x14, 32), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.d.s", op_rs_func(17, 0x10, 33), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.d.d", op_rs_func(17, 0x11, 33), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.d.w", op_rs_func(17, 0x14, 33), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.w.s", op_rs_func(17, 0x10, 36), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"cvt.w.d", op_rs_func(17, 0x11, 36), - op_rs_func(0x3f, 0x1f, 0x1f003f), "D,S", 0}, - {"c.f.s", op_rs_func(17, 0x10, 48), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.f.d", op_rs_func(17, 0x11, 48), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.un.s", op_rs_func(17, 0x10, 49), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.un.d", op_rs_func(17, 0x11, 49), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.eq.s", op_rs_func(17, 0x10, 50), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.eq.d", op_rs_func(17, 0x11, 50), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ueq.s", op_rs_func(17, 0x10, 51), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ueq.d", op_rs_func(17, 0x11, 51), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.olt.s", op_rs_func(17, 0x10, 52), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.olt.d", op_rs_func(17, 0x11, 52), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ult.s", op_rs_func(17, 0x10, 53), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ult.d", op_rs_func(17, 0x11, 53), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ole.s", op_rs_func(17, 0x10, 54), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ole.d", op_rs_func(17, 0x11, 54), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ule.s", op_rs_func(17, 0x10, 55), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ule.d", op_rs_func(17, 0x11, 55), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.sf.s", op_rs_func(17, 0x10, 56), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.sf.d", op_rs_func(17, 0x11, 56), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ngle.s", op_rs_func(17, 0x10, 57), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ngle.d", op_rs_func(17, 0x11, 57), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.seq.s", op_rs_func(17, 0x10, 58), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.seq.d", op_rs_func(17, 0x11, 58), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ngl.s", op_rs_func(17, 0x10, 59), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ngl.d", op_rs_func(17, 0x11, 59), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.lt.s", op_rs_func(17, 0x10, 60), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.lt.d", op_rs_func(17, 0x11, 60), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.nge.s", op_rs_func(17, 0x10, 61), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.nge.d", op_rs_func(17, 0x11, 61), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.le.s", op_rs_func(17, 0x10, 62), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.le.d", op_rs_func(17, 0x11, 62), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ngt.s", op_rs_func(17, 0x10, 63), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - {"c.ngt.d", op_rs_func(17, 0x11, 63), - op_rs_func(0x3f, 0x1f, 0x7ff), "S,T", 0}, - -/* co processor 2 instruction */ - {"mfc2", op_rs_b11 (18, 0, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"cfc2", op_rs_b11 (18, 2, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"mtc2", op_rs_b11 (18, 4, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"ctc2", op_rs_b11 (18, 6, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"bc2f", op_o16(18, 0x100), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc2f", op_o16(18, 0x180), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc2f", op_o16(18, 0x101), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc2t", op_o16(18, 0x181), op_o16(0x3f, 0x3ff), "b", 1}, - -/* co processor 3 instruction */ - {"mtc3", op_rs_b11 (19, 0, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"cfc3", op_rs_b11 (19, 2, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"mtc3", op_rs_b11 (19, 4, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"ctc3", op_rs_b11 (19, 6, 0), op_rs_b11(0x3f, 0x1f, 0x1ffff), "t,d", 0}, - {"bc3f", op_o16(19, 0x100), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc3f", op_o16(19, 0x180), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc3t", op_o16(19, 0x101), op_o16(0x3f, 0x3ff), "b", 1}, - {"bc3t", op_o16(19, 0x181), op_o16(0x3f, 0x3ff), "b", 1}, - - {"lb", one(32), one(0x3f), "t,j(s)", 0}, - {"lh", one(33), one(0x3f), "t,j(s)", 0}, - {"lwl", one(34), one(0x3f), "t,j(s)", 0}, - {"lw", one(35), one(0x3f), "t,j(s)", 0}, - {"lbu", one(36), one(0x3f), "t,j(s)", 0}, - {"lhu", one(37), one(0x3f), "t,j(s)", 0}, - {"lwr", one(38), one(0x3f), "t,j(s)", 0}, - {"sb", one(40), one(0x3f), "t,j(s)", 0}, - {"sh", one(41), one(0x3f), "t,j(s)", 0}, - {"swl", one(42), one(0x3f), "t,j(s)", 0}, - {"swr", one(46), one(0x3f), "t,j(s)", 0}, - {"sw", one(43), one(0x3f), "t,j(s)", 0}, - {"lwc0", one(48), one(0x3f), "t,j(s)", 0}, -/* for fpu */ - {"lwc1", one(49), one(0x3f), "T,j(s)", 0}, - {"lwc2", one(50), one(0x3f), "t,j(s)", 0}, - {"lwc3", one(51), one(0x3f), "t,j(s)", 0}, - {"swc0", one(56), one(0x3f), "t,j(s)", 0}, -/* for fpu */ - {"swc1", one(57), one(0x3f), "T,j(s)", 0}, - {"swc2", one(58), one(0x3f), "t,j(s)", 0}, - {"swc3", one(59), one(0x3f), "t,j(s)", 0}, -}; diff --git a/gdb/mips-xdep.c b/gdb/mips-xdep.c deleted file mode 100644 index e314bf7..0000000 --- a/gdb/mips-xdep.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Low level MIPS interface to ptrace, for GDB when running under Unix. - Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc. - Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU - and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "gdbcore.h" - -/* For now we stub this out; sgi core format is super-hairy (and completely - different in the new release). - For most mips systems, this function is defined in coredep.c. */ - -#if defined(sgi) -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; -{ - return; -} -#endif - -/* Access to the inferior is only good for native systems, not cross. - I am not sure why this is stubbed out on SGI... --gnu@cygnus.com */ - -#if defined(sgi) || !defined(GDB_TARGET_IS_MIPS) - -/* ARGSUSED */ -void -fetch_inferior_registers (regno) - int regno; -{ - return; -} - -/* ARGSUSED */ -void -store_inferior_registers (regno) - int regno; -{ - return; -} - - -#else - -/* DECstation native... */ - -#include - -/* Map gdb internal register number to ptrace ``address''. - These ``addresses'' are defined in DECstation */ - -#define REGISTER_PTRACE_ADDR(regno) \ - (regno < 32 ? GPR_BASE + regno \ - : regno == PC_REGNUM ? PC \ - : regno == CAUSE_REGNUM ? CAUSE \ - : regno == HI_REGNUM ? MMHI \ - : regno == LO_REGNUM ? MMLO \ - : regno == FCRCS_REGNUM ? FPC_CSR \ - : regno == FCRIR_REGNUM ? FPC_EIR \ - : regno >= FP0_REGNUM ? FPR_BASE + (regno - FP0_REGNUM) \ - : 0) - -static const char zerobuf[MAX_REGISTER_RAW_SIZE]; - -/* Get all registers from the inferior */ - -void -fetch_inferior_registers (regno) - int regno; -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - registers_fetched (); - - for (regno = 1; regno < NUM_REGS; regno++) - { - regaddr = REGISTER_PTRACE_ADDR (regno); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - - supply_register (ZERO_REGNUM, zerobuf); - /* Frame ptr reg must appear to be 0; it is faked by stack handling code. */ - supply_register (FP_REGNUM, zerobuf); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; - { - register unsigned int regaddr; - char buf[80]; - - if (regno == 0) - return; - - if (regno > 0) - { - regaddr = REGISTER_PTRACE_ADDR (regno); - errno = 0; - ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - if (regno == ZERO_REGNUM || regno == PS_REGNUM - || regno == BADVADDR_REGNUM || regno == CAUSE_REGNUM - || regno == FCRIR_REGNUM || regno == FP_REGNUM - || (regno >= FIRST_EMBED_REGNUM && regno <= LAST_EMBED_REGNUM)) - continue; - regaddr = register_addr (regno, 1); - errno = 0; - ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing all regs, number %d", regno); - perror_with_name (buf); - } - } - } -} - -#endif /* sgi */ diff --git a/gdb/mmap-alloc.c b/gdb/mmap-alloc.c index d1ac6e4..e69de29 100755 --- a/gdb/mmap-alloc.c +++ b/gdb/mmap-alloc.c @@ -1,159 +0,0 @@ -/* GDB support for special malloc using mmap. - Copyright 1992 Free Software Foundation, Inc. - Contributed by Cygnus Support, using pieces from other GDB modules. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" - -#if defined (HAVE_MMAP) - -/* Redefine the external visible symbols in gmalloc.c to be mmap versions */ - -#define free _mmap_free -#define malloc _mmap_malloc -#define realloc _mmap_realloc -#define valloc _mmap_valloc - -#define _bytes_free _mmap__bytes_free -#define _bytes_used _mmap__bytes_used -#define _chunks_free _mmap__chunks_free -#define _chunks_used _mmap__chunks_used -#define _fraghead _mmap__fraghead -#define _heapbase _mmap__heapbase -#define _heapindex _mmap__heapindex -#define _heapinfo _mmap__heapinfo -#define _heaplimit _mmap__heaplimit - -#define __default_morecore _mmap___default_morecore -#define __free _mmap___free -#define __free_hook _mmap___free_hook -#define __malloc_hook _mmap___malloc_hook -#define __malloc_initialized _mmap___malloc_initialized -#define __morecore _mmap___morecore -#define __realloc_hook _mmap___realloc_hook - -/* Arrange that instead of calling sbrk() we call mmap_sbrk() */ - -#define sbrk mmap_sbrk - -/* Now simply include the standard GNU malloc source, and all the - externally visible symbols will become _mmap_* versions, and - _mmap_sbrk will be called to get more core instead of sbrk. */ - -#include "gmalloc.c" - -/* Like mmap_malloc but get error if no storage available. */ - -PTR -mmap_xmalloc (size) - long size; -{ - register char *val = NULL; - - /* Protect against gdb wanting to allocate zero bytes. */ - - if (size > 0) - { - if ((val = (char *) _mmap_malloc (size)) == NULL) - { - fatal ("virtual memory exhausted.", 0); - } - } - return (val); -} - -/* Like mmap_realloc but get error if no storage available. */ - -PTR -mmap_xrealloc (ptr, size) - PTR ptr; - long size; -{ - register char *val; - - if ((val = (char *) _mmap_realloc (ptr, size)) == NULL) - { - fatal ("virtual memory exhausted.", 0); - } - return (val); -} - -PTR -mmap_malloc (size) - long size; -{ - return (_mmap_malloc (size)); -} - -PTR -mmap_realloc (ptr, size) - PTR ptr; - long size; -{ - return (_mmap_realloc (ptr, size)); -} - -void -mmap_free (ptr) - PTR ptr; -{ - _mmap_free (ptr); -} - -#else /* !defined (HAVE_MMAP) */ - -static char *errmsg = "This version of gdb does not support dumpable state."; - -PTR -mmap_malloc (size) - long size; -{ - error (errmsg); -} - -PTR -mmap_xmalloc (size) - long size; -{ - error (errmsg); -} - -PTR -mmap_realloc (ptr, size) - PTR ptr; - long size; -{ - error (errmsg); -} - -PTR -mmap_xrealloc (ptr, size) - PTR ptr; - long size; -{ - error (errmsg); -} - -void -mmap_free (ptr) - PTR ptr; -{ - error (errmsg); -} - -#endif /* HAVE_MMAP */ diff --git a/gdb/mmap-sbrk.c b/gdb/mmap-sbrk.c index 2622845..e69de29 100755 --- a/gdb/mmap-sbrk.c +++ b/gdb/mmap-sbrk.c @@ -1,144 +0,0 @@ -/* GDB support for an sbrk-like function that uses mmap. - Copyright 1992 Free Software Foundation, Inc. - Contributed by Cygnus Support, using pieces from other GDB modules. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" - -#ifdef HAVE_MMAP - -#include -#include - -#ifdef i386 -#define MMAP_BASE ((caddr_t) 0x81000000) -#define MMAP_PGSZ 0x00002000 /* Must be multiple of real page size */ -#else -#define MMAP_BASE ((caddr_t) 0xC2000000) -#define MMAP_PGSZ 0x00002000 /* Must be multiple of real page size */ -#endif - -#define PAGE_ALIGN(addr) (caddr_t) (((long)(addr) + MMAP_PGSZ - 1) & \ - ~(MMAP_PGSZ - 1)) - -static caddr_t mbase = MMAP_BASE; /* Current base of mmap'd region */ -static caddr_t mbreak = MMAP_BASE; /* Current "break" address */ -static caddr_t mtop = MMAP_BASE; /* Current top of mmap'd region */ - -static int fd = -1; /* Open fd for /dev/zero */ - - -/* Provide a utility routine for other modules to obtain compatible - page alignment. */ - -PTR -mmap_page_align (addr) - PTR addr; -{ - return (PAGE_ALIGN (addr)); -} - -/* Return the base address of the start of the mmap'd region. Note that - we can find the end of the region at anytime by calling mmap_sbrk(0) */ - -PTR -mmap_base () -{ - return (mbase); -} - -/* Works like sbrk(), but uses mmap to add to or subtract from a - memory region. */ - -PTR -mmap_sbrk (size) - int size; -{ - PTR result = NULL; - int minc; - caddr_t moveto; - - if (size == 0) - { - /* Just return the current "break" value. */ - result = mbreak; - } - else if (size < 0) - { - /* We are deallocating memory. If the amount requested would cause - us to try to deallocate back past the base of the mmap'd region - then do nothing, and return NULL. Otherwise, deallocate the - memory and return the old break value. */ - if (mbreak + size >= mbase) - { - result = (PTR) mbreak; - mbreak += size; - moveto = PAGE_ALIGN (mbreak); - munmap (moveto, (size_t) (mtop - moveto)); - mtop = moveto; - } - } - else - { - /* We are allocating memory. Make sure we have an open file - descriptor and then go on to get the memory. */ - if ((fd == -1) && (fd = open ("/dev/zero", O_RDONLY)) < 0) - { - result = NULL; - } - else if (mbreak + size > mtop) - { - /* The request would move us past the end of the currently - mapped memory, so map in enough more memory to satisfy - the request. */ - moveto = PAGE_ALIGN (mbreak + size); - if (mmap (mtop, moveto - mtop, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0) == mtop) - { - mtop = moveto; - result = (PTR) mbreak; - mbreak += size; - } - } - else - { - result = (PTR) mbreak; - mbreak += size; - } - } - return (result); -} - -PTR -mmap_remap (base, mapsize, fd, foffset) - PTR base; - long mapsize; - int fd; - long foffset; -{ - /* FIXME: Quick hack, needs error checking and other attention. */ - munmap (mbase, (size_t) (mtop - mbase)); - mbase = base; - mtop = mbase + mapsize; - base = mmap (base, mapsize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, dup (fd), foffset); - return (base); -} - - -#endif /* HAVE_MMAP */ diff --git a/gdb/mtrace.awk b/gdb/mtrace.awk deleted file mode 100755 index d7689ce..0000000 --- a/gdb/mtrace.awk +++ /dev/null @@ -1,36 +0,0 @@ -# -# Awk program to analyze mtrace.c output. -# -$1 == "+" { if (allocated[$2] != "") - print "+", $2, "Alloc", NR, "duplicate:", allocated[$2]; - else - allocated[$2] = $3; - } -$1 == "-" { if (allocated[$2] != "") { - allocated[$2] = ""; - if (allocated[$2] != "") - print "DELETE FAILED", $2, allocated[$2]; - } else - print "-", $2, "Free", NR, "was never alloc'd"; - } -$1 == "<" { if (allocated[$2] != "") - allocated[$2] = ""; - else - print "-", $2, "Realloc", NR, "was never alloc'd"; - } -$1 == ">" { if (allocated[$2] != "") - print "+", $2, "Realloc", NR, "duplicate:", allocated[$2]; - else - allocated[$2] = $3; - } - -# Ignore "= Start" -$1 == "=" { } -# Ignore failed realloc attempts for now -$1 == "!" { } - - -END { for (x in allocated) - if (allocated[x] != "") - print "+", x, allocated[x]; - } diff --git a/gdb/mtrace.c b/gdb/mtrace.c deleted file mode 100755 index 82e7f03..0000000 --- a/gdb/mtrace.c +++ /dev/null @@ -1,146 +0,0 @@ -/* More debugging hooks for `malloc'. - Copyright 1991 Free Software Foundation - Written April 2, 1991 by John Gilmore of Cygnus Support - Based on mcheck.c by Mike Haertel. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include "ansidecl.h" - -/* size_t may be defined in the system-supplied stdio.h. */ -/* So just kludge it. */ -#define size_t unsigned int -#define ptrdiff_t int -#define __ONEFILE - -/* We can't declare malloc and realloc here because we don't know - if they are char * or void *, and the compiler will give an error - if we get it wrong and they happen to be defined in some header - file e.g. . We can't include here because - it has some incompatability with our own includes, e.g. size_t or - whatever. So we just punt. This causes malloc and realloc to - default to returning "int", which works for most cases we care - about. FIXME-somehow. */ -/* #include */ -#include "gmalloc.h" - -extern char *getenv(); - -FILE *mallstream; -char mallenv[] = "MALLOC_TRACE"; -static char mallbuf[BUFSIZ]; /* Buffer for the output */ - -/* Address to breakpoint on accesses to... */ -PTR mallwatch; - -/* Old hook values. */ -static void EXFUN((*old_free_hook), (PTR ptr)); -static PTR EXFUN((*old_malloc_hook), (size_t size)); -static PTR EXFUN((*old_realloc_hook), (PTR ptr, size_t size)); - -/* This function is called when the block being alloc'd, realloc'd, or - freed has an address matching the variable "mallwatch". In a debugger, - set "mallwatch" to the address of interest, then put a breakpoint on - tr_break. */ - -void -tr_break() -{ - ; -} - -static void -DEFUN(tr_freehook, (ptr), PTR ptr) -{ - fprintf(mallstream, "- %08x\n", ptr); /* Be sure to print it first */ - if (ptr == mallwatch) - tr_break(); - __free_hook = old_free_hook; - free(ptr); - __free_hook = tr_freehook; -} - -static PTR -DEFUN(tr_mallochook, (size), size_t size) -{ - PTR hdr; - - __malloc_hook = old_malloc_hook; - hdr = (PTR) malloc(size); - __malloc_hook = tr_mallochook; - - /* We could be printing a NULL here; that's OK */ - fprintf (mallstream, "+ %08x %x\n", hdr, size); - - if (hdr == mallwatch) - tr_break(); - - return hdr; -} - -static PTR -DEFUN(tr_reallochook, (ptr, size), PTR ptr AND size_t size) -{ - PTR hdr; - - if (ptr == mallwatch) - tr_break(); - - __free_hook = old_free_hook; - __malloc_hook = old_malloc_hook; - __realloc_hook = old_realloc_hook; - hdr = (PTR) realloc(ptr, size); - __free_hook = tr_freehook; - __malloc_hook = tr_mallochook; - __realloc_hook = tr_reallochook; - if (hdr == NULL) { - fprintf (mallstream, "! %08x %x\n", ptr, size); /* Failed realloc */ - } else { - fprintf (mallstream, "< %08x\n> %08x %x\n", ptr, hdr, size); - } - - if (hdr == mallwatch) - tr_break(); - - return hdr; -} - -/* We enable tracing if either the environment variable MALLOC_TRACE - is set, or if the variable mallwatch has been patched to an address - that the debugging user wants us to stop on. When patching mallwatch, - don't forget to set a breakpoint on tr_break! */ - -void -mtrace() -{ - char *mallfile; - - mallfile = getenv (mallenv); - if (mallfile || mallwatch) { - mallstream = fopen (mallfile? mallfile: "/dev/null", "w"); - if (mallstream) { - /* Be sure it doesn't malloc its buffer! */ - setbuf (mallstream, mallbuf); - fprintf (mallstream, "= Start\n"); - old_free_hook = __free_hook; - __free_hook = tr_freehook; - old_malloc_hook = __malloc_hook; - __malloc_hook = tr_mallochook; - old_realloc_hook = __realloc_hook; - __realloc_hook = tr_reallochook; - } - } -} diff --git a/gdb/nat-sparc.c b/gdb/nat-sparc.c index fb78d2d..e69de29 100644 --- a/gdb/nat-sparc.c +++ b/gdb/nat-sparc.c @@ -1,297 +0,0 @@ -/* Functions specific to running gdb native on a Sun 4 running sunos4. - Copyright (C) 1989, 1992, Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "target.h" -#include "nat.h" - -#include -#include -#include -#include - -/* We don't store all registers immediately when requested, since they - get sent over in large chunks anyway. Instead, we accumulate most - of the changes and send them over once. "deferred_stores" keeps - track of which sets of registers we have locally-changed copies of, - so we only need send the groups that have changed. */ - -#define INT_REGS 1 -#define STACK_REGS 2 -#define FP_REGS 4 - -/* Fetch one or more registers from the inferior. REGNO == -1 to get - them all. We actually fetch more than requested, when convenient, - marking them as valid so we won't fetch them again. */ - -void -fetch_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - int i; - - /* We should never be called with deferred stores, because a prerequisite - for writing regs is to have fetched them all (PREPARE_TO_STORE), sigh. */ - if (deferred_stores) abort(); - - DO_DEFERRED_STORES; - - /* Global and Out regs are fetched directly, as well as the control - registers. If we're getting one of the in or local regs, - and the stack pointer has not yet been fetched, - we have to do that first, since they're found in memory relative - to the stack pointer. */ - if (regno < O7_REGNUM /* including -1 */ - || regno >= Y_REGNUM - || (!register_valid[SP_REGNUM] && regno < I7_REGNUM)) - { - if (0 != ptrace (PTRACE_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0)) - perror("ptrace_getregs"); - - registers[REGISTER_BYTE (0)] = 0; - memcpy (®isters[REGISTER_BYTE (1)], &inferior_registers.r_g1, - 15 * REGISTER_RAW_SIZE (G0_REGNUM)); - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; - *(int *)®isters[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc; - *(int *)®isters[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y; - - for (i = G0_REGNUM; i <= O7_REGNUM; i++) - register_valid[i] = 1; - register_valid[Y_REGNUM] = 1; - register_valid[PS_REGNUM] = 1; - register_valid[PC_REGNUM] = 1; - register_valid[NPC_REGNUM] = 1; - /* If we don't set these valid, read_register_bytes() rereads - all the regs every time it is called! FIXME. */ - register_valid[WIM_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[TBR_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[FPS_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[CPS_REGNUM] = 1; /* Not true yet, FIXME */ - } - - /* Floating point registers */ - if (regno == -1 || (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31)) - { - if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, - 0)) - perror("ptrace_getfpregs"); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fpu_fr); - /* bcopy (&inferior_fp_registers.Fpu_fsr, - ®isters[REGISTER_BYTE (FPS_REGNUM)], - sizeof (FPU_FSR_TYPE)); FIXME??? -- gnu@cyg */ - for (i = FP0_REGNUM; i <= FP0_REGNUM+31; i++) - register_valid[i] = 1; - register_valid[FPS_REGNUM] = 1; - } - - /* These regs are saved on the stack by the kernel. Only read them - all (16 ptrace calls!) if we really need them. */ - if (regno == -1) - { - target_xfer_memory (*(CORE_ADDR*)®isters[REGISTER_BYTE (SP_REGNUM)], - ®isters[REGISTER_BYTE (L0_REGNUM)], - 16*REGISTER_RAW_SIZE (L0_REGNUM), 0); - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - register_valid[i] = 1; - } - else if (regno >= L0_REGNUM && regno <= I7_REGNUM) - { - CORE_ADDR sp = *(CORE_ADDR*)®isters[REGISTER_BYTE (SP_REGNUM)]; - i = REGISTER_BYTE (regno); - if (register_valid[regno]) - printf("register %d valid and read\n", regno); - target_xfer_memory (sp + i - REGISTER_BYTE (L0_REGNUM), - ®isters[i], REGISTER_RAW_SIZE (regno), 0); - register_valid[regno] = 1; - } -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - int wanna_store = INT_REGS + STACK_REGS + FP_REGS; - - /* First decide which pieces of machine-state we need to modify. - Default for regno == -1 case is all pieces. */ - if (regno >= 0) - if (FP0_REGNUM <= regno && regno < FP0_REGNUM + 32) - { - wanna_store = FP_REGS; - } - else - { - if (regno == SP_REGNUM) - wanna_store = INT_REGS + STACK_REGS; - else if (regno < L0_REGNUM || regno > I7_REGNUM) - wanna_store = INT_REGS; - else - wanna_store = STACK_REGS; - } - - /* See if we're forcing the stores to happen now, or deferring. */ - if (regno == -2) - { - wanna_store = deferred_stores; - deferred_stores = 0; - } - else - { - if (wanna_store == STACK_REGS) - { - /* Fall through and just store one stack reg. If we deferred - it, we'd have to store them all, or remember more info. */ - } - else - { - deferred_stores |= wanna_store; - return; - } - } - - if (wanna_store & STACK_REGS) - { - CORE_ADDR sp = *(CORE_ADDR *)®isters[REGISTER_BYTE (SP_REGNUM)]; - - if (regno < 0 || regno == SP_REGNUM) - { - if (!register_valid[L0_REGNUM+5]) abort(); - target_xfer_memory (sp, - ®isters[REGISTER_BYTE (L0_REGNUM)], - 16*REGISTER_RAW_SIZE (L0_REGNUM), 1); - } - else - { - if (!register_valid[regno]) abort(); - target_xfer_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM), - ®isters[REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno), 1); - } - - } - - if (wanna_store & INT_REGS) - { - if (!register_valid[G1_REGNUM]) abort(); - - memcpy (&inferior_registers.r_g1, ®isters[REGISTER_BYTE (G1_REGNUM)], - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); - - inferior_registers.r_ps = - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_registers.r_pc = - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)]; - inferior_registers.r_npc = - *(int *)®isters[REGISTER_BYTE (NPC_REGNUM)]; - inferior_registers.r_y = - *(int *)®isters[REGISTER_BYTE (Y_REGNUM)]; - - if (0 != ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0)) - perror("ptrace_setregs"); - } - - if (wanna_store & FP_REGS) - { - if (!register_valid[FP0_REGNUM+9]) abort(); - memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.fpu_fr); - -/* memcpy (&inferior_fp_registers.Fpu_fsr, - ®isters[REGISTER_BYTE (FPS_REGNUM)], sizeof (FPU_FSR_TYPE)); -****/ - if (0 != - ptrace (PTRACE_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0)) - perror("ptrace_setfpregs"); - } -} - - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, ignore) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int ignore; /* reg addr, unused in this version */ -{ - - if (which == 0) { - - /* Integer registers */ - -#define gregs ((struct regs *)core_reg_sect) - /* G0 *always* holds 0. */ - *(int *)®isters[REGISTER_BYTE (0)] = 0; - - /* The globals and output registers. */ - memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1, - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; - *(int *)®isters[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc; - *(int *)®isters[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y; - - /* My best guess at where to get the locals and input - registers is exactly where they usually are, right above - the stack pointer. If the core dump was caused by a bus error - from blowing away the stack pointer (as is possible) then this - won't work, but it's worth the try. */ - { - int sp; - - sp = *(int *)®isters[REGISTER_BYTE (SP_REGNUM)]; - if (0 != target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM))) - { - /* fprintf so user can still use gdb */ - fprintf (stderr, - "Couldn't read input and local registers from core file\n"); - } - } - } else if (which == 2) { - - /* Floating point registers */ - -#define fpuregs ((struct fpu *) core_reg_sect) - if (core_reg_size >= sizeof (struct fpu)) - { - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fpuregs->fpu_regs, - sizeof (fpuregs->fpu_regs)); - memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr, - sizeof (FPU_FSR_TYPE)); - } - else - fprintf (stderr, "Couldn't read float regs from core file\n"); - } -} - diff --git a/gdb/nat-sun4os4.h b/gdb/nat-sun4os4.h index d871289..e69de29 100644 --- a/gdb/nat-sun4os4.h +++ b/gdb/nat-sun4os4.h @@ -1,27 +0,0 @@ -/* Macro definitions for running gdb on a Sun 4 running sunos 4. - Copyright (C) 1989, 1992, Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Do implement the attach and detach commands. */ - -#define ATTACH_DETACH - -/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ - -#define FETCH_INFERIOR_REGISTERS - diff --git a/gdb/nat-trash.h b/gdb/nat-trash.h index 38bed5a..e69de29 100644 --- a/gdb/nat-trash.h +++ b/gdb/nat-trash.h @@ -1,2 +0,0 @@ -/* this file is temporary scaffolding until all hosts have the - native/target/host split in place. FIXME. */ diff --git a/gdb/np1-opcode.h b/gdb/np1-opcode.h deleted file mode 100755 index 7e1001d..0000000 --- a/gdb/np1-opcode.h +++ /dev/null @@ -1,422 +0,0 @@ -/* Print GOULD NPL instructions for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -struct gld_opcode -{ - char *name; - unsigned long opcode; - unsigned long mask; - char *args; - int length; -}; - -/* We store four bytes of opcode for all opcodes because that - is the most any of them need. The actual length of an instruction - is always at least 2 bytes, and at most four. The length of the - instruction is based on the opcode. - - The mask component is a mask saying which bits must match - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing characters - that are used to format the arguments to the instruction. */ - -/* Kinds of operands: - r Register in first field - R Register in second field - b Base register in first field - B Base register in second field - v Vector register in first field - V Vector register in first field - A Optional address register (base register) - X Optional index register - I Immediate data (16bits signed) - O Offset field (16bits signed) - h Offset field (15bits signed) - d Offset field (14bits signed) - S Shift count field - - any other characters are printed as is... -*/ - -/* The assembler requires that this array be sorted as follows: - all instances of the same mnemonic must be consecutive. - All instances of the same mnemonic with the same number of operands - must be consecutive. - */ -struct gld_opcode gld_opcodes[] = -{ -{ "lb", 0xb4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnb", 0xb8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lbs", 0xec080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lh", 0xb4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lnh", 0xb8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lw", 0xb4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnw", 0xb8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "ld", 0xb4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lnd", 0xb8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "li", 0xf8000000, 0xfc7f0000, "r,I", 4 }, -{ "lpa", 0x50080000, 0xfc080000, "r,xOA,X", 4 }, -{ "la", 0x50000000, 0xfc080000, "r,xOA,X", 4 }, -{ "labr", 0x58080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lbp", 0x90080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lhp", 0x90000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lwp", 0x90000000, 0xfc080000, "r,xOA,X", 4 }, -{ "ldp", 0x90000002, 0xfc080002, "r,xOA,X", 4 }, -{ "suabr", 0x58000000, 0xfc080000, "b,xOA,X", 4 }, -{ "lf", 0xbc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lfbr", 0xbc080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lwbr", 0x5c000000, 0xfc080000, "b,xOA,X", 4 }, -{ "stb", 0xd4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sth", 0xd4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stw", 0xd4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "std", 0xd4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stf", 0xdc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stfbr", 0xdc080000, 0xfc080000, "b,xOA,X", 4 }, -{ "stwbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 }, -{ "zmb", 0xd8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "zmh", 0xd8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "zmw", 0xd8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "zmd", 0xd8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stbp", 0x94080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sthp", 0x94000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stwp", 0x94000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stdp", 0x94000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lil", 0xf80b0000, 0xfc7f0000, "r,D", 4 }, -{ "lwsl1", 0xec000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lwsl2", 0xfc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lwsl3", 0xfc080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "lvb", 0xb0080000, 0xfc080000, "v,xOA,X", 4 }, -{ "lvh", 0xb0000001, 0xfc080001, "v,xOA,X", 4 }, -{ "lvw", 0xb0000000, 0xfc080000, "v,xOA,X", 4 }, -{ "lvd", 0xb0000002, 0xfc080002, "v,xOA,X", 4 }, -{ "liv", 0x3c040000, 0xfc0f0000, "v,R", 2 }, -{ "livf", 0x3c080000, 0xfc0f0000, "v,R", 2 }, -{ "stvb", 0xd0080000, 0xfc080000, "v,xOA,X", 4 }, -{ "stvh", 0xd0000001, 0xfc080001, "v,xOA,X", 4 }, -{ "stvw", 0xd0000000, 0xfc080000, "v,xOA,X", 4 }, -{ "stvd", 0xd0000002, 0xfc080002, "v,xOA,X", 4 }, - -{ "trr", 0x2c000000, 0xfc0f0000, "r,R", 2 }, -{ "trn", 0x2c040000, 0xfc0f0000, "r,R", 2 }, -{ "trnd", 0x2c0c0000, 0xfc0f0000, "r,R", 2 }, -{ "trabs", 0x2c010000, 0xfc0f0000, "r,R", 2 }, -{ "trabsd", 0x2c090000, 0xfc0f0000, "r,R", 2 }, -{ "trc", 0x2c030000, 0xfc0f0000, "r,R", 2 }, -{ "xcr", 0x28040000, 0xfc0f0000, "r,R", 2 }, -{ "cxcr", 0x2c060000, 0xfc0f0000, "r,R", 2 }, -{ "cxcrd", 0x2c0e0000, 0xfc0f0000, "r,R", 2 }, -{ "tbrr", 0x2c020000, 0xfc0f0000, "r,B", 2 }, -{ "trbr", 0x28030000, 0xfc0f0000, "b,R", 2 }, -{ "xcbr", 0x28020000, 0xfc0f0000, "b,B", 2 }, -{ "tbrbr", 0x28010000, 0xfc0f0000, "b,B", 2 }, - -{ "trvv", 0x28050000, 0xfc0f0000, "v,V", 2 }, -{ "trvvn", 0x2c050000, 0xfc0f0000, "v,V", 2 }, -{ "trvvnd", 0x2c0d0000, 0xfc0f0000, "v,V", 2 }, -{ "trvab", 0x2c070000, 0xfc0f0000, "v,V", 2 }, -{ "trvabd", 0x2c0f0000, 0xfc0f0000, "v,V", 2 }, -{ "cmpv", 0x14060000, 0xfc0f0000, "v,V", 2 }, -{ "expv", 0x14070000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvlt", 0x10030000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvle", 0x10040000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvgt", 0x14030000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvge", 0x14040000, 0xfc0f0000, "v,V", 2 }, -{ "mrvveq", 0x10050000, 0xfc0f0000, "v,V", 2 }, -{ "mrvvne", 0x10050000, 0xfc0f0000, "v,V", 2 }, -{ "mrvrlt", 0x100d0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrle", 0x100e0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrgt", 0x140d0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrge", 0x140e0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvreq", 0x100f0000, 0xfc0f0000, "v,R", 2 }, -{ "mrvrne", 0x140f0000, 0xfc0f0000, "v,R", 2 }, -{ "trvr", 0x140b0000, 0xfc0f0000, "r,V", 2 }, -{ "trrv", 0x140c0000, 0xfc0f0000, "v,R", 2 }, - -{ "bu", 0x40000000, 0xff880000, "xOA,X", 4 }, -{ "bns", 0x70080000, 0xff880000, "xOA,X", 4 }, -{ "bnco", 0x70880000, 0xff880000, "xOA,X", 4 }, -{ "bge", 0x71080000, 0xff880000, "xOA,X", 4 }, -{ "bne", 0x71880000, 0xff880000, "xOA,X", 4 }, -{ "bunge", 0x72080000, 0xff880000, "xOA,X", 4 }, -{ "bunle", 0x72880000, 0xff880000, "xOA,X", 4 }, -{ "bgt", 0x73080000, 0xff880000, "xOA,X", 4 }, -{ "bnany", 0x73880000, 0xff880000, "xOA,X", 4 }, -{ "bs" , 0x70000000, 0xff880000, "xOA,X", 4 }, -{ "bco", 0x70800000, 0xff880000, "xOA,X", 4 }, -{ "blt", 0x71000000, 0xff880000, "xOA,X", 4 }, -{ "beq", 0x71800000, 0xff880000, "xOA,X", 4 }, -{ "buge", 0x72000000, 0xff880000, "xOA,X", 4 }, -{ "bult", 0x72800000, 0xff880000, "xOA,X", 4 }, -{ "ble", 0x73000000, 0xff880000, "xOA,X", 4 }, -{ "bany", 0x73800000, 0xff880000, "xOA,X", 4 }, -{ "brlnk", 0x44000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bib", 0x48000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bih", 0x48080000, 0xfc080000, "r,xOA,X", 4 }, -{ "biw", 0x4c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bid", 0x4c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivb", 0x60000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivh", 0x60080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivw", 0x64000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bivd", 0x64080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsb", 0x68000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsh", 0x68080000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsw", 0x6c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bvsd", 0x6c080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "camb", 0x80080000, 0xfc080000, "r,xOA,X", 4 }, -{ "camh", 0x80000001, 0xfc080001, "r,xOA,X", 4 }, -{ "camw", 0x80000000, 0xfc080000, "r,xOA,X", 4 }, -{ "camd", 0x80000002, 0xfc080002, "r,xOA,X", 4 }, -{ "car", 0x10000000, 0xfc0f0000, "r,R", 2 }, -{ "card", 0x14000000, 0xfc0f0000, "r,R", 2 }, -{ "ci", 0xf8050000, 0xfc7f0000, "r,I", 4 }, -{ "chkbnd", 0x5c080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "cavv", 0x10010000, 0xfc0f0000, "v,V", 2 }, -{ "cavr", 0x10020000, 0xfc0f0000, "v,R", 2 }, -{ "cavvd", 0x10090000, 0xfc0f0000, "v,V", 2 }, -{ "cavrd", 0x100b0000, 0xfc0f0000, "v,R", 2 }, - -{ "anmb", 0x84080000, 0xfc080000, "r,xOA,X", 4 }, -{ "anmh", 0x84000001, 0xfc080001, "r,xOA,X", 4 }, -{ "anmw", 0x84000000, 0xfc080000, "r,xOA,X", 4 }, -{ "anmd", 0x84000002, 0xfc080002, "r,xOA,X", 4 }, -{ "anr", 0x04000000, 0xfc0f0000, "r,R", 2 }, -{ "ani", 0xf8080000, 0xfc7f0000, "r,I", 4 }, -{ "ormb", 0xb8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "ormh", 0xb8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "ormw", 0xb8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "ormd", 0xb8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "orr", 0x08000000, 0xfc0f0000, "r,R", 2 }, -{ "oi", 0xf8090000, 0xfc7f0000, "r,I", 4 }, -{ "eomb", 0x8c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "eomh", 0x8c000001, 0xfc080001, "r,xOA,X", 4 }, -{ "eomw", 0x8c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "eomd", 0x8c000002, 0xfc080002, "r,xOA,X", 4 }, -{ "eor", 0x0c000000, 0xfc0f0000, "r,R", 2 }, -{ "eoi", 0xf80a0000, 0xfc7f0000, "r,I", 4 }, - -{ "anvv", 0x04010000, 0xfc0f0000, "v,V", 2 }, -{ "anvr", 0x04020000, 0xfc0f0000, "v,R", 2 }, -{ "orvv", 0x08010000, 0xfc0f0000, "v,V", 2 }, -{ "orvr", 0x08020000, 0xfc0f0000, "v,R", 2 }, -{ "eovv", 0x0c010000, 0xfc0f0000, "v,V", 2 }, -{ "eovr", 0x0c020000, 0xfc0f0000, "v,R", 2 }, - -{ "sacz", 0x100c0000, 0xfc0f0000, "r,R", 2 }, -{ "sla", 0x1c400000, 0xfc600000, "r,S", 2 }, -{ "sll", 0x1c600000, 0xfc600000, "r,S", 2 }, -{ "slc", 0x24400000, 0xfc600000, "r,S", 2 }, -{ "slad", 0x20400000, 0xfc600000, "r,S", 2 }, -{ "slld", 0x20600000, 0xfc600000, "r,S", 2 }, -{ "sra", 0x1c000000, 0xfc600000, "r,S", 2 }, -{ "srl", 0x1c200000, 0xfc600000, "r,S", 2 }, -{ "src", 0x24000000, 0xfc600000, "r,S", 2 }, -{ "srad", 0x20000000, 0xfc600000, "r,S", 2 }, -{ "srld", 0x20200000, 0xfc600000, "r,S", 2 }, -{ "sda", 0x3c030000, 0xfc0f0000, "r,R", 2 }, -{ "sdl", 0x3c020000, 0xfc0f0000, "r,R", 2 }, -{ "sdc", 0x3c010000, 0xfc0f0000, "r,R", 2 }, -{ "sdad", 0x3c0b0000, 0xfc0f0000, "r,R", 2 }, -{ "sdld", 0x3c0a0000, 0xfc0f0000, "r,R", 2 }, - -{ "svda", 0x3c070000, 0xfc0f0000, "v,R", 2 }, -{ "svdl", 0x3c060000, 0xfc0f0000, "v,R", 2 }, -{ "svdc", 0x3c050000, 0xfc0f0000, "v,R", 2 }, -{ "svdad", 0x3c0e0000, 0xfc0f0000, "v,R", 2 }, -{ "svdld", 0x3c0d0000, 0xfc0f0000, "v,R", 2 }, - -{ "sbm", 0xac080000, 0xfc080000, "f,xOA,X", 4 }, -{ "zbm", 0xac000000, 0xfc080000, "f,xOA,X", 4 }, -{ "tbm", 0xa8080000, 0xfc080000, "f,xOA,X", 4 }, -{ "incmb", 0xa0000000, 0xfc080000, "xOA,X", 4 }, -{ "incmh", 0xa0080000, 0xfc080000, "xOA,X", 4 }, -{ "incmw", 0xa4000000, 0xfc080000, "xOA,X", 4 }, -{ "incmd", 0xa4080000, 0xfc080000, "xOA,X", 4 }, -{ "sbmd", 0x7c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "zbmd", 0x7c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "tbmd", 0x78080000, 0xfc080000, "r,xOA,X", 4 }, - -{ "ssm", 0x9c080000, 0xfc080000, "f,xOA,X", 4 }, -{ "zsm", 0x9c000000, 0xfc080000, "f,xOA,X", 4 }, -{ "tsm", 0x98080000, 0xfc080000, "f,xOA,X", 4 }, - -{ "admb", 0xc8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "admh", 0xc8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "admw", 0xc8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "admd", 0xc8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "adr", 0x38000000, 0xfc0f0000, "r,R", 2 }, -{ "armb", 0xe8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "armh", 0xe8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "armw", 0xe8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "armd", 0xe8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "adi", 0xf8010000, 0xfc0f0000, "r,I", 4 }, -{ "sumb", 0xcc080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sumh", 0xcc000001, 0xfc080001, "r,xOA,X", 4 }, -{ "sumw", 0xcc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "sumd", 0xcc000002, 0xfc080002, "r,xOA,X", 4 }, -{ "sur", 0x3c000000, 0xfc0f0000, "r,R", 2 }, -{ "sui", 0xf8020000, 0xfc0f0000, "r,I", 4 }, -{ "mpmb", 0xc0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpmh", 0xc0000001, 0xfc080001, "r,xOA,X", 4 }, -{ "mpmw", 0xc0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpr", 0x38020000, 0xfc0f0000, "r,R", 2 }, -{ "mprd", 0x3c0f0000, 0xfc0f0000, "r,R", 2 }, -{ "mpi", 0xf8030000, 0xfc0f0000, "r,I", 4 }, -{ "dvmb", 0xc4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvmh", 0xc4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "dvmw", 0xc4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvr", 0x380a0000, 0xfc0f0000, "r,R", 2 }, -{ "dvi", 0xf8040000, 0xfc0f0000, "r,I", 4 }, -{ "exs", 0x38080000, 0xfc0f0000, "r,R", 2 }, - -{ "advv", 0x30000000, 0xfc0f0000, "v,V", 2 }, -{ "advvd", 0x30080000, 0xfc0f0000, "v,V", 2 }, -{ "adrv", 0x34000000, 0xfc0f0000, "v,R", 2 }, -{ "adrvd", 0x34080000, 0xfc0f0000, "v,R", 2 }, -{ "suvv", 0x30010000, 0xfc0f0000, "v,V", 2 }, -{ "suvvd", 0x30090000, 0xfc0f0000, "v,V", 2 }, -{ "surv", 0x34010000, 0xfc0f0000, "v,R", 2 }, -{ "survd", 0x34090000, 0xfc0f0000, "v,R", 2 }, -{ "mpvv", 0x30020000, 0xfc0f0000, "v,V", 2 }, -{ "mprv", 0x34020000, 0xfc0f0000, "v,R", 2 }, - -{ "adfw", 0xe0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "adfd", 0xe0080002, 0xfc080002, "r,xOA,X", 4 }, -{ "adrfw", 0x38010000, 0xfc0f0000, "r,R", 2 }, -{ "adrfd", 0x38090000, 0xfc0f0000, "r,R", 2 }, -{ "surfw", 0xe0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "surfd", 0xe0000002, 0xfc080002, "r,xOA,X", 4 }, -{ "surfw", 0x38030000, 0xfc0f0000, "r,R", 2 }, -{ "surfd", 0x380b0000, 0xfc0f0000, "r,R", 2 }, -{ "mpfw", 0xe4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpfd", 0xe4080002, 0xfc080002, "r,xOA,X", 4 }, -{ "mprfw", 0x38060000, 0xfc0f0000, "r,R", 2 }, -{ "mprfd", 0x380e0000, 0xfc0f0000, "r,R", 2 }, -{ "rfw", 0xe4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "rfd", 0xe4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "rrfw", 0x0c0e0000, 0xfc0f0000, "r", 2 }, -{ "rrfd", 0x0c0f0000, 0xfc0f0000, "r", 2 }, - -{ "advvfw", 0x30040000, 0xfc0f0000, "v,V", 2 }, -{ "advvfd", 0x300c0000, 0xfc0f0000, "v,V", 2 }, -{ "adrvfw", 0x34040000, 0xfc0f0000, "v,R", 2 }, -{ "adrvfd", 0x340c0000, 0xfc0f0000, "v,R", 2 }, -{ "suvvfw", 0x30050000, 0xfc0f0000, "v,V", 2 }, -{ "suvvfd", 0x300d0000, 0xfc0f0000, "v,V", 2 }, -{ "survfw", 0x34050000, 0xfc0f0000, "v,R", 2 }, -{ "survfd", 0x340d0000, 0xfc0f0000, "v,R", 2 }, -{ "mpvvfw", 0x30060000, 0xfc0f0000, "v,V", 2 }, -{ "mpvvfd", 0x300e0000, 0xfc0f0000, "v,V", 2 }, -{ "mprvfw", 0x34060000, 0xfc0f0000, "v,R", 2 }, -{ "mprvfd", 0x340e0000, 0xfc0f0000, "v,R", 2 }, -{ "rvfw", 0x30070000, 0xfc0f0000, "v", 2 }, -{ "rvfd", 0x300f0000, 0xfc0f0000, "v", 2 }, - -{ "fltw", 0x38070000, 0xfc0f0000, "r,R", 2 }, -{ "fltd", 0x380f0000, 0xfc0f0000, "r,R", 2 }, -{ "fixw", 0x38050000, 0xfc0f0000, "r,R", 2 }, -{ "fixd", 0x380d0000, 0xfc0f0000, "r,R", 2 }, -{ "cfpds", 0x3c090000, 0xfc0f0000, "r,R", 2 }, - -{ "fltvw", 0x080d0000, 0xfc0f0000, "v,V", 2 }, -{ "fltvd", 0x080f0000, 0xfc0f0000, "v,V", 2 }, -{ "fixvw", 0x080c0000, 0xfc0f0000, "v,V", 2 }, -{ "fixvd", 0x080e0000, 0xfc0f0000, "v,V", 2 }, -{ "cfpvds", 0x0c0d0000, 0xfc0f0000, "v,V", 2 }, - -{ "orvrn", 0x000a0000, 0xfc0f0000, "r,V", 2 }, -{ "andvrn", 0x00080000, 0xfc0f0000, "r,V", 2 }, -{ "frsteq", 0x04090000, 0xfc0f0000, "r,V", 2 }, -{ "sigma", 0x0c080000, 0xfc0f0000, "r,V", 2 }, -{ "sigmad", 0x0c0a0000, 0xfc0f0000, "r,V", 2 }, -{ "sigmf", 0x08080000, 0xfc0f0000, "r,V", 2 }, -{ "sigmfd", 0x080a0000, 0xfc0f0000, "r,V", 2 }, -{ "prodf", 0x04080000, 0xfc0f0000, "r,V", 2 }, -{ "prodfd", 0x040a0000, 0xfc0f0000, "r,V", 2 }, -{ "maxv", 0x10080000, 0xfc0f0000, "r,V", 2 }, -{ "maxvd", 0x100a0000, 0xfc0f0000, "r,V", 2 }, -{ "minv", 0x14080000, 0xfc0f0000, "r,V", 2 }, -{ "minvd", 0x140a0000, 0xfc0f0000, "r,V", 2 }, - -{ "lpsd", 0xf0000000, 0xfc080000, "xOA,X", 4 }, -{ "ldc", 0xf0080000, 0xfc080000, "xOA,X", 4 }, -{ "spm", 0x040c0000, 0xfc0f0000, "r", 2 }, -{ "rpm", 0x040d0000, 0xfc0f0000, "r", 2 }, -{ "tritr", 0x00070000, 0xfc0f0000, "r", 2 }, -{ "trrit", 0x00060000, 0xfc0f0000, "r", 2 }, -{ "rpswt", 0x04080000, 0xfc0f0000, "r", 2 }, -{ "exr", 0xf8070000, 0xfc0f0000, "", 4 }, -{ "halt", 0x00000000, 0xfc0f0000, "", 2 }, -{ "wait", 0x00010000, 0xfc0f0000, "", 2 }, -{ "nop", 0x00020000, 0xfc0f0000, "", 2 }, -{ "eiae", 0x00030000, 0xfc0f0000, "", 2 }, -{ "efae", 0x000d0000, 0xfc0f0000, "", 2 }, -{ "diae", 0x000e0000, 0xfc0f0000, "", 2 }, -{ "dfae", 0x000f0000, 0xfc0f0000, "", 2 }, -{ "spvc", 0xf8060000, 0xfc0f0000, "r,T,N", 4 }, -{ "rdsts", 0x00090000, 0xfc0f0000, "r", 2 }, -{ "setcpu", 0x000c0000, 0xfc0f0000, "r", 2 }, -{ "cmc", 0x000b0000, 0xfc0f0000, "r", 2 }, -{ "trrcu", 0x00040000, 0xfc0f0000, "r", 2 }, -{ "attnio", 0x00050000, 0xfc0f0000, "", 2 }, -{ "fudit", 0x28080000, 0xfc0f0000, "", 2 }, -{ "break", 0x28090000, 0xfc0f0000, "", 2 }, -{ "frzss", 0x280a0000, 0xfc0f0000, "", 2 }, -{ "ripi", 0x04040000, 0xfc0f0000, "r,R", 2 }, -{ "xcp", 0x04050000, 0xfc0f0000, "r", 2 }, -{ "block", 0x04060000, 0xfc0f0000, "", 2 }, -{ "unblock", 0x04070000, 0xfc0f0000, "", 2 }, -{ "trsc", 0x08060000, 0xfc0f0000, "r,R", 2 }, -{ "tscr", 0x08070000, 0xfc0f0000, "r,R", 2 }, -{ "fq", 0x04080000, 0xfc0f0000, "r", 2 }, -{ "flupte", 0x2c080000, 0xfc0f0000, "r", 2 }, -{ "rviu", 0x040f0000, 0xfc0f0000, "", 2 }, -{ "ldel", 0x280c0000, 0xfc0f0000, "r,R", 2 }, -{ "ldu", 0x280d0000, 0xfc0f0000, "r,R", 2 }, -{ "stdecc", 0x280b0000, 0xfc0f0000, "r,R", 2 }, -{ "trpc", 0x08040000, 0xfc0f0000, "r", 2 }, -{ "tpcr", 0x08050000, 0xfc0f0000, "r", 2 }, -{ "ghalt", 0x0c050000, 0xfc0f0000, "r", 2 }, -{ "grun", 0x0c040000, 0xfc0f0000, "", 2 }, -{ "tmpr", 0x2c0a0000, 0xfc0f0000, "r,R", 2 }, -{ "trmp", 0x2c0b0000, 0xfc0f0000, "r,R", 2 }, - -{ "trrve", 0x28060000, 0xfc0f0000, "r", 2 }, -{ "trver", 0x28070000, 0xfc0f0000, "r", 2 }, -{ "trvlr", 0x280f0000, 0xfc0f0000, "r", 2 }, - -{ "linkfl", 0x18000000, 0xfc0f0000, "r,R", 2 }, -{ "linkbl", 0x18020000, 0xfc0f0000, "r,R", 2 }, -{ "linkfp", 0x18010000, 0xfc0f0000, "r,R", 2 }, -{ "linkbp", 0x18030000, 0xfc0f0000, "r,R", 2 }, -{ "linkpl", 0x18040000, 0xfc0f0000, "r,R", 2 }, -{ "ulinkl", 0x18080000, 0xfc0f0000, "r,R", 2 }, -{ "ulinkp", 0x18090000, 0xfc0f0000, "r,R", 2 }, -{ "ulinktl", 0x180a0000, 0xfc0f0000, "r,R", 2 }, -{ "ulinktp", 0x180b0000, 0xfc0f0000, "r,R", 2 }, -}; - -int numopcodes = sizeof(gld_opcodes) / sizeof(gld_opcodes[0]); - -struct gld_opcode *endop = gld_opcodes + sizeof(gld_opcodes) / - sizeof(gld_opcodes[0]); diff --git a/gdb/obstack.c b/gdb/obstack.c deleted file mode 100755 index 590fcaa..0000000 --- a/gdb/obstack.c +++ /dev/null @@ -1,333 +0,0 @@ -/* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 1, or (at your option) any -later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "obstack.h" - -#ifdef __STDC__ -#define POINTER void * -#else -#define POINTER char * -#endif - -/* Determine default alignment. */ -struct fooalign {char x; double d;}; -#define DEFAULT_ALIGNMENT ((char *)&((struct fooalign *) 0)->d - (char *)0) -/* If malloc were really smart, it would round addresses to DEFAULT_ALIGNMENT. - But in fact it might be less smart and round addresses to as much as - DEFAULT_ROUNDING. So we prepare for it to do that. */ -union fooround {long x; double d;}; -#define DEFAULT_ROUNDING (sizeof (union fooround)) - -/* When we copy a long block of data, this is the unit to do it with. - On some machines, copying successive ints does not work; - in such a case, redefine COPYING_UNIT to `long' (if that works) - or `char' as a last resort. */ -#ifndef COPYING_UNIT -#define COPYING_UNIT int -#endif - -/* The non-GNU-C macros copy the obstack into this global variable - to avoid multiple evaluation. */ - -struct obstack *_obstack; - -/* Initialize an obstack H for use. Specify chunk size SIZE (0 means default). - Objects start on multiples of ALIGNMENT (0 means use default). - CHUNKFUN is the function to use to allocate chunks, - and FREEFUN the function to free them. */ - -void -_obstack_begin (h, size, alignment, chunkfun, freefun) - struct obstack *h; - int size; - int alignment; - POINTER (*chunkfun) (); - void (*freefun) (); -{ - register struct _obstack_chunk* chunk; /* points to new chunk */ - - if (alignment == 0) - alignment = DEFAULT_ALIGNMENT; - if (size == 0) - /* Default size is what GNU malloc can fit in a 4096-byte block. */ - { - /* 12 is sizeof (mhead) and 4 is EXTRA from GNU malloc. - Use the values for range checking, because if range checking is off, - the extra bytes won't be missed terribly, but if range checking is on - and we used a larger request, a whole extra 4096 bytes would be - allocated. - - These number are irrelevant to the new GNU malloc. I suspect it is - less sensitive to the size of the request. */ - int extra = ((((12 + DEFAULT_ROUNDING - 1) & ~(DEFAULT_ROUNDING - 1)) - + 4 + DEFAULT_ROUNDING - 1) - & ~(DEFAULT_ROUNDING - 1)); - size = 4096 - extra; - } - - h->chunkfun = chunkfun; - h->freefun = freefun; - h->chunk_size = size; - h->alignment_mask = alignment - 1; - - chunk = h->chunk = (struct _obstack_chunk *)(*h->chunkfun) (h->chunk_size); - h->next_free = h->object_base = chunk->contents; - h->chunk_limit = chunk->limit - = (char *) chunk + h->chunk_size; - chunk->prev = 0; -} - -/* Allocate a new current chunk for the obstack *H - on the assumption that LENGTH bytes need to be added - to the current object, or a new object of length LENGTH allocated. - Copies any partial object from the end of the old chunk - to the beginning of the new one. - - The function must be "int" so it can be used in non-ANSI C - compilers in a : expression. */ - -int -_obstack_newchunk (h, length) - struct obstack *h; - int length; -{ - register struct _obstack_chunk* old_chunk = h->chunk; - register struct _obstack_chunk* new_chunk; - register long new_size; - register int obj_size = h->next_free - h->object_base; - register int i; - int already; - - /* Compute size for new chunk. */ - new_size = (obj_size + length) + (obj_size >> 3) + 100; - if (new_size < h->chunk_size) - new_size = h->chunk_size; - - /* Allocate and initialize the new chunk. */ - new_chunk = h->chunk = (struct _obstack_chunk *)(*h->chunkfun) (new_size); - new_chunk->prev = old_chunk; - new_chunk->limit = h->chunk_limit = (char *) new_chunk + new_size; - - /* Move the existing object to the new chunk. - Word at a time is fast and is safe if the object - is sufficiently aligned. */ - if (h->alignment_mask + 1 >= DEFAULT_ALIGNMENT) - { - for (i = obj_size / sizeof (COPYING_UNIT) - 1; - i >= 0; i--) - ((COPYING_UNIT *)new_chunk->contents)[i] - = ((COPYING_UNIT *)h->object_base)[i]; - /* We used to copy the odd few remaining bytes as one extra COPYING_UNIT, - but that can cross a page boundary on a machine - which does not do strict alignment for COPYING_UNITS. */ - already = obj_size / sizeof (COPYING_UNIT) * sizeof (COPYING_UNIT); - } - else - already = 0; - /* Copy remaining bytes one by one. */ - for (i = already; i < obj_size; i++) - new_chunk->contents[i] = h->object_base[i]; - - h->object_base = new_chunk->contents; - h->next_free = h->object_base + obj_size; -} - -/* Return nonzero if object OBJ has been allocated from obstack H. - This is here for debugging. - If you use it in a program, you are probably losing. */ - -int -_obstack_allocated_p (h, obj) - struct obstack *h; - POINTER obj; -{ - register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk* plp; /* point to previous chunk if any */ - - lp = (h)->chunk; - while (lp != 0 && ((POINTER)lp > obj || (POINTER)(lp)->limit < obj)) - { - plp = lp -> prev; - lp = plp; - } - return lp != 0; -} - -/* Free objects in obstack H, including OBJ and everything allocate - more recently than OBJ. If OBJ is zero, free everything in H. */ - -#ifdef __STDC__ -#undef obstack_free -void -obstack_free (struct obstack *h, POINTER obj) -#else -int -_obstack_free (h, obj) - struct obstack *h; - POINTER obj; -#endif -{ - register struct _obstack_chunk* lp; /* below addr of any objects in this chunk */ - register struct _obstack_chunk* plp; /* point to previous chunk if any */ - - lp = (h)->chunk; - /* We use >= because there cannot be an object at the beginning of a chunk. - But there can be an empty object at that address - at the end of another chunk. */ - while (lp != 0 && ((POINTER)lp >= obj || (POINTER)(lp)->limit < obj)) - { - plp = lp -> prev; - (*h->freefun) ((POINTER) lp); - lp = plp; - } - if (lp) - { - (h)->object_base = (h)->next_free = (char *)(obj); - (h)->chunk_limit = lp->limit; - (h)->chunk = lp; - } - else if (obj != 0) - /* obj is not in any of the chunks! */ - abort (); -} - -/* Let same .o link with output of gcc and other compilers. */ - -#ifdef __STDC__ -int -_obstack_free (h, obj) - struct obstack *h; - POINTER obj; -{ - obstack_free (h, obj); -} -#endif - -/* #if 0 */ -/* These are now turned off because the applications do not use it - and it uses bcopy via obstack_grow, which causes trouble on sysV. */ - -/* Now define the functional versions of the obstack macros. - Define them to simply use the corresponding macros to do the job. */ - -#ifdef __STDC__ -/* These function definitions do not work with non-ANSI preprocessors; - they won't pass through the macro names in parentheses. */ - -/* The function names appear in parentheses in order to prevent - the macro-definitions of the names from being expanded there. */ - -POINTER (obstack_base) (obstack) - struct obstack *obstack; -{ - return obstack_base (obstack); -} - -POINTER (obstack_next_free) (obstack) - struct obstack *obstack; -{ - return obstack_next_free (obstack); -} - -int (obstack_object_size) (obstack) - struct obstack *obstack; -{ - return obstack_object_size (obstack); -} - -int (obstack_room) (obstack) - struct obstack *obstack; -{ - return obstack_room (obstack); -} - -void (obstack_grow) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - obstack_grow (obstack, pointer, length); -} - -void (obstack_grow0) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - obstack_grow0 (obstack, pointer, length); -} - -void (obstack_1grow) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow (obstack, character); -} - -void (obstack_blank) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank (obstack, length); -} - -void (obstack_1grow_fast) (obstack, character) - struct obstack *obstack; - int character; -{ - obstack_1grow_fast (obstack, character); -} - -void (obstack_blank_fast) (obstack, length) - struct obstack *obstack; - int length; -{ - obstack_blank_fast (obstack, length); -} - -POINTER (obstack_finish) (obstack) - struct obstack *obstack; -{ - return obstack_finish (obstack); -} - -POINTER (obstack_alloc) (obstack, length) - struct obstack *obstack; - int length; -{ - return obstack_alloc (obstack, length); -} - -POINTER (obstack_copy) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - return obstack_copy (obstack, pointer, length); -} - -POINTER (obstack_copy0) (obstack, pointer, length) - struct obstack *obstack; - POINTER pointer; - int length; -{ - return obstack_copy0 (obstack, pointer, length); -} - -#endif /* __STDC__ */ - -/* #endif 0 */ diff --git a/gdb/obstack.h b/gdb/obstack.h deleted file mode 100755 index 2e80c9c..0000000 --- a/gdb/obstack.h +++ /dev/null @@ -1,416 +0,0 @@ -/* obstack.h - object stack macros - Copyright (C) 1988 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 1, or (at your option) any -later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Summary: - -All the apparent functions defined here are macros. The idea -is that you would use these pre-tested macros to solve a -very specific set of problems, and they would run fast. -Caution: no side-effects in arguments please!! They may be -evaluated MANY times!! - -These macros operate a stack of objects. Each object starts life -small, and may grow to maturity. (Consider building a word syllable -by syllable.) An object can move while it is growing. Once it has -been "finished" it never changes address again. So the "top of the -stack" is typically an immature growing object, while the rest of the -stack is of mature, fixed size and fixed address objects. - -These routines grab large chunks of memory, using a function you -supply, called `obstack_chunk_alloc'. On occasion, they free chunks, -by calling `obstack_chunk_free'. You must define them and declare -them before using any obstack macros. - -Each independent stack is represented by a `struct obstack'. -Each of the obstack macros expects a pointer to such a structure -as the first argument. - -One motivation for this package is the problem of growing char strings -in symbol tables. Unless you are "fascist pig with a read-only mind" -[Gosper's immortal quote from HAKMEM item 154, out of context] you -would not like to put any arbitrary upper limit on the length of your -symbols. - -In practice this often means you will build many short symbols and a -few long symbols. At the time you are reading a symbol you don't know -how long it is. One traditional method is to read a symbol into a -buffer, realloc()ating the buffer every time you try to read a symbol -that is longer than the buffer. This is beaut, but you still will -want to copy the symbol from the buffer to a more permanent -symbol-table entry say about half the time. - -With obstacks, you can work differently. Use one obstack for all symbol -names. As you read a symbol, grow the name in the obstack gradually. -When the name is complete, finalize it. Then, if the symbol exists already, -free the newly read name. - -The way we do this is to take a large chunk, allocating memory from -low addresses. When you want to build a symbol in the chunk you just -add chars above the current "high water mark" in the chunk. When you -have finished adding chars, because you got to the end of the symbol, -you know how long the chars are, and you can create a new object. -Mostly the chars will not burst over the highest address of the chunk, -because you would typically expect a chunk to be (say) 100 times as -long as an average object. - -In case that isn't clear, when we have enough chars to make up -the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) -so we just point to it where it lies. No moving of chars is -needed and this is the second win: potentially long strings need -never be explicitly shuffled. Once an object is formed, it does not -change its address during its lifetime. - -When the chars burst over a chunk boundary, we allocate a larger -chunk, and then copy the partly formed object from the end of the old -chunk to the beginning of the new larger chunk. We then carry on -accreting characters to the end of the object as we normally would. - -A special macro is provided to add a single char at a time to a -growing object. This allows the use of register variables, which -break the ordinary 'growth' macro. - -Summary: - We allocate large chunks. - We carve out one object at a time from the current chunk. - Once carved, an object never moves. - We are free to append data of any size to the currently - growing object. - Exactly one object is growing in an obstack at any one time. - You can run one obstack per control block. - You may have as many control blocks as you dare. - Because of the way we do it, you can `unwind' a obstack - back to a previous state. (You may remove objects much - as you would with a stack.) -*/ - - -/* Don't do the contents of this file more than once. */ - -#ifndef __OBSTACKS__ -#define __OBSTACKS__ - -/* We use subtraction of (char *)0 instead of casting to int - because on word-addressable machines a simple cast to int - may ignore the byte-within-word field of the pointer. */ - -#ifndef __PTR_TO_INT -#define __PTR_TO_INT(P) ((P) - (char *)0) -#endif - -#ifndef __INT_TO_PTR -#define __INT_TO_PTR(P) ((P) + (char *)0) -#endif - -struct _obstack_chunk /* Lives at front of each chunk. */ -{ - char *limit; /* 1 past end of this chunk */ - struct _obstack_chunk *prev; /* address of prior chunk or NULL */ - char contents[4]; /* objects begin here */ -}; - -struct obstack /* control current object in current chunk */ -{ - long chunk_size; /* preferred size to allocate chunks in */ - struct _obstack_chunk* chunk; /* address of current struct obstack_chunk */ - char *object_base; /* address of object we are building */ - char *next_free; /* where to add next char to current object */ - char *chunk_limit; /* address of char after current chunk */ - int temp; /* Temporary for some macros. */ - int alignment_mask; /* Mask of alignment for each object. */ -#ifdef __STDC__ - void *(*chunkfun) (); /* User's fcn to allocate a chunk. */ -#else - char *(*chunkfun) (); /* User's fcn to allocate a chunk. */ -#endif - void (*freefun) (); /* User's function to free a chunk. */ -}; - -#ifdef __STDC__ - -/* Do the function-declarations after the structs - but before defining the macros. */ - -void obstack_init (struct obstack *obstack); - -void * obstack_alloc (struct obstack *obstack, int size); - -void * obstack_copy (struct obstack *obstack, void *address, int size); -void * obstack_copy0 (struct obstack *obstack, void *address, int size); - -void obstack_free (struct obstack *obstack, void *block); - -void obstack_blank (struct obstack *obstack, int size); - -void obstack_grow (struct obstack *obstack, void *data, int size); -void obstack_grow0 (struct obstack *obstack, void *data, int size); - -void obstack_1grow (struct obstack *obstack, int data_char); -void obstack_ptr_grow (struct obstack *obstack, void *data); -void obstack_int_grow (struct obstack *obstack, int data); - -void * obstack_finish (struct obstack *obstack); - -int obstack_object_size (struct obstack *obstack); - -int obstack_room (struct obstack *obstack); -void obstack_1grow_fast (struct obstack *obstack, int data_char); -void obstack_ptr_grow_fast (struct obstack *obstack, void *data); -void obstack_int_grow_fast (struct obstack *obstack, int data); -void obstack_blank_fast (struct obstack *obstack, int size); - -void * obstack_base (struct obstack *obstack); -void * obstack_next_free (struct obstack *obstack); -int obstack_alignment_mask (struct obstack *obstack); -int obstack_chunk_size (struct obstack *obstack); - -#endif /* __STDC__ */ - -/* Non-ANSI C cannot really support alternative functions for these macros, - so we do not declare them. */ - -/* Pointer to beginning of object being allocated or to be allocated next. - Note that this might not be the final address of the object - because a new chunk might be needed to hold the final size. */ - -#define obstack_base(h) ((h)->object_base) - -/* Size for allocating ordinary chunks. */ - -#define obstack_chunk_size(h) ((h)->chunk_size) - -/* Pointer to next byte not yet allocated in current chunk. */ - -#define obstack_next_free(h) ((h)->next_free) - -/* Mask specifying low bits that should be clear in address of an object. */ - -#define obstack_alignment_mask(h) ((h)->alignment_mask) - -#define obstack_init(h) \ - _obstack_begin ((h), 0, 0, obstack_chunk_alloc, obstack_chunk_free) - -#define obstack_begin(h, size) \ - _obstack_begin ((h), (size), 0, obstack_chunk_alloc, obstack_chunk_free) - -#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar) - -#define obstack_blank_fast(h,n) ((h)->next_free += (n)) - -#if defined (__GNUC__) && defined (__STDC__) - -/* For GNU C, if not -traditional, - we can define these macros to compute all args only once - without using a global variable. - Also, we can avoid using the `temp' slot, to make faster code. */ - -#define obstack_object_size(OBSTACK) \ - ({ struct obstack *__o = (OBSTACK); \ - (unsigned) (__o->next_free - __o->object_base); }) - -#define obstack_room(OBSTACK) \ - ({ struct obstack *__o = (OBSTACK); \ - (unsigned) (__o->chunk_limit - __o->next_free); }) - -#define obstack_grow(OBSTACK,where,length) \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - ((__o->next_free + __len > __o->chunk_limit) \ - ? _obstack_newchunk (__o, __len) : 0); \ - bcopy (where, __o->next_free, __len); \ - __o->next_free += __len; \ - (void) 0; }) - -#define obstack_grow0(OBSTACK,where,length) \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - ((__o->next_free + __len + 1 > __o->chunk_limit) \ - ? _obstack_newchunk (__o, __len + 1) : 0), \ - bcopy (where, __o->next_free, __len), \ - __o->next_free += __len, \ - *(__o->next_free)++ = 0; \ - (void) 0; }) - -#define obstack_1grow(OBSTACK,datum) \ -({ struct obstack *__o = (OBSTACK); \ - ((__o->next_free + 1 > __o->chunk_limit) \ - ? _obstack_newchunk (__o, 1) : 0), \ - *(__o->next_free)++ = (datum); \ - (void) 0; }) - -/* These assume that the obstack alignment is good enough for pointers or ints, - and that the data added so far to the current object - shares that much alignment. */ - -#define obstack_ptr_grow(OBSTACK,datum) \ -({ struct obstack *__o = (OBSTACK); \ - ((__o->next_free + sizeof (void *) > __o->chunk_limit) \ - ? _obstack_newchunk (__o, sizeof (void *)) : 0), \ - *(*(void ***)&__o->next_free)++ = ((void *)datum); \ - (void) 0; }) - -#define obstack_int_grow(OBSTACK,datum) \ -({ struct obstack *__o = (OBSTACK); \ - ((__o->next_free + sizeof (int) > __o->chunk_limit) \ - ? _obstack_newchunk (__o, sizeof (int)) : 0), \ - *(*(int **)&__o->next_free)++ = ((int)datum); \ - (void) 0; }) - -#define obstack_ptr_grow_fast(h,aptr) (*(*(void ***)&(h)->next_free)++ = (void *)aptr) -#define obstack_int_grow_fast(h,aint) (*(*(int **)&(h)->next_free)++ = (int)aint) - -#define obstack_blank(OBSTACK,length) \ -({ struct obstack *__o = (OBSTACK); \ - int __len = (length); \ - ((__o->chunk_limit - __o->next_free < __len) \ - ? _obstack_newchunk (__o, __len) : 0); \ - __o->next_free += __len; \ - (void) 0; }) - -#define obstack_alloc(OBSTACK,length) \ -({ struct obstack *__h = (OBSTACK); \ - obstack_blank (__h, (length)); \ - obstack_finish (__h); }) - -#define obstack_copy(OBSTACK,where,length) \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow (__h, (where), (length)); \ - obstack_finish (__h); }) - -#define obstack_copy0(OBSTACK,where,length) \ -({ struct obstack *__h = (OBSTACK); \ - obstack_grow0 (__h, (where), (length)); \ - obstack_finish (__h); }) - -#define obstack_finish(OBSTACK) \ -({ struct obstack *__o = (OBSTACK); \ - void *value = (void *) __o->object_base; \ - __o->next_free \ - = __INT_TO_PTR ((__PTR_TO_INT (__o->next_free)+__o->alignment_mask)\ - & ~ (__o->alignment_mask)); \ - ((__o->next_free - (char *)__o->chunk \ - > __o->chunk_limit - (char *)__o->chunk) \ - ? (__o->next_free = __o->chunk_limit) : 0); \ - __o->object_base = __o->next_free; \ - value; }) - -#define obstack_free(OBSTACK, OBJ) \ -({ struct obstack *__o = (OBSTACK); \ - void *__obj = (OBJ); \ - if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = __obj; \ - else (obstack_free) (__o, __obj); }) - -#else /* not __GNUC__ or not __STDC__ */ - -#define obstack_object_size(h) \ - (unsigned) ((h)->next_free - (h)->object_base) - -#define obstack_room(h) \ - (unsigned) ((h)->chunk_limit - (h)->next_free) - -#define obstack_grow(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp > (h)->chunk_limit) \ - ? _obstack_newchunk ((h), (h)->temp) : 0), \ - bcopy (where, (h)->next_free, (h)->temp), \ - (h)->next_free += (h)->temp) - -#define obstack_grow0(h,where,length) \ -( (h)->temp = (length), \ - (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ - ? _obstack_newchunk ((h), (h)->temp + 1) : 0), \ - bcopy (where, (h)->next_free, (h)->temp), \ - (h)->next_free += (h)->temp, \ - *((h)->next_free)++ = 0) - -#define obstack_1grow(h,datum) \ -( (((h)->next_free + 1 > (h)->chunk_limit) \ - ? _obstack_newchunk ((h), 1) : 0), \ - *((h)->next_free)++ = (datum)) - -#define obstack_ptr_grow(h,datum) \ -( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ - ? _obstack_newchunk ((h), sizeof (char *)) : 0), \ - *(*(char ***)&(h)->next_free)++ = ((char *)datum)) - -#define obstack_int_grow(h,datum) \ -( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ - ? _obstack_newchunk ((h), sizeof (int)) : 0), \ - *(*(int **)&(h)->next_free)++ = ((int)datum)) - -#define obstack_ptr_grow_fast(h,aptr) (*(*(char ***)&(h)->next_free)++ = (char *)aptr) -#define obstack_int_grow_fast(h,aint) (*(*(int **)&(h)->next_free)++ = (int)aint) - -#define obstack_blank(h,length) \ -( (h)->temp = (length), \ - (((h)->chunk_limit - (h)->next_free < (h)->temp) \ - ? _obstack_newchunk ((h), (h)->temp) : 0), \ - (h)->next_free += (h)->temp) - -#define obstack_alloc(h,length) \ - (obstack_blank ((h), (length)), obstack_finish ((h))) - -#define obstack_copy(h,where,length) \ - (obstack_grow ((h), (where), (length)), obstack_finish ((h))) - -#define obstack_copy0(h,where,length) \ - (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) - -#define obstack_finish(h) \ -( (h)->temp = __PTR_TO_INT ((h)->object_base), \ - (h)->next_free \ - = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \ - & ~ ((h)->alignment_mask)), \ - (((h)->next_free - (char *)(h)->chunk \ - > (h)->chunk_limit - (char *)(h)->chunk) \ - ? ((h)->next_free = (h)->chunk_limit) : 0), \ - (h)->object_base = (h)->next_free, \ - __INT_TO_PTR ((h)->temp)) - -#ifdef __STDC__ -#define obstack_free(h,obj) \ -( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \ - (((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ - ? (int) ((h)->next_free = (h)->object_base \ - = (h)->temp + (char *) (h)->chunk) \ - : ((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0))) -#else -#define obstack_free(h,obj) \ -( (h)->temp = (char *)(obj) - (char *) (h)->chunk, \ - (((h)->temp >= 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ - ? (int) ((h)->next_free = (h)->object_base \ - = (h)->temp + (char *) (h)->chunk) \ - : (int) _obstack_free ((h), (h)->temp + (char *) (h)->chunk))) -#endif - -#endif /* not __GNUC__ or not __STDC__ */ - -/* Declare the external functions we use; they are in obstack.c. */ - -#ifdef __STDC__ - extern int _obstack_newchunk (struct obstack *h, int length); - extern int _obstack_free (struct obstack *h, void *obj); - extern void _obstack_begin (struct obstack *h, int size, int alignment, - void *(*chunkfun) (), void (*freefun) ()); -#else - extern int _obstack_newchunk (); - extern int _obstack_free (); - extern void _obstack_begin (); -#endif - -#endif /* not __OBSTACKS__ */ - diff --git a/gdb/param-no-tm.h b/gdb/param-no-tm.h deleted file mode 100755 index 96bc85a..0000000 --- a/gdb/param-no-tm.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 1990 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#if !defined (PARAM_H) -#define PARAM_H 1 - -/* DO NOT #include "tm.h" -- a particular tm file has been inc'd by caller */ - -#include "xm.h" - -/* TARGET_BYTE_ORDER and HOST_BYTE_ORDER should be defined to one of these. */ -#if !defined (BIG_ENDIAN) -#define BIG_ENDIAN 4321 -#endif - -#if !defined (LITTLE_ENDIAN) -#define LITTLE_ENDIAN 1234 -#endif - -/* The bit byte-order has to do just with numbering of bits in - debugging symbols and such. Conceptually, it's quite separate - from byte/word byte order. */ - -#if !defined (BITS_BIG_ENDIAN) -#if TARGET_BYTE_ORDER == BIG_ENDIAN -#define BITS_BIG_ENDIAN 1 -#endif /* Big endian. */ - -#if TARGET_BYTE_ORDER == LITTLE_ENDIAN -#define BITS_BIG_ENDIAN 0 -#endif /* Little endian. */ -#endif /* BITS_BIG_ENDIAN not defined. */ - -/* Swap LEN bytes at BUFFER between target and host byte-order. */ -#if TARGET_BYTE_ORDER == HOST_BYTE_ORDER -#define SWAP_TARGET_AND_HOST(buffer,len) -#else /* Target and host byte order differ. */ -#define SWAP_TARGET_AND_HOST(buffer,len) \ - { \ - char tmp; \ - char *p = (char *)(buffer); \ - char *q = ((char *)(buffer)) + len - 1; \ - for (; p < q; p++, q--) \ - { \ - tmp = *q; \ - *q = *p; \ - *p = tmp; \ - } \ - } -#endif /* Target and host byte order differ. */ - -/* On some machines there are bits in addresses which are not really - part of the address, but are used by the kernel, the hardware, etc. - for special purposes. ADDR_BITS_REMOVE takes out any such bits - so we get a "real" address such as one would find in a symbol - table. ADDR_BITS_SET sets those bits the way the system wants - them. */ -#if !defined (ADDR_BITS_REMOVE) -#define ADDR_BITS_REMOVE(addr) (addr) -#define ADDR_BITS_SET(addr) (addr) -#endif /* No ADDR_BITS_REMOVE. */ - -#if !defined (SYS_SIGLIST_MISSING) -#define SYS_SIGLIST_MISSING defined (USG) -#endif /* No SYS_SIGLIST_MISSING */ - -#endif /* param.h not already included. */ diff --git a/gdb/param.h b/gdb/param.h deleted file mode 100755 index b408a03..0000000 --- a/gdb/param.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (C) 1990 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* The standard thing is to include param.h. However, files that are - specific to a particular target can include that tm-xxx.h file and - param-no-tm.h. Any future inclusions of param.h will be protected - against by the #if !defined stuff below. */ - -/* This file requires defs.h. */ - -#if !defined (PARAM_H) -#include "tm.h" -#endif - -#include "param-no-tm.h" - -#define PARAM_H 1 diff --git a/gdb/pn-opcode.h b/gdb/pn-opcode.h deleted file mode 100755 index 77a2770..0000000 --- a/gdb/pn-opcode.h +++ /dev/null @@ -1,282 +0,0 @@ -/* Print GOULD PN (PowerNode) instructions for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -struct gld_opcode -{ - char *name; - unsigned long opcode; - unsigned long mask; - char *args; - int length; -}; - -/* We store four bytes of opcode for all opcodes because that - is the most any of them need. The actual length of an instruction - is always at least 2 bytes, and at most four. The length of the - instruction is based on the opcode. - - The mask component is a mask saying which bits must match - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing characters - that are used to format the arguments to the instruction. */ - -/* Kinds of operands: - r Register in first field - R Register in second field - b Base register in first field - B Base register in second field - v Vector register in first field - V Vector register in first field - A Optional address register (base register) - X Optional index register - I Immediate data (16bits signed) - O Offset field (16bits signed) - h Offset field (15bits signed) - d Offset field (14bits signed) - S Shift count field - - any other characters are printed as is... -*/ - -/* The assembler requires that this array be sorted as follows: - all instances of the same mnemonic must be consecutive. - All instances of the same mnemonic with the same number of operands - must be consecutive. - */ -struct gld_opcode gld_opcodes[] = -{ -{ "abm", 0xa0080000, 0xfc080000, "f,xOA,X", 4 }, -{ "abr", 0x18080000, 0xfc0c0000, "r,f", 2 }, -{ "aci", 0xfc770000, 0xfc7f8000, "r,I", 4 }, -{ "adfd", 0xe0080002, 0xfc080002, "r,xOA,X", 4 }, -{ "adfw", 0xe0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "adi", 0xc8010000, 0xfc7f0000, "r,I", 4 }, -{ "admb", 0xb8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "admd", 0xb8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "admh", 0xb8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "admw", 0xb8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "adr", 0x38000000, 0xfc0f0000, "r,R", 2 }, -{ "adrfd", 0x38090000, 0xfc0f0000, "r,R", 2 }, -{ "adrfw", 0x38010000, 0xfc0f0000, "r,R", 2 }, -{ "adrm", 0x38080000, 0xfc0f0000, "r,R", 2 }, -{ "ai", 0xfc030000, 0xfc07ffff, "I", 4 }, -{ "anmb", 0x84080000, 0xfc080000, "r,xOA,X", 4 }, -{ "anmd", 0x84000002, 0xfc080002, "r,xOA,X", 4 }, -{ "anmh", 0x84000001, 0xfc080001, "r,xOA,X", 4 }, -{ "anmw", 0x84000000, 0xfc080000, "r,xOA,X", 4 }, -{ "anr", 0x04000000, 0xfc0f0000, "r,R", 2 }, -{ "armb", 0xe8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "armd", 0xe8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "armh", 0xe8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "armw", 0xe8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "bcf", 0xf0000000, 0xfc080000, "I,xOA,X", 4 }, -{ "bct", 0xec000000, 0xfc080000, "I,xOA,X", 4 }, -{ "bei", 0x00060000, 0xffff0000, "", 2 }, -{ "bft", 0xf0000000, 0xff880000, "xOA,X", 4 }, -{ "bib", 0xf4000000, 0xfc780000, "r,xOA", 4 }, -{ "bid", 0xf4600000, 0xfc780000, "r,xOA", 4 }, -{ "bih", 0xf4200000, 0xfc780000, "r,xOA", 4 }, -{ "biw", 0xf4400000, 0xfc780000, "r,xOA", 4 }, -{ "bl", 0xf8800000, 0xff880000, "xOA,X", 4 }, -{ "bsub", 0x5c080000, 0xff8f0000, "", 2 }, -{ "bsubm", 0x28080000, 0xfc080000, "", 4 }, -{ "bu", 0xec000000, 0xff880000, "xOA,X", 4 }, -{ "call", 0x28080000, 0xfc0f0000, "", 2 }, -{ "callm", 0x5c080000, 0xff880000, "", 4 }, -{ "camb", 0x90080000, 0xfc080000, "r,xOA,X", 4 }, -{ "camd", 0x90000002, 0xfc080002, "r,xOA,X", 4 }, -{ "camh", 0x90000001, 0xfc080001, "r,xOA,X", 4 }, -{ "camw", 0x90000000, 0xfc080000, "r.xOA,X", 4 }, -{ "car", 0x10000000, 0xfc0f0000, "r,R", 2 }, -{ "cd", 0xfc060000, 0xfc070000, "r,f", 4 }, -{ "cea", 0x000f0000, 0xffff0000, "", 2 }, -{ "ci", 0xc8050000, 0xfc7f0000, "r,I", 4 }, -{ "cmc", 0x040a0000, 0xfc7f0000, "r", 2 }, -{ "cmmb", 0x94080000, 0xfc080000, "r,xOA,X", 4 }, -{ "cmmd", 0x94000002, 0xfc080002, "r,xOA,X", 4 }, -{ "cmmh", 0x94000001, 0xfc080001, "r,xOA,X", 4 }, -{ "cmmw", 0x94000000, 0xfc080000, "r,xOA,X", 4 }, -{ "cmr", 0x14000000, 0xfc0f0000, "r,R", 2 }, -{ "daci", 0xfc7f0000, 0xfc7f8000, "r,I", 4 }, -{ "dae", 0x000e0000, 0xffff0000, "", 2 }, -{ "dai", 0xfc040000, 0xfc07ffff, "I", 4 }, -{ "dci", 0xfc6f0000, 0xfc7f8000, "r,I", 4 }, -{ "di", 0xfc010000, 0xfc07ffff, "I", 4 }, -{ "dvfd", 0xe4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "dvfw", 0xe4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvi", 0xc8040000, 0xfc7f0000, "r,I", 4 }, -{ "dvmb", 0xc4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvmh", 0xc4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "dvmw", 0xc4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "dvr", 0x380a0000, 0xfc0f0000, "r,R", 2 }, -{ "dvrfd", 0x380c0000, 0xfc0f0000, "r,R", 4 }, -{ "dvrfw", 0x38040000, 0xfc0f0000, "r,xOA,X", 4 }, -{ "eae", 0x00080000, 0xffff0000, "", 2 }, -{ "eci", 0xfc670000, 0xfc7f8080, "r,I", 4 }, -{ "ecwcs", 0xfc4f0000, 0xfc7f8000, "", 4 }, -{ "ei", 0xfc000000, 0xfc07ffff, "I", 4 }, -{ "eomb", 0x8c080000, 0xfc080000, "r,xOA,X", 4 }, -{ "eomd", 0x8c000002, 0xfc080002, "r,xOA,X", 4 }, -{ "eomh", 0x8c000001, 0xfc080001, "r,xOA,X", 4 }, -{ "eomw", 0x8c000000, 0xfc080000, "r,xOA,X", 4 }, -{ "eor", 0x0c000000, 0xfc0f0000, "r,R", 2 }, -{ "eorm", 0x0c080000, 0xfc0f0000, "r,R", 2 }, -{ "es", 0x00040000, 0xfc7f0000, "r", 2 }, -{ "exm", 0xa8000000, 0xff880000, "xOA,X", 4 }, -{ "exr", 0xc8070000, 0xfc7f0000, "r", 2 }, -{ "exrr", 0xc8070002, 0xfc7f0002, "r", 2 }, -{ "fixd", 0x380d0000, 0xfc0f0000, "r,R", 2 }, -{ "fixw", 0x38050000, 0xfc0f0000, "r,R", 2 }, -{ "fltd", 0x380f0000, 0xfc0f0000, "r,R", 2 }, -{ "fltw", 0x38070000, 0xfc0f0000, "r,R", 2 }, -{ "grio", 0xfc3f0000, 0xfc7f8000, "r,I", 4 }, -{ "halt", 0x00000000, 0xffff0000, "", 2 }, -{ "hio", 0xfc370000, 0xfc7f8000, "r,I", 4 }, -{ "jwcs", 0xfa080000, 0xff880000, "xOA,X", 4 }, -{ "la", 0x50000000, 0xfc000000, "r,xOA,X", 4 }, -{ "labr", 0x58080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lb", 0xac080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lcs", 0x00030000, 0xfc7f0000, "r", 2 }, -{ "ld", 0xac000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lear", 0x80000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lf", 0xcc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lfbr", 0xcc080000, 0xfc080000, "b,xOA,X", 4 }, -{ "lh", 0xac000001, 0xfc080001, "r,xOA,X", 4 }, -{ "li", 0xc8000000, 0xfc7f0000, "r,I", 4 }, -{ "lmap", 0x2c070000, 0xfc7f0000, "r", 2 }, -{ "lmb", 0xb0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lmd", 0xb0000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lmh", 0xb0000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lmw", 0xb0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnb", 0xb4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "lnd", 0xb4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "lnh", 0xb4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "lnw", 0xb4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lpsd", 0xf9800000, 0xff880000, "r,xOA,X", 4 }, -{ "lpsdcm", 0xfa800000, 0xff880000, "r,xOA,X", 4 }, -{ "lw", 0xac000000, 0xfc080000, "r,xOA,X", 4 }, -{ "lwbr", 0x5c000000, 0xfc080000, "b,xOA,X", 4 }, -{ "mpfd", 0xe4080002, 0xfc080002, "r,xOA,X", 4 }, -{ "mpfw", 0xe4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpi", 0xc8030000, 0xfc7f0000, "r,I", 4 }, -{ "mpmb", 0xc0080000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpmh", 0xc0000001, 0xfc080001, "r,xOA,X", 4 }, -{ "mpmw", 0xc0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "mpr", 0x38020000, 0xfc0f0000, "r,R", 2 }, -{ "mprfd", 0x380e0000, 0xfc0f0000, "r,R", 2 }, -{ "mprfw", 0x38060000, 0xfc0f0000, "r,R", 2 }, -{ "nop", 0x00020000, 0xffff0000, "", 2 }, -{ "ormb", 0x88080000, 0xfc080000, "r,xOA,X", 4 }, -{ "ormd", 0x88000002, 0xfc080002, "r,xOA,X", 4 }, -{ "ormh", 0x88000001, 0xfc080001, "r,xOA,X", 4 }, -{ "ormw", 0x88000000, 0xfc080000, "r,xOA,X", 4 }, -{ "orr", 0x08000000, 0xfc0f0000, "r,R", 2 }, -{ "orrm", 0x08080000, 0xfc0f0000, "r,R", 2 }, -{ "rdsts", 0x00090000, 0xfc7f0000, "r", 2 }, -{ "return", 0x280e0000, 0xfc7f0000, "", 2 }, -{ "ri", 0xfc020000, 0xfc07ffff, "I", 4 }, -{ "rnd", 0x00050000, 0xfc7f0000, "r", 2 }, -{ "rpswt", 0x040b0000, 0xfc7f0000, "r", 2 }, -{ "rschnl", 0xfc2f0000, 0xfc7f8000, "r,I", 4 }, -{ "rsctl", 0xfc470000, 0xfc7f8000, "r,I", 4 }, -{ "rwcs", 0x000b0000, 0xfc0f0000, "r,R", 2 }, -{ "sacz", 0x10080000, 0xfc0f0000, "r,R", 2 }, -{ "sbm", 0x98080000, 0xfc080000, "f,xOA,X", 4 }, -{ "sbr", 0x18000000, 0xfc0c0000, "r,f", 4 }, -{ "sea", 0x000d0000, 0xffff0000, "", 2 }, -{ "setcpu", 0x2c090000, 0xfc7f0000, "r", 2 }, -{ "sio", 0xfc170000, 0xfc7f8000, "r,I", 4 }, -{ "sipu", 0x000a0000, 0xffff0000, "", 2 }, -{ "sla", 0x1c400000, 0xfc600000, "r,S", 2 }, -{ "slad", 0x20400000, 0xfc600000, "r,S", 2 }, -{ "slc", 0x24400000, 0xfc600000, "r,S", 2 }, -{ "sll", 0x1c600000, 0xfc600000, "r,S", 2 }, -{ "slld", 0x20600000, 0xfc600000, "r,S", 2 }, -{ "smc", 0x04070000, 0xfc070000, "", 2 }, -{ "sra", 0x1c000000, 0xfc600000, "r,S", 2 }, -{ "srad", 0x20000000, 0xfc600000, "r,S", 2 }, -{ "src", 0x24000000, 0xfc600000, "r,S", 2 }, -{ "srl", 0x1c200000, 0xfc600000, "r,S", 2 }, -{ "srld", 0x20200000, 0xfc600000, "r,S", 2 }, -{ "stb", 0xd4080000, 0xfc080000, "r,xOA,X", 4 }, -{ "std", 0xd4000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stf", 0xdc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stfbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 }, -{ "sth", 0xd4000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stmb", 0xd8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "stmd", 0xd8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "stmh", 0xd8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "stmw", 0xd8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stpio", 0xfc270000, 0xfc7f8000, "r,I", 4 }, -{ "stw", 0xd4000000, 0xfc080000, "r,xOA,X", 4 }, -{ "stwbr", 0x54000000, 0xfc080000, "b,xOA,X", 4 }, -{ "suabr", 0x58000000, 0xfc080000, "b,xOA,X", 4 }, -{ "sufd", 0xe0000002, 0xfc080002, "r,xOA,X", 4 }, -{ "sufw", 0xe0000000, 0xfc080000, "r,xOA,X", 4 }, -{ "sui", 0xc8020000, 0xfc7f0000, "r,I", 4 }, -{ "sumb", 0xbc080000, 0xfc080000, "r,xOA,X", 4 }, -{ "sumd", 0xbc000002, 0xfc080002, "r,xOA,X", 4 }, -{ "sumh", 0xbc000001, 0xfc080001, "r,xOA,X", 4 }, -{ "sumw", 0xbc000000, 0xfc080000, "r,xOA,X", 4 }, -{ "sur", 0x3c000000, 0xfc0f0000, "r,R", 2 }, -{ "surfd", 0x380b0000, 0xfc0f0000, "r,xOA,X", 4 }, -{ "surfw", 0x38030000, 0xfc0f0000, "r,R", 2 }, -{ "surm", 0x3c080000, 0xfc0f0000, "r,R", 2 }, -{ "svc", 0xc8060000, 0xffff0000, "", 4 }, -{ "tbm", 0xa4080000, 0xfc080000, "f,xOA,X", 4 }, -{ "tbr", 0x180c0000, 0xfc0c0000, "r,f", 2 }, -{ "tbrr", 0x2c020000, 0xfc0f0000, "r,B", 2 }, -{ "tccr", 0x28040000, 0xfc7f0000, "", 2 }, -{ "td", 0xfc050000, 0xfc070000, "r,f", 4 }, -{ "tio", 0xfc1f0000, 0xfc7f8000, "r,I", 4 }, -{ "tmapr", 0x2c0a0000, 0xfc0f0000, "r,R", 2 }, -{ "tpcbr", 0x280c0000, 0xfc7f0000, "r", 2 }, -{ "trbr", 0x2c010000, 0xfc0f0000, "b,R", 2 }, -{ "trc", 0x2c030000, 0xfc0f0000, "r,R", 2 }, -{ "trcc", 0x28050000, 0xfc7f0000, "", 2 }, -{ "trcm", 0x2c0b0000, 0xfc0f0000, "r,R", 2 }, -{ "trn", 0x2c040000, 0xfc0f0000, "r,R", 2 }, -{ "trnm", 0x2c0c0000, 0xfc0f0000, "r,R", 2 }, -{ "trr", 0x2c000000, 0xfc0f0000, "r,R", 2 }, -{ "trrm", 0x2c080000, 0xfc0f0000, "r,R", 2 }, -{ "trsc", 0x2c0e0000, 0xfc0f0000, "r,R", 2 }, -{ "trsw", 0x28000000, 0xfc7f0000, "r", 2 }, -{ "tscr", 0x2c0f0000, 0xfc0f0000, "r,R", 2 }, -{ "uei", 0x00070000, 0xffff0000, "", 2 }, -{ "wait", 0x00010000, 0xffff0000, "", 2 }, -{ "wcwcs", 0xfc5f0000, 0xfc7f8000, "", 4 }, -{ "wwcs", 0x000c0000, 0xfc0f0000, "r,R", 2 }, -{ "xcbr", 0x28020000, 0xfc0f0000, "b,B", 2 }, -{ "xcr", 0x2c050000, 0xfc0f0000, "r,R", 2 }, -{ "xcrm", 0x2c0d0000, 0xfc0f0000, "r,R", 2 }, -{ "zbm", 0x9c080000, 0xfc080000, "f,xOA,X", 4 }, -{ "zbr", 0x18040000, 0xfc0c0000, "r,f", 2 }, -{ "zmb", 0xf8080000, 0xfc080000, "r,xOA,X", 4 }, -{ "zmd", 0xf8000002, 0xfc080002, "r,xOA,X", 4 }, -{ "zmh", 0xf8000001, 0xfc080001, "r,xOA,X", 4 }, -{ "zmw", 0xf8000000, 0xfc080000, "r,xOA,X", 4 }, -{ "zr", 0x0c000000, 0xfc0f0000, "r", 2 }, -}; - -int numopcodes = sizeof(gld_opcodes) / sizeof(gld_opcodes[0]); - -struct gld_opcode *endop = gld_opcodes + sizeof(gld_opcodes) / - sizeof(gld_opcodes[0]); diff --git a/gdb/pyr-opcode.h b/gdb/pyr-opcode.h deleted file mode 100755 index 06632b8..0000000 --- a/gdb/pyr-opcode.h +++ /dev/null @@ -1,287 +0,0 @@ -/* pyramid.opcode.h -- gdb initial attempt. */ - -/* pyramid opcode table: wot to do with this - particular opcode */ - -struct pyr_datum -{ - char nargs; - char * args; /* how to compile said opcode */ - unsigned long mask; /* Bit vector: which operand modes are valid - for this opcode */ - unsigned char code; /* op-code (always 6(?) bits */ -}; - -typedef struct pyr_insn_format { - unsigned int mode :4; - unsigned int operator :8; - unsigned int index_scale :2; - unsigned int index_reg :6; - unsigned int operand_1 :6; - unsigned int operand_2:6; -} pyr_insn_format; - - -/* We store four bytes of opcode for all opcodes. - Pyramid is sufficiently RISCy that: - - insns are always an integral number of words; - - the length of any insn can be told from the first word of - the insn. (ie, if there are zero, one, or two words of - immediate operand/offset). - - - The args component is a string containing two characters for each - operand of the instruction. The first specifies the kind of operand; - the second, the place it is stored. */ - -/* Kinds of operands: - mask assembler syntax description - 0x0001: movw Rn,Rn register to register - 0x0002: movw K,Rn quick immediate to register - 0x0004: movw I,Rn long immediate to register - 0x0008: movw (Rn),Rn register indirect to register - movw (Rn)[x],Rn register indirect to register - 0x0010: movw I(Rn),Rn offset register indirect to register - movw I(Rn)[x],Rn offset register indirect, indexed, to register - - 0x0020: movw Rn,(Rn) register to register indirect - 0x0040: movw K,(Rn) quick immediate to register indirect - 0x0080: movw I,(Rn) long immediate to register indirect - 0x0100: movw (Rn),(Rn) register indirect to-register indirect - 0x0100: movw (Rn),(Rn) register indirect to-register indirect - 0x0200: movw I(Rn),(Rn) register indirect+offset to register indirect - 0x0200: movw I(Rn),(Rn) register indirect+offset to register indirect - - 0x0400: movw Rn,I(Rn) register to register indirect+offset - 0x0800: movw K,I(Rn) quick immediate to register indirect+offset - 0x1000: movw I,I(Rn) long immediate to register indirect+offset - 0x1000: movw (Rn),I(Rn) register indirect to-register indirect+offset - 0x1000: movw I(Rn),I(Rn) register indirect+offset to register indirect - +offset - 0x0000: (irregular) ??? - - - Each insn has a four-bit field encoding the type(s) of its operands. -*/ - -/* Some common combinations - */ - -/* the first 5,(0x1|0x2|0x4|0x8|0x10) ie (1|2|4|8|16), ie ( 32 -1)*/ -#define GEN_TO_REG (31) - -#define UNKNOWN ((unsigned long)-1) -#define ANY (GEN_TO_REG | (GEN_TO_REG << 5) | (GEN_TO_REG << 15)) - -#define CONVERT (1|8|0x10|0x20|0x200) - -#define K_TO_REG (2) -#define I_TO_REG (4) -#define NOTK_TO_REG (GEN_TO_REG & ~K_TO_REG) -#define NOTI_TO_REG (GEN_TO_REG & ~I_TO_REG) - -/* The assembler requires that this array be sorted as follows: - all instances of the same mnemonic must be consecutive. - All instances of the same mnemonic with the same number of operands - must be consecutive. - */ - -struct pyr_opcode /* pyr opcode text */ -{ - char * name; /* opcode name: lowercase string [key] */ - struct pyr_datum datum; /* rest of opcode table [datum] */ -}; - -#define pyr_how args -#define pyr_nargs nargs -#define pyr_mask mask -#define pyr_name name - -struct pyr_opcode pyr_opcodes[] = -{ - {"movb", { 2, "", UNKNOWN, 0x11}, }, - {"movh", { 2, "", UNKNOWN, 0x12} }, - {"movw", { 2, "", ANY, 0x10} }, - {"movl", { 2, "", ANY, 0x13} }, - {"mnegw", { 2, "", (0x1|0x8|0x10), 0x14} }, - {"mnegf", { 2, "", 0x1, 0x15} }, - {"mnegd", { 2, "", 0x1, 0x16} }, - {"mcomw", { 2, "", (0x1|0x8|0x10), 0x17} }, - {"mabsw", { 2, "", (0x1|0x8|0x10), 0x18} }, - {"mabsf", { 2, "", 0x1, 0x19} }, - {"mabsd", { 2, "", 0x1, 0x1a} }, - {"mtstw", { 2, "", (0x1|0x8|0x10), 0x1c} }, - {"mtstf", { 2, "", 0x1, 0x1d} }, - {"mtstd", { 2, "", 0x1, 0x1e} }, - {"mova", { 2, "", 0x8|0x10, 0x1f} }, - {"movzbw", { 2, "", (0x1|0x8|0x10), 0x20} }, - {"movzhw", { 2, "", (0x1|0x8|0x10), 0x21} }, - /* 2 insns out of order here */ - {"movbl", { 2, "", 1, 0x4f} }, - {"filbl", { 2, "", 1, 0x4e} }, - - {"cvtbw", { 2, "", CONVERT, 0x22} }, - {"cvthw", { 2, "", CONVERT, 0x23} }, - {"cvtwb", { 2, "", CONVERT, 0x24} }, - {"cvtwh", { 2, "", CONVERT, 0x25} }, - {"cvtwf", { 2, "", CONVERT, 0x26} }, - {"cvtwd", { 2, "", CONVERT, 0x27} }, - {"cvtfw", { 2, "", CONVERT, 0x28} }, - {"cvtfd", { 2, "", CONVERT, 0x29} }, - {"cvtdw", { 2, "", CONVERT, 0x2a} }, - {"cvtdf", { 2, "", CONVERT, 0x2b} }, - - {"addw", { 2, "", GEN_TO_REG, 0x40} }, - {"addwc", { 2, "", GEN_TO_REG, 0x41} }, - {"subw", { 2, "", GEN_TO_REG, 0x42} }, - {"subwb", { 2, "", GEN_TO_REG, 0x43} }, - {"rsubw", { 2, "", GEN_TO_REG, 0x44} }, - {"mulw", { 2, "", GEN_TO_REG, 0x45} }, - {"emul", { 2, "", GEN_TO_REG, 0x47} }, - {"umulw", { 2, "", GEN_TO_REG, 0x46} }, - {"divw", { 2, "", GEN_TO_REG, 0x48} }, - {"ediv", { 2, "", GEN_TO_REG, 0x4a} }, - {"rdivw", { 2, "", GEN_TO_REG, 0x4b} }, - {"udivw", { 2, "", GEN_TO_REG, 0x49} }, - {"modw", { 2, "", GEN_TO_REG, 0x4c} }, - {"umodw", { 2, "", GEN_TO_REG, 0x4d} }, - - - {"addf", { 2, "", 1, 0x50} }, - {"addd", { 2, "", 1, 0x51} }, - {"subf", { 2, "", 1, 0x52} }, - {"subd", { 2, "", 1, 0x53} }, - {"mulf", { 2, "", 1, 0x56} }, - {"muld", { 2, "", 1, 0x57} }, - {"divf", { 2, "", 1, 0x58} }, - {"divd", { 2, "", 1, 0x59} }, - - - {"cmpb", { 2, "", UNKNOWN, 0x61} }, - {"cmph", { 2, "", UNKNOWN, 0x62} }, - {"cmpw", { 2, "", UNKNOWN, 0x60} }, - {"ucmpb", { 2, "", UNKNOWN, 0x66} }, - /* WHY no "ucmph"??? */ - {"ucmpw", { 2, "", UNKNOWN, 0x65} }, - {"xchw", { 2, "", UNKNOWN, 0x0f} }, - - - {"andw", { 2, "", GEN_TO_REG, 0x30} }, - {"orw", { 2, "", GEN_TO_REG, 0x31} }, - {"xorw", { 2, "", GEN_TO_REG, 0x32} }, - {"bicw", { 2, "", GEN_TO_REG, 0x33} }, - {"lshlw", { 2, "", GEN_TO_REG, 0x38} }, - {"ashlw", { 2, "", GEN_TO_REG, 0x3a} }, - {"ashll", { 2, "", GEN_TO_REG, 0x3c} }, - {"ashrw", { 2, "", GEN_TO_REG, 0x3b} }, - {"ashrl", { 2, "", GEN_TO_REG, 0x3d} }, - {"rotlw", { 2, "", GEN_TO_REG, 0x3e} }, - {"rotrw", { 2, "", GEN_TO_REG, 0x3f} }, - - /* push and pop insns are "going away next release". */ - {"pushw", { 2, "", GEN_TO_REG, 0x0c} }, - {"popw", { 2, "", (0x1|0x8|0x10), 0x0d} }, - {"pusha", { 2, "", (0x8|0x10), 0x0e} }, - - {"bitsw", { 2, "", UNKNOWN, 0x35} }, - {"bitcw", { 2, "", UNKNOWN, 0x36} }, - /* some kind of ibra/dbra insns??*/ - {"icmpw", { 2, "", UNKNOWN, 0x67} }, - {"dcmpw", { 2, "", (1|4|0x20|0x80|0x400|0x1000), 0x69} },/*FIXME*/ - {"acmpw", { 2, "", 1, 0x6b} }, - - /* Call is written as a 1-op insn, but is always (dis)assembled as a 2-op - insn with a 2nd op of tr14. The assembler will have to grok this. */ - {"call", { 2, "", GEN_TO_REG, 0x04} }, - {"call", { 1, "", GEN_TO_REG, 0x04} }, - - {"callk", { 1, "", UNKNOWN, 0x06} },/* system call?*/ - /* Ret is usually written as a 0-op insn, but gets disassembled as a - 1-op insn. The operand is always tr15. */ - {"ret", { 0, "", UNKNOWN, 0x09} }, - {"ret", { 1, "", UNKNOWN, 0x09} }, - {"adsf", { 2, "", (1|2|4), 0x08} }, - {"retd", { 2, "", UNKNOWN, 0x0a} }, - {"btc", { 2, "", UNKNOWN, 0x01} }, - {"bfc", { 2, "", UNKNOWN, 0x02} }, - /* Careful: halt is 0x00000000. Jump must have some other (mode?)bit set?? */ - {"jump", { 1, "", UNKNOWN, 0x00} }, - {"btp", { 2, "", UNKNOWN, 0xf00} }, - /* read control-stack pointer is another 1-or-2 operand insn. */ - {"rcsp", { 2, "", UNKNOWN, 0x01f} }, - {"rcsp", { 1, "", UNKNOWN, 0x01f} } -}; - -/* end: pyramid.opcode.h */ -/* One day I will have to take the time to find out what operands - are valid for these insns, and guess at what they mean. - - I can't imagine what the "I???" insns (iglob, etc) do. - - the arithmetic-sounding insns ending in "p" sound awfully like BCD - arithmetic insns: - dshlp -> Decimal SHift Left Packed - dshrp -> Decimal SHift Right Packed - and cvtlp would be convert long to packed. - I have no idea how the operands are interpreted; but having them be - a long register with (address, length) of an in-memory packed BCD operand - would not be surprising. - They are unlikely to be a packed bcd string: 64 bits of long give - is only 15 digits+sign, which isn't enough for COBOL. - */ -#if 0 - {"wcsp", { 2, "", UNKNOWN, 0x00} }, /*write csp?*/ - /* The OSx Operating System Porting Guide claims SSL does things - with tr12 (a register reserved to it) to do with static block-structure - references. SSL=Set Static Link? It's "Going away next release". */ - {"ssl", { 2, "", UNKNOWN, 0x00} }, - {"ccmps", { 2, "", UNKNOWN, 0x00} }, - {"lcd", { 2, "", UNKNOWN, 0x00} }, - {"uemul", { 2, "", UNKNOWN, 0x00} }, /*unsigned emul*/ - {"srf", { 2, "", UNKNOWN, 0x00} }, /*Gidget time???*/ - {"mnegp", { 2, "", UNKNOWN, 0x00} }, /move-neg phys?*/ - {"ldp", { 2, "", UNKNOWN, 0x00} }, /*load phys?*/ - {"ldti", { 2, "", UNKNOWN, 0x00} }, - {"ldb", { 2, "", UNKNOWN, 0x00} }, - {"stp", { 2, "", UNKNOWN, 0x00} }, - {"stti", { 2, "", UNKNOWN, 0x00} }, - {"stb", { 2, "", UNKNOWN, 0x00} }, - {"stu", { 2, "", UNKNOWN, 0x00} }, - {"addp", { 2, "", UNKNOWN, 0x00} }, - {"subp", { 2, "", UNKNOWN, 0x00} }, - {"mulp", { 2, "", UNKNOWN, 0x00} }, - {"divp", { 2, "", UNKNOWN, 0x00} }, - {"dshlp", { 2, "", UNKNOWN, 0x00} }, /* dec shl packed? */ - {"dshrp", { 2, "", UNKNOWN, 0x00} }, /* dec shr packed? */ - {"movs", { 2, "", UNKNOWN, 0x00} }, /*move (string?)?*/ - {"cmpp", { 2, "", UNKNOWN, 0x00} }, /* cmp phys?*/ - {"cmps", { 2, "", UNKNOWN, 0x00} }, /* cmp (string?)?*/ - {"cvtlp", { 2, "", UNKNOWN, 0x00} }, /* cvt long to p??*/ - {"cvtpl", { 2, "", UNKNOWN, 0x00} }, /* cvt p to l??*/ - {"dintr", { 2, "", UNKNOWN, 0x00} }, /* ?? intr ?*/ - {"rphysw", { 2, "", UNKNOWN, 0x00} }, /* read phys word?*/ - {"wphysw", { 2, "", UNKNOWN, 0x00} }, /* write phys word?*/ - {"cmovs", { 2, "", UNKNOWN, 0x00} }, - {"rsubw", { 2, "", UNKNOWN, 0x00} }, - {"bicpsw", { 2, "", UNKNOWN, 0x00} }, /* clr bit in psw? */ - {"bispsw", { 2, "", UNKNOWN, 0x00} }, /* set bit in psw? */ - {"eio", { 2, "", UNKNOWN, 0x00} }, /* ?? ?io ? */ - {"callp", { 2, "", UNKNOWN, 0x00} }, /* call phys?*/ - {"callr", { 2, "", UNKNOWN, 0x00} }, - {"lpcxt", { 2, "", UNKNOWN, 0x00} }, /*load proc context*/ - {"rei", { 2, "", UNKNOWN, 0x00} }, /*ret from intrpt*/ - {"rport", { 2, "", UNKNOWN, 0x00} }, /*read-port?*/ - {"rtod", { 2, "", UNKNOWN, 0x00} }, /*read-time-of-day?*/ - {"ssi", { 2, "", UNKNOWN, 0x00} }, - {"vtpa", { 2, "", UNKNOWN, 0x00} }, /*virt-to-phys-addr?*/ - {"wicl", { 2, "", UNKNOWN, 0x00} }, /* write icl ? */ - {"wport", { 2, "", UNKNOWN, 0x00} }, /*write-port?*/ - {"wtod", { 2, "", UNKNOWN, 0x00} }, /*write-time-of-day?*/ - {"flic", { 2, "", UNKNOWN, 0x00} }, - {"iglob", { 2, "", UNKNOWN, 0x00} }, /* I global? */ - {"iphys", { 2, "", UNKNOWN, 0x00} }, /* I physical? */ - {"ipid", { 2, "", UNKNOWN, 0x00} }, /* I pid? */ - {"ivect", { 2, "", UNKNOWN, 0x00} }, /* I vector? */ - {"lamst", { 2, "", UNKNOWN, 0x00} }, - {"tio", { 2, "", UNKNOWN, 0x00} }, -#endif diff --git a/gdb/rem-m68k.shar b/gdb/rem-m68k.shar deleted file mode 100755 index aeb76e5..0000000 --- a/gdb/rem-m68k.shar +++ /dev/null @@ -1,893 +0,0 @@ -# This is a shell archive. Remove anything before this line, -# then unpack it by saving it in a file and typing "sh file". -# -# Wrapped by Glenn Engel on Mon Jun 12 15:19:20 1989 -# -# This archive contains: -# remcom.c -# - -LANG=""; export LANG -PATH=/bin:/usr/bin:$PATH; export PATH - -echo x - remcom.c -cat >remcom.c <<'@EOF' - -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * $Header$ - * - * $Module name: remcom.c $ - * $Revision$ - * $Date$ - * $Contributor: Lake Stevens Instrument Division$ - * - * $Description: low level support for gdb debugger. $ - * - * $Considerations: only works on target hardware $ - * - * $Written by: Glenn Engel $ - * $ModuleState: Experimental $ - * - * $NOTES: See Below $ - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. - * - * Some explanation is probably necessary to explain how exceptions are - * handled. When an exception is encountered the 68000 pushes the current - * program counter and status register onto the supervisor stack and then - * transfers execution to a location specified in it's vector table. - * The handlers for the exception vectors are hardwired to jmp to an address - * given by the relation: (exception - 256) * 6. These are decending - * addresses starting from -6, -12, -18, ... By allowing 6 bytes for - * each entry, a jsr, jmp, bsr, ... can be used to enter the exception - * handler. Using a jsr to handle an exception has an added benefit of - * allowing a single handler to service several exceptions and use the - * return address as the key differentiation. The vector number can be - * computed from the return address by [ exception = (addr + 1530) / 6 ]. - * The sole purpose of the routine _catchException is to compute the - * exception number and push it on the stack in place of the return address. - * The external function exceptionHandler() is - * used to attach a specific handler to a specific 68k exception. - * For 68020 machines, the ability to have a return address around just - * so the vector can be determined is not necessary because the '020 pushes an - * extra word onto the stack containing the vector offset - * - * Because gdb will sometimes write to the stack area to execute function - * calls, this program cannot rely on using the supervisor stack so it - * uses it's own stack area reserved in the int array remcomStack. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include -#include -#include - -/************************************************************************ - * - * external low-level support routines - */ -typedef void (*ExceptionHook)(int); /* pointer to function with int parm */ -typedef void (*Function)(); /* pointer to a function */ - -extern putDebugChar(); /* write a single character */ -extern getDebugChar(); /* read and return a single char */ - -extern Function exceptionHandler(); /* assign an exception handler */ -extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */ - - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 400 - -static char initialized; /* boolean flag. != 0 means we've been initialized */ - -int remote_debug = 0; -/* debug > 0 prints ill-formed commands in valid packets & checksum errors */ - -char hexchars[]="0123456789abcdef"; - -/* there are 180 bytes of registers on a 68020 w/68881 */ -/* many of the fpa registers are 12 byte (96 bit) registers */ -#define NUMREGBYTES 180 -enum regnames {D0,D1,D2,D3,D4,D5,D6,D7, - A0,A1,A2,A3,A4,A5,A6,A7, - PS,PC, - FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7, - FPCONTROL,FPSTATUS,FPIADDR - }; - -typedef struct FrameStruct -{ - struct FrameStruct *previous; - int exceptionPC; /* pc value when this frame created */ - int exceptionVector; /* cpu vector causing exception */ - short frameSize; /* size of cpu frame in words */ - short sr; /* for 68000, this not always sr */ - int pc; - short format; - int fsaveHeader; - int morejunk[0]; /* exception frame, fp save... */ -} Frame; - -#define FRAMESIZE 500 -static Frame *lastFrame; -static int frameStack[FRAMESIZE]; - -/* - * these should not be static cuz they can be used outside this module - */ -int registers[NUMREGBYTES/4]; -int superStack; - -static int remcomStack[400]; -static int* stackPtr = &remcomStack[399]; - -/* - * In many cases, the system will want to continue exception processing - * when a continue command is given. - * oldExceptionHook is a function to invoke in this case. - */ - -static ExceptionHook oldExceptionHook; - -/* the size of the exception stack on the 68020 varies with the type of - * exception. The following table is the number of WORDS used - * for each exception format. - */ -static short exceptionSize[] = { 4,4,6,4,4,4,4,4,29,10,16,46,4,4,4,4 }; - -/************* jump buffer used for setjmp/longjmp **************************/ -jmp_buf env; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -#ifdef __HAVE_68881__ -/* do an fsave, then remember the address to begin a restore from */ -#define SAVE_FP_REGS() asm(" fsave a0@-"); \ - asm(" fmovemx fp0-fp7,_registers+72"); \ - asm(" fmoveml fpcr/fpsr/fpi,_registers+168"); -#define RESTORE_FP_REGS() asm(" fmoveml _registers+168,fpcr/fpsr/fpi"); \ - asm(" fmovemx _registers+72,fp0-fp7"); \ - asm(" frestore a0@+"); -#else -#define SAVE_FP_REGS() -#define RESTORE_FP_REGS() -#endif /* __HAVE_68881__ */ - -asm(" -.text -.globl _return_to_super -_return_to_super: - movel _registers+60,sp /* get new stack pointer */ - movel _lastFrame,a0 /* get last frame info */ - bra return_to_any - -.globl _return_to_user -_return_to_user: - movel _registers+60,a0 /* get usp */ - movel a0,usp /* set usp */ - movel _superStack,sp /* get original stack pointer */ - -return_to_any: - movel _lastFrame,a0 /* get last frame info */ - movel a0@+,_lastFrame /* link in previous frame */ - addql #8,a0 /* skip over pc, vector#*/ - movew a0@+,d0 /* get # of words in cpu frame */ - addw d0,a0 /* point to end of data */ - addw d0,a0 /* point to end of data */ - movel a0,a1 -# -# copy the stack frame - subql #1,d0 -copyUserLoop: - movew a1@-,sp@- - dbf d0,copyUserLoop -"); - RESTORE_FP_REGS() - asm(" moveml _registers,d0-d7/a0-a6"); - asm(" rte"); /* pop and go! */ - -#define DISABLE_INTERRUPTS() asm(" oriw #0x0700,sr"); -#define BREAKPOINT() asm(" trap #1"); - -/* this function is called immediately when a level 7 interrupt occurs */ -/* if the previous interrupt level was 7 then we're already servicing */ -/* this interrupt and an rte is in order to return to the debugger. */ -/* For the 68000, the offset for sr is 6 due to the jsr return address */ -asm(" -.text -.globl __debug_level7 -__debug_level7: - movew d0,sp@-"); -#ifdef mc68020 -asm(" movew sp@(2),d0"); -#else -asm(" movew sp@(6),d0"); -#endif -asm(" andiw #0x700,d0 - cmpiw #0x700,d0 - beq _already7 - movew sp@+,d0 - bra __catchException -_already7: - movew sp@+,d0"); -#ifndef mc68020 -asm(" lea sp@(4),sp"); /* pull off 68000 return address */ -#endif -asm(" rte"); - -extern void _catchException(); - -#ifdef mc68020 -/* This function is called when a 68020 exception occurs. It saves - * all the cpu and fpcp regs in the _registers array, creates a frame on a - * linked list of frames which has the cpu and fpcp stack frames needed - * to properly restore the context of these processors, and invokes - * an exception handler (remcom_handler). - * - * stack on entry: stack on exit: - * N bytes of junk exception # MSWord - * Exception Format Word exception # MSWord - * Program counter LSWord - * Program counter MSWord - * Status Register - * - * - */ -asm(" -.text -.globl __catchException -__catchException:"); -DISABLE_INTERRUPTS(); -asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ - movel _lastFrame,a0 /* last frame pointer */ -"); -SAVE_FP_REGS(); -asm(" - lea _registers,a5 /* get address of registers */ - movew sp@,d1 /* get status register */ - movew d1,a5@(66) /* save sr */ - movel sp@(2),a4 /* save pc in a4 for later use */ - movel a4,a5@(68) /* save pc in _regisers[] */ - -# -# figure out how many bytes in the stack frame - movew sp@(6),d0 /* get '020 exception format */ - movew d0,d2 /* make a copy of format word */ - andiw #0xf000,d0 /* mask off format type */ - rolw #5,d0 /* rotate into the low byte *2 */ - lea _exceptionSize,a1 - addw d0,a1 /* index into the table */ - movew a1@,d0 /* get number of words in frame */ - movew d0,d3 /* save it */ - subw d0,a0 /* adjust save pointer */ - subw d0,a0 /* adjust save pointer(bytes) */ - movel a0,a1 /* copy save pointer */ - subql #1,d0 /* predecrement loop counter */ -# -# copy the frame -saveFrameLoop: - movew sp@+,a1@+ - dbf d0,saveFrameLoop -# -# now that the stack has been clenaed, -# save the a7 in use at time of exception - movel sp,_superStack /* save supervisor sp */ - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra a7saveDone -userMode: - movel usp,a1 - movel a1,a5@(60) /* save user stack pointer */ -a7saveDone: - -# -# save size of frame - movew d3,a0@- - -# -# compute exception number - andl #0xfff,d2 /* mask off vector offset */ - lsrw #2,d2 /* divide by 4 to get vect num */ - movel d2,a0@- /* save it */ -# -# save pc causing exception - movel a4,a0@- -# -# save old frame link and set the new value - movel _lastFrame,a1 /* last frame pointer */ - movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame - - movel d2,sp@- /* push exception num */ - movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - jmp __returnFromException /* now, return */ -"); -#else /* mc68000 */ -/* This function is called when an exception occurs. It translates the - * return address found on the stack into an exception vector # which - * is then handled by either handle_exception or a system handler. - * _catchException provides a front end for both. - * - * stack on entry: stack on exit: - * Program counter MSWord exception # MSWord - * Program counter LSWord exception # MSWord - * Status Register - * Return Address MSWord - * Return Address LSWord - */ -asm(" -.text -.globl __catchException -__catchException:"); -DISABLE_INTERRUPTS(); -asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ - movel _lastFrame,a0 /* last frame pointer */ -"); -SAVE_FP_REGS(); -asm(" - lea _registers,a5 /* get address of registers */ - movel sp@+,d2 /* pop return address */ - addl #1530,d2 /* convert return addr to */ - divs #6,d2 /* exception number */ - extl d2 - - moveql #3,d3 /* assume a three word frame */ - - cmpiw #3,d2 /* bus error or address error ? */ - bgt normal /* if >3 then normal error */ - movel sp@+,a0@- /* copy error info to frame buff*/ - movel sp@+,a0@- /* these are never used */ - moveql #7,d3 /* this is a 7 word frame */ - -normal: - movew sp@+,d1 /* pop status register */ - movel sp@+,a4 /* pop program counter */ - movew d1,a5@(66) /* save sr */ - movel a4,a5@(68) /* save pc in _regisers[] */ - movel a4,a0@- /* copy pc to frame buffer */ - movew d1,a0@- /* copy sr to frame buffer */ - - movel sp,_superStack /* save supervisor sp */ - - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra saveDone -userMode: - movel usp,a1 /* save user stack pointer */ - movel a1,a5@(60) /* save user stack pointer */ -saveDone: - - movew d3,a0@- /* push frame size in words */ - movel d2,a0@- /* push vector number */ - movel a4,a0@- /* push exception pc */ - -# -# save old frame link and set the new value - movel _lastFrame,a1 /* last frame pointer */ - movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame - - movel d2,sp@- /* push exception num */ - movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - jmp __returnFromException /* now, return */ -"); -#endif - - -/* - * remcomHandler is a front end for handle_exception. It moves the - * stack pointer into an area reserved for debugger use in case the - * breakpoint happened in supervisor mode. - */ -asm("_remcomHandler:"); -asm(" addl #4,sp"); /* pop off return address */ -asm(" movel sp@+,d0"); /* get the exception number */ -asm(" movel _stackPtr,sp"); /* move to remcom stack area */ -asm(" movel d0,sp@-"); /* push exception onto stack */ -asm(" jbsr _handle_exception"); /* this never returns */ -asm(" rts"); /* return */ - -void _returnFromException( Frame *frame ) -{ - /* if no existing frame, dummy one up */ - if (! frame) - { - frame = lastFrame -1; - frame->frameSize = 4; - frame->format = 0; - frame->fsaveHeader = 0; - frame->previous = lastFrame; - } - -#ifndef mc68020 - /* a 68000 cannot use the internal info pushed onto a bus error - * or address error frame when doing an RTE so don't put this info - * onto the stack or the stack will creep every time this happens. - */ - frame->frameSize=3; -#endif - - /* throw away any frames in the list after this frame */ - lastFrame = frame; - - frame->sr = registers[(int) PS]; - frame->pc = registers[(int) PC]; - - if (registers[(int) PS] & 0x2000) - { - /* return to supervisor mode... */ - return_to_super(); - } - else - { /* return to user mode */ - return_to_user(); - } -} - -int hex(ch) -char ch; -{ - if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); - if ((ch >= '0') && (ch <= '9')) return (ch-'0'); - return (0); -} - - -/* scan for the sequence $# */ -void getpacket(buffer) -char * buffer; -{ - unsigned char checksum; - unsigned char xmitcsum; - int i; - int count; - char ch; - - do { - /* wait around for the start character, ignore all other characters */ - while ((ch = getDebugChar()) != '$'); - checksum = 0; - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) { - ch = getDebugChar(); - if (ch == '#') break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') { - xmitcsum = hex(getDebugChar()) << 4; - xmitcsum += hex(getDebugChar()); - if ((remote_debug ) && (checksum != xmitcsum)) { - fprintf(stderr,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", - checksum,xmitcsum,buffer); - } - - if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */ - else { - putDebugChar('+'); /* successful transfer */ - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') { - putDebugChar( buffer[0] ); - putDebugChar( buffer[1] ); - /* remove sequence chars from buffer */ - count = strlen(buffer); - for (i=3; i <= count; i++) buffer[i-3] = buffer[i]; - } - } - } - } while (checksum != xmitcsum); - -} - -/* send the packet in buffer. The host get's one chance to read it. - This routine does not wait for a positive acknowledge. */ - - -void putpacket(buffer) -char * buffer; -{ - unsigned char checksum; - int count; - char ch; - - /* $#. */ - do { - putDebugChar('$'); - checksum = 0; - count = 0; - - while (ch=buffer[count]) { - if (! putDebugChar(ch)) return; - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum % 16]); - - } while (1 == 0); /* (getDebugChar() != '+'); */ - -} - -static char inbuffer[BUFMAX]; -static char outbuffer[BUFMAX]; -static short error; - - -void debug_error(format, parm) -char * format; -char * parm; -{ - if (remote_debug) fprintf(stderr,format,parm); -} - -/* convert the memory pointed to by mem into hex, placing result in buf */ -/* return a pointer to the last char put in buf (null) */ -char* mem2hex(mem, buf, count) -char* mem; -char* buf; -int count; -{ - int i; - unsigned char ch; - for (i=0;i> 4]; - *buf++ = hexchars[ch % 16]; - } - *buf = 0; - return(buf); -} - -/* convert the hex array pointed to by buf into binary to be placed in mem */ -/* return a pointer to the character AFTER the last byte written */ -char* hex2mem(buf, mem, count) -char* buf; -char* mem; -int count; -{ - int i; - unsigned char ch; - for (i=0;iexceptionPC, - frame->exceptionVector); - if (frame->exceptionPC == newPC) break; /* bingo! a match */ - /* - * for a breakpoint instruction, the saved pc may - * be off by two due to re-executing the instruction - * replaced by the trap instruction. Check for this. - */ - if ((frame->exceptionVector == 33) && - (frame->exceptionPC == (newPC+2))) break; - frame = frame->previous; - } - - /* - * If we found a match for the PC AND we are not returning - * as a result of a breakpoint (33), - * trace exception (9), nmi (31), jmp to - * the old exception handler as if this code never ran. - */ - if (frame) - { - if ((frame->exceptionVector != 9) && - (frame->exceptionVector != 31) && - (frame->exceptionVector != 33)) - { - /* - * invoke the previous handler. - */ - if (oldExceptionHook) - (*oldExceptionHook) (frame->exceptionVector); - newPC = registers[ PC ]; /* pc may have changed */ - if (newPC != frame->exceptionPC) - { - if (remote_debug) - printf("frame at 0x%x has pc=0x%x, except#=%d\n", - frame,frame->exceptionPC, - frame->exceptionVector); - /* dispose of this frame, we're skipping it (longjump?)*/ - lastFrame = frame->previous; - frame = (Frame *) 0; - } - } - } - - _returnFromException( frame ); - - break; - - /* kill the program */ - case 'k' : /* do nothing */ - break; - } /* switch */ - - /* reply to the request */ - putpacket(outbuffer); - } -} - - -/* this function is used to set up exception handlers for tracing and - breakpoints */ -void set_debug_traps() -{ -extern void _debug_level7(); -extern void remcomHandler(); -int exception; - - for (exception = 2; exception <= 23; exception++) - exceptionHandler(exception,_catchException); - - /* level 7 interrupt */ - exceptionHandler(31,_debug_level7); - - /* breakpoint exception (trap #1) */ - exceptionHandler(33,_catchException); - - /* floating point error (trap #8) */ - exceptionHandler(40,_catchException); - - /* 48 to 54 are floating point coprocessor errors */ - for (exception = 48; exception <= 54; exception++) - exceptionHandler(exception,_catchException); - - if (oldExceptionHook != remcomHandler) - { - oldExceptionHook = exceptionHook; - exceptionHook = remcomHandler; - } - - initialized = 1; - - lastFrame = (Frame *) &frameStack[FRAMESIZE-1]; - lastFrame->previous = (Frame *) 0; -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void breakpoint() -{ - if (initialized) BREAKPOINT(); -} - -@EOF - -chmod 444 remcom.c - -exit 0 - diff --git a/gdb/remote-multi.shar b/gdb/remote-multi.shar deleted file mode 100755 index 86c9cf0..0000000 --- a/gdb/remote-multi.shar +++ /dev/null @@ -1,1313 +0,0 @@ -#!/bin/sh -# This is a shell archive. -# Run the file through sh to extract its contents. -# shar: Shell Archiver -# Run the following text with /bin/sh to create: -# Remote_Makefile -# remote_gutils.c -# remote_inflow.c -# remote_server.c -# remote_utils.c -# This archive created: Fri Jun 23 17:06:55 1989 -cat << \SHAR_EOF > Remote_Makefile -# Makefile for the remote server for GDB, the GNU debugger. -# Copyright (C) 1986, 1989 Free Software Foundation, Inc. -# -# This file is part of GDB. -# -# GDB is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 1, or (at your option) -# any later version. -# -# GDB is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GDB; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -CFLAGS = -g -CC = cc - -SERVER = remote_server.o\ - remote_inflow.o\ - remote_utils.o\ - remote_gutils.o - -prog : $(SERVER) - $(CC) -g -o serve $(SERVER) -SHAR_EOF -cat << \SHAR_EOF > remote_gutils.c -/* General utility routines for the remote server for GDB, the GNU debugger. - Copyright (C) 1986, 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include -#include "defs.h" - -void error (); -void fatal (); - -/* Chain of cleanup actions established with make_cleanup, - to be executed if an error happens. */ - -static struct cleanup *cleanup_chain; - -/* Nonzero means a quit has been requested. */ - -int quit_flag; - -/* Nonzero means quit immediately if Control-C is typed now, - rather than waiting until QUIT is executed. */ - -int immediate_quit; - -/* Add a new cleanup to the cleanup_chain, - and return the previous chain pointer - to be passed later to do_cleanups or discard_cleanups. - Args are FUNCTION to clean up with, and ARG to pass to it. */ - -struct cleanup * -make_cleanup (function, arg) - void (*function) (); - int arg; -{ - register struct cleanup *new - = (struct cleanup *) xmalloc (sizeof (struct cleanup)); - register struct cleanup *old_chain = cleanup_chain; - - new->next = cleanup_chain; - new->function = function; - new->arg = arg; - cleanup_chain = new; - - return old_chain; -} - -/* Discard cleanups and do the actions they describe - until we get back to the point OLD_CHAIN in the cleanup_chain. */ - -void -do_cleanups (old_chain) - register struct cleanup *old_chain; -{ - register struct cleanup *ptr; - while ((ptr = cleanup_chain) != old_chain) - { - (*ptr->function) (ptr->arg); - cleanup_chain = ptr->next; - free (ptr); - } -} - -/* Discard cleanups, not doing the actions they describe, - until we get back to the point OLD_CHAIN in the cleanup_chain. */ - -void -discard_cleanups (old_chain) - register struct cleanup *old_chain; -{ - register struct cleanup *ptr; - while ((ptr = cleanup_chain) != old_chain) - { - cleanup_chain = ptr->next; - free (ptr); - } -} - -/* This function is useful for cleanups. - Do - - foo = xmalloc (...); - old_chain = make_cleanup (free_current_contents, &foo); - - to arrange to free the object thus allocated. */ - -void -free_current_contents (location) - char **location; -{ - free (*location); -} - -/* Generally useful subroutines used throughout the program. */ - -/* Like malloc but get error if no storage available. */ - -char * -xmalloc (size) - long size; -{ - register char *val = (char *) malloc (size); - if (!val) - fatal ("virtual memory exhausted.", 0); - return val; -} - -/* Like realloc but get error if no storage available. */ - -char * -xrealloc (ptr, size) - char *ptr; - long size; -{ - register char *val = (char *) realloc (ptr, size); - if (!val) - fatal ("virtual memory exhausted.", 0); - return val; -} - -/* Print the system error message for errno, and also mention STRING - as the file name for which the error was encountered. - Then return to command level. */ - -void -perror_with_name (string) - char *string; -{ - extern int sys_nerr; - extern char *sys_errlist[]; - extern int errno; - char *err; - char *combined; - - if (errno < sys_nerr) - err = sys_errlist[errno]; - else - err = "unknown error"; - - combined = (char *) alloca (strlen (err) + strlen (string) + 3); - strcpy (combined, string); - strcat (combined, ": "); - strcat (combined, err); - - error ("%s.", combined); -} - -/* Print the system error message for ERRCODE, and also mention STRING - as the file name for which the error was encountered. */ - -void -print_sys_errmsg (string, errcode) - char *string; - int errcode; -{ - extern int sys_nerr; - extern char *sys_errlist[]; - char *err; - char *combined; - - if (errcode < sys_nerr) - err = sys_errlist[errcode]; - else - err = "unknown error"; - - combined = (char *) alloca (strlen (err) + strlen (string) + 3); - strcpy (combined, string); - strcat (combined, ": "); - strcat (combined, err); - - printf ("%s.\n", combined); -} - -void -quit () -{ - fflush (stdout); - ioctl (fileno (stdout), TIOCFLUSH, 0); - error ("Quit"); -} - -/* Control C comes here */ - -void -request_quit () -{ - quit_flag = 1; - if (immediate_quit) - quit (); -} - -/* Print an error message and return to command level. - STRING is the error message, used as a fprintf string, - and ARG is passed as an argument to it. */ - -void -error (string, arg1, arg2, arg3) - char *string; - int arg1, arg2, arg3; -{ - fflush (stdout); - fprintf (stderr, string, arg1, arg2, arg3); - fprintf (stderr, "\n"); - /************return_to_top_level ();************/ -} - -/* Print an error message and exit reporting failure. - This is for a error that we cannot continue from. - STRING and ARG are passed to fprintf. */ - -void -fatal (string, arg) - char *string; - int arg; -{ - fprintf (stderr, "gdb: "); - fprintf (stderr, string, arg); - fprintf (stderr, "\n"); - exit (1); -} - -/* Make a copy of the string at PTR with SIZE characters - (and add a null character at the end in the copy). - Uses malloc to get the space. Returns the address of the copy. */ - -char * -savestring (ptr, size) - char *ptr; - int size; -{ - register char *p = (char *) xmalloc (size + 1); - bcopy (ptr, p, size); - p[size] = 0; - return p; -} - -char * -concat (s1, s2, s3) - char *s1, *s2, *s3; -{ - register int len = strlen (s1) + strlen (s2) + strlen (s3) + 1; - register char *val = (char *) xmalloc (len); - strcpy (val, s1); - strcat (val, s2); - strcat (val, s3); - return val; -} - -void -print_spaces (n, file) - register int n; - register FILE *file; -{ - while (n-- > 0) - fputc (' ', file); -} - -/* Ask user a y-or-n question and return 1 iff answer is yes. - Takes three args which are given to printf to print the question. - The first, a control string, should end in "? ". - It should not say how to answer, because we do that. */ - -int -query (ctlstr, arg1, arg2) - char *ctlstr; -{ - register int answer; - - /* Automatically answer "yes" if input is not from a terminal. */ - /***********if (!input_from_terminal_p ()) - return 1; *************************/ - - while (1) - { - printf (ctlstr, arg1, arg2); - printf ("(y or n) "); - fflush (stdout); - answer = fgetc (stdin); - clearerr (stdin); /* in case of C-d */ - if (answer != '\n') - while (fgetc (stdin) != '\n') clearerr (stdin); - if (answer >= 'a') - answer -= 040; - if (answer == 'Y') - return 1; - if (answer == 'N') - return 0; - printf ("Please answer y or n.\n"); - } -} - -/* Parse a C escape sequence. STRING_PTR points to a variable - containing a pointer to the string to parse. That pointer - is updated past the characters we use. The value of the - escape sequence is returned. - - A negative value means the sequence \ newline was seen, - which is supposed to be equivalent to nothing at all. - - If \ is followed by a null character, we return a negative - value and leave the string pointer pointing at the null character. - - If \ is followed by 000, we return 0 and leave the string pointer - after the zeros. A value of 0 does not mean end of string. */ - -int -parse_escape (string_ptr) - char **string_ptr; -{ - register int c = *(*string_ptr)++; - switch (c) - { - case 'a': - return '\a'; - case 'b': - return '\b'; - case 'e': - return 033; - case 'f': - return '\f'; - case 'n': - return '\n'; - case 'r': - return '\r'; - case 't': - return '\t'; - case 'v': - return '\v'; - case '\n': - return -2; - case 0: - (*string_ptr)--; - return 0; - case '^': - c = *(*string_ptr)++; - if (c == '\\') - c = parse_escape (string_ptr); - if (c == '?') - return 0177; - return (c & 0200) | (c & 037); - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - { - register int i = c - '0'; - register int count = 0; - while (++count < 3) - { - if ((c = *(*string_ptr)++) >= '0' && c <= '7') - { - i *= 8; - i += c - '0'; - } - else - { - (*string_ptr)--; - break; - } - } - return i; - } - default: - return c; - } -} - -void -printchar (ch, stream) - unsigned char ch; - FILE *stream; -{ - register int c = ch; - if (c < 040 || c >= 0177) - { - if (c == '\n') - fprintf (stream, "\\n"); - else if (c == '\b') - fprintf (stream, "\\b"); - else if (c == '\t') - fprintf (stream, "\\t"); - else if (c == '\f') - fprintf (stream, "\\f"); - else if (c == '\r') - fprintf (stream, "\\r"); - else if (c == 033) - fprintf (stream, "\\e"); - else if (c == '\a') - fprintf (stream, "\\a"); - else - fprintf (stream, "\\%03o", c); - } - else - { - if (c == '\\' || c == '"' || c == '\'') - fputc ('\\', stream); - fputc (c, stream); - } -} -SHAR_EOF -cat << \SHAR_EOF > remote_inflow.c -/* Low level interface to ptrace, for GDB when running under Unix. - Copyright (C) 1986, 1987 Free Software Foundation, Inc. -*/ - -#include "defs.h" -#include "param.h" -#include "wait.h" -#include "frame.h" -#include "inferior.h" -/*************************** -#include "initialize.h" -****************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -/***************Begin MY defs*********************/ -int quit_flag = 0; -char registers[REGISTER_BYTES]; - -/* Index within `registers' of the first byte of the space for - register N. */ - - -char buf2[MAX_REGISTER_RAW_SIZE]; -/***************End MY defs*********************/ - -#ifdef NEW_SUN_PTRACE -#include -#include -#endif - -extern char **environ; -extern int errno; -extern int inferior_pid; -void error(), quit(), perror_with_name(); -int query(); -void supply_register(), write_register(); -CORE_ADDR read_register(); - -/* Nonzero if we are debugging an attached outside process - rather than an inferior. */ - - -/* Start an inferior process and returns its pid. - ALLARGS is a vector of program-name and args. - ENV is the environment vector to pass. */ - -int -create_inferior (allargs, env) - char **allargs; - char **env; -{ - int pid; - extern int sys_nerr; - extern char *sys_errlist[]; - extern int errno; - - /* exec is said to fail if the executable is open. */ - /****************close_exec_file ();*****************/ - - pid = vfork (); - if (pid < 0) - perror_with_name ("vfork"); - - if (pid == 0) - { - /* Run inferior in a separate process group. */ - setpgrp (getpid (), getpid ()); - -/* Not needed on Sun, at least, and loses there - because it clobbers the superior. */ -/*??? signal (SIGQUIT, SIG_DFL); - signal (SIGINT, SIG_DFL); */ - - errno = 0; - ptrace (0); - - execle ("/bin/sh", "sh", "-c", allargs, 0, env); - - fprintf (stderr, "Cannot exec /bin/sh: %s.\n", - errno < sys_nerr ? sys_errlist[errno] : "unknown error"); - fflush (stderr); - _exit (0177); - } - return pid; -} - -/* Kill the inferior process. Make us have no inferior. */ - -kill_inferior () -{ - if (inferior_pid == 0) - return; - ptrace (8, inferior_pid, 0, 0); - wait (0); - /*************inferior_died ();****VK**************/ -} - -/* Resume execution of the inferior process. - If STEP is nonzero, single-step it. - If SIGNAL is nonzero, give it that signal. */ - -unsigned char -resume (step, signal,status) - int step; - int signal; - char *status; -{ - int pid ; - WAITTYPE w; - - errno = 0; - ptrace (step ? 9 : 7, inferior_pid, 1, signal); - if (errno) - perror_with_name ("ptrace"); - pid = wait(&w); - if(pid != inferior_pid) - perror_with_name ("wait"); - - if(WIFEXITED(w)) - { - printf("\nchild exited with retcode = %x \n",WRETCODE(w)); - *status = 'E'; - return((unsigned char) WRETCODE(w)); - } - else if(!WIFSTOPPED(w)) - { - printf("\nchild did terminated with signal = %x \n",WTERMSIG(w)); - *status = 'T'; - return((unsigned char) WTERMSIG(w)); - } - else - { - printf("\nchild stopped with signal = %x \n",WSTOPSIG(w)); - *status = 'S'; - return((unsigned char) WSTOPSIG(w)); - } - -} - - -#ifdef NEW_SUN_PTRACE - -void -fetch_inferior_registers () -{ - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - extern char registers[]; - - ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers); - if (errno) - perror_with_name ("ptrace"); - /**********debugging begin **********/ - print_some_registers(&inferior_registers); - /**********debugging end **********/ - ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers); - if (errno) - perror_with_name ("ptrace"); - - bcopy (&inferior_registers, registers, 16 * 4); - bcopy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.fps_regs); - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; - bcopy (&inferior_fp_registers.fps_control, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - extern char registers[]; - - bcopy (registers, &inferior_registers, 16 * 4); - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fps_regs); - inferior_registers.r_ps = *(int *)®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_registers.r_pc = *(int *)®isters[REGISTER_BYTE (PC_REGNUM)]; - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &inferior_fp_registers.fps_control, - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); - - ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers); - if (errno) - perror_with_name ("ptrace"); - ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers); - if (errno) - perror_with_name ("ptrace"); -} - -#endif /* not NEW_SUN_PTRACE */ - - -/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory - in the NEW_SUN_PTRACE case. - It ought to be straightforward. But it appears that writing did - not write the data that I specified. I cannot understand where - it got the data that it actually did write. */ - -/* Copy LEN bytes from inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. */ - -read_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (int); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - /* Allocate buffer of that many longwords. */ - register int *buffer = (int *) alloca (count * sizeof (int)); - - /* Read all the longwords */ - for (i = 0; i < count; i++, addr += sizeof (int)) - { - buffer[i] = ptrace (1, inferior_pid, addr, 0); - } - - /* Copy appropriate bytes out of the buffer. */ - bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. - On failure (cannot write the inferior) - returns the value of errno. */ - -int -write_inferior_memory (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - register int i; - /* Round starting address down to longword boundary. */ - register CORE_ADDR addr = memaddr & - sizeof (int); - /* Round ending address up; get number of longwords that makes. */ - register int count - = (((memaddr + len) - addr) + sizeof (int) - 1) / sizeof (int); - /* Allocate buffer of that many longwords. */ - register int *buffer = (int *) alloca (count * sizeof (int)); - extern int errno; - - /* Fill start and end extra bytes of buffer with existing memory data. */ - - buffer[0] = ptrace (1, inferior_pid, addr, 0); - - if (count > 1) - { - buffer[count - 1] - = ptrace (1, inferior_pid, - addr + (count - 1) * sizeof (int), 0); - } - - /* Copy data to be written over corresponding part of buffer */ - - bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len); - - /* Write the entire buffer. */ - - for (i = 0; i < count; i++, addr += sizeof (int)) - { - errno = 0; - ptrace (4, inferior_pid, addr, buffer[i]); - if (errno) - return errno; - } - - return 0; -} - -void -try_writing_regs_command () -{ - register int i; - register int value; - extern int errno; - - if (inferior_pid == 0) - error ("There is no inferior process now."); - - fetch_inferior_registers(); - for (i = 0;i<18 ; i ++) - { - QUIT; - errno = 0; - value = read_register(i); - write_register ( i, value); - if (errno == 0) - { - printf (" Succeeded with register %d; value 0x%x (%d).\n", - i, value, value); - } - else - printf (" Failed with register %d.\n", i); - } -} - -void -initialize () -{ - - inferior_pid = 0; - - -} - - -/* Return the contents of register REGNO, - regarding it as an integer. */ - -CORE_ADDR -read_register (regno) - int regno; -{ - /* This loses when REGISTER_RAW_SIZE (regno) != sizeof (int) */ - return *(int *) ®isters[REGISTER_BYTE (regno)]; -} - -/* Store VALUE in the register number REGNO, regarded as an integer. */ - -void -write_register (regno, val) - int regno, val; -{ - /* This loses when REGISTER_RAW_SIZE (regno) != sizeof (int) */ - *(int *) ®isters[REGISTER_BYTE (regno)] = val; - - if (have_inferior_p ()) - store_inferior_registers (regno); -} - - -int -have_inferior_p () -{ - return inferior_pid != 0; -} - -print_some_registers(regs) -int regs[]; -{ - register int i; - for (i = 0; i < 18; i++) { - printf("reg[%d] = %x\n", i, regs[i]); - } -} - -SHAR_EOF -cat << \SHAR_EOF > remote_server.c -/* Main code for remote server for GDB, the GNU Debugger. - Copyright (C) 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "param.h" -#include - -void read_inferior_memory(), fetch_inferior_registers(); -unsigned char resume(); -void kill_inferior(); -void initialize(), try_writing_regs_command(); -int create_inferior(), read_register(); - -extern char registers[]; -int inferior_pid; -extern char **environ; - -/* Descriptor for I/O to remote machine. */ -int remote_desc; -int kiodebug = 0; -int remote_debugging; - -void remote_send (); -void putpkt (); -void getpkt (); -void remote_open(); -void write_ok(); -void write_enn(); -void convert_ascii_to_int(); -void convert_int_to_ascii(); -void prepare_resume_reply(); -void decode_m_packet(); -void decode_M_packet(); - - -main(argc,argv) -int argc; char *argv[]; -{ - char ch,status, own_buf[2000], mem_buf[2000]; - int i=0; - unsigned char signal; - unsigned int mem_addr, len; - - initialize(); - printf("\nwill open serial link\n"); - remote_open("/dev/ttya",0); - - if(argc < 2) - { - printf("Enter name of program to be run with command line args\n"); - gets(own_buf); - inferior_pid = create_inferior(own_buf,environ); - printf("\nProcess %s created; pid = %d\n",own_buf,inferior_pid); - } - else - { - inferior_pid = create_inferior(argv[1],environ); - printf("\nProcess %s created; pid = %d\n",argv[1],inferior_pid); - } - - do { - getpkt(own_buf); - printf("\nPacket received is>:%s\n",own_buf); - i = 0; - ch = own_buf[i++]; - switch (ch) { - case 'h': /**********This is only for tweaking the gdb+ program *******/ - signal = resume(1,0,&status); - prepare_resume_reply(own_buf,status,signal); - break; - /*************end tweak*************************************/ - - case 'g': fetch_inferior_registers(); - convert_int_to_ascii(registers,own_buf,REGISTER_BYTES); - break; - case 'G': convert_ascii_to_int(&own_buf[1],registers,REGISTER_BYTES); - if(store_inferior_registers(-1)==0) - write_ok(own_buf); - else - write_enn(own_buf); - break; - case 'm': decode_m_packet(&own_buf[1],&mem_addr,&len); - read_inferior_memory(mem_addr,mem_buf,len); - convert_int_to_ascii(mem_buf,own_buf,len); - break; - case 'M': decode_M_packet(&own_buf[1],&mem_addr,&len,mem_buf); - if(write_inferior_memory(mem_addr,mem_buf,len)==0) - write_ok(own_buf); - else - write_enn(own_buf); - break; - case 'c': signal = resume(0,0,&status); - printf("\nSignal received is >: %0x \n",signal); - prepare_resume_reply(own_buf,status,signal); - break; - case 's': signal = resume(1,0,&status); - prepare_resume_reply(own_buf,status,signal); - break; - case 'k': kill_inferior(); - sprintf(own_buf,"q"); - putpkt(own_buf); - printf("\nObtained kill request...terminating\n"); - close(remote_desc); - exit(0); - case 't': try_writing_regs_command(); - own_buf[0] = '\0'; - break; - default : printf("\nUnknown option chosen by master\n"); - write_enn(own_buf); - break; - } - - putpkt(own_buf); - } while(1) ; - - close(remote_desc); - /** now get out of here**/ - printf("\nFinished reading data from serial link - Bye!\n"); - exit(0); - -} - -SHAR_EOF -cat << \SHAR_EOF > remote_utils.c -/* Remote utility routines for the remote server for GDB, the GNU debugger. - Copyright (C) 1986, 1989 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "param.h" -#include -#include -#include -#include -#include -#include -#include - -extern int remote_desc; -extern int remote_debugging; -extern int kiodebug; - -void remote_open(); -void remote_send(); -void putpkt(); -void getpkt(); - -void write_ok(); -void write_enn(); -void convert_ascii_to_int(); -void convert_int_to_ascii(); -void prepare_resume_reply(); - -/* Open a connection to a remote debugger. - NAME is the filename used for communication. */ - -void -remote_open (name, from_tty) - char *name; - int from_tty; -{ - struct sgttyb sg; - - remote_debugging = 0; - - remote_desc = open (name, O_RDWR); - if (remote_desc < 0) - printf("\ncould not open remote device\n"); - - ioctl (remote_desc, TIOCGETP, &sg); - sg.sg_flags = RAW; - ioctl (remote_desc, TIOCSETP, &sg); - - if (from_tty) - printf ("Remote debugging using %s\n", name); - remote_debugging = 1; -} - -/* Convert hex digit A to a number. */ - -static int -fromhex (a) - int a; -{ - if (a >= '0' && a <= '9') - return a - '0'; - else if (a >= 'a' && a <= 'f') - return a - 'a' + 10; - else - perror ("Reply contains invalid hex digit"); -} - -/* Convert number NIB to a hex digit. */ - -static int -tohex (nib) - int nib; -{ - if (nib < 10) - return '0'+nib; - else - return 'a'+nib-10; -} - -/* Send the command in BUF to the remote machine, - and read the reply into BUF. - Report an error if we get an error reply. */ - -void -remote_send (buf) - char *buf; -{ - putpkt (buf); - getpkt (buf); - - if (buf[0] == 'E') - perror ("Remote failure reply: %s", buf); -} - -/* Send a packet to the remote machine, with error checking. - The data of the packet is in BUF. */ - -void -putpkt (buf) - char *buf; -{ - int i; - unsigned char csum = 0; - char buf2[500]; - char buf3[1]; - int cnt = strlen (buf); - char *p; - - if (kiodebug) - fprintf (stderr, "Sending packet: %s\n", buf); - - /* Copy the packet into buffer BUF2, encapsulating it - and giving it a checksum. */ - - p = buf2; - *p++ = '$'; - - for (i = 0; i < cnt; i++) - { - csum += buf[i]; - *p++ = buf[i]; - } - *p++ = '#'; - *p++ = tohex ((csum >> 4) & 0xf); - *p++ = tohex (csum & 0xf); - - /* Send it over and over until we get a positive ack. */ - - do { - write (remote_desc, buf2, p - buf2); - read (remote_desc, buf3, 1); - } while (buf3[0] != '+'); -} - -static int -readchar () -{ - char buf[1]; - while (read (remote_desc, buf, 1) != 1) ; - return buf[0] & 0x7f; -} - -/* Read a packet from the remote machine, with error checking, - and store it in BUF. */ - -void -getpkt (buf) - char *buf; -{ - char *bp; - unsigned char csum, c, c1, c2; - extern kiodebug; - - while (1) - { - csum = 0; - while ((c = readchar()) != '$'); - - bp = buf; - while (1) - { - c = readchar (); - if (c == '#') - break; - *bp++ = c; - csum += c; - } - *bp = 0; - - c1 = fromhex (readchar ()); - c2 = fromhex (readchar ()); - if (csum == (c1 << 4) + c2) - break; - - printf ("Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n", - (c1 << 4) + c2, csum, buf); - write (remote_desc, "-", 1); - } - - write (remote_desc, "+", 1); - - if (kiodebug) - fprintf (stderr,"Packet received :%s\n", buf); -} - - -void -write_ok(buf) - char *buf; -{ - buf[0] = 'O'; - buf[1] = 'k'; - buf[2] = '\0'; -} - -void -write_enn(buf) - char *buf; -{ - buf[0] = 'E'; - buf[1] = 'N'; - buf[2] = 'N'; - buf[3] = '\0'; -} - -void -convert_int_to_ascii(from,to,n) -char *from, *to; int n; -{ - int nib ; - char ch; - while( n-- ) - { - ch = *from++; - nib = ((ch & 0xf0) >> 4)& 0x0f; - *to++ = tohex(nib); - nib = ch & 0x0f; - *to++ = tohex(nib); - } - *to++ = 0; -} - - -void -convert_ascii_to_int(from,to,n) -char *from, *to; int n; -{ - int nib1,nib2 ; - while( n-- ) - { - nib1 = fromhex(*from++); - nib2 = fromhex(*from++); - *to++ = (((nib1 & 0x0f)<< 4)& 0xf0) | (nib2 & 0x0f); - } -} - -void -prepare_resume_reply(buf,status,signal) -char *buf ,status; -unsigned char signal; -{ - int nib; - char ch; - - *buf++ = 'S'; - *buf++ = status; - nib = ((signal & 0xf0) >> 4) ; - *buf++ = tohex(nib); - nib = signal & 0x0f; - *buf++ = tohex(nib); - *buf++ = 0; -} - -void -decode_m_packet(from,mem_addr_ptr,len_ptr) -char *from; -unsigned int *mem_addr_ptr, *len_ptr; -{ - int i = 0, j = 0 ; - char ch; - *mem_addr_ptr = *len_ptr = 0; - /************debugging begin************/ - printf("\nIn decode_m_packet"); - /************debugging end************/ - - while((ch = from[i++]) != ',') - { - *mem_addr_ptr = *mem_addr_ptr << 4; - *mem_addr_ptr |= fromhex(ch) & 0x0f; - } - /************debugging begin************/ - printf("\nFinished mem_addr part"); - /************debugging end************/ - - for(j=0; j < 4; j++) - { - if((ch = from[i++]) == 0) - break; - *len_ptr = *len_ptr << 4; - *len_ptr |= fromhex(ch) & 0x0f; - } - /************debugging begin************/ - printf("\nFinished len_ptr part"); - /************debugging end************/ -} - -void -decode_M_packet(from,mem_addr_ptr,len_ptr,to) -char *from, *to; -unsigned int *mem_addr_ptr, *len_ptr; -{ - int i = 0, j = 0 ; - char ch; - *mem_addr_ptr = *len_ptr = 0; - /************debugging begin************/ - printf("\nIn decode_M_packet"); - /************debugging end************/ - - while((ch = from[i++]) != ',') - { - *mem_addr_ptr = *mem_addr_ptr << 4; - *mem_addr_ptr |= fromhex(ch) & 0x0f; - } - /************debugging begin************/ - printf("\nFinished mem_addr part: memaddr = %x",*mem_addr_ptr); - /************debugging end************/ - - while((ch = from[i++]) != ':') - { - *len_ptr = *len_ptr << 4; - *len_ptr |= fromhex(ch) & 0x0f; - } - /************debugging begin************/ - printf("\nFinished len_ptr part: len = %d",*len_ptr); - /************debugging end************/ - - convert_ascii_to_int(&from[i++],to,*len_ptr); - - /************debugging begin************/ - printf("\nmembuf : %x",*(int *)to); - /************debugging end************/ -} - -SHAR_EOF -# End of shell archive -exit 0 diff --git a/gdb/remote-sa.m68k.shar b/gdb/remote-sa.m68k.shar deleted file mode 100755 index aeb76e5..0000000 --- a/gdb/remote-sa.m68k.shar +++ /dev/null @@ -1,893 +0,0 @@ -# This is a shell archive. Remove anything before this line, -# then unpack it by saving it in a file and typing "sh file". -# -# Wrapped by Glenn Engel on Mon Jun 12 15:19:20 1989 -# -# This archive contains: -# remcom.c -# - -LANG=""; export LANG -PATH=/bin:/usr/bin:$PATH; export PATH - -echo x - remcom.c -cat >remcom.c <<'@EOF' - -/**************************************************************************** - - THIS SOFTWARE IS NOT COPYRIGHTED - - HP offers the following for use in the public domain. HP makes no - warranty with regard to the software or it's performance and the - user accepts the software "AS IS" with all faults. - - HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD - TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -****************************************************************************/ - -/**************************************************************************** - * $Header$ - * - * $Module name: remcom.c $ - * $Revision$ - * $Date$ - * $Contributor: Lake Stevens Instrument Division$ - * - * $Description: low level support for gdb debugger. $ - * - * $Considerations: only works on target hardware $ - * - * $Written by: Glenn Engel $ - * $ModuleState: Experimental $ - * - * $NOTES: See Below $ - * - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a trap #1. - * - * Some explanation is probably necessary to explain how exceptions are - * handled. When an exception is encountered the 68000 pushes the current - * program counter and status register onto the supervisor stack and then - * transfers execution to a location specified in it's vector table. - * The handlers for the exception vectors are hardwired to jmp to an address - * given by the relation: (exception - 256) * 6. These are decending - * addresses starting from -6, -12, -18, ... By allowing 6 bytes for - * each entry, a jsr, jmp, bsr, ... can be used to enter the exception - * handler. Using a jsr to handle an exception has an added benefit of - * allowing a single handler to service several exceptions and use the - * return address as the key differentiation. The vector number can be - * computed from the return address by [ exception = (addr + 1530) / 6 ]. - * The sole purpose of the routine _catchException is to compute the - * exception number and push it on the stack in place of the return address. - * The external function exceptionHandler() is - * used to attach a specific handler to a specific 68k exception. - * For 68020 machines, the ability to have a return address around just - * so the vector can be determined is not necessary because the '020 pushes an - * extra word onto the stack containing the vector offset - * - * Because gdb will sometimes write to the stack area to execute function - * calls, this program cannot rely on using the supervisor stack so it - * uses it's own stack area reserved in the int array remcomStack. - * - ************* - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - ****************************************************************************/ - -#include -#include -#include - -/************************************************************************ - * - * external low-level support routines - */ -typedef void (*ExceptionHook)(int); /* pointer to function with int parm */ -typedef void (*Function)(); /* pointer to a function */ - -extern putDebugChar(); /* write a single character */ -extern getDebugChar(); /* read and return a single char */ - -extern Function exceptionHandler(); /* assign an exception handler */ -extern ExceptionHook exceptionHook; /* hook variable for errors/exceptions */ - - -/************************************************************************/ -/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ -/* at least NUMREGBYTES*2 are needed for register packets */ -#define BUFMAX 400 - -static char initialized; /* boolean flag. != 0 means we've been initialized */ - -int remote_debug = 0; -/* debug > 0 prints ill-formed commands in valid packets & checksum errors */ - -char hexchars[]="0123456789abcdef"; - -/* there are 180 bytes of registers on a 68020 w/68881 */ -/* many of the fpa registers are 12 byte (96 bit) registers */ -#define NUMREGBYTES 180 -enum regnames {D0,D1,D2,D3,D4,D5,D6,D7, - A0,A1,A2,A3,A4,A5,A6,A7, - PS,PC, - FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7, - FPCONTROL,FPSTATUS,FPIADDR - }; - -typedef struct FrameStruct -{ - struct FrameStruct *previous; - int exceptionPC; /* pc value when this frame created */ - int exceptionVector; /* cpu vector causing exception */ - short frameSize; /* size of cpu frame in words */ - short sr; /* for 68000, this not always sr */ - int pc; - short format; - int fsaveHeader; - int morejunk[0]; /* exception frame, fp save... */ -} Frame; - -#define FRAMESIZE 500 -static Frame *lastFrame; -static int frameStack[FRAMESIZE]; - -/* - * these should not be static cuz they can be used outside this module - */ -int registers[NUMREGBYTES/4]; -int superStack; - -static int remcomStack[400]; -static int* stackPtr = &remcomStack[399]; - -/* - * In many cases, the system will want to continue exception processing - * when a continue command is given. - * oldExceptionHook is a function to invoke in this case. - */ - -static ExceptionHook oldExceptionHook; - -/* the size of the exception stack on the 68020 varies with the type of - * exception. The following table is the number of WORDS used - * for each exception format. - */ -static short exceptionSize[] = { 4,4,6,4,4,4,4,4,29,10,16,46,4,4,4,4 }; - -/************* jump buffer used for setjmp/longjmp **************************/ -jmp_buf env; - -/*************************** ASSEMBLY CODE MACROS *************************/ -/* */ - -#ifdef __HAVE_68881__ -/* do an fsave, then remember the address to begin a restore from */ -#define SAVE_FP_REGS() asm(" fsave a0@-"); \ - asm(" fmovemx fp0-fp7,_registers+72"); \ - asm(" fmoveml fpcr/fpsr/fpi,_registers+168"); -#define RESTORE_FP_REGS() asm(" fmoveml _registers+168,fpcr/fpsr/fpi"); \ - asm(" fmovemx _registers+72,fp0-fp7"); \ - asm(" frestore a0@+"); -#else -#define SAVE_FP_REGS() -#define RESTORE_FP_REGS() -#endif /* __HAVE_68881__ */ - -asm(" -.text -.globl _return_to_super -_return_to_super: - movel _registers+60,sp /* get new stack pointer */ - movel _lastFrame,a0 /* get last frame info */ - bra return_to_any - -.globl _return_to_user -_return_to_user: - movel _registers+60,a0 /* get usp */ - movel a0,usp /* set usp */ - movel _superStack,sp /* get original stack pointer */ - -return_to_any: - movel _lastFrame,a0 /* get last frame info */ - movel a0@+,_lastFrame /* link in previous frame */ - addql #8,a0 /* skip over pc, vector#*/ - movew a0@+,d0 /* get # of words in cpu frame */ - addw d0,a0 /* point to end of data */ - addw d0,a0 /* point to end of data */ - movel a0,a1 -# -# copy the stack frame - subql #1,d0 -copyUserLoop: - movew a1@-,sp@- - dbf d0,copyUserLoop -"); - RESTORE_FP_REGS() - asm(" moveml _registers,d0-d7/a0-a6"); - asm(" rte"); /* pop and go! */ - -#define DISABLE_INTERRUPTS() asm(" oriw #0x0700,sr"); -#define BREAKPOINT() asm(" trap #1"); - -/* this function is called immediately when a level 7 interrupt occurs */ -/* if the previous interrupt level was 7 then we're already servicing */ -/* this interrupt and an rte is in order to return to the debugger. */ -/* For the 68000, the offset for sr is 6 due to the jsr return address */ -asm(" -.text -.globl __debug_level7 -__debug_level7: - movew d0,sp@-"); -#ifdef mc68020 -asm(" movew sp@(2),d0"); -#else -asm(" movew sp@(6),d0"); -#endif -asm(" andiw #0x700,d0 - cmpiw #0x700,d0 - beq _already7 - movew sp@+,d0 - bra __catchException -_already7: - movew sp@+,d0"); -#ifndef mc68020 -asm(" lea sp@(4),sp"); /* pull off 68000 return address */ -#endif -asm(" rte"); - -extern void _catchException(); - -#ifdef mc68020 -/* This function is called when a 68020 exception occurs. It saves - * all the cpu and fpcp regs in the _registers array, creates a frame on a - * linked list of frames which has the cpu and fpcp stack frames needed - * to properly restore the context of these processors, and invokes - * an exception handler (remcom_handler). - * - * stack on entry: stack on exit: - * N bytes of junk exception # MSWord - * Exception Format Word exception # MSWord - * Program counter LSWord - * Program counter MSWord - * Status Register - * - * - */ -asm(" -.text -.globl __catchException -__catchException:"); -DISABLE_INTERRUPTS(); -asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ - movel _lastFrame,a0 /* last frame pointer */ -"); -SAVE_FP_REGS(); -asm(" - lea _registers,a5 /* get address of registers */ - movew sp@,d1 /* get status register */ - movew d1,a5@(66) /* save sr */ - movel sp@(2),a4 /* save pc in a4 for later use */ - movel a4,a5@(68) /* save pc in _regisers[] */ - -# -# figure out how many bytes in the stack frame - movew sp@(6),d0 /* get '020 exception format */ - movew d0,d2 /* make a copy of format word */ - andiw #0xf000,d0 /* mask off format type */ - rolw #5,d0 /* rotate into the low byte *2 */ - lea _exceptionSize,a1 - addw d0,a1 /* index into the table */ - movew a1@,d0 /* get number of words in frame */ - movew d0,d3 /* save it */ - subw d0,a0 /* adjust save pointer */ - subw d0,a0 /* adjust save pointer(bytes) */ - movel a0,a1 /* copy save pointer */ - subql #1,d0 /* predecrement loop counter */ -# -# copy the frame -saveFrameLoop: - movew sp@+,a1@+ - dbf d0,saveFrameLoop -# -# now that the stack has been clenaed, -# save the a7 in use at time of exception - movel sp,_superStack /* save supervisor sp */ - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra a7saveDone -userMode: - movel usp,a1 - movel a1,a5@(60) /* save user stack pointer */ -a7saveDone: - -# -# save size of frame - movew d3,a0@- - -# -# compute exception number - andl #0xfff,d2 /* mask off vector offset */ - lsrw #2,d2 /* divide by 4 to get vect num */ - movel d2,a0@- /* save it */ -# -# save pc causing exception - movel a4,a0@- -# -# save old frame link and set the new value - movel _lastFrame,a1 /* last frame pointer */ - movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame - - movel d2,sp@- /* push exception num */ - movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - jmp __returnFromException /* now, return */ -"); -#else /* mc68000 */ -/* This function is called when an exception occurs. It translates the - * return address found on the stack into an exception vector # which - * is then handled by either handle_exception or a system handler. - * _catchException provides a front end for both. - * - * stack on entry: stack on exit: - * Program counter MSWord exception # MSWord - * Program counter LSWord exception # MSWord - * Status Register - * Return Address MSWord - * Return Address LSWord - */ -asm(" -.text -.globl __catchException -__catchException:"); -DISABLE_INTERRUPTS(); -asm(" - moveml d0-d7/a0-a6,_registers /* save registers */ - movel _lastFrame,a0 /* last frame pointer */ -"); -SAVE_FP_REGS(); -asm(" - lea _registers,a5 /* get address of registers */ - movel sp@+,d2 /* pop return address */ - addl #1530,d2 /* convert return addr to */ - divs #6,d2 /* exception number */ - extl d2 - - moveql #3,d3 /* assume a three word frame */ - - cmpiw #3,d2 /* bus error or address error ? */ - bgt normal /* if >3 then normal error */ - movel sp@+,a0@- /* copy error info to frame buff*/ - movel sp@+,a0@- /* these are never used */ - moveql #7,d3 /* this is a 7 word frame */ - -normal: - movew sp@+,d1 /* pop status register */ - movel sp@+,a4 /* pop program counter */ - movew d1,a5@(66) /* save sr */ - movel a4,a5@(68) /* save pc in _regisers[] */ - movel a4,a0@- /* copy pc to frame buffer */ - movew d1,a0@- /* copy sr to frame buffer */ - - movel sp,_superStack /* save supervisor sp */ - - andiw #0x2000,d1 /* were we in supervisor mode ? */ - beq userMode - movel a7,a5@(60) /* save a7 */ - bra saveDone -userMode: - movel usp,a1 /* save user stack pointer */ - movel a1,a5@(60) /* save user stack pointer */ -saveDone: - - movew d3,a0@- /* push frame size in words */ - movel d2,a0@- /* push vector number */ - movel a4,a0@- /* push exception pc */ - -# -# save old frame link and set the new value - movel _lastFrame,a1 /* last frame pointer */ - movel a1,a0@- /* save pointer to prev frame */ - movel a0,_lastFrame - - movel d2,sp@- /* push exception num */ - movel _exceptionHook,a0 /* get address of handler */ - jbsr a0@ /* and call it */ - jmp __returnFromException /* now, return */ -"); -#endif - - -/* - * remcomHandler is a front end for handle_exception. It moves the - * stack pointer into an area reserved for debugger use in case the - * breakpoint happened in supervisor mode. - */ -asm("_remcomHandler:"); -asm(" addl #4,sp"); /* pop off return address */ -asm(" movel sp@+,d0"); /* get the exception number */ -asm(" movel _stackPtr,sp"); /* move to remcom stack area */ -asm(" movel d0,sp@-"); /* push exception onto stack */ -asm(" jbsr _handle_exception"); /* this never returns */ -asm(" rts"); /* return */ - -void _returnFromException( Frame *frame ) -{ - /* if no existing frame, dummy one up */ - if (! frame) - { - frame = lastFrame -1; - frame->frameSize = 4; - frame->format = 0; - frame->fsaveHeader = 0; - frame->previous = lastFrame; - } - -#ifndef mc68020 - /* a 68000 cannot use the internal info pushed onto a bus error - * or address error frame when doing an RTE so don't put this info - * onto the stack or the stack will creep every time this happens. - */ - frame->frameSize=3; -#endif - - /* throw away any frames in the list after this frame */ - lastFrame = frame; - - frame->sr = registers[(int) PS]; - frame->pc = registers[(int) PC]; - - if (registers[(int) PS] & 0x2000) - { - /* return to supervisor mode... */ - return_to_super(); - } - else - { /* return to user mode */ - return_to_user(); - } -} - -int hex(ch) -char ch; -{ - if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); - if ((ch >= '0') && (ch <= '9')) return (ch-'0'); - return (0); -} - - -/* scan for the sequence $# */ -void getpacket(buffer) -char * buffer; -{ - unsigned char checksum; - unsigned char xmitcsum; - int i; - int count; - char ch; - - do { - /* wait around for the start character, ignore all other characters */ - while ((ch = getDebugChar()) != '$'); - checksum = 0; - count = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) { - ch = getDebugChar(); - if (ch == '#') break; - checksum = checksum + ch; - buffer[count] = ch; - count = count + 1; - } - buffer[count] = 0; - - if (ch == '#') { - xmitcsum = hex(getDebugChar()) << 4; - xmitcsum += hex(getDebugChar()); - if ((remote_debug ) && (checksum != xmitcsum)) { - fprintf(stderr,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", - checksum,xmitcsum,buffer); - } - - if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */ - else { - putDebugChar('+'); /* successful transfer */ - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') { - putDebugChar( buffer[0] ); - putDebugChar( buffer[1] ); - /* remove sequence chars from buffer */ - count = strlen(buffer); - for (i=3; i <= count; i++) buffer[i-3] = buffer[i]; - } - } - } - } while (checksum != xmitcsum); - -} - -/* send the packet in buffer. The host get's one chance to read it. - This routine does not wait for a positive acknowledge. */ - - -void putpacket(buffer) -char * buffer; -{ - unsigned char checksum; - int count; - char ch; - - /* $#. */ - do { - putDebugChar('$'); - checksum = 0; - count = 0; - - while (ch=buffer[count]) { - if (! putDebugChar(ch)) return; - checksum += ch; - count += 1; - } - - putDebugChar('#'); - putDebugChar(hexchars[checksum >> 4]); - putDebugChar(hexchars[checksum % 16]); - - } while (1 == 0); /* (getDebugChar() != '+'); */ - -} - -static char inbuffer[BUFMAX]; -static char outbuffer[BUFMAX]; -static short error; - - -void debug_error(format, parm) -char * format; -char * parm; -{ - if (remote_debug) fprintf(stderr,format,parm); -} - -/* convert the memory pointed to by mem into hex, placing result in buf */ -/* return a pointer to the last char put in buf (null) */ -char* mem2hex(mem, buf, count) -char* mem; -char* buf; -int count; -{ - int i; - unsigned char ch; - for (i=0;i> 4]; - *buf++ = hexchars[ch % 16]; - } - *buf = 0; - return(buf); -} - -/* convert the hex array pointed to by buf into binary to be placed in mem */ -/* return a pointer to the character AFTER the last byte written */ -char* hex2mem(buf, mem, count) -char* buf; -char* mem; -int count; -{ - int i; - unsigned char ch; - for (i=0;iexceptionPC, - frame->exceptionVector); - if (frame->exceptionPC == newPC) break; /* bingo! a match */ - /* - * for a breakpoint instruction, the saved pc may - * be off by two due to re-executing the instruction - * replaced by the trap instruction. Check for this. - */ - if ((frame->exceptionVector == 33) && - (frame->exceptionPC == (newPC+2))) break; - frame = frame->previous; - } - - /* - * If we found a match for the PC AND we are not returning - * as a result of a breakpoint (33), - * trace exception (9), nmi (31), jmp to - * the old exception handler as if this code never ran. - */ - if (frame) - { - if ((frame->exceptionVector != 9) && - (frame->exceptionVector != 31) && - (frame->exceptionVector != 33)) - { - /* - * invoke the previous handler. - */ - if (oldExceptionHook) - (*oldExceptionHook) (frame->exceptionVector); - newPC = registers[ PC ]; /* pc may have changed */ - if (newPC != frame->exceptionPC) - { - if (remote_debug) - printf("frame at 0x%x has pc=0x%x, except#=%d\n", - frame,frame->exceptionPC, - frame->exceptionVector); - /* dispose of this frame, we're skipping it (longjump?)*/ - lastFrame = frame->previous; - frame = (Frame *) 0; - } - } - } - - _returnFromException( frame ); - - break; - - /* kill the program */ - case 'k' : /* do nothing */ - break; - } /* switch */ - - /* reply to the request */ - putpacket(outbuffer); - } -} - - -/* this function is used to set up exception handlers for tracing and - breakpoints */ -void set_debug_traps() -{ -extern void _debug_level7(); -extern void remcomHandler(); -int exception; - - for (exception = 2; exception <= 23; exception++) - exceptionHandler(exception,_catchException); - - /* level 7 interrupt */ - exceptionHandler(31,_debug_level7); - - /* breakpoint exception (trap #1) */ - exceptionHandler(33,_catchException); - - /* floating point error (trap #8) */ - exceptionHandler(40,_catchException); - - /* 48 to 54 are floating point coprocessor errors */ - for (exception = 48; exception <= 54; exception++) - exceptionHandler(exception,_catchException); - - if (oldExceptionHook != remcomHandler) - { - oldExceptionHook = exceptionHook; - exceptionHook = remcomHandler; - } - - initialized = 1; - - lastFrame = (Frame *) &frameStack[FRAMESIZE-1]; - lastFrame->previous = (Frame *) 0; -} - -/* This function will generate a breakpoint exception. It is used at the - beginning of a program to sync up with a debugger and can be used - otherwise as a quick means to stop program execution and "break" into - the debugger. */ - -void breakpoint() -{ - if (initialized) BREAKPOINT(); -} - -@EOF - -chmod 444 remcom.c - -exit 0 - diff --git a/gdb/remote-ser.c b/gdb/remote-ser.c index aebd693..e69de29 100644 --- a/gdb/remote-ser.c +++ b/gdb/remote-ser.c @@ -1,794 +0,0 @@ -/* Remote target communications for serial-line targets in custom GDB protocol - Copyright 1988, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Remote communication protocol. - All values are encoded in ascii hex digits. - - Request Packet - - read registers g - reply XX....X Each byte of register data - is described by two hex digits. - Registers are in the internal order - for GDB, and the bytes in a register - are in the same order the machine uses. - or ENN for an error. - - write regs GXX..XX Each byte of register data - is described by two hex digits. - reply OK for success - ENN for an error - - read mem mAA..AA,LLLL AA..AA is address, LLLL is length. - reply XX..XX XX..XX is mem contents - or ENN NN is errno - - write mem MAA..AA,LLLL:XX..XX - AA..AA is address, - LLLL is number of bytes, - XX..XX is data - reply OK for success - ENN for an error - - cont cAA..AA AA..AA is address to resume - If AA..AA is omitted, - resume at same address. - - step sAA..AA AA..AA is address to resume - If AA..AA is omitted, - resume at same address. - - last signal ? Reply the current reason for stopping. - This is the same reply as is generated - for step or cont : SAA where AA is the - signal number. - - There is no immediate reply to step or cont. - The reply comes when the machine stops. - It is SAA AA is the "signal number" - - or... TAAPPPPPPPPFFFFFFFF - where AA is the signal number, - PPPPPPPP is the PC (PC_REGNUM), and - FFFFFFFF is the frame ptr (FP_REGNUM). - - kill req k -*/ - -#include "defs.h" -#include -#include "serial.h" -#include "frame.h" -#include "inferior.h" -#include "target.h" -#include "wait.h" -#include "terminal.h" -#include "gdbcmd.h" - -#include - -static int kiodebug = 0; -static int timeout = 5; - -#define PBUFSIZ 1024 - -/* Maximum number of bytes to read/write at once. The value here - is chosen to fill up a packet (the headers account for the 32). */ -#define MAXBUFBYTES ((PBUFSIZ-32)/2) - -/* Round up PBUFSIZ to hold all the registers, at least. */ -#if REGISTER_BYTES > MAXBUFBYTES -#undef PBUFSIZ -#define PBUFSIZ (REGISTER_BYTES * 2 + 32) -#endif - -/* remote_detach() - takes a program previously attached to and detaches it. - We better not have left any breakpoints - in the program or it'll die when it hits one. - Close the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ - -static void -remote_detach (args, from_tty) - char *args; - int from_tty; -{ - if (args) - error ("Argument given to \"detach\" when remotely debugging."); - - pop_target (); - if (from_tty) - printf ("Ending remote debugging.\n"); -} - -/* Convert hex digit A to a number. */ - -static int -fromhex (a) - int a; -{ - if (a >= '0' && a <= '9') - return a - '0'; - else if (a >= 'a' && a <= 'f') - return a - 'a' + 10; - else - error ("Reply contains invalid hex digit"); - return -1; -} - -/* Convert number NIB to a hex digit. */ - -static int -tohex (nib) - int nib; -{ - if (nib < 10) - return '0'+nib; - else - return 'a'+nib-10; -} - -/* Tell the remote machine to resume. */ - -/* Send a packet to the remote machine, with error checking. - The data of the packet is in BUF. */ - -static void -putpkt (buf) - char *buf; -{ - int i; - unsigned char csum = 0; - char buf2[PBUFSIZ]; - int cnt = strlen (buf); - char ch; - char *p; - - /* Copy the packet into buffer BUF2, encapsulating it - and giving it a checksum. */ - - if (cnt > sizeof(buf2) - 5) /* Prosanity check */ - abort(); - - p = buf2; - *p++ = '$'; - - for (i = 0; i < cnt; i++) - { - csum += buf[i]; - *p++ = buf[i]; - } - *p++ = '#'; - *p++ = tohex ((csum >> 4) & 0xf); - *p++ = tohex (csum & 0xf); - - /* Send it over and over until we get a positive ack. */ - - do { - if (kiodebug) - { - *p = '\0'; - printf ("Sending packet: %s...", buf2); fflush(stdout); - } - serial_write (buf2, p - buf2); - - /* read until either a timeout occurs (\0) or '+' is read */ - do { - ch = readchar (); - if (kiodebug) { - if (ch == '+') - printf("Ack\n"); - else - printf ("%02X%c ", ch&0xFF, ch); - } - } while ((ch != '+') && (ch != '\0')); - } while (ch != '+'); -} - -/* Read a packet from the remote machine, with error checking, - and store it in BUF. BUF is expected to be of size PBUFSIZ. */ - -static void -getpkt (buf) - char *buf; -{ - char *bp; - unsigned char csum; - int c; - unsigned char c1, c2; - - while (1) - { - /* Force csum to be zero here because of possible error retry. */ - csum = 0; - - while ((c = readchar()) != '$'); - - bp = buf; - while (1) - { - c = readchar (); - if (c == '#') - break; - if (bp >= buf+PBUFSIZ-1) - { - *bp = '\0'; - printf_filtered ("Remote packet too long: %s\n", buf); - goto whole; - } - *bp++ = c; - csum += c; - } - *bp = 0; - - c1 = fromhex (readchar ()); - c2 = fromhex (readchar ()); - if ((csum & 0xff) == (c1 << 4) + c2) - break; - printf_filtered ("Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n", - (c1 << 4) + c2, csum & 0xff, buf); - /* Try the whole thing again. */ -whole: - serial_write ("-", 1); - } - -#if 0 - immediate_quit--; -#endif - - serial_write ("+", 1); - - if (kiodebug) - fprintf (stderr,"Packet received: %s\n", buf); -} - -static void -remote_resume (step, siggnal) - int step, siggnal; -{ - char buf[PBUFSIZ]; - - if (siggnal) - error ("Can't send signals to a remote system. Try `handle %d ignore'.", - siggnal); - -#if 0 - dcache_flush (); -#endif - - strcpy (buf, step ? "s": "c"); - - putpkt (buf); -} - -/* Send ^C to target to halt it. Target will respond, and send us a - packet. */ - -void remote_interrupt(signo) - int signo; -{ - - if (kiodebug) - printf ("remote_interrupt called\n"); - - serial_write ("\003", 1); /* Send a ^C */ -} - - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. - Returns "pid" (though it's not clear what, if anything, that - means in the case of this target). */ - -static int -remote_wait (status) - WAITTYPE *status; -{ - unsigned char buf[PBUFSIZ]; - void (*ofunc)(); - unsigned char *p; - int i; - char regs[REGISTER_RAW_SIZE (PC_REGNUM) + REGISTER_RAW_SIZE (FP_REGNUM)]; - - WSETEXIT ((*status), 0); - - ofunc = (void (*)()) signal (SIGINT, remote_interrupt); - getpkt ((char *) buf); - signal (SIGINT, ofunc); - - if (buf[0] == 'E') - error ("Remote failure reply: %s", buf); - if (buf[0] == 'T') - { - /* Expedited reply, containing Signal, PC, and FP. */ - p = &buf[3]; /* after Txx */ - for (i = 0; i < sizeof (regs); i++) - { - if (p[0] == 0 || p[1] == 0) - error ("Remote reply is too short: %s", buf); - regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]); - p += 2; - } - supply_register (PC_REGNUM, ®s[0]); - supply_register (FP_REGNUM, ®s[REGISTER_RAW_SIZE (PC_REGNUM)]); - } - else if (buf[0] != 'S') - error ("Invalid remote reply: %s", buf); - - WSETSTOP ((*status), (((fromhex (buf[1])) << 4) + (fromhex (buf[2])))); - - return 0; -} - -/* Send the command in BUF to the remote machine, - and read the reply into BUF. - Report an error if we get an error reply. */ - -static void -remote_send (buf) - char *buf; -{ - - putpkt (buf); - getpkt (buf); - - if (buf[0] == 'E') - error ("Remote failure reply: %s", buf); -} - -/* Read the remote registers into the block REGS. */ -/* Currently we just read all the registers, so we don't use regno. */ -/* ARGSUSED */ -static void -remote_fetch_registers (regno) - int regno; -{ - char buf[PBUFSIZ]; - int i; - char *p; - char regs[REGISTER_BYTES]; - - sprintf (buf, "g"); - remote_send (buf); - - /* Reply describes registers byte by byte, each byte encoded as two - hex characters. Suck them all up, then supply them to the - register cacheing/storage mechanism. */ - - p = buf; - for (i = 0; i < REGISTER_BYTES; i++) - { - if (p[0] == 0 || p[1] == 0) - error ("Remote reply is too short: %s", buf); - regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]); - p += 2; - } - for (i = 0; i < NUM_REGS; i++) - supply_register (i, ®s[REGISTER_BYTE(i)]); -} - -/* Prepare to store registers. Since we send them all, we have to - read out the ones we don't want to change first. */ - -static void -remote_prepare_to_store () -{ - remote_fetch_registers (-1); -} - -/* Store the remote registers from the contents of the block REGISTERS. - FIXME, eventually just store one register if that's all that is needed. */ - -/* ARGSUSED */ -static void -remote_store_registers (regno) - int regno; -{ - char buf[PBUFSIZ]; - int i; - char *p; - - buf[0] = 'G'; - - /* Command describes registers byte by byte, - each byte encoded as two hex characters. */ - - p = buf + 1; - for (i = 0; i < REGISTER_BYTES; i++) - { - *p++ = tohex ((registers[i] >> 4) & 0xf); - *p++ = tohex (registers[i] & 0xf); - } - *p = '\0'; - - remote_send (buf); -} - - -/* Write memory data directly to the remote machine. - This does not inform the data cache; the data cache uses this. - MEMADDR is the address in the remote memory space. - MYADDR is the address of the buffer in our space. - LEN is the number of bytes. */ - -static void -remote_write_bytes (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - char buf[PBUFSIZ]; - int i; - char *p; - - if (len > PBUFSIZ / 2 - 20) - abort (); - - sprintf (buf, "M%x,%x:", memaddr, len); - - /* We send target system values byte by byte, in increasing byte addresses, - each byte encoded as two hex characters. */ - - p = buf + strlen (buf); - for (i = 0; i < len; i++) - { - *p++ = tohex ((myaddr[i] >> 4) & 0xf); - *p++ = tohex (myaddr[i] & 0xf); - } - *p = '\0'; - - remote_send (buf); -} - -/* Read memory data directly from the remote machine. - This does not use the data cache; the data cache uses this. - MEMADDR is the address in the remote memory space. - MYADDR is the address of the buffer in our space. - LEN is the number of bytes. */ - -static void -remote_read_bytes (memaddr, myaddr, len) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - char buf[PBUFSIZ]; - int i; - char *p; - - if (len > PBUFSIZ / 2 - 1) - abort (); - - sprintf (buf, "m%x,%x", memaddr, len); - remote_send (buf); - - /* Reply describes memory byte by byte, - each byte encoded as two hex characters. */ - - p = buf; - for (i = 0; i < len; i++) - { - if (p[0] == 0 || p[1] == 0) - error ("Remote reply is too short: %s", buf); - myaddr[i] = fromhex (p[0]) * 16 + fromhex (p[1]); - p += 2; - } -} - -/* Read or write LEN bytes from inferior memory at MEMADDR, transferring - to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is - nonzero. Returns length of data written or read; 0 for error. */ - -/* ARGSUSED */ -static int -remote_xfer_memory(memaddr, myaddr, len, should_write, target) - CORE_ADDR memaddr; - char *myaddr; - int len; - int should_write; - struct target_ops *target; /* ignored */ -{ - int origlen = len; - int xfersize; - while (len > 0) - { - if (len > MAXBUFBYTES) - xfersize = MAXBUFBYTES; - else - xfersize = len; - - if (should_write) - remote_write_bytes(memaddr, myaddr, xfersize); - else - remote_read_bytes (memaddr, myaddr, xfersize); - memaddr += xfersize; - myaddr += xfersize; - len -= xfersize; - } - return origlen; /* no error possible */ -} - -static void -remote_files_info (ignore) -struct target_ops *ignore; -{ - printf ("Debugging a target over a serial line.\n"); -} - -/* - -A debug packet whose contents are -is encapsulated for transmission in the form: - - $ # CSUM1 CSUM2 - - must be ASCII alphanumeric and cannot include characters - '$' or '#' - - CSUM1 and CSUM2 are ascii hex representation of an 8-bit - checksum of , the most significant nibble is sent first. - the hex digits 0-9,a-f are used. - -Receiver responds with: - - + - if CSUM is correct and ready for next packet - - - if CSUM is incorrect - -*/ - -/* Read a single character from the remote end. - (If supported, we actually read many characters and buffer them up.) */ - -static int -readchar () -{ - static int inbuf_index, inbuf_count; -#define INBUFSIZE PBUFSIZ - static char inbuf[INBUFSIZE]; - - if (inbuf_index >= inbuf_count) - { - /* Time to do another read... */ - inbuf_index = 0; - inbuf_count = 0; - inbuf[0] = 0; /* Just in case */ - if ((inbuf[inbuf_index] = serial_readchar (timeout)) < 0) - inbuf_count = -1; - else - inbuf_count = 1; - } - - /* Just return the next character from the buffer. */ - return inbuf[inbuf_index++] & 0x7f; -} - - - -/* The data cache leads to incorrect results because it doesn't know about - volatile variables, thus making it impossible to debug functions which - use hardware registers. Therefore it is #if 0'd out. Effect on - performance is some, for backtraces of functions with a few - arguments each. For functions with many arguments, the stack - frames don't fit in the cache blocks, which makes the cache less - helpful. Disabling the cache is a big performance win for fetching - large structures, because the cache code fetched data in 16-byte - chunks. */ -#if 0 -/* The data cache records all the data read from the remote machine - since the last time it stopped. - - Each cache block holds 16 bytes of data - starting at a multiple-of-16 address. */ - -#define DCACHE_SIZE 64 /* Number of cache blocks */ - -struct dcache_block { - struct dcache_block *next, *last; - unsigned int addr; /* Address for which data is recorded. */ - int data[4]; -}; - -struct dcache_block dcache_free, dcache_valid; - -/* Free all the data cache blocks, thus discarding all cached data. */ - -static void -dcache_flush () -{ - register struct dcache_block *db; - - while ((db = dcache_valid.next) != &dcache_valid) - { - remque (db); - insque (db, &dcache_free); - } -} - -/* - * If addr is present in the dcache, return the address of the block - * containing it. - */ - -struct dcache_block * -dcache_hit (addr) -{ - register struct dcache_block *db; - - if (addr & 3) - abort (); - - /* Search all cache blocks for one that is at this address. */ - db = dcache_valid.next; - while (db != &dcache_valid) - { - if ((addr & 0xfffffff0) == db->addr) - return db; - db = db->next; - } - return NULL; -} - -/* Return the int data at address ADDR in dcache block DC. */ - -int -dcache_value (db, addr) - struct dcache_block *db; - unsigned int addr; -{ - if (addr & 3) - abort (); - return (db->data[(addr>>2)&3]); -} - -/* Get a free cache block, put it on the valid list, - and return its address. The caller should store into the block - the address and data that it describes. */ - -struct dcache_block * -dcache_alloc () -{ - register struct dcache_block *db; - - if ((db = dcache_free.next) == &dcache_free) - /* If we can't get one from the free list, take last valid */ - db = dcache_valid.last; - - remque (db); - insque (db, &dcache_valid); - return (db); -} - -/* Return the contents of the word at address ADDR in the remote machine, - using the data cache. */ - -int -dcache_fetch (addr) - CORE_ADDR addr; -{ - register struct dcache_block *db; - - db = dcache_hit (addr); - if (db == 0) - { - db = dcache_alloc (); - remote_read_bytes (addr & ~0xf, db->data, 16); - db->addr = addr & ~0xf; - } - return (dcache_value (db, addr)); -} - -/* Write the word at ADDR both in the data cache and in the remote machine. */ - -dcache_poke (addr, data) - CORE_ADDR addr; - int data; -{ - register struct dcache_block *db; - - /* First make sure the word is IN the cache. DB is its cache block. */ - db = dcache_hit (addr); - if (db == 0) - { - db = dcache_alloc (); - remote_read_bytes (addr & ~0xf, db->data, 16); - db->addr = addr & ~0xf; - } - - /* Modify the word in the cache. */ - db->data[(addr>>2)&3] = data; - - /* Send the changed word. */ - remote_write_bytes (addr, &data, 4); -} - -/* Initialize the data cache. */ - -dcache_init () -{ - register i; - register struct dcache_block *db; - - db = (struct dcache_block *) xmalloc (sizeof (struct dcache_block) * - DCACHE_SIZE); - dcache_free.next = dcache_free.last = &dcache_free; - dcache_valid.next = dcache_valid.last = &dcache_valid; - for (i=0;i -#include -#include -#include -#include -#include -#include -#define free bogon_free /* Sun claims "int free()" not void */ -#include -#undef free -#include -#include -#include "xdr_ptrace.h" -#include "xdr_ld.h" -#include "xdr_rdb.h" -#include "dbgRpcLib.h" - -/* get rid of value.h if possible */ -#include -#include - -extern void symbol_file_command (); -extern int stop_soon_quietly; /* for wait_for_inferior */ - -static int net_ptrace_clnt_call (); /* Forward decl */ -static enum clnt_stat net_clnt_call (); /* Forward decl */ -extern struct target_ops vx_ops, vx_run_ops; /* Forward declaration */ - -/* Saved name of target host and called function for "info files". - Both malloc'd. */ - -static char *vx_host; -static char *vx_running; - -/* Nonzero means target that is being debugged remotely has a floating - point processor. */ - -static int target_has_fp; - -/* Default error message when the network is forking up. */ - -static const char rpcerr[] = "network target debugging: rpc error"; - -CLIENT *pClient; /* client used in net debugging */ -static int ptraceSock = RPC_ANYSOCK; -extern int errno; - -enum clnt_stat net_clnt_call(); -static void parse_args (); - -static struct timeval rpcTimeout = { 10, 0 }; - -static char *skip_white_space (); -static char *find_white_space (); - -/* Tell the VxWorks target system to download a file. - The load addresses of the text, data, and bss segments are - stored in pTextAddr, pDataAddr, and *pBssAddr (respectively). - Returns 0 for success, -1 for failure. */ - -static int -net_load (filename, pTextAddr, pDataAddr, pBssAddr) - char *filename; - CORE_ADDR *pTextAddr; - CORE_ADDR *pDataAddr; - CORE_ADDR *pBssAddr; - { - enum clnt_stat status; - struct ldfile ldstruct; - struct timeval load_timeout; - - bzero ((char *) &ldstruct, sizeof (ldstruct)); - - /* We invoke clnt_call () here directly, instead of through - net_clnt_call (), because we need to set a large timeout value. - The load on the target side can take quite a while, easily - more than 10 seconds. The user can kill this call by typing - CTRL-C if there really is a problem with the load. */ - - load_timeout.tv_sec = 0x7FFF7FFF; /* A large number, effectively inf. */ - load_timeout.tv_usec = 0; - - status = clnt_call (pClient, VX_LOAD, xdr_wrapstring, &filename, xdr_ldfile, - &ldstruct, load_timeout); - - if (status == RPC_SUCCESS) - { - if (*ldstruct.name == NULL) /* load failed on VxWorks side */ - return -1; - *pTextAddr = ldstruct.txt_addr; - *pDataAddr = ldstruct.data_addr; - *pBssAddr = ldstruct.bss_addr; - return 0; - } - else - return -1; - } - -/* returns 0 if successful, errno if RPC failed or VxWorks complains. */ - -static int -net_break (addr, procnum) - int addr; - u_long procnum; - { - enum clnt_stat status; - int break_status; - Rptrace ptrace_in; /* XXX This is stupid. It doesn't need to be a ptrace - structure. How about something smaller? */ - - bzero ((char *) &ptrace_in, sizeof (ptrace_in)); - break_status = 0; - - ptrace_in.addr = addr; - ptrace_in.pid = inferior_pid; - - status = net_clnt_call (procnum, xdr_rptrace, &ptrace_in, xdr_int, - &break_status); - - if (status != RPC_SUCCESS) - return errno; - - if (break_status == -1) - return ENOMEM; - return break_status; /* probably (FIXME) zero */ - } - -/* returns 0 if successful, errno otherwise */ - -int -vx_insert_breakpoint (addr) - int addr; - { - return net_break (addr, VX_BREAK_ADD); - } - -/* returns 0 if successful, errno otherwise */ - -int -vx_remove_breakpoint (addr) - int addr; - { - return net_break (addr, VX_BREAK_DELETE); - } - -/* Call a function on the VxWorks target system. - ARGS is a vector of values of arguments (NARGS of them). - FUNCTION is a value, the function to be called. - Returns a struct value * representing what the function returned. - May fail to return, if a breakpoint or signal is hit - during the execution of the function. */ - -#ifdef FIXME -/* FIXME, function calls are really fried. GO back to manual method. */ -value -call_function (function, nargs, args) - value function; - int nargs; - value *args; -{ - register CORE_ADDR sp; - register int i; - CORE_ADDR start_sp; - static REGISTER_TYPE dummy[] = CALL_DUMMY; - REGISTER_TYPE dummy1[sizeof dummy / sizeof (REGISTER_TYPE)]; - CORE_ADDR old_sp; - struct type *value_type; - unsigned char struct_return; - CORE_ADDR struct_addr; - struct inferior_status inf_status; - struct cleanup *old_chain; - CORE_ADDR funaddr; - int using_gcc; - - save_inferior_status (&inf_status, 1); - old_chain = make_cleanup (restore_inferior_status, &inf_status); - - /* PUSH_DUMMY_FRAME is responsible for saving the inferior registers - (and POP_FRAME for restoring them). (At least on most machines) - they are saved on the stack in the inferior. */ - PUSH_DUMMY_FRAME; - - old_sp = sp = read_register (SP_REGNUM); - -#if 1 INNER_THAN 2 /* Stack grows down */ - sp -= sizeof dummy; - start_sp = sp; -#else /* Stack grows up */ - start_sp = sp; - sp += sizeof dummy; -#endif - - funaddr = find_function_addr (function, &value_type); - - { - struct block *b = block_for_pc (funaddr); - /* If compiled without -g, assume GCC. */ - using_gcc = b == NULL || BLOCK_GCC_COMPILED (b); - } - - /* Are we returning a value using a structure return or a normal - value return? */ - - struct_return = using_struct_return (function, funaddr, value_type, - using_gcc); - - /* Create a call sequence customized for this function - and the number of arguments for it. */ - bcopy (dummy, dummy1, sizeof dummy); - FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args, - value_type, using_gcc); - -#if CALL_DUMMY_LOCATION == ON_STACK - write_memory (start_sp, dummy1, sizeof dummy); - -#else /* Not on stack. */ -#if CALL_DUMMY_LOCATION == BEFORE_TEXT_END - /* Convex Unix prohibits executing in the stack segment. */ - /* Hope there is empty room at the top of the text segment. */ - { - static checked = 0; - if (!checked) - for (start_sp = text_end - sizeof dummy; start_sp < text_end; ++start_sp) - if (read_memory_integer (start_sp, 1) != 0) - error ("text segment full -- no place to put call"); - checked = 1; - sp = old_sp; - start_sp = text_end - sizeof dummy; - write_memory (start_sp, dummy1, sizeof dummy); - } -#else /* After text_end. */ - { - int errcode; - sp = old_sp; - start_sp = text_end; - errcode = target_write_memory (start_sp, dummy1, sizeof dummy); - if (errcode != 0) - error ("Cannot write text segment -- vx_call_function failed"); - } -#endif /* After text_end. */ -#endif /* Not on stack. */ - -#ifdef STACK_ALIGN - /* If stack grows down, we must leave a hole at the top. */ - { - int len = 0; - - /* Reserve space for the return structure to be written on the - stack, if necessary */ - - if (struct_return) - len += TYPE_LENGTH (value_type); - - for (i = nargs - 1; i >= 0; i--) - len += TYPE_LENGTH (VALUE_TYPE (value_arg_coerce (args[i]))); -#ifdef CALL_DUMMY_STACK_ADJUST - len += CALL_DUMMY_STACK_ADJUST; -#endif -#if 1 INNER_THAN 2 - sp -= STACK_ALIGN (len) - len; -#else - sp += STACK_ALIGN (len) - len; -#endif - } -#endif /* STACK_ALIGN */ - - /* Reserve space for the return structure to be written on the - stack, if necessary */ - - if (struct_return) - { -#if 1 INNER_THAN 2 - sp -= TYPE_LENGTH (value_type); - struct_addr = sp; -#else - struct_addr = sp; - sp += TYPE_LENGTH (value_type); -#endif - } - -#if defined (REG_STRUCT_HAS_ADDR) - { - /* This is a machine like the sparc, where we need to pass a pointer - to the structure, not the structure itself. */ - if (REG_STRUCT_HAS_ADDR (using_gcc)) - for (i = nargs - 1; i >= 0; i--) - if ( TYPE_CODE (VALUE_TYPE (args[i])) == TYPE_CODE_STRUCT - || TYPE_CODE (VALUE_TYPE (args[i])) == TYPE_CODE_UNION) - { - CORE_ADDR addr; -#if !(1 INNER_THAN 2) - /* The stack grows up, so the address of the thing we push - is the stack pointer before we push it. */ - addr = sp; -#endif - /* Push the structure. */ - sp = value_push (sp, args[i]); -#if 1 INNER_THAN 2 - /* The stack grows down, so the address of the thing we push - is the stack pointer after we push it. */ - addr = sp; -#endif - /* The value we're going to pass is the address of the thing - we just pushed. */ - args[i] = value_from_long (builtin_type_long, (LONGEST) addr); - } - } -#endif /* REG_STRUCT_HAS_ADDR. */ - -#ifdef PUSH_ARGUMENTS - PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr); -#else /* !PUSH_ARGUMENTS */ - for (i = nargs - 1; i >= 0; i--) - sp = value_arg_push (sp, args[i]); -#endif /* !PUSH_ARGUMENTS */ - -#ifdef CALL_DUMMY_STACK_ADJUST -#if 1 INNER_THAN 2 - sp -= CALL_DUMMY_STACK_ADJUST; -#else - sp += CALL_DUMMY_STACK_ADJUST; -#endif -#endif /* CALL_DUMMY_STACK_ADJUST */ - - /* Store the address at which the structure is supposed to be - written. Note that this (and the code which reserved the space - above) assumes that gcc was used to compile this function. Since - it doesn't cost us anything but space and if the function is pcc - it will ignore this value, we will make that assumption. - - Also note that on some machines (like the sparc) pcc uses a - convention like gcc's. */ - - if (struct_return) - STORE_STRUCT_RETURN (struct_addr, sp); - - /* Write the stack pointer. This is here because the statements above - might fool with it. On SPARC, this write also stores the register - window into the right place in the new stack frame, which otherwise - wouldn't happen. (See write_inferior_registers in sparc-xdep.c.) */ - write_register (SP_REGNUM, sp); - - /* Figure out the value returned by the function. */ - { - char retbuf[REGISTER_BYTES]; - - /* Execute the stack dummy routine, calling FUNCTION. - When it is done, discard the empty frame - after storing the contents of all regs into retbuf. */ - run_stack_dummy (start_sp + CALL_DUMMY_START_OFFSET, retbuf); - - do_cleanups (old_chain); - - return value_being_returned (value_type, retbuf, struct_return); - } -} -/* should return a value of some sort */ - -value -vx_call_function (funcAddr, nargs, args, valueType) - char *funcAddr; - int nargs; - value *args; - struct type * valueType; -{ - int i; - func_call funcInfo; - arg_value *argValue; - enum clnt_stat status; - register int len; - arg_value funcReturn; - value gdbValue; - - argValue = (arg_value *) xmalloc (nargs * sizeof (arg_value)); - - bzero (argValue, nargs * sizeof (arg_value)); - bzero (&funcReturn, sizeof (funcReturn)); - - for (i = nargs - 1; i >= 0; i--) - { - len = TYPE_LENGTH (VALUE_TYPE (args [i])); - - switch (TYPE_CODE (VALUE_TYPE (args[i]))) - { - /* XXX put other types here. Where's CHAR, etc??? */ - - case TYPE_CODE_FLT: - argValue[i].type = T_FLOAT; - break; - case TYPE_CODE_INT: - case TYPE_CODE_PTR: - case TYPE_CODE_ENUM: - case TYPE_CODE_FUNC: - argValue[i].type = T_INT; - break; - - case TYPE_CODE_UNDEF: - case TYPE_CODE_ARRAY: - case TYPE_CODE_STRUCT: - case TYPE_CODE_UNION: - case TYPE_CODE_VOID: - case TYPE_CODE_SET: - case TYPE_CODE_RANGE: - case TYPE_CODE_PASCAL_ARRAY: - case TYPE_CODE_MEMBER: /* C++ */ - case TYPE_CODE_METHOD: /* C++ */ - case TYPE_CODE_REF: /* C++ */ - default: - error ("No corresponding VxWorks type for %d. CHECK IT OUT!!!\n", - TYPE_CODE(VALUE_TYPE(args[i]))); - } /* switch */ - if (TYPE_CODE(VALUE_TYPE(args[i])) == TYPE_CODE_FUNC) - argValue[i].arg_value_u.v_int = VALUE_ADDRESS(args[i]); - else - bcopy (VALUE_CONTENTS (args[i]), (char *) &argValue[i].arg_value_u, - len); - } - - /* XXX what should the type of this function addr be? - * XXX Both in gdb and vxWorks - */ - funcInfo.func_addr = (int) funcAddr; - funcInfo.args.args_len = nargs; - funcInfo.args.args_val = argValue; - - status = net_clnt_call (VX_CALL_FUNC, xdr_func_call, (char *) &funcInfo, - xdr_arg_value, &funcReturn); - - free ((char *) argValue); - - if (status == RPC_SUCCESS) - { - /* XXX this assumes that vxWorks ALWAYS returns an int, and that - * XXX gdb isn't expecting anything more - */ - - /******************* - if (funcReturn.type == T_UNKNOWN) - return YYYXXX...; - *******************/ - gdbValue = allocate_value (valueType); - bcopy (&funcReturn.arg_value_u.v_int, VALUE_CONTENTS (gdbValue), - sizeof (int)); - return gdbValue; - } - else - error (rpcerr); - } -#endif /* FIXME */ - -/* Start an inferior process and sets inferior_pid to its pid. - EXEC_FILE is the file to run. - ALLARGS is a string containing the arguments to the program. - ENV is the environment vector to pass. - Returns process id. Errors reported with error(). - On VxWorks, we ignore exec_file. */ - -void -vx_create_inferior (exec_file, args, env) - char *exec_file; - char *args; - char **env; -{ - enum clnt_stat status; - arg_array passArgs; - TASK_START taskStart; - - bzero ((char *) &passArgs, sizeof (passArgs)); - bzero ((char *) &taskStart, sizeof (taskStart)); - - /* parse arguments, put them in passArgs */ - - parse_args (args, &passArgs); - - if (passArgs.arg_array_len == 0) - error ("You must specify a function name to run, and arguments if any"); - - status = net_clnt_call (PROCESS_START, xdr_arg_array, &passArgs, - xdr_TASK_START, &taskStart); - - if ((status != RPC_SUCCESS) || (taskStart.status == -1)) - error ("Can't create process on remote target machine"); - - /* Save the name of the running function */ - if (vx_running) - free (vx_running); - vx_running = savestring (passArgs.arg_array_val[0], - strlen (passArgs.arg_array_val[0])); - -#ifdef CREATE_INFERIOR_HOOK - CREATE_INFERIOR_HOOK (pid); -#endif - - push_target (&vx_run_ops); - inferior_pid = taskStart.pid; - -#if defined (START_INFERIOR_HOOK) - START_INFERIOR_HOOK (); -#endif - - /* We will get a trace trap after one instruction. - Insert breakpoints and continue. */ - - init_wait_for_inferior (); - - /* Set up the "saved terminal modes" of the inferior - based on what modes we are starting it with. */ - target_terminal_init (); - - /* Install inferior's terminal modes. */ - target_terminal_inferior (); - - /* remote_start(args); */ - /* trap_expected = 0; */ - stop_soon_quietly = 1; - wait_for_inferior (); /* Get the task spawn event */ - stop_soon_quietly = 0; - - /* insert_step_breakpoint (); FIXME, do we need this? */ - proceed(-1, -1, 0); -} - -/* Fill ARGSTRUCT in argc/argv form with the arguments from the - argument string ARGSTRING. */ - -static void -parse_args (arg_string, arg_struct) - register char *arg_string; - arg_array *arg_struct; -{ - register int arg_count = 0; /* number of arguments */ - register int arg_index = 0; - register char *p0; - - bzero ((char *) arg_struct, sizeof (arg_array)); - - /* first count how many arguments there are */ - - p0 = arg_string; - while (*p0 != '\0') - { - if (*(p0 = skip_white_space (p0)) == '\0') - break; - p0 = find_white_space (p0); - arg_count++; - } - - arg_struct->arg_array_len = arg_count; - arg_struct->arg_array_val = (char **) xmalloc ((arg_count + 1) - * sizeof (char *)); - - /* now copy argument strings into arg_struct. */ - - while (*(arg_string = skip_white_space (arg_string))) - { - p0 = find_white_space (arg_string); - arg_struct->arg_array_val[arg_index++] = savestring (arg_string, - p0 - arg_string); - arg_string = p0; - } - - arg_struct->arg_array_val[arg_count] = NULL; -} - -/* Advance a string pointer across whitespace and return a pointer - to the first non-white character. */ - -static char * -skip_white_space (p) - register char *p; -{ - while (*p == ' ' || *p == '\t') - p++; - return p; -} - -/* Search for the first unquoted whitespace character in a string. - Returns a pointer to the character, or to the null terminator - if no whitespace is found. */ - -static char * -find_white_space (p) - register char *p; -{ - register int c; - - while ((c = *p) != ' ' && c != '\t' && c) - { - if (c == '\'' || c == '"') - { - while (*++p != c && *p) - { - if (*p == '\\') - p++; - } - if (!*p) - break; - } - p++; - } - return p; -} - -/* Poll the VxWorks target system for an event related - to the debugged task. - Returns -1 if remote wait failed, task status otherwise. */ - -int -net_wait (pEvent) - RDB_EVENT *pEvent; -{ - int pid; - enum clnt_stat status; - - bzero ((char *) pEvent, sizeof (RDB_EVENT)); - - pid = inferior_pid; - status = net_clnt_call (PROCESS_WAIT, xdr_int, &pid, xdr_RDB_EVENT, pEvent); - - return (status == RPC_SUCCESS)? pEvent->status: -1; -} - -/* Suspend the remote task. - Returns -1 if suspend fails on target system, 0 otherwise. */ - -int -net_quit () -{ - int pid; - int quit_status; - enum clnt_stat status; - - quit_status = 0; - - /* don't let rdbTask suspend itself by passing a pid of 0 */ - - if ((pid = inferior_pid) == 0) - return -1; - - status = net_clnt_call (VX_TASK_SUSPEND, xdr_int, &pid, xdr_int, - &quit_status); - - return (status == RPC_SUCCESS)? quit_status: -1; -} - -/* Read a register or registers from the remote system. */ - -int -vx_read_register (regno) - int regno; -{ - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - extern char registers[]; - - bzero ((char *) &ptrace_in, sizeof (ptrace_in)); - bzero ((char *) &ptrace_out, sizeof (ptrace_out)); - - /* FIXME, eventually only get the ones we need. */ - registers_fetched (); - - ptrace_in.pid = inferior_pid; - ptrace_out.info.more_data = (caddr_t) &inferior_registers; - status = net_ptrace_clnt_call (PTRACE_GETREGS, &ptrace_in, &ptrace_out); - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - return -1; - } - -#ifdef I80960 -#else /* I80960 */ - bcopy (&inferior_registers, registers, 16 * 4); - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; - - if (target_has_fp) - { - ptrace_in.pid = inferior_pid; - ptrace_out.info.more_data = (caddr_t) &inferior_fp_registers; - status = net_ptrace_clnt_call (PTRACE_GETFPREGS, &ptrace_in, &ptrace_out); - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - return -1; - } - - bcopy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.fps_regs); - bcopy (&inferior_fp_registers.fps_control, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); - } - else - { - bzero (®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.fps_regs); - bzero (®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); - } -#endif - return 0; -} - -/* Prepare to store registers. Since we will store all of them, - read out their current values now. */ - -void -vx_prepare_to_store () -{ - vx_read_register (-1); -} - - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - /* FIXME, look at REGNO to save time here */ - -vx_write_register (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - extern char registers[]; - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - - bzero ((char *) &ptrace_in, sizeof (ptrace_in)); - bzero ((char *) &ptrace_out, sizeof (ptrace_out)); - - bcopy (registers, &inferior_registers, 16 * 4); - inferior_registers.r_ps = *(int *)®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_registers.r_pc = *(int *)®isters[REGISTER_BYTE (PC_REGNUM)]; - ptrace_in.pid = inferior_pid; - ptrace_in.info.ttype = REGS; - ptrace_in.info.more_data = (caddr_t) &inferior_registers; - - /* XXX change second param to be a proc number */ - status = net_ptrace_clnt_call (PTRACE_SETREGS, &ptrace_in, &ptrace_out); - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - return -1; - } - - if (target_has_fp) - { - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fps_regs); - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &inferior_fp_registers.fps_control, - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); - - ptrace_in.pid = inferior_pid; - ptrace_in.info.ttype = FPREGS; - ptrace_in.info.more_data = (caddr_t) &inferior_fp_registers; - - status = net_ptrace_clnt_call (PTRACE_SETFPREGS, &ptrace_in, &ptrace_out); - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - return -1; - } - } - return 0; -} - -/* Copy LEN bytes to or from remote inferior's memory starting at MEMADDR - to debugger memory starting at MYADDR. WRITE is true if writing to the - inferior. - Result is the number of bytes written or read (zero if error). The - protocol allows us to return a negative count, indicating that we can't - handle the current address but can handle one N bytes further, but - vxworks doesn't give us that information. */ - -int -vx_xfer_memory (memaddr, myaddr, len, write) - CORE_ADDR memaddr; - char *myaddr; - int len; -{ - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - C_bytes data; - - bzero ((char *) &ptrace_in, sizeof (ptrace_in)); - bzero ((char *) &ptrace_out, sizeof (ptrace_out)); - - ptrace_in.pid = inferior_pid; /* XXX pid unnecessary for READDATA */ - ptrace_in.addr = (int) memaddr; /* Where from */ - ptrace_in.data = len; /* How many bytes */ - - if (write) - { - ptrace_in.info.ttype = DATA; - ptrace_in.info.more_data = (caddr_t) &data; - - data.bytes = (caddr_t) myaddr; /* Where from */ - data.len = len; /* How many bytes (again, for XDR) */ - - /* XXX change second param to be a proc number */ - status = net_ptrace_clnt_call (PTRACE_WRITEDATA, &ptrace_in, &ptrace_out); - } - else - { - ptrace_out.info.more_data = (caddr_t) &data; - data.bytes = myaddr; /* Where to */ - data.len = len; /* How many (again, for XDR) */ - - /* XXX change second param to be a proc number */ - status = net_ptrace_clnt_call (PTRACE_READDATA, &ptrace_in, &ptrace_out); - } - - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - return 0; /* No bytes moved */ - } - return len; /* Moved *all* the bytes */ -} - -void -vx_files_info () -{ - printf ("\tAttached to host `%s'", vx_host); - printf (", which has %sfloating point", target_has_fp? "": "no "); - printf (".\n"); -} - -void -vx_run_files_info () -{ - printf ("\tRunning VxWorks process 0x%x, function `%s'.\n", - inferior_pid, vx_running); -} - -void -vx_resume (step, siggnal) - int step; - int siggnal; -{ - int status; - Rptrace ptrace_in; - Ptrace_return ptrace_out; - - if (siggnal != 0) - error ("Cannot send signals to VxWorks processes"); - - bzero ((char *) &ptrace_in, sizeof (ptrace_in)); - bzero ((char *) &ptrace_out, sizeof (ptrace_out)); - - ptrace_in.pid = inferior_pid; - ptrace_in.addr = 1; /* Target side insists on this, or it panics. */ - - /* XXX change second param to be a proc number */ - status = net_ptrace_clnt_call (step? PTRACE_SINGLESTEP: PTRACE_CONT, - &ptrace_in, &ptrace_out); - if (status) - error (rpcerr); - if (ptrace_out.status == -1) - { - errno = ptrace_out.errno; - perror_with_name ("Resuming remote process"); - } -} - -void -vx_mourn_inferior () -{ - pop_target (); /* Pop back to no-child state */ - generic_mourn_inferior (); -} - - -/* This function allows the addition of incrementally linked object files. */ - -void -vx_add_file_command (arg_string, from_tty) - char* arg_string; - int from_tty; -{ - CORE_ADDR text_addr; - CORE_ADDR data_addr; - CORE_ADDR bss_addr; - - if (arg_string == 0) - error ("add-file takes a file name in VxWorks"); - - arg_string = tilde_expand (arg_string); - make_cleanup (free, arg_string); - - dont_repeat (); - - if (net_load (arg_string, &text_addr, &data_addr, &bss_addr) == -1) - error ("Load failed on target machine"); - - /* FIXME, for now we ignore data_addr and bss_addr. */ - symbol_file_add (arg_string, from_tty, text_addr, 0); -} - -#ifdef FIXME /* Not ready for prime time */ -/* Single step the target program at the source or machine level. - Takes an error exit if rpc fails. - Returns -1 if remote single-step operation fails, else 0. */ - -static int -net_step () -{ - enum clnt_stat status; - int step_status; - SOURCE_STEP source_step; - - source_step.taskId = inferior_pid; - - if (step_range_end) - { - source_step.startAddr = step_range_start; - source_step.endAddr = step_range_end; - } - else - { - source_step.startAddr = 0; - source_step.endAddr = 0; - } - - status = net_clnt_call (VX_SOURCE_STEP, xdr_SOURCE_STEP, &source_step, - xdr_int, &step_status); - - if (status == RPC_SUCCESS) - return step_status; - else - error (rpcerr); -} -#endif - -/* Emulate ptrace using RPC calls to the VxWorks target system. - Returns nonzero (-1) if RPC status to VxWorks is bad, 0 otherwise. */ - -static int -net_ptrace_clnt_call (request, pPtraceIn, pPtraceOut) - enum ptracereq request; - Rptrace *pPtraceIn; - Ptrace_return *pPtraceOut; -{ - enum clnt_stat status; - - status = net_clnt_call (request, xdr_rptrace, pPtraceIn, xdr_ptrace_return, - pPtraceOut); - - if (status != RPC_SUCCESS) - return -1; - - return 0; -} - -/* Query the target for the name of the file from which VxWorks was - booted. pBootFile is the address of a pointer to the buffer to - receive the file name; if the pointer pointed to by pBootFile is - NULL, memory for the buffer will be allocated by XDR. - Returns -1 if rpc failed, 0 otherwise. */ - -int -net_get_boot_file (pBootFile) - char **pBootFile; -{ - enum clnt_stat status; - - status = net_clnt_call (VX_BOOT_FILE_INQ, xdr_void, (char *) 0, - xdr_wrapstring, pBootFile); - return (status == RPC_SUCCESS) ? 0 : -1; -} - -/* Fetch a list of loaded object modules from the VxWorks target. - Returns -1 if rpc failed, 0 otherwise - There's no way to check if the returned loadTable is correct. - VxWorks doesn't check it. */ - -int -net_get_symbols (pLoadTable) - ldtabl *pLoadTable; /* return pointer to ldtabl here */ -{ - enum clnt_stat status; - - bzero ((char *) pLoadTable, sizeof (struct ldtabl)); - - status = net_clnt_call (VX_STATE_INQ, xdr_void, 0, xdr_ldtabl, pLoadTable); - return (status == RPC_SUCCESS) ? 0 : -1; -} - -/* Look up a symbol in the VxWorks target's symbol table. - Returns status of symbol read on target side (0=success, -1=fail) - Returns -1 and complain()s if rpc fails. */ - -struct complaint cant_contact_target = - {"Lost contact with VxWorks target", 0, 0}; - -int -vx_lookup_symbol (name, pAddr) - char *name; /* symbol name */ - CORE_ADDR *pAddr; -{ - enum clnt_stat status; - SYMBOL_ADDR symbolAddr; - - *pAddr = 0; - bzero ((char *) &symbolAddr, sizeof (symbolAddr)); - - status = net_clnt_call (VX_SYMBOL_INQ, xdr_wrapstring, &name, - xdr_SYMBOL_ADDR, &symbolAddr); - if (status != RPC_SUCCESS) { - complain (&cant_contact_target, 0); - return -1; - } - - *pAddr = symbolAddr.addr; - return symbolAddr.status; -} - -/* Check to see if the VxWorks target has a floating point coprocessor. - Returns 1 if target has floating point processor, 0 otherwise. - Calls error() if rpc fails. */ - -int -net_check_for_fp () -{ - enum clnt_stat status; - bool_t fp = 0; /* true if fp processor is present on target board */ - - status = net_clnt_call (VX_FP_INQUIRE, xdr_void, 0, xdr_bool, &fp); - if (status != RPC_SUCCESS) - error (rpcerr); - - return (int) fp; -} - -/* Establish an RPC connection with the VxWorks target system. - Calls error () if unable to establish connection. */ - -void -net_connect (host) - char *host; -{ - struct sockaddr_in destAddr; - struct hostent *destHost; - - /* get the internet address for the given host */ - - if ((destHost = (struct hostent *) gethostbyname (host)) == NULL) - error ("Invalid hostname. Couldn't attach remote target."); - - bzero (&destAddr, sizeof (destAddr)); - - destAddr.sin_addr.s_addr = * (u_long *) destHost->h_addr; - destAddr.sin_family = AF_INET; - destAddr.sin_port = 0; /* set to actual port that remote - ptrace is listening on. */ - - /* Create a tcp client transport on which to issue - calls to the remote ptrace server. */ - - ptraceSock = RPC_ANYSOCK; - pClient = clnttcp_create (&destAddr, RDBPROG, RDBVERS, &ptraceSock, 0, 0); - /* FIXME, here is where we deal with different version numbers of the proto */ - - if (pClient == NULL) - { - clnt_pcreateerror ("\tnet_connect"); - error ("Couldn't connect to remote target."); - } -} - -/* Sleep for the specified number of milliseconds - * (assumed to be less than 1000). - * If select () is interrupted, returns immediately; - * takes an error exit if select () fails for some other reason. - */ - -static void -sleep_ms (ms) - long ms; -{ - struct timeval select_timeout; - int status; - - select_timeout.tv_sec = 0; - select_timeout.tv_usec = ms * 1000; - - status = select (0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &select_timeout); - - if (status < 0 && errno != EINTR) - perror_with_name ("select"); -} - -/* Wait for control to return from inferior to debugger. - If inferior gets a signal, we may decide to start it up again - instead of returning. That is why there is a loop in this function. - When this function actually returns it means the inferior - should be left stopped and GDB should read more commands. */ - -/* For network debugging with VxWorks. - * VxWorks knows when tasks hit breakpoints, receive signals, exit, etc, - * so vx_wait() receives this information directly from - * VxWorks instead of trying to figure out what happenned via a wait() call. - */ - -static int -vx_wait (status) - int *status; -{ - register int pid; - WAITTYPE w; - RDB_EVENT rdbEvent; - int quit_failed; - - do - { - /* If CTRL-C is hit during this loop, - suspend the inferior process. */ - - quit_failed = 0; - if (quit_flag) - { - quit_failed = (net_quit () == -1); - quit_flag = 0; - } - - /* If a net_quit () or net_wait () call has failed, - allow the user to break the connection with the target. - We can't simply error () out of this loop, since the - data structures representing the state of the inferior - are in an inconsistent state. */ - - if (quit_failed || net_wait (&rdbEvent) == -1) - { - terminal_ours (); - if (query ("Can't %s. Disconnect from target system? ", - (quit_failed) ? "suspend remote task" - : "get status of remote task")) - { - target_mourn_inferior(); - error ("Use the \"target\" command to reconnect."); - } - else - { - terminal_inferior (); - continue; - } - } - - - if (quit_failed || net_wait (&rdbEvent) == -1) - { - error ("Wait on remote target failed"); - } - - pid = rdbEvent.taskId; - if (pid == 0) - { - sleep_ms (200); /* FIXME Don't kill the network too badly */ - } - else if (pid != inferior_pid) - fatal ("Bad pid for debugged task: 0x%x\n", pid); - } while (pid == 0); - - /* FIXME, eventually do more then SIGTRAP on everything... */ - switch (rdbEvent.eventType) - { - case EVENT_EXIT: - WSETEXIT (w, 0); - /* FIXME is it possible to distinguish between a - XXX normal vs abnormal exit in VxWorks? */ - break; - - case EVENT_START: - WSETSTOP (w, SIGTRAP); - break; - - case EVENT_STOP: - WSETSTOP (w, SIGTRAP); - /* XXX was it stopped by a signal? act accordingly */ - break; - - case EVENT_BREAK: - /* Expecting a trace trap. Stop the inferior and - * return silently when it happens. */ - WSETSTOP (w, SIGTRAP); - break; - - case EVENT_SUSPEND: - target_terminal_ours_for_output (); - printf ("\nRemote task suspended\n"); /* FIXME */ - fflush (stdout); - WSETSTOP (w, SIGTRAP); - break; - - case EVENT_SIGNAL: - /* The target is not running Unix, and its - faults/traces do not map nicely into Unix signals. - Make sure they do not get confused with Unix signals - by numbering them with values higher than the highest - legal Unix signal. code in the arch-dependent PRINT_RANDOM_SIGNAL - routine will interpret the value for wait_for_inferior. */ - WSETSTOP (w, rdbEvent.sigType + NSIG); - break; - } /* switch */ - *status = *(int *)&w; /* Grumble union wait crap Grumble */ - return pid; -} - -static int -symbol_stub (arg) - int arg; -{ - char *bootFile = (char *)arg; - symbol_file_command (bootFile, 0); - return 1; -} - -static int -add_symbol_stub (arg) - int arg; -{ - struct ldfile *pLoadFile = (struct ldfile *)arg; - - symbol_file_add (pLoadFile->name, 0, pLoadFile->txt_addr, 0); - return 1; -} -/* Target command for VxWorks target systems. - - Used in vxgdb. Takes the name of a remote target machine - running vxWorks and connects to it to initialize remote network - debugging. */ - -static void -vx_open (args, from_tty) - char *args; - int from_tty; -{ - extern int close (); - char *bootFile; - extern char *source_path; - struct ldtabl loadTable; - struct ldfile *pLoadFile; - int i; - extern CLIENT *pClient; - - if (!args) - error_no_arg ("target machine name"); - - target_preopen (); - - printf ("Attaching remote machine across net...\n"); - fflush (stdout); - - /* Allow the user to kill the connect attempt by typing ^C. - Wait until the call to target_has_fp () completes before - disallowing an immediate quit, since even if net_connect () - is successful, the remote debug server might be hung. */ - - immediate_quit++; - - net_connect (args); - target_has_fp = net_check_for_fp (); - printf_filtered ("Connected to %s\n", args); - - immediate_quit--; - - push_target (&vx_ops); - - /* Save a copy of the target host's name. */ - if (vx_host) - free (vx_host); - vx_host = savestring (args, strlen (args)); - - /* Find out the name of the file from which the target was booted - and load its symbol table. */ - - bootFile = NULL; - if (!net_get_boot_file (&bootFile)) - { - if (*bootFile) { - printf_filtered ("%s: ", bootFile); - if (catch_errors (symbol_stub, (int)bootFile, - "Error reading symbols from boot file")) - puts_filtered ("ok\n"); - } else if (from_tty) - printf ("VxWorks kernel symbols not loaded.\n"); - } - else - error ("Can't retrieve boot file name from target machine."); - - clnt_freeres (pClient, xdr_wrapstring, &bootFile); - - if (net_get_symbols (&loadTable) != 0) - error ("Can't read loaded modules from target machine"); - - i = 0-1; - while (++i < loadTable.tbl_size) - { - QUIT; /* FIXME, avoids clnt_freeres below: mem leak */ - pLoadFile = &loadTable.tbl_ent [i]; -#ifdef WRS_ORIG - { - register int desc; - struct cleanup *old_chain; - char *fullname = NULL; - - desc = openp (source_path, 0, pLoadFile->name, O_RDONLY, 0, &fullname); - if (desc < 0) - perror_with_name (pLoadFile->name); - old_chain = make_cleanup (close, desc); - add_file_at_addr (fullname, desc, pLoadFile->txt_addr, pLoadFile->data_addr, - pLoadFile->bss_addr); - do_cleanups (old_chain); - } -#else - /* Botches, FIXME: - (1) Searches the PATH, not the source path. - (2) data and bss are assumed to be at the usual offsets from text. */ - catch_errors (add_symbol_stub, (int)pLoadFile, - "Error in reading symbols from loaded module."); -#endif - } - - clnt_freeres (pClient, xdr_ldtabl, &loadTable); - - if (from_tty) - { - puts_filtered ("Success!\n"); - } -} - -/* Cross-net conversion of floats to and from extended form. - (This is needed because different target machines have different - extended floating point formats.) */ - -/* Convert from an extended float to a double. - - The extended float is stored as raw data pointed to by FROM. - Return the converted value as raw data in the double pointed to by TO. -*/ - -static void -vx_convert_to_virtual (regno, from, to) - int regno; - char *from; - char *to; -{ - enum clnt_stat status; - ext_fp from_ext_fp; - double to_double; - - if (REGISTER_CONVERTIBLE (regno)) - { - if (!target_has_fp) { - *(double *)to = 0.0; /* Skip the trouble if no float anyway */ - return; - } - bcopy (from, (char *) &from_ext_fp, sizeof (from_ext_fp)); - bzero ((char *) &to_double, sizeof (to_double)); - - status = net_clnt_call (VX_CONV_FROM_68881, xdr_ext_fp, &from_ext_fp, - xdr_double, &to_double); - if (status == RPC_SUCCESS) - bcopy ((char *) &to_double, to, sizeof (to_double)); - else - error (rpcerr); - } - else - bcopy (from, to, REGISTER_VIRTUAL_SIZE (regno)); -} - - -/* The converse: convert from a double to an extended float. - - The double is stored as raw data pointed to by FROM. - Return the converted value as raw data in the extended - float pointed to by TO. -*/ - -static void -vx_convert_from_virtual (regno, from, to) - int regno; - char *from; - char *to; -{ - enum clnt_stat status; - ext_fp to_ext_fp; - double from_double; - - if (REGISTER_CONVERTIBLE (regno)) - { - if (!target_has_fp) { - bzero (to, REGISTER_RAW_SIZE (FP0_REGNUM)); /* Shrug */ - return; - } - bcopy (from, (char *) &from_double, sizeof (from_double)); - bzero ((char *) &to_ext_fp, sizeof (to_ext_fp)); - - status = net_clnt_call (VX_CONV_TO_68881, xdr_double, &from_double, - xdr_ext_fp, &to_ext_fp); - if (status == RPC_SUCCESS) - bcopy ((char *) &to_ext_fp, to, sizeof (to_ext_fp)); - else - error (rpcerr); - } - else - bcopy (from, to, REGISTER_VIRTUAL_SIZE (regno)); -} - -/* Make an RPC call to the VxWorks target. - Returns RPC status. */ - -static enum clnt_stat -net_clnt_call (procNum, inProc, in, outProc, out) - enum ptracereq procNum; - xdrproc_t inProc; - char *in; - xdrproc_t outProc; - char *out; -{ - enum clnt_stat status; - - status = clnt_call (pClient, procNum, inProc, in, outProc, out, rpcTimeout); - - if (status != RPC_SUCCESS) - clnt_perrno (status); - - return status; -} - -/* A vxprocess target should be started via "run" not "target". */ -/*ARGSUSED*/ -static void -vx_proc_open (name, from_tty) - char *name; - int from_tty; -{ - error ("Use the \"run\" command to start a VxWorks process."); -} - - -/* Target ops structure for accessing memory and such over the net */ - -struct target_ops vx_ops = { - "vxworks", "VxWorks target memory via RPC over TCP/IP", - "Use VxWorks target memory. \n\ -Specify the name of the machine to connect to.", - vx_open, 0, /* vx_detach, */ - 0, 0, /* resume, wait */ - 0, 0, /* read_reg, write_reg */ - 0, vx_convert_to_virtual, vx_convert_from_virtual, /* prep_to_store, */ - vx_xfer_memory, vx_files_info, - 0, 0, /* insert_breakpoint, remove_breakpoint */ - 0, 0, 0, 0, 0, /* terminal stuff */ - 0, /* vx_kill, */ - vx_add_file_command, - vx_lookup_symbol, - vx_create_inferior, 0, /* mourn_inferior */ - core_stratum, 0, /* next */ - 1, 1, 0, 0, 0, /* all mem, mem, stack, regs, exec */ - OPS_MAGIC, /* Always the last thing */ -}; - -/* Target ops structure for accessing VxWorks child processes over the net */ - -struct target_ops vx_run_ops = { - "vxprocess", "VxWorks process", - "VxWorks process, started by the \"run\" command.", - vx_proc_open, 0, /* vx_detach, */ - vx_resume, vx_wait, - vx_read_register, vx_write_register, - vx_prepare_to_store, vx_convert_to_virtual, vx_convert_from_virtual, - vx_xfer_memory, vx_run_files_info, - vx_insert_breakpoint, vx_remove_breakpoint, - 0, 0, 0, 0, 0, /* terminal stuff */ - 0, /* vx_kill, */ - vx_add_file_command, - vx_lookup_symbol, - vx_create_inferior, vx_mourn_inferior, - process_stratum, 0, /* next */ - 1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */ - OPS_MAGIC, /* Always the last thing */ -}; -/* ==> Remember when reading at end of file, there are two "ops" structs here. */ - -void -_initialize_vx () -{ - add_target (&vx_ops); - add_target (&vx_run_ops); -} diff --git a/gdb/rs6000-xdep.c b/gdb/rs6000-xdep.c index 5524826..e69de29 100644 --- a/gdb/rs6000-xdep.c +++ b/gdb/rs6000-xdep.c @@ -1,281 +0,0 @@ -/* IBM RS/6000 host-dependent code for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" -#include "target.h" - -#ifdef IBM6000_TARGET - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -extern int errno; - -static void -exec_one_dummy_insn PARAMS ((void)); - -/* Conversion from gdb-to-system special purpose register numbers.. */ - -static int special_regs[] = { - IAR, /* PC_REGNUM */ - MSR, /* PS_REGNUM */ - CR, /* CR_REGNUM */ - LR, /* LR_REGNUM */ - CTR, /* CTR_REGNUM */ - XER, /* XER_REGNUM */ - MQ /* MQ_REGNUM */ -}; - -void -fetch_inferior_registers (regno) - int regno; -{ - int ii; - extern char registers[]; - - if (regno < 0) { /* for all registers */ - - /* read 32 general purpose registers. */ - - for (ii=0; ii < 32; ++ii) - *(int*)®isters[REGISTER_BYTE (ii)] = - ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii, 0, 0); - - /* read general purpose floating point registers. */ - - for (ii=0; ii < 32; ++ii) - ptrace (PT_READ_FPR, inferior_pid, - (PTRACE_ARG3_TYPE) ®isters [REGISTER_BYTE (FP0_REGNUM+ii)], - FPR0+ii, 0); - - /* read special registers. */ - for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii) - *(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)] = - ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) special_regs[ii], - 0, 0); - - registers_fetched (); - return; - } - - /* else an individual register is addressed. */ - - else if (regno < FP0_REGNUM) { /* a GPR */ - *(int*)®isters[REGISTER_BYTE (regno)] = - ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0, 0); - } - else if (regno <= FPLAST_REGNUM) { /* a FPR */ - ptrace (PT_READ_FPR, inferior_pid, - (PTRACE_ARG3_TYPE) ®isters [REGISTER_BYTE (regno)], - (regno-FP0_REGNUM+FPR0), 0); - } - else if (regno <= LAST_SP_REGNUM) { /* a special register */ - *(int*)®isters[REGISTER_BYTE (regno)] = - ptrace (PT_READ_GPR, inferior_pid, - (PTRACE_ARG3_TYPE) special_regs[regno-FIRST_SP_REGNUM], 0, 0); - } - else - fprintf (stderr, "gdb error: register no %d not implemented.\n", regno); - - register_valid [regno] = 1; -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - extern char registers[]; - - errno = 0; - - if (regno == -1) { /* for all registers.. */ - int ii; - - /* execute one dummy instruction (which is a breakpoint) in inferior - process. So give kernel a chance to do internal house keeping. - Otherwise the following ptrace(2) calls will mess up user stack - since kernel will get confused about the bottom of the stack (%sp) */ - - exec_one_dummy_insn (); - - /* write general purpose registers first! */ - for ( ii=GPR0; ii<=GPR31; ++ii) { - ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii, - *(int*)®isters[REGISTER_BYTE (ii)], 0); - if ( errno ) { - perror ("ptrace write_gpr"); errno = 0; - } - } - - /* write floating point registers now. */ - for ( ii=0; ii < 32; ++ii) { - ptrace (PT_WRITE_FPR, inferior_pid, - (PTRACE_ARG3_TYPE) ®isters[REGISTER_BYTE (FP0_REGNUM+ii)], - FPR0+ii, 0); - if ( errno ) { - perror ("ptrace write_fpr"); errno = 0; - } - } - - /* write special registers. */ - for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii) { - ptrace (PT_WRITE_GPR, inferior_pid, - (PTRACE_ARG3_TYPE) special_regs[ii], - *(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)], 0); - if ( errno ) { - perror ("ptrace write_gpr"); errno = 0; - } - } - } - - /* else, a specific register number is given... */ - - else if (regno < FP0_REGNUM) { /* a GPR */ - - ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno, - *(int*)®isters[REGISTER_BYTE (regno)], 0); - } - - else if (regno <= FPLAST_REGNUM) { /* a FPR */ - ptrace (PT_WRITE_FPR, inferior_pid, - (PTRACE_ARG3_TYPE) ®isters[REGISTER_BYTE (regno)], - regno-FP0_REGNUM+FPR0, 0); - } - - else if (regno <= LAST_SP_REGNUM) { /* a special register */ - - ptrace (PT_WRITE_GPR, inferior_pid, - (PTRACE_ARG3_TYPE) special_regs [regno-FIRST_SP_REGNUM], - *(int*)®isters[REGISTER_BYTE (regno)], 0); - } - - else - fprintf (stderr, "Gdb error: register no %d not implemented.\n", regno); - - if ( errno ) { - perror ("ptrace write"); errno = 0; - } -} - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ - /* fetch GPRs and special registers from the first register section - in core bfd. */ - if (which == 0) { - - /* copy GPRs first. */ - bcopy (core_reg_sect, registers, 32 * 4); - - /* gdb's internal register template and bfd's register section layout - should share a common include file. FIXMEmgo */ - /* then comes special registes. They are supposed to be in the same - order in gdb template and bfd `.reg' section. */ - core_reg_sect += (32 * 4); - bcopy (core_reg_sect, ®isters [REGISTER_BYTE (FIRST_SP_REGNUM)], - (LAST_SP_REGNUM - FIRST_SP_REGNUM + 1) * 4); - } - - /* fetch floating point registers from register section 2 in core bfd. */ - else if (which == 2) - bcopy (core_reg_sect, ®isters [REGISTER_BYTE (FP0_REGNUM)], 32 * 8); - - else - fprintf (stderr, "Gdb error: unknown parameter to fetch_core_registers().\n"); -} - - -/* Execute one dummy breakpoint instruction. This way we give the kernel - a chance to do some housekeeping and update inferior's internal data, - including u_area. */ -static void -exec_one_dummy_insn () -{ -#define DUMMY_INSN_ADDR (TEXT_SEGMENT_BASE)+0x200 - - unsigned long shadow; - unsigned int status, pid; - - /* We plant one dummy breakpoint into DUMMY_INSN_ADDR address. We assume that - this address will never be executed again by the real code. */ - - target_insert_breakpoint (DUMMY_INSN_ADDR, &shadow); - - errno = 0; - ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) DUMMY_INSN_ADDR, 0, 0); - if (errno) - perror ("pt_continue"); - - do { - pid = wait (&status); - } while (pid != inferior_pid); - - target_remove_breakpoint (DUMMY_INSN_ADDR, &shadow); -} - - -#else /* IBM6000_TARGET */ - -/* FIXME: Kludge this til we separate host vs. target vs. native code. */ - -void -fetch_inferior_registers (regno) - int regno; -{ -} - -void -store_inferior_registers (regno) - int regno; -{ -} - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ -} - -#endif /* IBM6000_TARGET */ diff --git a/gdb/rs6k-opcode.def b/gdb/rs6k-opcode.def index 785fd9d..e69de29 100755 --- a/gdb/rs6k-opcode.def +++ b/gdb/rs6k-opcode.def @@ -1,224 +0,0 @@ - -/* operand format specifiers. */ - -#define TO 1 -#define RA 2 -#define SI 3 -#define RT 4 -#define UI 5 -#define BF 6 -#define BFA 7 -#define BT 8 -#define BA 9 -#define BB 10 -#define BO 11 -#define BI 12 -#define RB 13 -#define RS 14 -#define SH 15 -#define MB 16 -#define ME 17 -#define SPR 18 -#define DIS 19 -#define FXM 21 -#define FRT 22 -#define NB 23 -#define FRS 24 -#define FRA 25 -#define FRB 26 -#define FRC 27 -#define FLM 28 -#define I 29 -#define LI 30 -#define A2 31 -#define TA14 32 /* 14 bit representation of target address */ -#define TA24 33 /* 24 bit representation of target address */ -#define FL1 34 -#define FL2 35 -#define LEV 36 - -#if 0 - - RS6000 INSTRUCTION SET - (sorted on first primary and second extended opcode) - - oprtr primary ext. -operator ext format opcode opcode operand format -------- ------- ------ ------- ------ --------------- -#endif /* 0 */ - -{"ti", 0, "d", 3, -1, {TO,RA,SI,0} }, -{"muli", 0, "d", 7, -1, {RT,RA,SI,0} }, -{"sfi", 0, "d", 8, -1, {RT,RA,SI,0} }, -{"dozi", 0, "d", 9, -1, {RT,RA,SI,0} }, -{"cmpli", 0, "d", 10, -1, {BF,RA,UI,0} }, -{"cmpi", 0, "d", 11, -1, {BF,RA,SI,0} }, -{"ai", 0, "d", 12, -1, {RT,RA,SI,0} }, -{"ai.", 0, "d", 13, -1, {RT,RA,SI,0} }, -{"lil", 0, "d", 14, -1, {RT,SI,0} }, /* same as `cal' */ -{"cal", 0, "d", 14, -1, {RT,DIS,RA,0} }, -{"liu", 0, "d", 15, -1, {RT, UI,0} }, /* same as `cau' */ -{"cau", 0, "d", 15, -1, {RT,RA,UI,0} }, -{"bb", "1tfl", "b", 16, -1, {LI,A2,0} }, -/* ^^^^^ - exception #1. Either fix this, or document what you are doing here. FIXMEmgo. -*/ -{"bc", "la", "b", 16, -1, {BO,BI,TA14,0} }, -{"svc", "la", "sc", 17, -1, {LEV,FL1,FL2,0} }, -{"b", "la", "i", 18, -1, {TA24,0} }, -{"mcrf", 0, "xl", 19, 0, {BF,BFA,0} }, -{"bcr", "l", "xl", 19, 16, {BO,BI,0} }, -{"cror", 0, "xl", 19, 33, {BT,BA,BB,0} }, -{"crandc", 0, "xl", 19, 129, {BT,BA,BB,0} }, -{"bcc", "l", "xl", 19, 193, {BO,BI,0} }, -{"crnor", 0, "xl", 19, 225, {BT,BA,BB,0} }, -{"crand", 0, "xl", 19, 257, {BT,BA,BB,0} }, -{"creqv", 0, "xl", 19, 289, {BT,BA,BB,0} }, -{"crnand", 0, "xl", 19, 289, {BT,BA,BB,0} }, -{"crxor", 0, "xl", 19, 417, {BT,BA,BB,0} }, -{"crorc", 0, "xl", 19, 449, {BT,BA,BB,0} }, -{"bcr", "l", "xl", 19, 528, {BO,BI,0} }, -{"rlimi", ".", "m", 20, -1, {RA,RS,SH,MB,ME,0} /*??*/}, -{"rlinm", ".", "m", 21, -1, {RA,RS,SH,MB,ME,0} /*??*/}, -{"rlmi", ".", "m", 22, -1, {RA,RS,RB,MB,ME,0} /*??*/}, -{"rlnm", ".", "m", 23, -1, {RA,RS,RB,MB,ME,0} /*??*/}, -{"oril", 0, "d", 24, -1, {RA,RS,UI,0} }, -{"oriu", 0, "d", 25, -1, {RA,RS,UI,0} }, -{"xoril", 0, "d", 26, -1, {RA,RS,UI,0} }, -{"xoriu", 0, "d", 27, -1, {RA,RS,UI,0} }, -{"andil.", 0, "d", 28, -1, {RA,RS,UI,0} }, -{"andiu.", 0, "d", 29, -1, {RA,RS,UI,0} }, -{"cmp", 0, "x", 31, 0, {BF,RA,RB,0} }, -{"t", 0, "x", 31, 4, {TO,RA,RB,0} }, -{"sf", "o.", "xo", 31, 8, {RT,RA,RB,0} }, -{"a", "o.", "xo", 31, 10, {RT,RA,RB,0} }, -{"mfcr", 0, "x", 31, 19, {RT,0} }, -{"lx", 0, "x", 31, 23, {RT,RA,RB,0} }, -{"sl", ".", "x", 31, 24, {RA,RS,RB,0} }, -{"cntlz", ".", "xo", 31, 26, {RA,RS,0} }, -{"and", ".", "x", 31, 28, {RA,RS,RB,0} }, -{"maskg", ".", "x", 31, 29, {RA,RS,RB,0} }, -{"cmpl", 0, "x", 31, 32, {BF,RA,RB,0} }, -{"sfe", "o.", "xo", 31, 36, {RT,RA,RB,0} }, -{"lux", 0, "x", 31, 55, {RT,RA,RB,0} }, -{"andc", ".", "x", 31, 60, {RA,RS,RB,0} }, -{"mfmsr", 0, "x", 31, 83, {RT,0} }, -{"lbzx", 0, "x", 31, 87, {RT,RA,RB,0} }, -{"neg", "o.", "xo", 31, 104, {RT,RA,0} }, -{"mul", "o.", "xo", 31, 107, {RT,RA,RB,0} }, -{"lbzux", 0, "x", 31, 119, {RT,RA,RB,0} }, -{"nor", ".", "x", 31, 124, {RA,RS,RB,0} }, -{"ae", "o.", "xo", 31, 138, {RT,RA,RB,0} }, -{"mtcrf", 0, "xfx", 31, 144, {FXM,RS,0} }, -{"stx", 0, "x", 31, 151, {RS,RA,RB,0} }, -{"slq", ".", "x", 31, 152, {RA,RS,RB,0} }, -{"sle", ".", "x", 31, 153, {RA,RS,RB,0} }, -{"stux", 0, "x", 31, 183, {RS,RA,RB,0} }, -{"sliq", ".", "x", 31, 184, {RA,RS,SH,0} }, -{"sfze", "o.", "xo", 31, 200, {RT,RA,0} }, -{"aze", "o.", "xo", 31, 202, {RT,RA,0} }, -{"stbx", 0, "x", 31, 215, {RS,RA,RB,0} }, -{"sllq", ".", "x", 31, 216, {RA,RS,RB,0} }, -{"sleq", ".", "x", 31, 217, {RA,RS,RB,0} }, -{"sfme", "o.", "xo", 31, 232, {RT,RA,0} }, -{"ame", "o.", "xo", 31, 234, {RT,RA,0} }, -{"muls", "o.", "xo", 31, 235, {RT,RA,RB,0} }, -{"stbux", 0, "x", 31, 247, {RS,RA,RB,0} }, -{"slliq", ".", "x", 31, 248, {RA,RS,SH,0} }, -{"doz", "o.", "x", 31, 264, {RT,RA,RB,0} }, -{"cax", "o.", "xo", 31, 266, {RT,RA,RB,0} }, -{"lscbx", ".", "x", 31, 277, {RT,RA,RB,0} }, -{"lhzx", 0, "x", 31, 279, {RT,RA,RB,0} }, -{"eqv", ".", "x", 31, 284, {RA,RS,RB,0} }, -{"lhzux", 0, "x", 31, 311, {RT,RA,RB,0} }, -{"xor", ".", "x", 31, 316, {RA,RS,RB,0} }, -{"div", "o.", "xo", 31, 331, {RT,RA,RB,0} }, -{"mfspr", 0, "x", 31, 339, {RT,SPR,0} }, -{"lhax", 0, "x", 31, 343, {RT,RA,RB,0} }, -{"abs", "o.", "xo", 31, 360, {RT,RA,0} }, -{"divs", "o.", "xo", 31, 363, {RT,RA,RB,0} }, -{"lhaux", 0, "x", 31, 375, {RT,RA,RB,0} }, -{"sthx", 0, "x", 31, 407, {RS,RA,RB,0} }, -{"orc", ".", "x", 31, 412, {RA,RS,RB,0} }, -{"sthux", 0, "x", 31, 439, {RS,RA,RB,0} }, -{"or", ".", "x", 31, 444, {RA,RS,RB,0} }, -{"mtspr", 0, "x", 31, 467, {SPR,RS,0} }, -{"nand", ".", "x", 31, 476, {RA,RS,RB,0} }, -{"nabs", "o.", "xo", 31, 488, {RT,RA,0} }, -{"mcrxr", 0, "x", 31, 512, {BF,0} }, -{"lsx", 0, "x", 31, 533, {RT,RA,RB,0} }, -{"lbrx", 0, "x", 31, 534, {RT,RA,RB,0} }, -{"lfsx", 0, "x", 31, 535, {FRT,RA,RB,0} }, -{"sr", ".", "x", 31, 536, {RA,RS,RB,0} }, -{"rrib", ".", "x", 31, 537, {RA,RS,RB,0} }, -{"maskir", ".", "x", 31, 541, {RA,RS,RB,0} }, -{"lfsux", 0, "x", 31, 567, {FRT,RA,RB,0} }, -{"lsi", 0, "x", 31, 597, {RT,RA,NB,0} }, -{"lfdx", 0, "x", 31, 599, {FRT,RA,RB,0} }, -{"lfdux", 0, "x", 31, 631, {FRT,RA,RB,0} }, -{"stsx", 0, "x", 31, 661, {RS,RA,RB,0} }, -{"stbrx", 0, "x", 31, 662, {RA,RA,RB,0} }, -{"stfsx", 0, "x", 31, 663, {FRS,RA,RB,0} }, -{"srq", ".", "x", 31, 664, {RA,RS,RB,0} }, -{"sre", ".", "x", 31, 665, {RA,RS,RB,0} }, -{"stfsux", 0, "x", 31, 695, {FRS,RA,RB,0} }, -{"sriq", ".", "x", 31, 696, {RA,RS,SH,0} }, -{"stsi", 0, "x", 31, 725, {RS,RA,NB,0} }, -{"stfdx", 0, "x", 31, 727, {FRS,RA,RB,0} }, -{"srlq", ".", "x", 31, 728, {RA,RS,RB,0} }, -{"sreq", ".", "x", 31, 729, {RA,RS,RB,0} }, -{"stfdux", 0, "x", 31, 759, {FRS,RA,RB,0} }, -{"srliq", ".", "x", 31, 760, {RA,RS,SH,0} }, -{"lhbrx", 0, "x", 31, 790, {RT,RA,RB,0} }, -{"sra", ".", "x", 31, 792, {RA,RS,RB,0} }, -{"srai", ".", "x", 31, 824, {RA,RS,SH,0} }, -{"sthbrx", 0, "x", 31, 918, {RS,RA,RB,0} }, -{"sraq", ".", "x", 31, 920, {RA,RS,RB,0} }, -{"srea", ".", "x", 31, 921, {RA,RS,RB,0} }, -{"exts", ".", "x", 31, 922, {RA,RS,0} }, -{"sraiq", ".", "x", 31, 952, {RA,RS,SH,0} }, -{"l", 0, "d", 32, -1, {RT,DIS,RA,0} }, -{"lu", 0, "d", 33, -1, {RT,DIS,RA,0} }, -{"lbz", 0, "d", 34, -1, {RT,DIS,RA,0} }, -{"lbzu", 0, "d", 35, -1, {RT,DIS,RA,0} }, -{"st", 0, "d", 36, -1, {RS,DIS,RA,0} }, -{"stu", 0, "d", 37, -1, {RS,DIS,RA,0} }, -{"stb", 0, "d", 38, -1, {RS,DIS,RA,0} }, -{"stbu", 0, "d", 39, -1, {RS,DIS,RA,0} }, -{"lhz", 0, "d", 40, -1, {RT,DIS,RA,0} }, -{"lhzu", 0, "d", 41, -1, {RT,DIS,RA,0} }, -{"lha", 0, "d", 42, -1, {RT,DIS,RA,0} }, -{"lhau", 0, "d", 43, -1, {RT,DIS,RA,0} }, -{"sth", 0, "d", 44, -1, {RS,DIS,RA,0} }, -{"sthu", 0, "d", 45, -1, {RS,DIS,RA,0} }, -{"lm", 0, "d", 46, -1, {RT,DIS,RA,0} }, -{"stm", 0, "d", 47, -1, {RS,DIS,RA,0} }, -{"lfs", 0, "d", 48, -1, {FRT,DIS,RA,0} }, -{"lfsu", 0, "d", 49, -1, {FRT,DIS,RA,0} }, -{"lfd", 0, "d", 50, -1, {FRT,DIS,RA,0} }, -{"lfdu", 0, "d", 51, -1, {FRT,DIS,RA,0} }, -{"stfs", 0, "d", 52, -1, {FRS,DIS,RA,0} }, -{"stfsu", 0, "d", 53, -1, {FRS,DIS,RA,0} }, -{"stfd", 0, "d", 54, -1, {FRS,DIS,RA,0} }, -{"stfdu", 0, "d", 55, -1, {FRS,DIS,RA,0} }, -{"fcmpu", 0, "x", 63, 0, {BF,FRA,FRB,0} }, -{"fm", ".", "a", 63, 5, {FRT,FRA,FRC,0} }, -{"fd", ".", "a", 63, 8, {FRT,FRA,FRB,0} }, -{"frsp", ".", "x", 63, 12, {FRT,FRB,0} }, -{"fs", ".", "a", 63, 20, {FRT,FRA,FRB,0} }, -{"fa", ".", "a", 63, 21, {FRT,FRA,FRB,0} }, -{"fms", ".", "a", 63, 28, {FRT,FRA,FRC,FRB,0} }, -{"fma", ".", "a", 63, 29, {FRT,FRA,FRC,FRB,0} }, -{"fnms", ".", "a", 63, 30, {FRT,FRA,FRC,FRB,0} }, -{"fnma", ".", "a", 63, 31, {FRT,FRA,FRC,FRB,0} }, -{"fcmpo", 0, "x", 63, 32, {BF,FRA,FRB,0} }, -{"mtfsb1", ".", "x", 63, 38, {BT,0} }, -{"fneg", ".", "x", 63, 40, {FRT,FRB,0} }, -{"mcrfs", 0, "x", 63, 64, {BF,BFA,0} }, -{"mtfsb0", ".", "x", 63, 70, {BT,0} }, -{"fmr", ".", "x", 63, 72, {FRT,FRB,0} }, -{"mtfsfi", ".", "x", 63, 134, {BF,I,0} }, -{"fnabs", ".", "x", 63, 136, {FRT,FRB,0} }, -{"fabs", ".", "x", 63, 264, {FRT,FRB,0} }, -{"mffs", ".", "x", 63, 583, {FRT,0} }, -{"mtfsf", ".", "xfl", 63, 711, {FLM,FRB,0} }, diff --git a/gdb/rs6k-opcode.h b/gdb/rs6k-opcode.h index 7f616b5..e69de29 100755 --- a/gdb/rs6k-opcode.h +++ b/gdb/rs6k-opcode.h @@ -1,236 +0,0 @@ -/* IBM RS/6000 instruction set definitions, for GNU software. */ - -typedef struct rs6000_insn { - char *operator; /* opcode name */ - char *opr_ext; /* opcode name extension */ - char *format; /* opcode format */ - char p_opcode; /* primary opcode */ - int e_opcode; /* extended opcode */ - char oprnd_format[6]; /* operand format */ -} OPCODE; - -/* operand format specifiers */ - -#define TO 1 -#define RA 2 -#define SI 3 -#define RT 4 -#define UI 5 -#define BF 6 -#define BFA 7 -#define BT 8 -#define BA 9 -#define BB 10 -#define BO 11 -#define BI 12 -#define RB 13 -#define RS 14 -#define SH 15 -#define MB 16 -#define ME 17 -#define SPR 18 -#define DIS 19 -#define FXM 21 -#define FRT 22 -#define NB 23 -#define FRS 24 -#define FRA 25 -#define FRB 26 -#define FRC 27 -#define FLM 28 -#define I 29 -#define LI 30 -#define A2 31 -#define TA14 32 /* 14 bit representation of target address */ -#define TA24 33 /* 24 bit representation of target address */ -#define FL1 34 -#define FL2 35 -#define LEV 36 - -/* RS/6000 INSTRUCTION SET - (sorted on primary and extended opcode) - - oprtr primary ext. -operator ext format opcode opcode operand format -------- ------- ------ ------- ------ --------------- */ - -struct rs6000_insn rs6k_ops [] = { - -{"ti", 0, "d", 3, -1, {TO,RA,SI,0} }, -{"muli", 0, "d", 7, -1, {RT,RA,SI,0} }, -{"sfi", 0, "d", 8, -1, {RT,RA,SI,0} }, -{"dozi", 0, "d", 9, -1, {RT,RA,SI,0} }, -{"cmpli", 0, "d", 10, -1, {BF,RA,UI,0} }, -{"cmpi", 0, "d", 11, -1, {BF,RA,SI,0} }, -{"ai", 0, "d", 12, -1, {RT,RA,SI,0} }, -{"ai.", 0, "d", 13, -1, {RT,RA,SI,0} }, -{"lil", 0, "d", 14, -1, {RT,SI,0} }, /* same as `cal' */ -{"cal", 0, "d", 14, -1, {RT,DIS,RA,0} }, -{"liu", 0, "d", 15, -1, {RT, UI,0} }, /* same as `cau' */ -{"cau", 0, "d", 15, -1, {RT,RA,UI,0} }, -{"bb", "1tfl", "b", 16, -1, {LI,A2,0} }, -/* ^^^^^ - exception #1. Either fix this, or document what you are doing here. FIXMEmgo. -*/ -{"bc", "la", "b", 16, -1, {BO,BI,TA14,0} }, -{"svc", "la", "sc", 17, -1, {LEV,FL1,FL2,0} }, -{"b", "la", "i", 18, -1, {TA24,0} }, -{"mcrf", 0, "xl", 19, 0, {BF,BFA,0} }, -{"bcr", "l", "xl", 19, 16, {BO,BI,0} }, -{"cror", 0, "xl", 19, 33, {BT,BA,BB,0} }, -{"crandc", 0, "xl", 19, 129, {BT,BA,BB,0} }, -{"bcc", "l", "xl", 19, 193, {BO,BI,0} }, -{"crnor", 0, "xl", 19, 225, {BT,BA,BB,0} }, -{"crand", 0, "xl", 19, 257, {BT,BA,BB,0} }, -{"creqv", 0, "xl", 19, 289, {BT,BA,BB,0} }, -{"crnand", 0, "xl", 19, 289, {BT,BA,BB,0} }, -{"crxor", 0, "xl", 19, 417, {BT,BA,BB,0} }, -{"crorc", 0, "xl", 19, 449, {BT,BA,BB,0} }, -{"bcr", "l", "xl", 19, 528, {BO,BI,0} }, -{"rlimi", ".", "m", 20, -1, {RA,RS,SH,MB,ME,0} /*??*/}, -{"rlinm", ".", "m", 21, -1, {RA,RS,SH,MB,ME,0} /*??*/}, -{"rlmi", ".", "m", 22, -1, {RA,RS,RB,MB,ME,0} /*??*/}, -{"rlnm", ".", "m", 23, -1, {RA,RS,RB,MB,ME,0} /*??*/}, -{"oril", 0, "d", 24, -1, {RA,RS,UI,0} }, -{"oriu", 0, "d", 25, -1, {RA,RS,UI,0} }, -{"xoril", 0, "d", 26, -1, {RA,RS,UI,0} }, -{"xoriu", 0, "d", 27, -1, {RA,RS,UI,0} }, -{"andil.", 0, "d", 28, -1, {RA,RS,UI,0} }, -{"andiu.", 0, "d", 29, -1, {RA,RS,UI,0} }, -{"cmp", 0, "x", 31, 0, {BF,RA,RB,0} }, -{"t", 0, "x", 31, 4, {TO,RA,RB,0} }, -{"sf", "o.", "xo", 31, 8, {RT,RA,RB,0} }, -{"a", "o.", "xo", 31, 10, {RT,RA,RB,0} }, -{"mfcr", 0, "x", 31, 19, {RT,0} }, -{"lx", 0, "x", 31, 23, {RT,RA,RB,0} }, -{"sl", ".", "x", 31, 24, {RA,RS,RB,0} }, -{"cntlz", ".", "xo", 31, 26, {RA,RS,0} }, -{"and", ".", "x", 31, 28, {RA,RS,RB,0} }, -{"maskg", ".", "x", 31, 29, {RA,RS,RB,0} }, -{"cmpl", 0, "x", 31, 32, {BF,RA,RB,0} }, -{"sfe", "o.", "xo", 31, 136, {RT,RA,RB,0} }, -{"lux", 0, "x", 31, 55, {RT,RA,RB,0} }, -{"andc", ".", "x", 31, 60, {RA,RS,RB,0} }, -{"mfmsr", 0, "x", 31, 83, {RT,0} }, -{"lbzx", 0, "x", 31, 87, {RT,RA,RB,0} }, -{"neg", "o.", "xo", 31, 104, {RT,RA,0} }, -{"mul", "o.", "xo", 31, 107, {RT,RA,RB,0} }, -{"lbzux", 0, "x", 31, 119, {RT,RA,RB,0} }, -{"nor", ".", "x", 31, 124, {RA,RS,RB,0} }, -{"ae", "o.", "xo", 31, 138, {RT,RA,RB,0} }, -{"mtcrf", 0, "xfx", 31, 144, {FXM,RS,0} }, -{"stx", 0, "x", 31, 151, {RS,RA,RB,0} }, -{"slq", ".", "x", 31, 152, {RA,RS,RB,0} }, -{"sle", ".", "x", 31, 153, {RA,RS,RB,0} }, -{"stux", 0, "x", 31, 183, {RS,RA,RB,0} }, -{"sliq", ".", "x", 31, 184, {RA,RS,SH,0} }, -{"sfze", "o.", "xo", 31, 200, {RT,RA,0} }, -{"aze", "o.", "xo", 31, 202, {RT,RA,0} }, -{"stbx", 0, "x", 31, 215, {RS,RA,RB,0} }, -{"sllq", ".", "x", 31, 216, {RA,RS,RB,0} }, -{"sleq", ".", "x", 31, 217, {RA,RS,RB,0} }, -{"sfme", "o.", "xo", 31, 232, {RT,RA,0} }, -{"ame", "o.", "xo", 31, 234, {RT,RA,0} }, -{"muls", "o.", "xo", 31, 235, {RT,RA,RB,0} }, -{"stbux", 0, "x", 31, 247, {RS,RA,RB,0} }, -{"slliq", ".", "x", 31, 248, {RA,RS,SH,0} }, -{"doz", "o.", "x", 31, 264, {RT,RA,RB,0} }, -{"cax", "o.", "xo", 31, 266, {RT,RA,RB,0} }, -{"lscbx", ".", "x", 31, 277, {RT,RA,RB,0} }, -{"lhzx", 0, "x", 31, 279, {RT,RA,RB,0} }, -{"eqv", ".", "x", 31, 284, {RA,RS,RB,0} }, -{"lhzux", 0, "x", 31, 311, {RT,RA,RB,0} }, -{"xor", ".", "x", 31, 316, {RA,RS,RB,0} }, -{"div", "o.", "xo", 31, 331, {RT,RA,RB,0} }, -{"mfspr", 0, "x", 31, 339, {RT,SPR,0} }, -{"lhax", 0, "x", 31, 343, {RT,RA,RB,0} }, -{"abs", "o.", "xo", 31, 360, {RT,RA,0} }, -{"divs", "o.", "xo", 31, 363, {RT,RA,RB,0} }, -{"lhaux", 0, "x", 31, 375, {RT,RA,RB,0} }, -{"sthx", 0, "x", 31, 407, {RS,RA,RB,0} }, -{"orc", ".", "x", 31, 412, {RA,RS,RB,0} }, -{"sthux", 0, "x", 31, 439, {RS,RA,RB,0} }, -{"or", ".", "x", 31, 444, {RA,RS,RB,0} }, -{"mtspr", 0, "x", 31, 467, {SPR,RS,0} }, -{"nand", ".", "x", 31, 476, {RA,RS,RB,0} }, -{"nabs", "o.", "xo", 31, 488, {RT,RA,0} }, -{"mcrxr", 0, "x", 31, 512, {BF,0} }, -{"lsx", 0, "x", 31, 533, {RT,RA,RB,0} }, -{"lbrx", 0, "x", 31, 534, {RT,RA,RB,0} }, -{"lfsx", 0, "x", 31, 535, {FRT,RA,RB,0} }, -{"sr", ".", "x", 31, 536, {RA,RS,RB,0} }, -{"rrib", ".", "x", 31, 537, {RA,RS,RB,0} }, -{"maskir", ".", "x", 31, 541, {RA,RS,RB,0} }, -{"lfsux", 0, "x", 31, 567, {FRT,RA,RB,0} }, -{"lsi", 0, "x", 31, 597, {RT,RA,NB,0} }, -{"lfdx", 0, "x", 31, 599, {FRT,RA,RB,0} }, -{"lfdux", 0, "x", 31, 631, {FRT,RA,RB,0} }, -{"stsx", 0, "x", 31, 661, {RS,RA,RB,0} }, -{"stbrx", 0, "x", 31, 662, {RS,RA,RB,0} }, -{"stfsx", 0, "x", 31, 663, {FRS,RA,RB,0} }, -{"srq", ".", "x", 31, 664, {RA,RS,RB,0} }, -{"sre", ".", "x", 31, 665, {RA,RS,RB,0} }, -{"stfsux", 0, "x", 31, 695, {FRS,RA,RB,0} }, -{"sriq", ".", "x", 31, 696, {RA,RS,SH,0} }, -{"stsi", 0, "x", 31, 725, {RS,RA,NB,0} }, -{"stfdx", 0, "x", 31, 727, {FRS,RA,RB,0} }, -{"srlq", ".", "x", 31, 728, {RA,RS,RB,0} }, -{"sreq", ".", "x", 31, 729, {RA,RS,RB,0} }, -{"stfdux", 0, "x", 31, 759, {FRS,RA,RB,0} }, -{"srliq", ".", "x", 31, 760, {RA,RS,SH,0} }, -{"lhbrx", 0, "x", 31, 790, {RT,RA,RB,0} }, -{"sra", ".", "x", 31, 792, {RA,RS,RB,0} }, -{"srai", ".", "x", 31, 824, {RA,RS,SH,0} }, -{"sthbrx", 0, "x", 31, 918, {RS,RA,RB,0} }, -{"sraq", ".", "x", 31, 920, {RA,RS,RB,0} }, -{"srea", ".", "x", 31, 921, {RA,RS,RB,0} }, -{"exts", ".", "x", 31, 922, {RA,RS,0} }, -{"sraiq", ".", "x", 31, 952, {RA,RS,SH,0} }, -{"l", 0, "d", 32, -1, {RT,DIS,RA,0} }, -{"lu", 0, "d", 33, -1, {RT,DIS,RA,0} }, -{"lbz", 0, "d", 34, -1, {RT,DIS,RA,0} }, -{"lbzu", 0, "d", 35, -1, {RT,DIS,RA,0} }, -{"st", 0, "d", 36, -1, {RS,DIS,RA,0} }, -{"stu", 0, "d", 37, -1, {RS,DIS,RA,0} }, -{"stb", 0, "d", 38, -1, {RS,DIS,RA,0} }, -{"stbu", 0, "d", 39, -1, {RS,DIS,RA,0} }, -{"lhz", 0, "d", 40, -1, {RT,DIS,RA,0} }, -{"lhzu", 0, "d", 41, -1, {RT,DIS,RA,0} }, -{"lha", 0, "d", 42, -1, {RT,DIS,RA,0} }, -{"lhau", 0, "d", 43, -1, {RT,DIS,RA,0} }, -{"sth", 0, "d", 44, -1, {RS,DIS,RA,0} }, -{"sthu", 0, "d", 45, -1, {RS,DIS,RA,0} }, -{"lm", 0, "d", 46, -1, {RT,DIS,RA,0} }, -{"stm", 0, "d", 47, -1, {RS,DIS,RA,0} }, -{"lfs", 0, "d", 48, -1, {FRT,DIS,RA,0} }, -{"lfsu", 0, "d", 49, -1, {FRT,DIS,RA,0} }, -{"lfd", 0, "d", 50, -1, {FRT,DIS,RA,0} }, -{"lfdu", 0, "d", 51, -1, {FRT,DIS,RA,0} }, -{"stfs", 0, "d", 52, -1, {FRS,DIS,RA,0} }, -{"stfsu", 0, "d", 53, -1, {FRS,DIS,RA,0} }, -{"stfd", 0, "d", 54, -1, {FRS,DIS,RA,0} }, -{"stfdu", 0, "d", 55, -1, {FRS,DIS,RA,0} }, -{"fcmpu", 0, "x", 63, 0, {BF,FRA,FRB,0} }, -{"fm", ".", "a", 63, 5, {FRT,FRA,FRC,0} }, -{"fd", ".", "a", 63, 8, {FRT,FRA,FRB,0} }, -{"frsp", ".", "x", 63, 12, {FRT,FRB,0} }, -{"fs", ".", "a", 63, 20, {FRT,FRA,FRB,0} }, -{"fa", ".", "a", 63, 21, {FRT,FRA,FRB,0} }, -{"fms", ".", "a", 63, 28, {FRT,FRA,FRC,FRB,0} }, -{"fma", ".", "a", 63, 29, {FRT,FRA,FRC,FRB,0} }, -{"fnms", ".", "a", 63, 30, {FRT,FRA,FRC,FRB,0} }, -{"fnma", ".", "a", 63, 31, {FRT,FRA,FRC,FRB,0} }, -{"fcmpo", 0, "x", 63, 32, {BF,FRA,FRB,0} }, -{"mtfsb1", ".", "x", 63, 38, {BT,0} }, -{"fneg", ".", "x", 63, 40, {FRT,FRB,0} }, -{"mcrfs", 0, "x", 63, 64, {BF,BFA,0} }, -{"mtfsb0", ".", "x", 63, 70, {BT,0} }, -{"fmr", ".", "x", 63, 72, {FRT,FRB,0} }, -{"mtfsfi", ".", "x", 63, 134, {BF,I,0} }, -{"fnabs", ".", "x", 63, 136, {FRT,FRB,0} }, -{"fabs", ".", "x", 63, 264, {FRT,FRB,0} }, -{"mffs", ".", "x", 63, 583, {FRT,0} }, -{"mtfsf", ".", "xfl", 63, 711, {FLM,FRB,0} }, -}; - -#define NOPCODES (sizeof (rs6k_ops) / sizeof (struct rs6000_insn)) diff --git a/gdb/signame.c b/gdb/signame.c deleted file mode 100755 index f96b74e..0000000 --- a/gdb/signame.c +++ /dev/null @@ -1,260 +0,0 @@ -/* Convert between signal names and numbers, for GDB. - Copyright 1990, 1991, 1992 Free Software Foundation, Inc. - - This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* GDB-specific, FIXME. (This is for the SYS_SIGLIST_MISSING define). */ -#include "defs.h" -#include -#include "signame.h" - -static void -init_sig PARAMS ((int, const char *, const char *)); - -static void -init_sigs PARAMS ((void)); - -#if SYS_SIGLIST_MISSING -/* There is too much variation in Sys V signal numbers and names, so - we must initialize them at runtime. */ - -static const char undoc[] = "unknown signal"; - -/* We'd like to make this const char*[], but whoever's using it might - want to assign from it to a char*. */ -char *sys_siglist[NSIG]; -#endif /* SYS_SIGLIST_MISSING */ - -/* Table of abbreviations for signals. Note: A given number can - appear more than once with different abbreviations. */ -typedef struct - { - int number; - const char *abbrev; - } num_abbrev; -static num_abbrev sig_table[NSIG*2]; -/* Number of elements of sig_table used. */ -static int sig_table_nelts = 0; - -/* Enter signal number NUMBER into the tables with ABBREV and NAME. */ -/* ARGSUSED */ -static void -init_sig (number, abbrev, name) - int number; - const char *abbrev; - const char *name; -{ -#if SYS_SIGLIST_MISSING - sys_siglist[number] = (char *) name; -#endif - sig_table[sig_table_nelts].number = number; - sig_table[sig_table_nelts++].abbrev = abbrev; -} - -static void init_sigs () -{ -#if SYS_SIGLIST_MISSING - int i; - - /* Initialize signal names. */ - for (i = 0; i < NSIG; i++) - sys_siglist[i] = (char *) undoc; -#endif /* SYS_SIGLIST_MISSING */ - - /* Initialize signal names. */ -#if defined (SIGHUP) - init_sig (SIGHUP, "HUP", "Hangup"); -#endif -#if defined (SIGINT) - init_sig (SIGINT, "INT", "Interrupt"); -#endif -#if defined (SIGQUIT) - init_sig (SIGQUIT, "QUIT", "Quit"); -#endif -#if defined (SIGILL) - init_sig (SIGILL, "ILL", "Illegal Instruction"); -#endif -#if defined (SIGTRAP) - init_sig (SIGTRAP, "TRAP", "Trace/breakpoint trap"); -#endif - /* If SIGIOT == SIGABRT, we want to print it as SIGABRT because - SIGABRT is in ANSI and POSIX.1 and SIGIOT isn't. */ -#if defined (SIGABRT) - init_sig (SIGABRT, "ABRT", "Aborted"); -#endif -#if defined (SIGIOT) - init_sig (SIGIOT, "IOT", "IOT trap"); -#endif -#if defined (SIGEMT) - init_sig (SIGEMT, "EMT", "EMT trap"); -#endif -#if defined (SIGFPE) - init_sig (SIGFPE, "FPE", "Floating point exception"); -#endif -#if defined (SIGKILL) - init_sig (SIGKILL, "KILL", "Killed"); -#endif -#if defined (SIGBUS) - init_sig (SIGBUS, "BUS", "Bus error"); -#endif -#if defined (SIGSEGV) - init_sig (SIGSEGV, "SEGV", "Segmentation fault"); -#endif -#if defined (SIGSYS) - init_sig (SIGSYS, "SYS", "Bad system call"); -#endif -#if defined (SIGPIPE) - init_sig (SIGPIPE, "PIPE", "Broken pipe"); -#endif -#if defined (SIGALRM) - init_sig (SIGALRM, "ALRM", "Alarm clock"); -#endif -#if defined (SIGTERM) - init_sig (SIGTERM, "TERM", "Terminated"); -#endif -#if defined (SIGUSR1) - init_sig (SIGUSR1, "USR1", "User defined signal 1"); -#endif -#if defined (SIGUSR2) - init_sig (SIGUSR2, "USR2", "User defined signal 2"); -#endif - /* If SIGCLD == SIGCHLD, we want to print it as SIGCHLD because that - is what is in POSIX.1. */ -#if defined (SIGCHLD) - init_sig (SIGCHLD, "CHLD", "Child exited"); -#endif -#if defined (SIGCLD) - init_sig (SIGCLD, "CLD", "Child exited"); -#endif -#if defined (SIGPWR) - init_sig (SIGPWR, "PWR", "Power failure"); -#endif -#if defined (SIGTSTP) - init_sig (SIGTSTP, "TSTP", "Stopped"); -#endif -#if defined (SIGTTIN) - init_sig (SIGTTIN, "TTIN", "Stopped (tty input)"); -#endif -#if defined (SIGTTOU) - init_sig (SIGTTOU, "TTOU", "Stopped (tty output)"); -#endif -#if defined (SIGSTOP) - init_sig (SIGSTOP, "STOP", "Stopped (signal)"); -#endif -#if defined (SIGXCPU) - init_sig (SIGXCPU, "XCPU", "CPU time limit exceeded"); -#endif -#if defined (SIGXFSZ) - init_sig (SIGXFSZ, "XFSZ", "File size limit exceeded"); -#endif -#if defined (SIGVTALRM) - init_sig (SIGVTALRM, "VTALRM", "Virtual timer expired"); -#endif -#if defined (SIGPROF) - init_sig (SIGPROF, "PROF", "Profiling timer expired"); -#endif -#if defined (SIGWINCH) - /* "Window size changed" might be more accurate, but even if that - is all that it means now, perhaps in the future it will be - extended to cover other kinds of window changes. */ - init_sig (SIGWINCH, "WINCH", "Window changed"); -#endif -#if defined (SIGCONT) - init_sig (SIGCONT, "CONT", "Continued"); -#endif -#if defined (SIGURG) - init_sig (SIGURG, "URG", "Urgent I/O condition"); -#endif -#if defined (SIGIO) - /* "I/O pending" has also been suggested. A disadvantage is - that signal only happens when the process has - asked for it, not everytime I/O is pending. Another disadvantage - is the confusion from giving it a different name than under Unix. */ - init_sig (SIGIO, "IO", "I/O possible"); -#endif -#if defined (SIGWIND) - init_sig (SIGWIND, "WIND", "SIGWIND"); -#endif -#if defined (SIGPHONE) - init_sig (SIGPHONE, "PHONE", "SIGPHONE"); -#endif -#if defined (SIGPOLL) - init_sig (SIGPOLL, "POLL", "I/O possible"); -#endif -#if defined (SIGLOST) - init_sig (SIGLOST, "LOST", "Resource lost"); -#endif -#if defined (SIGWAITING) - init_sig (SIGWAITING, "WAITING", "Process's LWPs are blocked"); /* FIXME */ -#endif -#if defined (SIGLWP) - init_sig (SIGLWP, "LWP", "Signal LWP"); /* FIXME description */ -#endif -} - -/* Return the abbreviation for signal NUMBER. */ -char * -sig_abbrev (number) - int number; -{ - int i; - - for (i = 0; i < sig_table_nelts; i++) - if (sig_table[i].number == number) - return (char *)sig_table[i].abbrev; - return NULL; -} - -/* Return the signal number for an ABBREV, or -1 if there is no - signal by that name. */ -int -sig_number (abbrev) - const char *abbrev; -{ - int i; - - /* Skip over "SIG" if present. */ - if (abbrev[0] == 'S' && abbrev[1] == 'I' && abbrev[2] == 'G') - abbrev += 3; - - for (i = 0; i < sig_table_nelts; i++) - if (abbrev[0] == sig_table[i].abbrev[0] - && strcmp (abbrev, sig_table[i].abbrev) == 0) - return sig_table[i].number; - return -1; -} - -#if SYS_SIGLIST_MISSING -/* Print to standard error the name of SIGNAL, preceded by MESSAGE and - a colon, and followed by a newline. */ -void -psignal (signal, message) - unsigned signal; - const char *message; -{ - if (signal <= 0 || signal >= NSIG) - fprintf (stderr, "%s: unknown signal", message); - else - fprintf (stderr, "%s: %s\n", message, sys_siglist[signal]); -} -#endif /* SYS_SIGLIST_MISSING */ - -void -_initialize_signame () -{ - init_sigs (); -} diff --git a/gdb/signame.h b/gdb/signame.h deleted file mode 100755 index 0010796..0000000 --- a/gdb/signame.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Convert between signal names and numbers. - Copyright 1990, 1992 Free Software Foundation, Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#if !defined (SIGNAME_H) -#define SIGNAME_H 1 - -/* Names for signals from 0 to NSIG-1. */ -extern char *sys_siglist[]; - -/* Return the abbreviation (e.g. ABRT, FPE, etc.) for signal NUMBER. - Do not return this as a const char *. The caller might want to - assign it to a char *. */ - -extern char * -sig_abbrev PARAMS ((int)); - -/* Return the signal number for an ABBREV, or -1 if there is no - signal by that name. */ - -extern int -sig_number PARAMS ((const char *)); - -#ifndef PSIGNAL_IN_SIGNAL_H -/* Print to standard error the name of SIGNAL, preceded by MESSAGE and - a colon, and followed by a newline. */ - -extern void -psignal PARAMS ((unsigned, const char *)); -#endif - -#endif /* !defined (SIGNAME_H) */ diff --git a/gdb/sparc-opcode.h b/gdb/sparc-opcode.h deleted file mode 100755 index d97c7a3..0000000 --- a/gdb/sparc-opcode.h +++ /dev/null @@ -1,643 +0,0 @@ -/* Table of opcodes for the sparc. - Copyright (C) 1989 Free Software Foundation, Inc. - -This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#if !defined(__STDC__) && !defined(const) -#define const -#endif - -/* - * Structure of an opcode table entry. - */ -struct sparc_opcode -{ - const char *name; - unsigned long int match; /* Bits that must be set. */ - unsigned long int lose; /* Bits that must not be set. */ - const char *args; - char flags; -}; - -#define F_DELAYED 1 /* Delayed branch */ -#define F_ALIAS 2 /* Alias for a "real" instruction */ - -/* - All sparc opcodes are 32 bits, except for the `set' instruction (really - a macro), which is 64 bits. It is handled as a special case. - - The match component is a mask saying which bits must match a - particular opcode in order for an instruction to be an instance - of that opcode. - - The args component is a string containing one character - for each operand of the instruction. - -Kinds of operands: - # Number used by optimizer. It is ignored. - 1 rs1 register. - 2 rs2 register. - d rd register. - e frs1 floating point register. - f frs2 floating point register. - g frsd floating point register. - b crs1 coprocessor register - c crs2 coprocessor register - D crsd coprocessor register - h 22 high bits. - i 13 bit Immediate. - l 22 bit PC relative immediate. - L 30 bit PC relative immediate. - a Annul. The annul bit is set. - A Alternate address space. Stored as 8 bits. - C Coprocessor state register. - F floating point state register. - p Processor state register. - q Floating point queue. - r Single register that is both rs1 and rsd. - Q Coprocessor queue. - S Special case. - t Trap base register. - w Window invalid mask register. - y Y register. - -*/ - -/* The order of the opcodes in this table is significant: - - * The assembler requires that all instances of the same mnemonic must be - consecutive. If they aren't, the assembler will bomb at runtime. - - * The disassembler should not care about the order of the opcodes. */ - -static struct sparc_opcode sparc_opcodes[] = -{ - -{ "ldd", 0xc1980000, 0x0060201f, "[1],D", 0 }, /* ldd [rs1+%g0],d */ -{ "ldd", 0xc1982000, 0x00601fff, "[1],D", 0 }, /* ldd [rs1+0],d */ -{ "ldd", 0xc1982000, 0x00600000, "[1+i],D", 0 }, -{ "ldd", 0xc1982000, 0x00600000, "[i+1],D", 0 }, -{ "ldd", 0xc1980000, 0x00602000, "[1+2],D", 0 }, -{ "ldd", 0xc1180000, 0x00e0201f, "[1],g", 0 }, /* ldd [rs1+%g0],d */ -{ "ldd", 0xc1182000, 0x00e01fff, "[1],g", 0 }, /* ldd [rs1+0],d */ -{ "ldd", 0xc1182000, 0x00e00000, "[1+i],g", 0 }, -{ "ldd", 0xc1182000, 0x00e00000, "[i+1],g", 0 }, -{ "ldd", 0xc1180000, 0x00e02000, "[1+2],g", 0 }, -{ "ldd", 0xc0180000, 0x01e0201f, "[1],d", 0 }, /* ldd [rs1+%g0],d */ -{ "ldd", 0xc0182000, 0x01e01fff, "[1],d", 0 }, /* ldd [rs1+0],d */ -{ "ldd", 0xc0182000, 0x01e00000, "[1+i],d", 0 }, -{ "ldd", 0xc0182000, 0x01e00000, "[i+1],d", 0 }, -{ "ldd", 0xc0180000, 0x01e02000, "[1+2],d", 0 }, -{ "ld", 0xc1880000, 0x0070201f, "[1],C", 0 }, /* ld [rs1+%g0],d */ -{ "ld", 0xc1882000, 0x00701fff, "[1],C", 0 }, /* ld [rs1+0],d */ -{ "ld", 0xc1882000, 0x00700000, "[1+i],C", 0 }, -{ "ld", 0xc1882000, 0x00700000, "[i+1],C", 0 }, -{ "ld", 0xc1880000, 0x00702000, "[1+2],C", 0 }, -{ "ld", 0xc1800000, 0x0078201f, "[1],D", 0 }, /* ld [rs1+%g0],d */ -{ "ld", 0xc1802000, 0x00781fff, "[1],D", 0 }, /* ld [rs1+0],d */ -{ "ld", 0xc1802000, 0x00780000, "[1+i],D", 0 }, -{ "ld", 0xc1802000, 0x00780000, "[i+1],D", 0 }, -{ "ld", 0xc1800000, 0x00782000, "[1+2],D", 0 }, -{ "ld", 0xc1080000, 0x00f0201f, "[1],F", 0 }, /* ld [rs1+%g0],d */ -{ "ld", 0xc1082000, 0x00f01fff, "[1],F", 0 }, /* ld [rs1+0],d */ -{ "ld", 0xc1082000, 0x00f00000, "[1+i],F", 0 }, -{ "ld", 0xc1082000, 0x00f00000, "[i+1],F", 0 }, -{ "ld", 0xc1080000, 0x00f02000, "[1+2],F", 0 }, -{ "ld", 0xc1000000, 0x00f8201f, "[1],g", 0 }, /* ld [rs1+%g0],d */ -{ "ld", 0xc1002000, 0x00f81fff, "[1],g", 0 }, /* ld [rs1+0],d */ -{ "ld", 0xc1002000, 0x00f80000, "[1+i],g", 0 }, -{ "ld", 0xc1002000, 0x00f80000, "[i+1],g", 0 }, -{ "ld", 0xc1000000, 0x00f82000, "[1+2],g", 0 }, -{ "ld", 0xc0000000, 0x01f8201f, "[1],d", 0 }, /* ld [rs1+%g0],d */ -{ "ld", 0xc0002000, 0x01f81fff, "[1],d", 0 }, /* ld [rs1+0],d */ -{ "ld", 0xc0002000, 0x01f80000, "[1+i],d", 0 }, -{ "ld", 0xc0002000, 0x01f80000, "[i+1],d", 0 }, -{ "ld", 0xc0000000, 0x01f82000, "[1+2],d", 0 }, -{ "ldstuba", 0xc0d80000, 0x0100201f, "[1]A,d", 0 }, /* ldstuba [rs1+%g0],d */ -{ "ldstuba", 0xc0d80000, 0x01002000, "[1+2]A,d", 0 }, -{ "ldsha", 0xc0d00000, 0x0128201f, "[1]A,d", 0 }, /* ldsha [rs1+%g0],d */ -{ "ldsha", 0xc0d00000, 0x01282000, "[1+2]A,d", 0 }, -{ "ldsba", 0xc0c80000, 0x0130201f, "[1]A,d", 0 }, /* ldsba [rs1+%g0],d */ -{ "ldsba", 0xc0c80000, 0x01302000, "[1+2]A,d", 0 }, -{ "ldda", 0xc0980000, 0x0160201f, "[1]A,d", 0 }, /* ldda [rs1+%g0],d */ -{ "ldda", 0xc0980000, 0x01602000, "[1+2]A,d", 0 }, -{ "lduha", 0xc0900000, 0x0168201f, "[1]A,d", 0 }, /* lduha [rs1+%g0],d */ -{ "lduha", 0xc0900000, 0x01682000, "[1+2]A,d", 0 }, -{ "ldstub", 0xc0680000, 0x0190201f, "[1],d", 0 }, /* ldstub [rs1+%g0],d */ -{ "ldstub", 0xc0682000, 0x01900000, "[1+i],d", 0 }, -{ "ldstub", 0xc0682000, 0x01900000, "[i+1],d", 0 }, -{ "ldstub", 0xc0680000, 0x01902000, "[1+2],d", 0 }, -{ "lda", 0xc0800000, 0x0178201f, "[1]A,d", 0 }, /* lda [rs1+%g0],d */ -{ "lda", 0xc0800000, 0x01782000, "[1+2]A,d", 0 }, -{ "ldsh", 0xc0500000, 0x0000000d, "[1],d", 0 }, /* ldsh [rs1+%g0],d */ -{ "ldsh", 0xc0502000, 0x01a81fff, "[1],d", 0 }, /* ldsh [rs1+0],d */ -{ "ldsh", 0xc0502000, 0x01a80000, "[1+i],d", 0 }, -{ "ldsh", 0xc0502000, 0x01a80000, "[i+1],d", 0 }, -{ "ldsh", 0xc0500000, 0x01a82000, "[1+2],d", 0 }, -{ "ldsb", 0xc0480000, 0x01b0201f, "[1],d", 0 }, /* ldsb [rs1+%g0],d */ -{ "ldsb", 0xc0482000, 0x01b01fff, "[1],d", 0 }, /* ldsb [rs1+0],d */ -{ "ldsb", 0xc0482000, 0x01b00000, "[1+i],d", 0 }, -{ "ldsb", 0xc0482000, 0x01b00000, "[i+1],d", 0 }, -{ "ldsb", 0xc0480000, 0x01b02000, "[1+2],d", 0 }, -{ "ldub", 0xc0080000, 0x01f0201f, "[1],d", 0 }, /* ldub [rs1+%g0],d */ -{ "ldub", 0xc0082000, 0x01f01fff, "[1],d", 0 }, /* ldub [rs1+0],d */ -{ "ldub", 0xc0082000, 0x01f00000, "[1+i],d", 0 }, -{ "ldub", 0xc0082000, 0x01f00000, "[i+1],d", 0 }, -{ "ldub", 0xc0080000, 0x01f02000, "[1+2],d", 0 }, -{ "lduba", 0xc0880000, 0x0170201f, "[1]A,d", 0 }, /* lduba [rs1+%g0],d */ -{ "lduba", 0xc0880000, 0x01702000, "[1+2]A,d", 0 }, -{ "lduh", 0xc0102000, 0x01e80000, "[1+i],d", 0 }, -{ "lduh", 0xc0102000, 0x01e80000, "[i+1],d", 0 }, -{ "lduh", 0xc0100000, 0x01e8201f, "[1],d", 0 }, /* lduh [rs1+%g0],d */ -{ "lduh", 0xc0102000, 0x01e81fff, "[1],d", 0 }, /* lduh [rs1+0],d */ -{ "lduh", 0xc0100000, 0x01e82000, "[1+2],d", 0 }, - -{ "st", 0xc0200000, 0x01d8201f, "d,[1]", 0 }, /* st d,[rs1+%g0] */ -{ "st", 0xc0202000, 0x01d81fff, "d,[1]", 0 }, /* st d,[rs1+0] */ -{ "st", 0xc0202000, 0x01d80000, "d,[1+i]", 0 }, -{ "st", 0xc0202000, 0x01d80000, "d,[i+1]", 0 }, -{ "st", 0xc0200000, 0x01d82000, "d,[1+2]", 0 }, -{ "st", 0xc1200000, 0x00d8201f, "g,[1]", 0 }, /* st d[rs1+%g0] */ -{ "st", 0xc1202000, 0x00d81fff, "g,[1]", 0 }, /* st d,[rs1+0] */ -{ "st", 0xc1202000, 0x00d80000, "g,[1+i]", 0 }, -{ "st", 0xc1202000, 0x00d80000, "g,[i+1]", 0 }, -{ "st", 0xc1200000, 0x00d82000, "g,[1+2]", 0 }, -{ "st", 0xc1280000, 0x00d0201f, "F,[1]", 0 }, /* st %fsr,[rs1+%g0] */ -{ "st", 0xc1282000, 0x00d01fff, "F,[1]", 0 }, /* st %fsr,[rs1+0] */ -{ "st", 0xc1282000, 0x00d00000, "F,[1+i]", 0 }, -{ "st", 0xc1282000, 0x00d00000, "F,[i+1]", 0 }, -{ "st", 0xc1280000, 0x00d02000, "F,[1+2]", 0 }, -{ "st", 0xc1a00000, 0x0058201f, "D,[1]", 0 }, /* st d,[rs1+%g0] */ -{ "st", 0xc1a02000, 0x00581fff, "D,[1]", 0 }, /* st d,[rs1+0] */ -{ "st", 0xc1a02000, 0x00580000, "D,[1+i]", 0 }, -{ "st", 0xc1a02000, 0x00580000, "D,[i+1]", 0 }, -{ "st", 0xc1a00000, 0x00582000, "D,[1+2]", 0 }, -{ "st", 0xc1a80000, 0x0050201f, "C,[1]", 0 }, /* st d,[rs1+%g0] */ -{ "st", 0xc1a82000, 0x00501fff, "C,[1]", 0 }, /* st d,[rs1+0] */ -{ "st", 0xc1a82000, 0x00500000, "C,[1+i]", 0 }, -{ "st", 0xc1a82000, 0x00500000, "C,[i+1]", 0 }, -{ "st", 0xc1a80000, 0x00502000, "C,[1+2]", 0 }, -{ "sta", 0xc0a00000, 0x0108201f, "d,[1]A", 0 }, /* sta d,[rs1+%g0] */ -{ "sta", 0xc0a00000, 0x01082000, "d,[1+2]A", 0 }, - -{ "stb", 0xc0280000, 0x01d0201f, "d,[1]", 0 }, /* stb d,[rs1+%g0] */ -{ "stb", 0xc0282000, 0x01d01fff, "d,[1]", 0 }, /* stb d,[rs1+0] */ -{ "stb", 0xc0282000, 0x01d00000, "d,[1+i]", 0 }, -{ "stb", 0xc0282000, 0x01d00000, "d,[i+1]", 0 }, -{ "stb", 0xc0280000, 0x01d02000, "d,[1+2]", 0 }, -{ "stba", 0xc0a80000, 0x01002000, "d,[1+2]A", 0 }, -{ "stba", 0xc0a80000, 0x0100201f, "d,[1]A", 0 }, /* stba d,[rs1+%g0] */ - -{ "std", 0xc0380000, 0x01c0201f, "d,[1]", 0 }, /* std d,[rs1+%g0] */ -{ "std", 0xc0382000, 0x01c01fff, "d,[1]", 0 }, /* std d,[rs1+0] */ -{ "std", 0xc0382000, 0x01c00000, "d,[1+i]", 0 }, -{ "std", 0xc0382000, 0x01c00000, "d,[i+1]", 0 }, -{ "std", 0xc0380000, 0x01c02000, "d,[1+2]", 0 }, -{ "std", 0xc1380000, 0x00c0201f, "g,[1]", 0 }, /* std d,[rs1+%g0] */ -{ "std", 0xc1382000, 0x00c01fff, "g,[1]", 0 }, /* std d,[rs1+0] */ -{ "std", 0xc1382000, 0x00c00000, "g,[1+i]", 0 }, -{ "std", 0xc1382000, 0x00c00000, "g,[i+1]", 0 }, -{ "std", 0xc1380000, 0x00c02000, "g,[1+2]", 0 }, -{ "std", 0xc1300000, 0x00c8201f, "q,[1]", 0 }, /* std d,[rs1+%g0] */ -{ "std", 0xc1302000, 0x00c81fff, "q,[1]", 0 }, /* std d,[rs1+0] */ -{ "std", 0xc1302000, 0x00c80000, "q,[1+i]", 0 }, -{ "std", 0xc1302000, 0x00c80000, "q,[i+1]", 0 }, -{ "std", 0xc1300000, 0x00c82000, "q,[1+2]", 0 }, -{ "std", 0xc1b80000, 0x0040201f, "D,[1]", 0 }, /* std d,[rs1+%g0] */ -{ "std", 0xc1b82000, 0x00401fff, "D,[1]", 0 }, /* std d,[rs1+0] */ -{ "std", 0xc1b82000, 0x00400000, "D,[1+i]", 0 }, -{ "std", 0xc1b82000, 0x00400000, "D,[i+1]", 0 }, -{ "std", 0xc1b80000, 0x00402000, "D,[1+2]", 0 }, -{ "std", 0xc1b00000, 0x0048201f, "Q,[1]", 0 }, /* std d,[rs1+%g0] */ -{ "std", 0xc1b02000, 0x00481fff, "Q,[1]", 0 }, /* std d,[rs1+0] */ -{ "std", 0xc1b02000, 0x00480000, "Q,[1+i]", 0 }, -{ "std", 0xc1b02000, 0x00480000, "Q,[i+1]", 0 }, -{ "std", 0xc1b00000, 0x00482000, "Q,[1+2]", 0 }, -{ "stda", 0xc0b80000, 0x01402000, "d,[1+2]A", 0 }, -{ "stda", 0xc0b80000, 0x0140201f, "d,[1]A", 0 }, /* stda d,[rs1+%g0] */ - -{ "sth", 0xc0300000, 0x01c8201f, "d,[1]", 0 }, /* sth d,[rs1+%g0] */ -{ "sth", 0xc0302000, 0x01c81fff, "d,[1]", 0 }, /* sth d,[rs1+0] */ -{ "sth", 0xc0300000, 0x01c82000, "d,[1+2]", 0 }, -{ "sth", 0xc0302000, 0x01c80000, "d,[1+i]", 0 }, -{ "sth", 0xc0302000, 0x01c80000, "d,[i+1]", 0 }, -{ "stha", 0xc0b00000, 0x0148201f, "d,[1]A", 0 }, /* stha d,[rs1+%g0] */ -{ "stha", 0xc0b00000, 0x01482000, "d,[1+2]A", 0 }, - -{ "swap", 0xc0780000, 0x0180201f, "[1],d", 0 }, /* swap [rs1+%g0],d */ -{ "swap", 0xc0782000, 0x01801fff, "[1],d", 0 }, /* swap [rs1+0],d */ -{ "swap", 0xc0782000, 0x01800000, "[1+i],d", 0 }, -{ "swap", 0xc0782000, 0x01800000, "[i+1],d", 0 }, -{ "swap", 0xc0780000, 0x01802000, "[1+2],d", 0 }, -{ "swapa", 0xc0f80000, 0x01002000, "[1+2]A,d", 0 }, -{ "swapa", 0xc0f80000, 0x0100201f, "[1]A,d", 0 }, /* swapa [rs1+%g0],d */ - -{ "restore", 0x81e80000, 0x7e17e01f, "", 0 }, /* restore %g0,%g0,%g0 */ -{ "restore", 0x81e82000, 0x7e14dfff, "", 0 }, /* restore %g0,0,%g0 */ -{ "restore", 0x81e82000, 0x00000000, "1,i,d", 0 }, -{ "restore", 0x81e80000, 0x00000000, "1,2,d", 0 }, -{ "rett", 0x81c82000, 0x40300000, "1+i", F_DELAYED }, -{ "rett", 0x81c82000, 0x40300000, "i+1", F_DELAYED }, -{ "rett", 0x81c80000, 0x40302000, "1+2", F_DELAYED }, -{ "rett", 0x81c82000, 0x40301fff, "1", F_DELAYED}, /* rett X,0 */ -{ "rett", 0x81c80000, 0x4030201f, "1", F_DELAYED}, /* rett X,%g0 */ -{ "save", 0x81e02000, 0x40180000, "1,i,d", 0 }, -{ "save", 0x81e00000, 0x40180000, "1,2,d", 0 }, - -{ "ret", 0x81c7e008, 0x00001ff7, "", F_DELAYED }, /* jmpl %i7+8,%g0 */ -{ "retl", 0x81c3e008, 0x00001ff7, "", F_DELAYED }, /* jmpl %o7+8,%g0 */ - -{ "jmpl", 0x81c00000, 0x4038201f, "1,d", F_DELAYED }, /* jmpl rs1+%g0,d */ -{ "jmpl", 0x81c02000, 0x4037c000, "i,d", F_DELAYED }, /* jmpl %g0+i,d */ -{ "jmpl", 0x81c02000, 0x40380000, "1+i,d", F_DELAYED }, -{ "jmpl", 0x81c02000, 0x40380000, "i+1,d", F_DELAYED }, -{ "jmpl", 0x81c00000, 0x40382000, "1+2,d", F_DELAYED }, -{ "wr", 0x81982000, 0x40600000, "1,i,t", 0 }, -{ "wr", 0x81980000, 0x40600000, "1,2,t", 0 }, -{ "wr", 0x81902000, 0x40680000, "1,i,w", 0 }, -{ "wr", 0x81900000, 0x40680000, "1,2,w", 0 }, -{ "wr", 0x81882000, 0x40700000, "1,i,p", 0 }, -{ "wr", 0x81880000, 0x40700000, "1,2,p", 0 }, -{ "wr", 0x81802000, 0x40780000, "1,i,y", 0 }, -{ "wr", 0x81800000, 0x40780000, "1,2,y", 0 }, - -{ "rd", 0x81580000, 0x40a00000, "t,d", 0 }, -{ "rd", 0x81500000, 0x40a80000, "w,d", 0 }, -{ "rd", 0x81480000, 0x40b00000, "p,d", 0 }, -{ "rd", 0x81400000, 0x40b80000, "y,d", 0 }, - -{ "sra", 0x81382000, 0x00000000, "1,i,d", 0 }, -{ "sra", 0x81380000, 0x00000000, "1,2,d", 0 }, -{ "srl", 0x81302000, 0x40c80000, "1,i,d", 0 }, -{ "srl", 0x81300000, 0x40c80000, "1,2,d", 0 }, -{ "sll", 0x81282000, 0x40d00000, "1,i,d", 0 }, -{ "sll", 0x81280000, 0x40d00000, "1,2,d", 0 }, - -{ "mulscc", 0x81202000, 0x40d80000, "1,i,d", 0 }, -{ "mulscc", 0x81200000, 0x40d80000, "1,2,d", 0 }, - -{ "clr", 0x80100000, 0x4e87e01f, "d", F_ALIAS }, /* or %g0,%g0,d */ -{ "clr", 0x80102000, 0x41efdfff, "d", F_ALIAS }, /* or %g0,0,d */ -{ "clr", 0xc0200000, 0x3fd8001f, "[1]", F_ALIAS }, /* st %g0,[rs1+%g0] */ -{ "clr", 0xc0202000, 0x3fd81fff, "[1]", F_ALIAS }, /* st %g0,[rs1+0] */ -{ "clr", 0xc0202000, 0x3fd80000, "[1+i]", F_ALIAS }, -{ "clr", 0xc0202000, 0x3fd80000, "[i+1]", F_ALIAS }, -{ "clr", 0xc0200000, 0x3fd80000, "[1+2]", F_ALIAS }, - -{ "clrb", 0xc0280000, 0x3fd0001f, "[1]", F_ALIAS },/* stb %g0,[rs1+%g0] */ -{ "clrb", 0xc0282000, 0x3fd00000, "[1+i]", F_ALIAS }, -{ "clrb", 0xc0282000, 0x3fd00000, "[i+1]", F_ALIAS }, -{ "clrb", 0xc0280000, 0x3fd00000, "[1+2]", F_ALIAS }, - -{ "clrh", 0xc0300000, 0x3fc8001f, "[1]", F_ALIAS },/* sth %g0,[rs1+%g0] */ -{ "clrh", 0xc0300000, 0x3fc80000, "[1+2]", F_ALIAS }, -{ "clrh", 0xc0302000, 0x3fc80000, "[1+i]", F_ALIAS }, -{ "clrh", 0xc0302000, 0x3fc80000, "[i+1]", F_ALIAS }, - -{ "orncc", 0x80b02000, 0x04048000, "1,i,d", 0 }, -{ "orncc", 0x80b00000, 0x04048000, "1,2,d", 0 }, - -{ "tst", 0x80900000, 0x7f6fe000, "2", 0 }, /* orcc %g0, rs2, %g0 */ -{ "tst", 0x80900000, 0x7f68201f, "1", 0 }, /* orcc rs1, %g0, %g0 */ -{ "tst", 0x80902000, 0x7f681fff, "1", 0 }, /* orcc rs1, 0, %g0 */ - -{ "orcc", 0x80902000, 0x41680000, "1,i,d", 0 }, -{ "orcc", 0x80902000, 0x41680000, "i,1,d", 0 }, -{ "orcc", 0x80900000, 0x41680000, "1,2,d", 0 }, -{ "orn", 0x80302000, 0x41c80000, "1,i,d", 0 }, -{ "orn", 0x80300000, 0x41c80000, "1,2,d", 0 }, - -{ "mov", 0x81800000, 0x4078201f, "1,y", F_ALIAS }, /* wr rs1,%g0,%y */ -{ "mov", 0x81802000, 0x40781fff, "1,y", F_ALIAS }, /* wr rs1,0,%y */ -{ "mov", 0x81802000, 0x40780000, "i,y", F_ALIAS }, -{ "mov", 0x81400000, 0x40b80000, "y,d", F_ALIAS }, /* rd %y,d */ -{ "mov", 0x81980000, 0x4060201f, "1,t", F_ALIAS }, /* wr rs1,%g0,%tbr */ -{ "mov", 0x81982000, 0x40601fff, "1,t", F_ALIAS }, /* wr rs1,0,%tbr */ -{ "mov", 0x81982000, 0x40600000, "i,t", F_ALIAS }, -{ "mov", 0x81580000, 0x40a00000, "t,d", F_ALIAS }, /* rd %tbr,d */ -{ "mov", 0x81900000, 0x4068201f, "1,w", F_ALIAS }, /* wr rs1,%g0,%wim */ -{ "mov", 0x81902000, 0x40681fff, "1,w", F_ALIAS }, /* wr rs1,0,%wim */ -{ "mov", 0x81902000, 0x40680000, "i,w", F_ALIAS }, -{ "mov", 0x81500000, 0x40a80000, "w,d", F_ALIAS }, /* rd %wim,d */ -{ "mov", 0x81880000, 0x4070201f, "1,p", F_ALIAS }, /* wr rs1,%g0,%psr */ -{ "mov", 0x81882000, 0x40701fff, "1,p", F_ALIAS }, /* wr rs1,0,%psr */ -{ "mov", 0x81882000, 0x40700000, "i,p", F_ALIAS }, -{ "mov", 0x81480000, 0x40b00000, "p,d", F_ALIAS }, /* rd %psr,d */ - -{ "mov", 0x80102000, 0x41efc000, "i,d", 0 }, /* or %g0,i,d */ -{ "mov", 0x80100000, 0x41efe000, "2,d", 0 }, /* or %g0,rs2,d */ -{ "mov", 0x80102000, 0x41e81fff, "1,d", 0 }, /* or rs1,0,d */ -{ "mov", 0x80100000, 0x41e8201f, "1,d", 0 }, /* or rs1,%g0,d */ - -{ "or", 0x80102000, 0x40800000, "1,i,d", 0 }, -{ "or", 0x80102000, 0x40800000, "i,1,d", 0 }, -{ "or", 0x80100000, 0x40800000, "1,2,d", 0 }, - -{ "bset", 0x80102000, 0x40800000, "i,r", F_ALIAS },/* or rd,i,rd */ -{ "bset", 0x80100000, 0x40800000, "2,r", F_ALIAS },/* or rd,rs2,rd */ - -{ "andncc", 0x80a82000, 0x41500000, "1,i,d", 0 }, -{ "andncc", 0x80a80000, 0x41500000, "1,2,d", 0 }, -{ "andn", 0x80282000, 0x41d00000, "1,i,d", 0 }, -{ "andn", 0x80280000, 0x41d00000, "1,2,d", 0 }, - -{ "bclr", 0x80282000, 0x41d00000, "i,r", F_ALIAS },/* andn rd,i,rd */ -{ "bclr", 0x80280000, 0x41d00000, "2,r", F_ALIAS },/* andn rd,rs2,rd */ - -{ "cmp", 0x80a02000, 0x7d580000, "1,i", 0 }, /* subcc rs1,i,%g0 */ -{ "cmp", 0x80a00000, 0x7d580000, "1,2", 0 }, /* subcc rs1,rs2,%g0 */ - -{ "subcc", 0x80a02000, 0x41580000, "1,i,d", 0 }, -{ "subcc", 0x80a00000, 0x41580000, "1,2,d", 0 }, -{ "sub", 0x80202000, 0x41d80000, "1,i,d", 0 }, -{ "sub", 0x80200000, 0x41d80000, "1,2,d", 0 }, -{ "subx", 0x80602000, 0x41980000, "1,i,d", 0 }, -{ "subx", 0x80600000, 0x41980000, "1,2,d", 0 }, -{ "subxcc", 0x80e02000, 0x41180000, "1,i,d", 0 }, -{ "subxcc", 0x80e00000, 0x41180000, "1,2,d", 0 }, - -{ "andcc", 0x80882000, 0x41700000, "1,i,d", 0 }, -{ "andcc", 0x80882000, 0x41700000, "i,1,d", 0 }, -{ "andcc", 0x80880000, 0x41700000, "1,2,d", 0 }, -{ "and", 0x80082000, 0x41f00000, "1,i,d", 0 }, -{ "and", 0x80082000, 0x41f00000, "i,1,d", 0 }, -{ "and", 0x80080000, 0x41f00000, "1,2,d", 0 }, - -{ "inc", 0x80002001, 0x41f81ffe, "r", F_ALIAS }, /* add rs1,1,rsd */ -{ "inccc", 0x80802001, 0x41781ffe, "r", F_ALIAS }, /* addcc rd,1,rd */ -{ "dec", 0x80202001, 0x41d81ffe, "r", F_ALIAS }, /* sub rd,1,rd */ -{ "deccc", 0x80a02001, 0x41581ffe, "r", F_ALIAS }, /* subcc rd,1,rd */ - -{ "btst", 0x80882000, 0x41700000, "i,1", F_ALIAS },/* andcc rs1,i,%g0 */ -{ "btst", 0x80880000, 0x41700000, "1,2", F_ALIAS },/* andcc rs1,rs2,%0 */ - -{ "neg", 0x80200000, 0x41d80000, "r", F_ALIAS }, /* sub %0,rd,rd */ -{ "neg", 0x80200000, 0x41d80000, "2,d", F_ALIAS }, /* sub %0,rs2,rd */ - -{ "addxcc", 0x80c02000, 0x41380000, "1,i,d", 0 }, -{ "addxcc", 0x80c02000, 0x41380000, "i,1,d", 0 }, -{ "addxcc", 0x80c00000, 0x41380000, "1,2,d", 0 }, -{ "addcc", 0x80802000, 0x41780000, "1,i,d", 0 }, -{ "addcc", 0x80802000, 0x41780000, "i,1,d", 0 }, -{ "addcc", 0x80800000, 0x41780000, "1,2,d", 0 }, -{ "addx", 0x80402000, 0x41b80000, "1,i,d", 0 }, -{ "addx", 0x80402000, 0x41b80000, "i,1,d", 0 }, -{ "addx", 0x80400000, 0x41b80000, "1,2,d", 0 }, -{ "add", 0x80002000, 0x41f80000, "1,i,d", 0 }, -{ "add", 0x80002000, 0x41f80000, "i,1,d", 0 }, -{ "add", 0x80000000, 0x41f80000, "1,2,d", 0 }, - -{ "call", 0x9fc00000, 0x4038201f, "1", F_DELAYED }, /* jmpl rs1+%g0, %o7 */ -{ "call", 0x9fc00000, 0x4038201f, "1,#", F_DELAYED }, -{ "call", 0x40000000, 0x80000000, "L", F_DELAYED }, -{ "call", 0x40000000, 0x80000000, "L,#", F_DELAYED }, - -{ "jmp", 0x81c00000, 0x7e38201f, "1", F_DELAYED }, /* jmpl rs1+%g0,%g0 */ -{ "jmp", 0x81c02000, 0x7e3fc000, "i", F_DELAYED }, /* jmpl %g0+i,%g0 */ -{ "jmp", 0x81c00000, 0x7e382000, "1+2", F_DELAYED }, /* jmpl rs1+rs2,%g0 */ -{ "jmp", 0x81c02000, 0x7e380000, "1+i", F_DELAYED }, /* jmpl rs1+i,%g0 */ -{ "jmp", 0x81c02000, 0x7e380000, "i+1", F_DELAYED }, /* jmpl i+rs1,%g0 */ - -{ "nop", 0x01000000, 0xfeffffff, "", 0 }, /* sethi 0, %g0 */ - -{ "set", 0x01000000, 0xc0c00000, "Sh,d", F_ALIAS }, - -{ "sethi", 0x01000000, 0xc0c00000, "h,d", 0 }, - -{ "taddcctv", 0x81102000, 0x40e00000, "1,i,d", 0 }, -{ "taddcctv", 0x81100000, 0x40e00000, "1,2,d", 0 }, -{ "taddcc", 0x81002000, 0x40f80000, "1,i,d", 0 }, -{ "taddcc", 0x81000000, 0x40f80000, "1,2,d", 0 }, - -/* Conditional instructions. - - Because this part of the table was such a mess earlier, I have - macrofied it so that all the branches and traps are generated from - a single-line description of each condition value. */ - -#define ANNUL 0x20000000 -#define IMMED 0x00002000 -#define RS1_G0 0x0007C000 -#define RS2_G0 0x0000001F - -/* Define two branches -- one annulled, one without */ -#define br(opcode, mask, lose, flags) \ - { opcode, mask+ANNUL, lose, ",al", flags }, \ - { opcode, mask , lose, "l", flags } - -/* Define four traps: reg+reg, reg + immediate, immediate alone, reg alone. */ -#define tr(opcode, mask, lose, flags) \ - {opcode, mask+IMMED, lose+RS1_G0 , "i", flags }, /* %g0 + imm */ \ - {opcode, mask+IMMED, lose , "1+i", flags }, /* rs1 + imm */ \ - {opcode, mask , lose+IMMED , "1+2", flags }, /* rs1 + rs2 */ \ - {opcode, mask , lose+IMMED+RS2_G0, "1", flags } /* rs1 + %g0 */ - -/* Define both branches and traps based on condition mask */ -#ifdef __STDC__ -#define cond(bop, top, mask, flags) \ - br(#bop, 0x00800000+(mask << 25), 0xC1400000, F_DELAYED|flags), \ - tr(#top, 0x81d00000+(mask << 25), 0x40280000, flags) -#else -#define cond(bop, top, mask, flags) \ - br("bop", 0x00800000+(mask << 25), 0xC1400000, F_DELAYED|flags), \ - tr("top", 0x81d00000+(mask << 25), 0x40280000, flags) -#endif - -/* Define all the conditions, all the branches, all the traps. */ -/* Use no extra spaces or tabs around the first two args, since cpp - will include them in the printed strings. */ -cond (bvc,tvc, 0xF, 0), -cond (bvs,tvs, 0x7, 0), -cond (bpos,tpos, 0xE, 0), -cond (bneg,tneg, 0x6, 0), -cond (bcc,tcc, 0xD, 0), -cond (bcs,tcs, 0x5, 0), -cond (blu,tlu, 0x5, F_ALIAS), /* for cs */ -cond (bgeu,tgeu, 0xD, F_ALIAS), /* for cc */ -cond (bgu,tgu, 0xC, 0), -cond (bleu,tleu, 0x4, 0), -cond (bge,tge, 0xB, 0), -cond (bl,tl, 0x3, 0), -cond (bg,tg, 0xA, 0), -cond (ble,tle, 0x2, 0), -cond (be,te, 0x1, 0), -cond (bz,tz, 0x1, F_ALIAS), /* for e */ -cond (bne,tne, 0x9, 0), -cond (bnz,tnz, 0x9, F_ALIAS), /* for ne */ -cond (b,t, 0x8, 0), -cond (ba,ta, 0x8, F_ALIAS), /* for nothing */ -cond (bn,tn, 0x0, 0), - -#undef cond -#undef br -#undef tr - -{ "tsubcc", 0x81080000, 0x40f00000, "1,2,d", 0 }, -{ "tsubcc", 0x81082000, 0x40f00000, "1,i,d", 0 }, -{ "tsubcctv", 0x80580000, 0x40a00000, "1,2,d", 0 }, -{ "tsubcctv", 0x80582000, 0x40a00000, "1,i,d", 0 }, - -{ "unimp", 0x00000000, 0xFFFFFFFF, "l", 0 }, - -{ "iflush", 0x81d80000, 0x40202000, "1+2", 0 }, -{ "iflush", 0x81d82000, 0x40200000, "1+i", 0 }, - -{ "xnorcc", 0x80b80000, 0x41400000, "1,2,d", 0 }, -{ "xnorcc", 0x80b82000, 0x41400000, "1,i,d", 0 }, -{ "xnorcc", 0x80b82000, 0x41400000, "i,1,d", 0 }, -{ "xorcc", 0x80980000, 0x41600000, "1,2,d", 0 }, -{ "xorcc", 0x80982000, 0x41600000, "1,i,d", 0 }, -{ "xorcc", 0x80982000, 0x41600000, "i,1,d", 0 }, -{ "xnor", 0x80380000, 0x41c00000, "1,2,d", 0 }, -{ "xnor", 0x80382000, 0x41c00000, "1,i,d", 0 }, -{ "xnor", 0x80382000, 0x41c00000, "i,1,d", 0 }, -{ "xor", 0x80180000, 0x41e00000, "1,2,d", 0 }, -{ "xor", 0x80182000, 0x41e00000, "1,i,d", 0 }, -{ "xor", 0x80182000, 0x41e00000, "i,1,d", 0 }, - -{ "not", 0x80380000, 0x41c00000, "r", F_ALIAS }, /* xnor rd,%0,rd */ -{ "not", 0x80380000, 0x41c00000, "1,d", F_ALIAS }, /* xnor rs1,%0,rd */ - -{ "btog", 0x80180000, 0x41e02000, "2,r", F_ALIAS }, /* xor rd,rs2,rd */ -{ "btog", 0x80182000, 0x41e00000, "i,r", F_ALIAS }, /* xor rd,i,rd */ - -{ "fpop1", 0x81a00000, 0x40580000, "[1+2],d", 0 }, -{ "fpop2", 0x81a80000, 0x40500000, "[1+2],d", 0 }, - -/* Someday somebody should give these the same treatment as the branches - above. FIXME someday. */ - -{ "fb", 0x31800000, 0xc0400000, ",al", F_DELAYED }, -{ "fb", 0x11800000, 0xc0400000, "l", F_DELAYED }, -{ "fba", 0x31800000, 0xc0400000, ",al", F_DELAYED|F_ALIAS }, -{ "fba", 0x11800000, 0xc0400000, "l", F_DELAYED|F_ALIAS }, -{ "fbn", 0x21800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbn", 0x01800000, 0xc0400000, "l", F_DELAYED }, -{ "fbu", 0x2f800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbu", 0x0f800000, 0xc0400000, "l", F_DELAYED }, -{ "fbg", 0x2d800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbg", 0x0d800000, 0xc0400000, "l", F_DELAYED }, -{ "fbug", 0x2b800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbug", 0x0b800000, 0xc0400000, "l", F_DELAYED }, -{ "fbl", 0x29800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbl", 0x09800000, 0xc0400000, "l", F_DELAYED }, -{ "fbul", 0x27800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbul", 0x07800000, 0xc0400000, "l", F_DELAYED }, -{ "fblg", 0x25800000, 0xc0400000, ",al", F_DELAYED }, -{ "fblg", 0x05800000, 0xc0400000, "l", F_DELAYED }, -{ "fbne", 0x23800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbne", 0x03800000, 0xc0400000, "l", F_DELAYED }, -{ "fbe", 0x33800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbe", 0x13800000, 0xc0400000, "l", F_DELAYED }, -{ "fbue", 0x35800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbue", 0x15800000, 0xc0400000, "l", F_DELAYED }, -{ "fbge", 0x37800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbge", 0x17800000, 0xc0400000, "l", F_DELAYED }, -{ "fbuge", 0x39800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbuge", 0x19800000, 0xc0400000, "l", F_DELAYED }, -{ "fble", 0x3b800000, 0xc0400000, ",al", F_DELAYED }, -{ "fble", 0x1b800000, 0xc0400000, "l", F_DELAYED }, -{ "fbule", 0x3d800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbule", 0x1d800000, 0xc0400000, "l", F_DELAYED }, -{ "fbo", 0x3f800000, 0xc0400000, ",al", F_DELAYED }, -{ "fbo", 0x1f800000, 0xc0400000, "l", F_DELAYED }, - -{ "cba", 0x31c00000, 0xce000000, ",al", F_DELAYED }, -{ "cba", 0x11c00000, 0xce000000, "l", F_DELAYED }, -{ "cbn", 0x21c00000, 0xde000000, ",al", F_DELAYED }, -{ "cbn", 0x01c00000, 0xde000000, "l", F_DELAYED }, -{ "cb3", 0x2fc00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb3", 0x0fc00000, 0xc0000000, "l", F_DELAYED }, -{ "cb2", 0x2dc00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb2", 0x0dc00000, 0xc0000000, "l", F_DELAYED }, -{ "cb23", 0x2bc00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb23", 0x0bc00000, 0xc0000000, "l", F_DELAYED }, -{ "cb1", 0x29c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb1", 0x09c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb13", 0x27c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb13", 0x07c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb12", 0x25c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb12", 0x05c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb123", 0x23c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb123", 0x03c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb0", 0x33c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb0", 0x13c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb03", 0x35c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb03", 0x15c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb02", 0x37c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb02", 0x17c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb023", 0x39c00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb023", 0x19c00000, 0xc0000000, "l", F_DELAYED }, -{ "cb01", 0x3bc00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb01", 0x1bc00000, 0xc0000000, "l", F_DELAYED }, -{ "cb013", 0x3dc00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb013", 0x1dc00000, 0xc0000000, "l", F_DELAYED }, -{ "cb012", 0x3fc00000, 0xc0000000, ",al", F_DELAYED }, -{ "cb012", 0x1fc00000, 0xc0000000, "l", F_DELAYED }, - -{ "fstoi", 0x81a01a20, 0x400025c0, "f,g", 0 }, -{ "fdtoi", 0x81a01a40, 0x400025a0, "f,g", 0 }, -{ "fxtoi", 0x81a01a60, 0x40002580, "f,g", 0 }, - -{ "fitox", 0x81a01980, 0x40002660, "f,g", 0 }, -{ "fitod", 0x81a01900, 0x400026e0, "f,g", 0 }, -{ "fitos", 0x81a01880, 0x40002660, "f,g", 0 }, - -{ "fstod", 0x81a01920, 0x400026c0, "f,g", 0 }, -{ "fstox", 0x81a019a0, 0x40002640, "f,g", 0 }, -{ "fdtos", 0x81a018c0, 0x40002720, "f,g", 0 }, -{ "fdtox", 0x81a019c0, 0x40002620, "f,g", 0 }, -{ "fxtos", 0x81a018e0, 0x40002700, "f,g", 0 }, -{ "fxtod", 0x81a01960, 0x40002680, "f,g", 0 }, - -{ "fdivx", 0x81a009e0, 0x40083600, "e,f,g", 0 }, -{ "fdivd", 0x81a009c0, 0x40003620, "e,f,g", 0 }, -{ "fdivs", 0x81a009a0, 0x40003640, "e,f,g", 0 }, - -{ "fmuls", 0x81a00920, 0x400036c0, "e,f,g", 0 }, -{ "fmuld", 0x81a00940, 0x400036a0, "e,f,g", 0 }, -{ "fmulx", 0x81a00960, 0x40003680, "e,f,g", 0 }, - -{ "fsqrts", 0x81a00520, 0x40003ac0, "f,g", 0 }, -{ "fsqrtd", 0x81a00540, 0x40003aa8, "f,g", 0 }, -{ "fsqrtx", 0x81a00560, 0x40003a80, "f,g", 0 }, - -{ "fabss", 0x81a00120, 0x40003ec0, "f,g", 0 }, -{ "fnegs", 0x81a000a0, 0x40003f40, "f,g", 0 }, -{ "fmovs", 0x81a00020, 0x40003fc0, "f,g", 0 }, - -{ "fsubx", 0x81a008e0, 0x40003700, "e,f,g", 0 }, -{ "fsubd", 0x81a008c0, 0x40003720, "e,f,g", 0 }, -{ "fsubs", 0x81a008a0, 0x40003740, "e,f,g", 0 }, - -{ "faddx", 0x81a00860, 0x40003780, "e,f,g", 0 }, -{ "faddd", 0x81a00840, 0x400037a0, "e,f,g", 0 }, -{ "fadds", 0x81a00820, 0x400037c0, "e,f,g", 0 }, - -{ "fcmpex", 0x81a80ae0, 0x40003500, "e,f", 0 }, -{ "fcmped", 0x81a80ac0, 0x40003520, "e,f", 0 }, -{ "fcmpes", 0x81a80aa0, 0x40003540, "e,f", 0 }, -{ "fcmpx", 0x81a80a60, 0x40003580, "e,f", 0 }, -{ "fcmpd", 0x81a80a40, 0x400035a0, "e,f", 0 }, -{ "fcmps", 0x81a80a20, 0x400035c0, "e,f", 0 }, - -{ "cpop1", 0x81b00000, 0x40480000, "[1+2],d", 0 }, -{ "cpop2", 0x81b80000, 0x40400000, "[1+2],d", 0 }, -}; - -#define NUMOPCODES ((sizeof sparc_opcodes)/(sizeof sparc_opcodes[0])) - diff --git a/gdb/sparc-xdep.c b/gdb/sparc-xdep.c deleted file mode 100644 index a040bf5..0000000 --- a/gdb/sparc-xdep.c +++ /dev/null @@ -1,302 +0,0 @@ -/* Host-dependent code for SPARC host systems, for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* This code only compiles when we have the definitions in tm-sparc.h. */ - -#define TM_FILE_OVERRIDE -#include "defs.h" -#include "tm-sparc.h" - -#include "inferior.h" -#include "target.h" - -#include -#include -#include - -#include "gdbcore.h" -#include - -/* We don't store all registers immediately when requested, since they - get sent over in large chunks anyway. Instead, we accumulate most - of the changes and send them over once. "deferred_stores" keeps - track of which sets of registers we have locally-changed copies of, - so we only need send the groups that have changed. */ - -#define INT_REGS 1 -#define STACK_REGS 2 -#define FP_REGS 4 - -/* The variable deferred_stores itself is defined in sparc-tdep.c. */ - -/* Fetch one or more registers from the inferior. REGNO == -1 to get - them all. We actually fetch more than requested, when convenient, - marking them as valid so we won't fetch them again. */ -void -fetch_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - int i; - - /* We should never be called with deferred stores, because a prerequisite - for writing regs is to have fetched them all (PREPARE_TO_STORE), sigh. */ - if (deferred_stores) abort(); - - DO_DEFERRED_STORES; - - /* Global and Out regs are fetched directly, as well as the control - registers. If we're getting one of the in or local regs, - and the stack pointer has not yet been fetched, - we have to do that first, since they're found in memory relative - to the stack pointer. */ - if (regno < O7_REGNUM /* including -1 */ - || regno >= Y_REGNUM - || (!register_valid[SP_REGNUM] && regno < I7_REGNUM)) - { - if (0 != ptrace (PTRACE_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0)) - perror("ptrace_getregs"); - - registers[REGISTER_BYTE (0)] = 0; - memcpy (®isters[REGISTER_BYTE (1)], &inferior_registers.r_g1, - 15 * REGISTER_RAW_SIZE (G0_REGNUM)); - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; - *(int *)®isters[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc; - *(int *)®isters[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y; - - for (i = G0_REGNUM; i <= O7_REGNUM; i++) - register_valid[i] = 1; - register_valid[Y_REGNUM] = 1; - register_valid[PS_REGNUM] = 1; - register_valid[PC_REGNUM] = 1; - register_valid[NPC_REGNUM] = 1; - /* If we don't set these valid, read_register_bytes() rereads - all the regs every time it is called! FIXME. */ - register_valid[WIM_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[TBR_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[FPS_REGNUM] = 1; /* Not true yet, FIXME */ - register_valid[CPS_REGNUM] = 1; /* Not true yet, FIXME */ - } - - /* Floating point registers */ - if (regno == -1 || (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31)) - { - if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, - 0)) - perror("ptrace_getfpregs"); - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fpu_fr); - /* bcopy (&inferior_fp_registers.Fpu_fsr, - ®isters[REGISTER_BYTE (FPS_REGNUM)], - sizeof (FPU_FSR_TYPE)); FIXME??? -- gnu@cyg */ - for (i = FP0_REGNUM; i <= FP0_REGNUM+31; i++) - register_valid[i] = 1; - register_valid[FPS_REGNUM] = 1; - } - - /* These regs are saved on the stack by the kernel. Only read them - all (16 ptrace calls!) if we really need them. */ - if (regno == -1) - { - target_xfer_memory (*(CORE_ADDR*)®isters[REGISTER_BYTE (SP_REGNUM)], - ®isters[REGISTER_BYTE (L0_REGNUM)], - 16*REGISTER_RAW_SIZE (L0_REGNUM), 0); - for (i = L0_REGNUM; i <= I7_REGNUM; i++) - register_valid[i] = 1; - } - else if (regno >= L0_REGNUM && regno <= I7_REGNUM) - { - CORE_ADDR sp = *(CORE_ADDR*)®isters[REGISTER_BYTE (SP_REGNUM)]; - i = REGISTER_BYTE (regno); - if (register_valid[regno]) - printf("register %d valid and read\n", regno); - target_xfer_memory (sp + i - REGISTER_BYTE (L0_REGNUM), - ®isters[i], REGISTER_RAW_SIZE (regno), 0); - register_valid[regno] = 1; - } -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_status inferior_fp_registers; - int wanna_store = INT_REGS + STACK_REGS + FP_REGS; - - /* First decide which pieces of machine-state we need to modify. - Default for regno == -1 case is all pieces. */ - if (regno >= 0) - if (FP0_REGNUM <= regno && regno < FP0_REGNUM + 32) - { - wanna_store = FP_REGS; - } - else - { - if (regno == SP_REGNUM) - wanna_store = INT_REGS + STACK_REGS; - else if (regno < L0_REGNUM || regno > I7_REGNUM) - wanna_store = INT_REGS; - else - wanna_store = STACK_REGS; - } - - /* See if we're forcing the stores to happen now, or deferring. */ - if (regno == -2) - { - wanna_store = deferred_stores; - deferred_stores = 0; - } - else - { - if (wanna_store == STACK_REGS) - { - /* Fall through and just store one stack reg. If we deferred - it, we'd have to store them all, or remember more info. */ - } - else - { - deferred_stores |= wanna_store; - return; - } - } - - if (wanna_store & STACK_REGS) - { - CORE_ADDR sp = *(CORE_ADDR *)®isters[REGISTER_BYTE (SP_REGNUM)]; - - if (regno < 0 || regno == SP_REGNUM) - { - if (!register_valid[L0_REGNUM+5]) abort(); - target_xfer_memory (sp, - ®isters[REGISTER_BYTE (L0_REGNUM)], - 16*REGISTER_RAW_SIZE (L0_REGNUM), 1); - } - else - { - if (!register_valid[regno]) abort(); - target_xfer_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM), - ®isters[REGISTER_BYTE (regno)], - REGISTER_RAW_SIZE (regno), 1); - } - - } - - if (wanna_store & INT_REGS) - { - if (!register_valid[G1_REGNUM]) abort(); - - memcpy (&inferior_registers.r_g1, ®isters[REGISTER_BYTE (G1_REGNUM)], - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); - - inferior_registers.r_ps = - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_registers.r_pc = - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)]; - inferior_registers.r_npc = - *(int *)®isters[REGISTER_BYTE (NPC_REGNUM)]; - inferior_registers.r_y = - *(int *)®isters[REGISTER_BYTE (Y_REGNUM)]; - - if (0 != ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers, 0)) - perror("ptrace_setregs"); - } - - if (wanna_store & FP_REGS) - { - if (!register_valid[FP0_REGNUM+9]) abort(); - memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.fpu_fr); - -/* memcpy (&inferior_fp_registers.Fpu_fsr, - ®isters[REGISTER_BYTE (FPS_REGNUM)], sizeof (FPU_FSR_TYPE)); -****/ - if (0 != - ptrace (PTRACE_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0)) - perror("ptrace_setfpregs"); - } -} - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, ignore) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int ignore; /* reg addr, unused in this version */ -{ - - if (which == 0) { - - /* Integer registers */ - -#define gregs ((struct regs *)core_reg_sect) - /* G0 *always* holds 0. */ - *(int *)®isters[REGISTER_BYTE (0)] = 0; - - /* The globals and output registers. */ - memcpy (®isters[REGISTER_BYTE (G1_REGNUM)], &gregs->r_g1, - 15 * REGISTER_RAW_SIZE (G1_REGNUM)); - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = gregs->r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = gregs->r_pc; - *(int *)®isters[REGISTER_BYTE (NPC_REGNUM)] = gregs->r_npc; - *(int *)®isters[REGISTER_BYTE (Y_REGNUM)] = gregs->r_y; - - /* My best guess at where to get the locals and input - registers is exactly where they usually are, right above - the stack pointer. If the core dump was caused by a bus error - from blowing away the stack pointer (as is possible) then this - won't work, but it's worth the try. */ - { - int sp; - - sp = *(int *)®isters[REGISTER_BYTE (SP_REGNUM)]; - if (0 != target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)], - 16 * REGISTER_RAW_SIZE (L0_REGNUM))) - { - /* fprintf so user can still use gdb */ - fprintf (stderr, - "Couldn't read input and local registers from core file\n"); - } - } - } else if (which == 2) { - - /* Floating point registers */ - -#define fpuregs ((struct fpu *) core_reg_sect) - if (core_reg_size >= sizeof (struct fpu)) - { - memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], fpuregs->fpu_regs, - sizeof (fpuregs->fpu_regs)); - memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)], &fpuregs->fpu_fsr, - sizeof (FPU_FSR_TYPE)); - } - else - fprintf (stderr, "Couldn't read float regs from core file\n"); - } -} diff --git a/gdb/stab.def b/gdb/stab.def deleted file mode 100755 index 58364e1..0000000 --- a/gdb/stab.def +++ /dev/null @@ -1,182 +0,0 @@ -/* Table of DBX symbol codes for the GNU system. - Copyright (C) 1988 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 1, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Global variable. Only the name is significant. - To find the address, look in the corresponding external symbol. */ -__define_stab (N_GSYM, 0x20, "GSYM") - -/* Function name for BSD Fortran. Only the name is significant. - To find the address, look in the corresponding external symbol. */ -__define_stab (N_FNAME, 0x22, "FNAME") - -/* Function name or text-segment variable for C. Value is its address. - Desc is supposedly starting line number, but GCC doesn't set it - and DBX seems not to miss it. */ -__define_stab (N_FUN, 0x24, "FUN") - -/* Data-segment variable with internal linkage. Value is its address. */ -__define_stab (N_STSYM, 0x26, "STSYM") - -/* BSS-segment variable with internal linkage. Value is its address. */ -__define_stab (N_LCSYM, 0x28, "LCSYM") - -/* Name of main routine. Only the name is significant. - This is not used in C. */ -__define_stab (N_MAIN, 0x2a, "MAIN") - -/* Register variable. Value is number of register. */ -__define_stab (N_RSYM, 0x40, "RSYM") - -/* Structure or union element. Value is offset in the structure. */ -__define_stab (N_SSYM, 0x60, "SSYM") - -/* Parameter variable. Value is offset from argument pointer. - (On most machines the argument pointer is the same as the frame pointer. */ -__define_stab (N_PSYM, 0xa0, "PSYM") - -/* Automatic variable in the stack. Value is offset from frame pointer. - Also used for type descriptions. */ -__define_stab (N_LSYM, 0x80, "LSYM") - -/* Alternate entry point. Value is its address. */ -__define_stab (N_ENTRY, 0xa4, "ENTRY") - -/* Name of main source file. - Value is starting text address of the compilation. */ -__define_stab (N_SO, 0x64, "SO") - -/* Name of sub-source file. - Value is starting text address of the compilation. */ -__define_stab (N_SOL, 0x84, "SOL") - -/* Line number in text segment. Desc is the line number; - value is corresponding address. */ -__define_stab (N_SLINE, 0x44, "SLINE") -/* Similar, for data segment. */ -__define_stab (N_DSLINE, 0x66, "DSLINE") -/* Similar, for bss segment. */ -__define_stab (N_BSLINE, 0x68, "BSLINE") - -/* Beginning of an include file. Only Sun uses this. - In an object file, only the name is significant. - The Sun linker puts data into some of the other fields. */ -__define_stab (N_BINCL, 0x82, "BINCL") -/* End of an include file. No name. - These two act as brackets around the file's output. - In an object file, there is no significant data in this entry. - The Sun linker puts data into some of the fields. */ -__define_stab (N_EINCL, 0xa2, "EINCL") -/* Place holder for deleted include file. - This appears only in output from the Sun linker. */ -__define_stab (N_EXCL, 0xc2, "EXCL") - -/* Beginning of lexical block. - The desc is the nesting level in lexical blocks. - The value is the address of the start of the text for the block. - The variables declared inside the block *precede* the N_LBRAC symbol. */ -__define_stab (N_LBRAC, 0xc0, "LBRAC") -/* End of a lexical block. Desc matches the N_LBRAC's desc. - The value is the address of the end of the text for the block. */ -__define_stab (N_RBRAC, 0xe0, "RBRAC") - -/* Begin named common block. Only the name is significant. */ -__define_stab (N_BCOMM, 0xe2, "BCOMM") -/* Begin named common block. Only the name is significant - (and it should match the N_BCOMM). */ -__define_stab (N_ECOMM, 0xe4, "ECOMM") -/* End common (local name): value is address. - I'm not sure how this is used. */ -__define_stab (N_ECOML, 0xe8, "ECOML") -/* Second symbol entry containing a length-value for the preceding entry. - The value is the length. */ -__define_stab (N_LENG, 0xfe, "LENG") - -/* Global symbol in Pascal. - Supposedly the value is its line number; I'm skeptical. */ -__define_stab (N_PC, 0x30, "PC") - -/* Modula-2 compilation unit. Can someone say what info it contains? */ -__define_stab (N_M2C, 0x42, "M2C") -/* Modula-2 scope information. Can someone say what info it contains? */ -__define_stab (N_SCOPE, 0xc4, "SCOPE") - -/* Sun's source-code browser stabs. ?? Don't know what the fields are. - Supposedly the field is "path to associated .cb file". */ -__define_stab (N_BROWS, 0x48, "BROWS") - -/* GNU C++ exception stabs. */ - -/* GNU C++ exception variable. Name is variable name. */ -__define_stab (N_EHDECL, 0x50, "EHDECL") - -/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if - this entry is immediately followed by a CAUGHT stab saying what exception - was caught. Multiple CAUGHT stabs means that multiple exceptions - can be caught here. If Desc is 0, it means all exceptions are caught - here. */ -__define_stab (N_CATCH, 0x54, "CATCH") - -/* These STAB's are used on Gould systems for Non-Base register symbols - or something like that. FIXME. I have assigned the values at random - since I don't have a Gould here. Fixups from Gould folk welcome... */ -__define_stab (N_NBTEXT, 0xF0, "NBTEXT") -__define_stab (N_NBDATA, 0xF2, "NBDATA") -__define_stab (N_NBBSS, 0xF4, "NBBSS") -__define_stab (N_NBSTS, 0xF6, "NBSTS") -__define_stab (N_NBLCS, 0xF8, "NBLCS") -__define_stab (N_NSYMS, 0xFA, "NSYMS") - -/* The above information, in matrix format. - - STAB MATRIX - _________________________________________________ - | 00 - 1F are not dbx stab symbols | - | Entries with bits 01 set are external symbols | - | N_UNDEF | N_ABS | N_TEXT | N_DATA | - | N_BSS | N_COMM | | N_FN | - |_______________________________________________| - | 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM | - | 28 LCSYM | 2A MAIN | 2C | 2E | - | 30 PC | 32 | 34 | 36 | - | 38 | 3A | 3C | 3E | - | 40 RSYM | 42 M2C | 44 SLINE | 46 | - | 48 BROWS | 4A | 4C | 4E | - | 50 EHDECL | 52 | 54 CATCH | 56 | - | 58 | 5A | 5C | 5E | - | 60 SSYM | 62 | 64 SO | 66 DSLINE | - | 68 BSLINE | 6A | 6C | 6E | - | 70 | 72 | 74 | 76 | - | 78 | 7A | 7C | 7E | - | 80 LSYM | 82 BINCL | 84 SOL | 86 | - | 88 | 8A | 8C | 8E | - | 90 | 92 | 94 | 96 | - | 98 | 9A | 9C | 9E | - | A0 PSYM | A2 EINCL | A4 ENTRY | A6 | - | A8 | AA | AC | AE | - | B0 | B2 | B4 | B6 | - | B8 | BA | BC | BE | - | C0 LBRAC | C2 EXCL | C4 SCOPE | C6 | - | C8 | CA | CC | CE | - | D0 | D2 | D4 | D6 | - | D8 | DA | DC | DE | - | E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 | - | E8 ECOML | EA | EC | EE | - | F0 | F2 | F4 | F6 | - | F8 | FA | FC | FE LENG | - +-----------------------------------------------+ - -*/ diff --git a/gdb/stddef.h b/gdb/stddef.h deleted file mode 100755 index c2c396e..0000000 --- a/gdb/stddef.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _STDDEF_H -#define _STDDEF_H - -/* Signed type of difference of two pointers. */ - -typedef long ptrdiff_t; - -/* Unsigned type of `sizeof' something. */ - -/* in case has defined it. */ -/* DECstation uses _SIZE_T_. */ -#if !defined (_SIZE_T) && !defined (_SIZE_T_) -#define _SIZE_T -typedef unsigned long size_t; -#endif /* _SIZE_T */ - -/* A null pointer constant. */ - -#undef NULL /* in case has defined it. */ -#define NULL 0 - -/* Offset of member MEMBER in a struct of type TYPE. */ - -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - -#endif /* _STDDEF_H */ diff --git a/gdb/stdlib.h b/gdb/stdlib.h deleted file mode 100755 index 40ce167..0000000 --- a/gdb/stdlib.h +++ /dev/null @@ -1,10 +0,0 @@ -/* Fake stdlib.h supplying the stuff needed by malloc. */ - -#ifndef __ONEFILE -#include -#endif - -extern void EXFUN(abort, (void)); -extern void EXFUN(free, (PTR)); -extern PTR EXFUN(malloc, (size_t)); -extern PTR EXFUN(realloc, (PTR, size_t)); diff --git a/gdb/sun3-xdep.c b/gdb/sun3-xdep.c deleted file mode 100644 index 03cc3ae..0000000 --- a/gdb/sun3-xdep.c +++ /dev/null @@ -1,167 +0,0 @@ -/* Host-dependent code for Sun-3 for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "defs.h" -#include "inferior.h" -#include "gdbcore.h" - -#include -#define KERNEL /* To get floating point reg definitions */ -#include - -extern int errno; - -#if defined (GDB_TARGET_IS_SUN3) -/* All of this stuff is only relevant if both host and target are sun3. */ -void -fetch_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; -#ifdef FP0_REGNUM - struct fp_status inferior_fp_registers; -#endif - extern char registers[]; - - registers_fetched (); - - ptrace (PTRACE_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); -#ifdef FP0_REGNUM - ptrace (PTRACE_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); -#endif - - bcopy (&inferior_registers, registers, 16 * 4); -#ifdef FP0_REGNUM - bcopy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.fps_regs); -#endif - *(int *)®isters[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps; - *(int *)®isters[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc; -#ifdef FP0_REGNUM - bcopy (&inferior_fp_registers.fps_control, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); -#endif -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; -#ifdef FP0_REGNUM - struct fp_status inferior_fp_registers; -#endif - extern char registers[]; - - bcopy (registers, &inferior_registers, 16 * 4); -#ifdef FP0_REGNUM - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, - sizeof inferior_fp_registers.fps_regs); -#endif - inferior_registers.r_ps = *(int *)®isters[REGISTER_BYTE (PS_REGNUM)]; - inferior_registers.r_pc = *(int *)®isters[REGISTER_BYTE (PC_REGNUM)]; - -#ifdef FP0_REGNUM - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &inferior_fp_registers.fps_control, - sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs); -#endif - - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); -#if FP0_REGNUM - ptrace (PTRACE_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); -#endif -} - -/* Machine-dependent code for pulling registers out of a Sun-3 core file. */ - -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ - extern char registers[]; - struct regs *regs = (struct regs *) core_reg_sect; - - if (which == 0) { - if (core_reg_size < sizeof (struct regs)) - error ("Can't find registers in core file"); - - bcopy ((char *)regs, registers, 16 * 4); - supply_register (PS_REGNUM, (char *)®s->r_ps); - supply_register (PC_REGNUM, (char *)®s->r_pc); - - } else if (which == 2) { - -#define fpustruct ((struct fpu *) core_reg_sect) - - if (core_reg_size >= sizeof (struct fpu)) - { -#ifdef FP0_REGNUM - bcopy (fpustruct->f_fpstatus.fps_regs, - ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof fpustruct->f_fpstatus.fps_regs); - bcopy (&fpustruct->f_fpstatus.fps_control, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof fpustruct->f_fpstatus - - sizeof fpustruct->f_fpstatus.fps_regs); -#endif - } - else - fprintf (stderr, "Couldn't read float regs from core file\n"); - } -} -#else /* Not sun3 target. */ -/* These functions shouldn't be called when we're cross-debugging. */ - -/* ARGSUSED */ -void -fetch_inferior_registers (regno) - int regno; -{ -} - -/* ARGSUSED */ -void -store_inferior_registers (regno) - int regno; -{ -} - -/* ARGSUSED */ -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ -} -#endif /* Not sun3 target. */ diff --git a/gdb/sun386-xdep.c b/gdb/sun386-xdep.c deleted file mode 100644 index 7da605b..0000000 --- a/gdb/sun386-xdep.c +++ /dev/null @@ -1,289 +0,0 @@ -/* Machine-dependent code for host Sun 386i's for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - Changes for sun386i by Jean Daniel Fekete (jdf@litp.univ-p6-7.fr), - C2V Paris, April 89. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#if defined (GDB_TARGET_IS_SUN386) - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "gdbcore.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -void -fetch_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_state inferior_fp_registers; - extern char registers[]; - - registers_fetched (); - - ptrace (PTRACE_GETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_GETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); - - bcopy (&inferior_registers, registers, sizeof inferior_registers); - - bcopy (inferior_fp_registers.f_st,®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof inferior_fp_registers.f_st); - bcopy (&inferior_fp_registers.f_ctrl, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (regno) - int regno; -{ - struct regs inferior_registers; - struct fp_state inferior_fp_registers; - extern char registers[]; - - bcopy (registers, &inferior_registers, 20 * 4); - - bcopy (®isters[REGISTER_BYTE (FP0_REGNUM)],inferior_fp_registers.f_st, - sizeof inferior_fp_registers.f_st); - bcopy (®isters[REGISTER_BYTE (FPC_REGNUM)], - &inferior_fp_registers.f_ctrl, - sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st); - -#ifdef PTRACE_FP_BUG - if (regno == FP_REGNUM || regno == -1) - /* Storing the frame pointer requires a gross hack, in which an - instruction that moves eax into ebp gets single-stepped. */ - { - int stack = inferior_registers.r_reg[SP_REGNUM]; - int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, - (PTRACE_ARG3_TYPE) stack); - int reg = inferior_registers.r_reg[EAX]; - inferior_registers.r_reg[EAX] = - inferior_registers.r_reg[FP_REGNUM]; - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, - 0xc589); - ptrace (PTRACE_SINGLESTEP, inferior_pid, (PTRACE_ARG3_TYPE) stack, - 0); - wait (0); - ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, - stuff); - inferior_registers.r_reg[EAX] = reg; - } -#endif - ptrace (PTRACE_SETREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_registers); - ptrace (PTRACE_SETFPREGS, inferior_pid, - (PTRACE_ARG3_TYPE) &inferior_fp_registers); -} - -/* Machine-dependent code which would otherwise be in core.c */ -/* Work with core files, for GDB. */ - - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - extern char registers[]; - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the inferior with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - - { - struct core corestr; - - val = myread (corechan, &corestr, sizeof corestr); - if (val < 0) - perror_with_name (filename); - if (corestr.c_magic != CORE_MAGIC) - error ("\"%s\" does not appear to be a core dump file (magic 0x%x, expected 0x%x)", - filename, corestr.c_magic, (int) CORE_MAGIC); - else if (sizeof (struct core) != corestr.c_len) - error ("\"%s\" has an invalid struct core length (%d, expected %d)", - filename, corestr.c_len, (int) sizeof (struct core)); - - data_start = exec_data_start; - data_end = data_start + corestr.c_dsize; - stack_start = stack_end - corestr.c_ssize; - data_offset = sizeof corestr; - stack_offset = sizeof corestr + corestr.c_dsize; - - bcopy (&corestr.c_regs, registers, sizeof corestr.c_regs); - - bcopy (corestr.c_fpu.f_fpstatus.f_st, - ®isters[REGISTER_BYTE (FP0_REGNUM)], - sizeof corestr.c_fpu.f_fpstatus.f_st); - bcopy (&corestr.c_fpu.f_fpstatus.f_ctrl, - ®isters[REGISTER_BYTE (FPC_REGNUM)], - sizeof corestr.c_fpu.f_fpstatus - - sizeof corestr.c_fpu.f_fpstatus.f_st); - - /* the struct aouthdr of sun coff is not the struct exec stored - in the core file. */ - bcopy (&corestr.c_aouthdr, &core_aouthdr, sizeof (struct exec)); -#ifndef COFF_ENCAPSULATE - core_aouthdr.magic = corestr.c_aouthdr.a_info; - core_aouthdr.vstamp = /*SUNVERSION*/ 31252; -#endif - printf ("Core file is from \"%s\".\n", corestr.c_cmdname); - if (corestr.c_signo > 0) - printf ("Program terminated with signal %d, %s.\n", - corestr.c_signo, safe_strsignal (corestr.c_signo)); - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename, NULL); - } - - set_current_frame ( create_new_frame (read_register (FP_REGNUM), - read_pc ())); - select_frame (get_current_frame (), 0); - - validate_files (); - } - else if (from_tty) - printf ("No core file now.\n"); -} - -i387_to_double (from, to) - char *from; - char *to; -{ - long *lp; - /* push extended mode on 387 stack, then pop in double mode - * - * first, set exception masks so no error is generated - - * number will be rounded to inf or 0, if necessary - */ - asm ("pushl %eax"); /* grab a stack slot */ - asm ("fstcw (%esp)"); /* get 387 control word */ - asm ("movl (%esp),%eax"); /* save old value */ - asm ("orl $0x3f,%eax"); /* mask all exceptions */ - asm ("pushl %eax"); - asm ("fldcw (%esp)"); /* load new value into 387 */ - - asm ("movl 8(%ebp),%eax"); - asm ("fldt (%eax)"); /* push extended number on 387 stack */ - asm ("fwait"); - asm ("movl 12(%ebp),%eax"); - asm ("fstpl (%eax)"); /* pop double */ - asm ("fwait"); - - asm ("popl %eax"); /* flush modified control word */ - asm ("fnclex"); /* clear exceptions */ - asm ("fldcw (%esp)"); /* restore original control word */ - asm ("popl %eax"); /* flush saved copy */ -} - -double_to_i387 (from, to) - char *from; - char *to; -{ - /* push double mode on 387 stack, then pop in extended mode - * no errors are possible because every 64-bit pattern - * can be converted to an extended - */ - asm ("movl 8(%ebp),%eax"); - asm ("fldl (%eax)"); - asm ("fwait"); - asm ("movl 12(%ebp),%eax"); - asm ("fstpt (%eax)"); - asm ("fwait"); -} -#else /* Not sun386 target. */ - -/* These functions shouldn't be called when we're cross-debugging. */ - -/* ARGSUSED */ -void -fetch_inferior_registers (regno) - int regno; -{ -} - -/* ARGSUSED */ -void -store_inferior_registers (regno) - int regno; -{ -} - -/* ARGSUSED */ -void -fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) - char *core_reg_sect; - unsigned core_reg_size; - int which; - unsigned int reg_addr; /* Unused in this version */ -{ -} - -#endif /* Not sun386 target. */ diff --git a/gdb/symmetry-tdep.c b/gdb/symmetry-tdep.c deleted file mode 100755 index aba21c3..0000000 --- a/gdb/symmetry-tdep.c +++ /dev/null @@ -1,494 +0,0 @@ -/* Sequent Symmetry target interface, for GDB when running under Unix. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* many 387-specific items of use taken from i386-dep.c */ - -#include -#include "defs.h" -#include "param.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" - -#include -#include -#include -#include -#include -#include -#include "gdbcore.h" -#include - -static long i386_get_frame_setup (); -static i386_follow_jump (); - -#include -#define TERMINAL struct sgttyb - -exec_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - - /* Eliminate all traces of old exec file. - Mark text segment as empty. */ - - if (execfile) - free (execfile); - execfile = 0; - data_start = 0; - data_end -= exec_data_start; - text_start = 0; - text_end = 0; - exec_data_start = 0; - exec_data_end = 0; - if (execchan >= 0) - close (execchan); - execchan = -1; - - /* Now open and digest the file the user requested, if any. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, - &execfile); - if (execchan < 0) - perror_with_name (filename); - -#ifdef COFF_FORMAT - { - int aout_hdrsize; - int num_sections; - - if (read_file_hdr (execchan, &file_hdr) < 0) - error ("\"%s\": not in executable format.", execfile); - - aout_hdrsize = file_hdr.f_opthdr; - num_sections = file_hdr.f_nscns; - - if (read_aout_hdr (execchan, &exec_aouthdr, aout_hdrsize) < 0) - error ("\"%s\": can't read optional aouthdr", execfile); - - if (read_section_hdr (execchan, _TEXT, &text_hdr, num_sections, - aout_hdrsize) < 0) - error ("\"%s\": can't read text section header", execfile); - - if (read_section_hdr (execchan, _DATA, &data_hdr, num_sections, - aout_hdrsize) < 0) - error ("\"%s\": can't read data section header", execfile); - - text_start = exec_aouthdr.text_start; - text_end = text_start + exec_aouthdr.tsize; - text_offset = text_hdr.s_scnptr; - exec_data_start = exec_aouthdr.data_start; - exec_data_end = exec_data_start + exec_aouthdr.dsize; - exec_data_offset = data_hdr.s_scnptr; - data_start = exec_data_start; - data_end += exec_data_start; - exec_mtime = file_hdr.f_timdat; - } -#else /* not COFF_FORMAT */ - { - struct stat st_exec; - - val = myread (execchan, &exec_aouthdr, sizeof (AOUTHDR)); - - if (val < 0) - perror_with_name (filename); - - text_start = N_ADDRADJ(exec_aouthdr); - exec_data_start = round(exec_aouthdr.a_text, NBPG*CLSIZE); - text_offset = N_TXTOFF (exec_aouthdr); - exec_data_offset = N_TXTOFF (exec_aouthdr) + exec_aouthdr.a_text; - text_end = exec_aouthdr.a_text; - exec_data_end = exec_data_start + exec_aouthdr.a_data; - data_start = exec_data_start; - data_end = data_start + exec_aouthdr.a_data; - exec_data_offset = N_TXTOFF(exec_aouthdr); - fstat (execchan, &st_exec); - exec_mtime = st_exec.st_mtime; - } -#endif /* not COFF_FORMAT */ - - validate_files (); - } - else if (from_tty) - printf ("No exec file now.\n"); - - /* Tell display code (if any) about the changed file name. */ - if (exec_file_display_hook) - (*exec_file_display_hook) (filename); -} - -/* rounds 'one' up to divide evenly by 'two' */ - -int -round(one,two) -register int one, two; - -{ - register int temp; - temp = (one/two)*two; - if (one != temp) { - temp += two; - } - return temp; -} - - -static CORE_ADDR codestream_next_addr; -static CORE_ADDR codestream_addr; -static unsigned char codestream_buf[sizeof (int)]; -static int codestream_off; -static int codestream_cnt; - -#define codestream_tell() (codestream_addr + codestream_off) -#define codestream_peek() (codestream_cnt == 0 ? \ - codestream_fill(1): codestream_buf[codestream_off]) -#define codestream_get() (codestream_cnt-- == 0 ? \ - codestream_fill(0) : codestream_buf[codestream_off++]) - - -static unsigned char -codestream_fill (peek_flag) -{ - codestream_addr = codestream_next_addr; - codestream_next_addr += sizeof (int); - codestream_off = 0; - codestream_cnt = sizeof (int); - read_memory (codestream_addr, - (unsigned char *)codestream_buf, - sizeof (int)); - - if (peek_flag) - return (codestream_peek()); - else - return (codestream_get()); -} - -static void -codestream_seek (place) -{ - codestream_next_addr = place & -sizeof (int); - codestream_cnt = 0; - codestream_fill (1); - while (codestream_tell() != place) - codestream_get (); -} - -static void -codestream_read (buf, count) - unsigned char *buf; -{ - unsigned char *p; - int i; - p = buf; - for (i = 0; i < count; i++) - *p++ = codestream_get (); -} - -/* - * Following macro translates i386 opcode register numbers to Symmetry - * register numbers. This is used by FRAME_FIND_SAVED_REGS. - * - * %eax %ecx %edx %ebx %esp %ebp %esi %edi - * i386 0 1 2 3 4 5 6 7 - * Symmetry 0 2 1 5 14 15 6 7 - * - */ -#define I386_REGNO_TO_SYMMETRY(n) \ -((n)==0?0 :(n)==1?2 :(n)==2?1 :(n)==3?5 :(n)==4?14 :(n)==5?15 :(n)) - -/* from i386-dep.c */ -i386_frame_find_saved_regs (fip, fsrp) - struct frame_info *fip; - struct frame_saved_regs *fsrp; -{ - unsigned long locals; - unsigned char *p; - unsigned char op; - CORE_ADDR dummy_bottom; - CORE_ADDR adr; - int i; - - bzero (fsrp, sizeof *fsrp); - - /* if frame is the end of a dummy, compute where the - * beginning would be - */ - dummy_bottom = fip->frame - 4 - NUM_REGS*4 - CALL_DUMMY_LENGTH; - - /* check if the PC is in the stack, in a dummy frame */ - if (dummy_bottom <= fip->pc && fip->pc <= fip->frame) - { - /* all regs were saved by push_call_dummy () */ - adr = fip->frame - 4; - for (i = 0; i < NUM_REGS; i++) - { - fsrp->regs[i] = adr; - adr -= 4; - } - return; - } - - locals = i386_get_frame_setup (get_pc_function_start (fip->pc)); - - if (locals >= 0) - { - adr = fip->frame - 4 - locals; - for (i = 0; i < 8; i++) - { - op = codestream_get (); - if (op < 0x50 || op > 0x57) - break; - fsrp->regs[I386_REGNO_TO_SYMMETRY(op - 0x50)] = adr; - adr -= 4; - } - } - - fsrp->regs[PC_REGNUM] = fip->frame + 4; - fsrp->regs[FP_REGNUM] = fip->frame; -} - -static long -i386_get_frame_setup (pc) -{ - unsigned char op; - - codestream_seek (pc); - - i386_follow_jump (); - - op = codestream_get (); - - if (op == 0x58) /* popl %eax */ - { - /* - * this function must start with - * - * popl %eax 0x58 - * xchgl %eax, (%esp) 0x87 0x04 0x24 - * or xchgl %eax, 0(%esp) 0x87 0x44 0x24 0x00 - * - * (the system 5 compiler puts out the second xchg - * inst, and the assembler doesn't try to optimize it, - * so the 'sib' form gets generated) - * - * this sequence is used to get the address of the return - * buffer for a function that returns a structure - */ - int pos; - unsigned char buf[4]; - static unsigned char proto1[3] = { 0x87,0x04,0x24 }; - static unsigned char proto2[4] = { 0x87,0x44,0x24,0x00 }; - pos = codestream_tell (); - codestream_read (buf, 4); - if (bcmp (buf, proto1, 3) == 0) - pos += 3; - else if (bcmp (buf, proto2, 4) == 0) - pos += 4; - - codestream_seek (pos); - op = codestream_get (); /* update next opcode */ - } - - if (op == 0x55) /* pushl %esp */ - { - if (codestream_get () != 0x8b) /* movl %esp, %ebp (2bytes) */ - return (-1); - if (codestream_get () != 0xec) - return (-1); - /* - * check for stack adjustment - * - * subl $XXX, %esp - * - * note: you can't subtract a 16 bit immediate - * from a 32 bit reg, so we don't have to worry - * about a data16 prefix - */ - op = codestream_peek (); - if (op == 0x83) /* subl with 8 bit immed */ - { - codestream_get (); - if (codestream_get () != 0xec) - return (-1); - /* subl with signed byte immediate - * (though it wouldn't make sense to be negative) - */ - return (codestream_get()); - } - else if (op == 0x81) /* subl with 32 bit immed */ - { - int locals; - if (codestream_get () != 0xec) - return (-1); - /* subl with 32 bit immediate */ - codestream_read ((unsigned char *)&locals, 4); - return (locals); - } - else - { - return (0); - } - } - else if (op == 0xc8) - { - /* enter instruction: arg is 16 unsigned immed */ - unsigned short slocals; - codestream_read ((unsigned char *)&slocals, 2); - codestream_get (); /* flush final byte of enter instruction */ - return (slocals); - } - return (-1); -} - -/* next instruction is a jump, move to target */ -static -i386_follow_jump () -{ - int long_delta; - short short_delta; - char byte_delta; - int data16; - int pos; - - pos = codestream_tell (); - - data16 = 0; - if (codestream_peek () == 0x66) - { - codestream_get (); - data16 = 1; - } - - switch (codestream_get ()) - { - case 0xe9: - /* relative jump: if data16 == 0, disp32, else disp16 */ - if (data16) - { - codestream_read ((unsigned char *)&short_delta, 2); - pos += short_delta + 3; /* include size of jmp inst */ - } - else - { - codestream_read ((unsigned char *)&long_delta, 4); - pos += long_delta + 5; - } - break; - case 0xeb: - /* relative jump, disp8 (ignore data16) */ - codestream_read ((unsigned char *)&byte_delta, 1); - pos += byte_delta + 2; - break; - } - codestream_seek (pos + data16); -} - -/* return pc of first real instruction */ -/* from i386-dep.c */ - -i386_skip_prologue (pc) -{ - unsigned char op; - int i; - - if (i386_get_frame_setup (pc) < 0) - return (pc); - - /* found valid frame setup - codestream now points to - * start of push instructions for saving registers - */ - - /* skip over register saves */ - for (i = 0; i < 8; i++) - { - op = codestream_peek (); - /* break if not pushl inst */ - if (op < 0x50 || op > 0x57) - break; - codestream_get (); - } - - i386_follow_jump (); - - return (codestream_tell ()); -} - -symmetry_extract_return_value(type, regbuf, valbuf) - struct type *type; - char *regbuf; - char *valbuf; -{ - union { - double d; - int l[2]; - } xd; - int i; - float f; - - if (TYPE_CODE_FLT == TYPE_CODE(type)) { - for (i = 0; i < misc_function_count; i++) { - if (!strcmp(misc_function_vector[i].name, "1167_flt")) - break; - } - if (i < misc_function_count) { - /* found "1167_flt" means 1167, %fp2-%fp3 */ - /* float & double; 19= %fp2, 20= %fp3 */ - /* no single precision on 1167 */ - xd.l[1] = *((int *)®buf[REGISTER_BYTE(19)]); - xd.l[0] = *((int *)®buf[REGISTER_BYTE(20)]); - switch (TYPE_LENGTH(type)) { - case 4: - f = (float) xd.d; - bcopy(&f, valbuf, TYPE_LENGTH(type)); - break; - case 8: - bcopy(&xd.d, valbuf, TYPE_LENGTH(type)); - break; - default: - error("Unknown floating point size"); - break; - } - } else { - /* 387 %st(0), gcc uses this */ - i387_to_double(((int *)®buf[REGISTER_BYTE(3)]), - &xd.d); - switch (TYPE_LENGTH(type)) { - case 4: /* float */ - f = (float) xd.d; - bcopy(&f, valbuf, 4); - break; - case 8: /* double */ - bcopy(&xd.d, valbuf, 8); - break; - default: - error("Unknown floating point size"); - break; - } - } - } else { - bcopy (regbuf, valbuf, TYPE_LENGTH (type)); - } -} diff --git a/gdb/symmetry-xdep.c b/gdb/symmetry-xdep.c deleted file mode 100755 index 3449678..0000000 --- a/gdb/symmetry-xdep.c +++ /dev/null @@ -1,557 +0,0 @@ -/* Sequent Symmetry host interface, for GDB when running under Unix. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* many 387-specific items of use taken from i386-dep.c */ - -#include -#include "defs.h" -#include "param.h" -#include "frame.h" -#include "inferior.h" -#include "symtab.h" - -#include -#include -#include -#include -#include -#include -#include "gdbcore.h" -#include - -static long i386_get_frame_setup (); -static i386_follow_jump (); - -#include -#define TERMINAL struct sgttyb - -store_inferior_registers(regno) -int regno; -{ - struct pt_regset regs; - int reg_tmp, i; - extern char registers[]; - -#if 0 - /* PREPARE_TO_STORE deals with this. */ - if (-1 == regno) - { -#endif - regs.pr_eax = *(int *)®isters[REGISTER_BYTE(0)]; - regs.pr_ebx = *(int *)®isters[REGISTER_BYTE(5)]; - regs.pr_ecx = *(int *)®isters[REGISTER_BYTE(2)]; - regs.pr_edx = *(int *)®isters[REGISTER_BYTE(1)]; - regs.pr_esi = *(int *)®isters[REGISTER_BYTE(6)]; - regs.pr_edi = *(int *)®isters[REGISTER_BYTE(7)]; - regs.pr_esp = *(int *)®isters[REGISTER_BYTE(14)]; - regs.pr_ebp = *(int *)®isters[REGISTER_BYTE(15)]; - regs.pr_eip = *(int *)®isters[REGISTER_BYTE(16)]; - regs.pr_flags = *(int *)®isters[REGISTER_BYTE(17)]; - for (i = 0; i < 31; i++) { - regs.pr_fpa.fpa_regs[i] = - *(int *)®isters[REGISTER_BYTE(FP1_REGNUM+i)]; - } -#if 0 - } - else - { - reg_tmp = *(int *)®isters[REGISTER_BYTE(regno)]; - ptrace(XPT_RREGS, inferior_pid, ®s, 0); - switch (regno) - { - case 0: - regs.pr_eax = *(int *)®isters[REGISTER_BYTE(0)]; - break; - case 5: - regs.pr_ebx = *(int *)®isters[REGISTER_BYTE(5)]; - break; - case 2: - regs.pr_ecx = *(int *)®isters[REGISTER_BYTE(2)]; - break; - case 1: - regs.pr_edx = *(int *)®isters[REGISTER_BYTE(1)]; - break; - case 6: - regs.pr_esi = *(int *)®isters[REGISTER_BYTE(6)]; - break; - case 7: - regs.pr_edi = *(int *)®isters[REGISTER_BYTE(7)]; - break; - case 15: - regs.pr_ebp = *(int *)®isters[REGISTER_BYTE(15)]; - break; - case 14: - regs.pr_esp = *(int *)®isters[REGISTER_BYTE(14)]; - break; - case 16: - regs.pr_eip = *(int *)®isters[REGISTER_BYTE(16)]; - break; - case 17: - regs.pr_flags = *(int *)®isters[REGISTER_BYTE(17)]; - break; - } - } -#endif /* 0 */ - ptrace(XPT_WREGS, inferior_pid, ®s, 0); -} - -void -fetch_inferior_registers() -{ - int i; - struct pt_regset regs; - extern char registers[]; - - registers_fetched (); - - ptrace(XPT_RREGS, inferior_pid, ®s, 0); - *(int *)®isters[REGISTER_BYTE(0)] = regs.pr_eax; - *(int *)®isters[REGISTER_BYTE(5)] = regs.pr_ebx; - *(int *)®isters[REGISTER_BYTE(2)] = regs.pr_ecx; - *(int *)®isters[REGISTER_BYTE(1)] = regs.pr_edx; - *(int *)®isters[REGISTER_BYTE(6)] = regs.pr_esi; - *(int *)®isters[REGISTER_BYTE(7)] = regs.pr_edi; - *(int *)®isters[REGISTER_BYTE(15)] = regs.pr_ebp; - *(int *)®isters[REGISTER_BYTE(14)] = regs.pr_esp; - *(int *)®isters[REGISTER_BYTE(16)] = regs.pr_eip; - *(int *)®isters[REGISTER_BYTE(17)] = regs.pr_flags; - for (i = 0; i < FPA_NREGS; i++) { - *(int *)®isters[REGISTER_BYTE(FP1_REGNUM+i)] = regs.pr_fpa.fpa_regs[i]; - } - bcopy(regs.pr_fpu.fpu_stack[0], ®isters[REGISTER_BYTE(3)], 10); - bcopy(regs.pr_fpu.fpu_stack[1], ®isters[REGISTER_BYTE(4)], 10); - bcopy(regs.pr_fpu.fpu_stack[2], ®isters[REGISTER_BYTE(8)], 10); - bcopy(regs.pr_fpu.fpu_stack[3], ®isters[REGISTER_BYTE(9)], 10); - bcopy(regs.pr_fpu.fpu_stack[4], ®isters[REGISTER_BYTE(10)], 10); - bcopy(regs.pr_fpu.fpu_stack[5], ®isters[REGISTER_BYTE(11)], 10); - bcopy(regs.pr_fpu.fpu_stack[6], ®isters[REGISTER_BYTE(12)], 10); - bcopy(regs.pr_fpu.fpu_stack[7], ®isters[REGISTER_BYTE(13)], 10); -} - - -/* Work with core dump and executable files, for GDB. - This code would be in core.c if it weren't machine-dependent. */ - -#include "gdbcore.h" - -void -core_file_command (filename, from_tty) - char *filename; - int from_tty; -{ - int val; - extern char registers[]; - - /* Discard all vestiges of any previous core file - and mark data and stack spaces as empty. */ - - if (corefile) - free (corefile); - corefile = 0; - - if (corechan >= 0) - close (corechan); - corechan = -1; - - data_start = 0; - data_end = 0; - stack_start = STACK_END_ADDR; - stack_end = STACK_END_ADDR; - - /* Now, if a new core file was specified, open it and digest it. */ - - if (filename) - { - filename = tilde_expand (filename); - make_cleanup (free, filename); - - if (have_inferior_p ()) - error ("To look at a core file, you must kill the inferior with \"kill\"."); - corechan = open (filename, O_RDONLY, 0); - if (corechan < 0) - perror_with_name (filename); - /* 4.2-style (and perhaps also sysV-style) core dump file. */ - { - struct user u; - int reg_offset; - - val = myread (corechan, &u, sizeof u); - if (val < 0) - perror_with_name (filename); - data_start = exec_data_start; - - data_end = data_start + NBPG * (u.u_dsize - u.u_tsize); - stack_start = stack_end - NBPG * u.u_ssize; - data_offset = NBPG * UPAGES; - stack_offset = ctob(UPAGES + u.u_dsize - u.u_tsize); - reg_offset = (int) u.u_ar0 - KERNEL_U_ADDR; -printf("u.u_tsize= %#x, u.u_dsize= %#x, u.u_ssize= %#x, stack_off= %#x\n", - u.u_tsize, u.u_dsize, u.u_ssize, stack_offset); - - core_aouthdr.a_magic = 0; - - /* Read the register values out of the core file and store - them where `read_register' will find them. */ - - { - register int regno; - - for (regno = 0; regno < NUM_REGS; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - - val = lseek (corechan, register_addr (regno, reg_offset), 0); - if (val < 0) - perror_with_name (filename); - - val = myread (corechan, buf, sizeof buf); - if (val < 0) - perror_with_name (filename); - supply_register (regno, buf); - } - } - } - if (filename[0] == '/') - corefile = savestring (filename, strlen (filename)); - else - { - corefile = concat (current_directory, "/", filename); - } - - set_current_frame(create_new_frame(read_register(FP_REGNUM), - read_pc())); -/* set_current_frame (read_register (FP_REGNUM));*/ - select_frame (get_current_frame (), 0); - validate_files (); - } - else if (from_tty) - printf ("No core file now.\n"); -} - -/* from i386-dep.c */ -static -print_387_control_word (control) -unsigned short control; -{ - printf ("control 0x%04x: ", control); - printf ("compute to "); - switch ((control >> 8) & 3) - { - case 0: printf ("24 bits; "); break; - case 1: printf ("(bad); "); break; - case 2: printf ("53 bits; "); break; - case 3: printf ("64 bits; "); break; - } - printf ("round "); - switch ((control >> 10) & 3) - { - case 0: printf ("NEAREST; "); break; - case 1: printf ("DOWN; "); break; - case 2: printf ("UP; "); break; - case 3: printf ("CHOP; "); break; - } - if (control & 0x3f) - { - printf ("mask:"); - if (control & 0x0001) printf (" INVALID"); - if (control & 0x0002) printf (" DENORM"); - if (control & 0x0004) printf (" DIVZ"); - if (control & 0x0008) printf (" OVERF"); - if (control & 0x0010) printf (" UNDERF"); - if (control & 0x0020) printf (" LOS"); - printf (";"); - } - printf ("\n"); - if (control & 0xe080) printf ("warning: reserved bits on 0x%x\n", - control & 0xe080); -} - -static -print_387_status_word (status) - unsigned short status; -{ - printf ("status %#04x: ", status); - if (status & 0xff) { - printf ("exceptions:"); /* exception names match */ - if (status & 0x0001) printf (" FLTINV"); - if (status & 0x0002) printf (" FLTDEN"); - if (status & 0x0004) printf (" FLTDIV"); - if (status & 0x0008) printf (" FLTOVF"); - if (status & 0x0010) printf (" FLTUND"); - if (status & 0x0020) printf (" FLTPRE"); - if (status & 0x0040) printf (" FLTSTK"); - printf ("; "); - } - printf ("flags: %d%d%d%d; ", - (status & 0x4000) != 0, - (status & 0x0400) != 0, - (status & 0x0200) != 0, - (status & 0x0100) != 0); - - printf ("top %d\n", (status >> 11) & 7); -} - -static -print_fpu_status(ep) -struct pt_regset ep; - -{ - int i; - int bothstatus; - int top; - int fpreg; - unsigned char *p; - - printf("80387:"); - if (ep.pr_fpu.fpu_ip == 0) { - printf(" not in use.\n"); - return; - } else { - printf("\n"); - } - if (ep.pr_fpu.fpu_status != 0) { - print_387_status_word (ep.pr_fpu.fpu_status); - } - print_387_control_word (ep.pr_fpu.fpu_control); - printf ("last exception: "); - printf ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4); - printf ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip); - printf ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel); - - top = (ep.pr_fpu.fpu_status >> 11) & 7; - - printf ("regno tag msb lsb value\n"); - for (fpreg = 7; fpreg >= 0; fpreg--) - { - double val; - - printf ("%s %d: ", fpreg == top ? "=>" : " ", fpreg); - - switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3) - { - case 0: printf ("valid "); break; - case 1: printf ("zero "); break; - case 2: printf ("trap "); break; - case 3: printf ("empty "); break; - } - for (i = 9; i >= 0; i--) - printf ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]); - - i387_to_double (ep.pr_fpu.fpu_stack[fpreg], (char *)&val); - printf (" %g\n", val); - } - if (ep.pr_fpu.fpu_rsvd1) - printf ("warning: rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1); - if (ep.pr_fpu.fpu_rsvd2) - printf ("warning: rsvd2 is 0x%x\n", ep.pr_fpu.fpu_rsvd2); - if (ep.pr_fpu.fpu_rsvd3) - printf ("warning: rsvd3 is 0x%x\n", ep.pr_fpu.fpu_rsvd3); - if (ep.pr_fpu.fpu_rsvd5) - printf ("warning: rsvd5 is 0x%x\n", ep.pr_fpu.fpu_rsvd5); -} - - -print_1167_control_word(pcr) -unsigned int pcr; - -{ - int pcr_tmp; - - pcr_tmp = pcr & FPA_PCR_MODE; - printf("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12); - switch (pcr_tmp & 12) { - case 0: - printf("RN (Nearest Value)"); - break; - case 1: - printf("RZ (Zero)"); - break; - case 2: - printf("RP (Positive Infinity)"); - break; - case 3: - printf("RM (Negative Infinity)"); - break; - } - printf("; IRND= %d ", pcr_tmp & 2); - if (0 == pcr_tmp & 2) { - printf("(same as RND)\n"); - } else { - printf("(toward zero)\n"); - } - pcr_tmp = pcr & FPA_PCR_EM; - printf("\tEM= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_EM_DM) printf(" DM"); - if (pcr_tmp & FPA_PCR_EM_UOM) printf(" UOM"); - if (pcr_tmp & FPA_PCR_EM_PM) printf(" PM"); - if (pcr_tmp & FPA_PCR_EM_UM) printf(" UM"); - if (pcr_tmp & FPA_PCR_EM_OM) printf(" OM"); - if (pcr_tmp & FPA_PCR_EM_ZM) printf(" ZM"); - if (pcr_tmp & FPA_PCR_EM_IM) printf(" IM"); - printf("\n"); - pcr_tmp = FPA_PCR_CC; - printf("\tCC= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_20MHZ) printf(" 20MHZ"); - if (pcr_tmp & FPA_PCR_CC_Z) printf(" Z"); - if (pcr_tmp & FPA_PCR_CC_C2) printf(" C2"); - if (pcr_tmp & FPA_PCR_CC_C1) printf(" C1"); - switch (pcr_tmp) { - case FPA_PCR_CC_Z: - printf(" (Equal)"); - break; - case FPA_PCR_CC_C1: - printf(" (Less than)"); - break; - case 0: - printf(" (Greater than)"); - break; - case FPA_PCR_CC_Z | FPA_PCR_CC_C1 | FPA_PCR_CC_C2: - printf(" (Unordered)"); - break; - default: - printf(" (Undefined)"); - break; - } - printf("\n"); - pcr_tmp = pcr & FPA_PCR_AE; - printf("\tAE= %#x", pcr_tmp); - if (pcr_tmp & FPA_PCR_AE_DE) printf(" DE"); - if (pcr_tmp & FPA_PCR_AE_UOE) printf(" UOE"); - if (pcr_tmp & FPA_PCR_AE_PE) printf(" PE"); - if (pcr_tmp & FPA_PCR_AE_UE) printf(" UE"); - if (pcr_tmp & FPA_PCR_AE_OE) printf(" OE"); - if (pcr_tmp & FPA_PCR_AE_ZE) printf(" ZE"); - if (pcr_tmp & FPA_PCR_AE_EE) printf(" EE"); - if (pcr_tmp & FPA_PCR_AE_IE) printf(" IE"); - printf("\n"); -} - -print_1167_regs(regs) -long regs[FPA_NREGS]; - -{ - int i; - - union { - double d; - long l[2]; - } xd; - union { - float f; - long l; - } xf; - - - for (i = 0; i < FPA_NREGS; i++) { - xf.l = regs[i]; - printf("%%fp%d: raw= %#x, single= %f", i+1, regs[i], xf.f); - if (!(i & 1)) { - printf("\n"); - } else { - xd.l[1] = regs[i]; - xd.l[0] = regs[i+1]; - printf(", double= %f\n", xd.d); - } - } -} - -print_fpa_status(ep) -struct pt_regset ep; - -{ - - printf("WTL 1167:"); - if (ep.pr_fpa.fpa_pcr !=0) { - printf("\n"); - print_1167_control_word(ep.pr_fpa.fpa_pcr); - print_1167_regs(ep.pr_fpa.fpa_regs); - } else { - printf(" not in use.\n"); - } -} - -i386_float_info () - -{ - char ubuf[UPAGES*NBPG]; - struct pt_regset regset; - extern int corechan; - - if (have_inferior_p()) { - call_ptrace(XPT_RREGS, inferior_pid, ®set, 0); - } else { - if (lseek (corechan, 0, 0) < 0) { - perror ("seek on core file"); - } - if (myread (corechan, ubuf, UPAGES*NBPG) < 0) { - perror ("read on core file"); - } - /* only interested in the floating point registers */ - regset.pr_fpu = ((struct user *) ubuf)->u_fpusave; - regset.pr_fpa = ((struct user *) ubuf)->u_fpasave; - } - print_fpu_status(regset); - print_fpa_status(regset); -} - -i387_to_double (from, to) - char *from; - char *to; -{ - long *lp; - /* push extended mode on 387 stack, then pop in double mode - * - * first, set exception masks so no error is generated - - * number will be rounded to inf or 0, if necessary - */ - asm ("pushl %eax"); /* grab a stack slot */ - asm ("fstcw (%esp)"); /* get 387 control word */ - asm ("movl (%esp),%eax"); /* save old value */ - asm ("orl $0x3f,%eax"); /* mask all exceptions */ - asm ("pushl %eax"); - asm ("fldcw (%esp)"); /* load new value into 387 */ - - asm ("movl 8(%ebp),%eax"); - asm ("fldt (%eax)"); /* push extended number on 387 stack */ - asm ("fwait"); - asm ("movl 12(%ebp),%eax"); - asm ("fstpl (%eax)"); /* pop double */ - asm ("fwait"); - - asm ("popl %eax"); /* flush modified control word */ - asm ("fnclex"); /* clear exceptions */ - asm ("fldcw (%esp)"); /* restore original control word */ - asm ("popl %eax"); /* flush saved copy */ -} - -double_to_i387 (from, to) - char *from; - char *to; -{ - /* push double mode on 387 stack, then pop in extended mode - * no errors are possible because every 64-bit pattern - * can be converted to an extended - */ - asm ("movl 8(%ebp),%eax"); - asm ("fldl (%eax)"); - asm ("fwait"); - asm ("movl 12(%ebp),%eax"); - asm ("fstpt (%eax)"); - asm ("fwait"); -} diff --git a/gdb/tahoe-opcode.h b/gdb/tahoe-opcode.h deleted file mode 100755 index b5cee24..0000000 --- a/gdb/tahoe-opcode.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Ported by the State University of New York at Buffalo by the Distributed - * Computer Systems Lab, Department of Computer Science, 1991. - */ - -#ifndef tahoe_opcodeT -#define tahoe_opcodeT int -#endif /* no tahoe_opcodeT */ - -struct vot_wot /* tahoe opcode table: wot to do with this */ - /* particular opcode */ -{ - char * args; /* how to compile said opcode */ - tahoe_opcodeT code; /* op-code (may be > 8 bits!) */ -}; - -struct vot /* tahoe opcode text */ -{ - char * name; /* opcode name: lowercase string [key] */ - struct vot_wot detail; /* rest of opcode table [datum] */ -}; - -#define vot_how args -#define vot_code code -#define vot_detail detail -#define vot_name name - -static struct vot -votstrs[] = -{ -{ "halt", {"", 0x00 } }, -{ "sinf", {"", 0x05 } }, -{ "ldf", {"rl", 0x06 } }, -{ "ldd", {"rq", 0x07 } }, -{ "addb2", {"rbmb", 0x08 } }, -{ "movb", {"rbwb", 0x09 } }, -{ "addw2", {"rwmw", 0x0a } }, -{ "movw", {"rwww", 0x0b } }, -{ "addl2", {"rlml", 0x0c } }, -{ "movl", {"rlwl", 0x0d } }, -{ "bbs", {"rlvlbw", 0x0e } }, -{ "nop", {"", 0x10 } }, -{ "brb", {"bb", 0x11 } }, -{ "brw", {"bw", 0x13 } }, -{ "cosf", {"", 0x15 } }, -{ "lnf", {"rl", 0x16 } }, -{ "lnd", {"rq", 0x17 } }, -{ "addb3", {"rbrbwb", 0x18 } }, -{ "cmpb", {"rbwb", 0x19 } }, -{ "addw3", {"rwrwww", 0x1a } }, -{ "cmpw", {"rwww", 0x1b } }, -{ "addl3", {"rlrlwl", 0x1c } }, -{ "cmpl", {"rlwl", 0x1d } }, -{ "bbc", {"rlvlbw", 0x1e } }, -{ "rei", {"", 0x20 } }, -{ "bneq", {"bb", 0x21 } }, -{ "bnequ", {"bb", 0x21 } }, -{ "cvtwl", {"rwwl", 0x23 } }, -{ "stf", {"wl", 0x26 } }, -{ "std", {"wq", 0x27 } }, -{ "subb2", {"rbmb", 0x28 } }, -{ "mcomb", {"rbwb", 0x29 } }, -{ "subw2", {"rwmw", 0x2a } }, -{ "mcomw", {"rwww", 0x2b } }, -{ "subl2", {"rlml", 0x2c } }, -{ "mcoml", {"rlwl", 0x2d } }, -{ "emul", {"rlrlrlwq", 0x2e } }, -{ "aoblss", {"rlmlbw", 0x2f } }, -{ "bpt", {"", 0x30 } }, -{ "beql", {"bb", 0x31 } }, -{ "beqlu", {"bb", 0x31 } }, -{ "cvtwb", {"rwwb", 0x33 } }, -{ "logf", {"", 0x35 } }, -{ "cmpf", {"rl", 0x36 } }, -{ "cmpd", {"rq", 0x37 } }, -{ "subb3", {"rbrbwb", 0x38 } }, -{ "bitb", {"rbrb", 0x39 } }, -{ "subw3", {"rwrwww", 0x3a } }, -{ "bitw", {"rwrw", 0x3b } }, -{ "subl3", {"rlrlwl", 0x3c } }, -{ "bitl", {"rlrl", 0x3d } }, -{ "ediv", {"rlrqwlwl", 0x3e } }, -{ "aobleq", {"rlmlbw", 0x3f } }, -{ "ret", {"", 0x40 } }, -{ "bgtr", {"bb", 0x41 } }, -{ "sqrtf", {"", 0x45 } }, -{ "cmpf2", {"rl", 0x46 } }, -{ "cmpd2", {"rqrq", 0x47 } }, -{ "shll", {"rbrlwl", 0x48 } }, -{ "clrb", {"wb", 0x49 } }, -{ "shlq", {"rbrqwq", 0x4a } }, -{ "clrw", {"ww", 0x4b } }, -{ "mull2", {"rlml", 0x4c } }, -{ "clrl", {"wl", 0x4d } }, -{ "shal", {"rbrlwl", 0x4e } }, -{ "bleq", {"bb", 0x51 } }, -{ "expf", {"", 0x55 } }, -{ "tstf", {"", 0x56 } }, -{ "tstd", {"", 0x57 } }, -{ "shrl", {"rbrlwl", 0x58 } }, -{ "tstb", {"rb", 0x59 } }, -{ "shrq", {"rbrqwq", 0x5a } }, -{ "tstw", {"rw", 0x5b } }, -{ "mull3", {"rlrlwl", 0x5c } }, -{ "tstl", {"rl", 0x5d } }, -{ "shar", {"rbrlwl", 0x5e } }, -{ "bbssi", {"rlmlbw", 0x5f } }, -{ "ldpctx", {"", 0x60 } }, -{ "pushd", {"", 0x67 } }, -{ "incb", {"mb", 0x69 } }, -{ "incw", {"mw", 0x6b } }, -{ "divl2", {"rlml", 0x6c } }, -{ "incl", {"ml", 0x6d } }, -{ "cvtlb", {"rlwb", 0x6f } }, -{ "svpctx", {"", 0x70 } }, -{ "jmp", {"ab", 0x71 } }, -{ "cvlf", {"rl", 0x76 } }, -{ "cvld", {"rl", 0x77 } }, -{ "decb", {"mb", 0x79 } }, -{ "decw", {"mw", 0x7b } }, -{ "divl3", {"rlrlwl", 0x7c } }, -{ "decl", {"ml", 0x7d } }, -{ "cvtlw", {"rlww", 0x7f } }, -{ "bgeq", {"bb", 0x81 } }, -{ "movs2", {"abab", 0x82 } }, -{ "cvfl", {"wl", 0x86 } }, -{ "cvdl", {"wl", 0x87 } }, -{ "orb2", {"rbmb", 0x88 } }, -{ "cvtbl", {"rbwl", 0x89 } }, -{ "orw2", {"rwmw", 0x8a } }, -{ "bispsw", {"rw", 0x8b } }, -{ "orl2", {"rlml", 0x8c } }, -{ "adwc", {"rlml", 0x8d } }, -{ "adda", {"rlml", 0x8e } }, -{ "blss", {"bb", 0x91 } }, -{ "cmps2", {"abab", 0x92 } }, -{ "ldfd", {"rl", 0x97 } }, -{ "orb3", {"rbrbwb", 0x98 } }, -{ "cvtbw", {"rbww", 0x99 } }, -{ "orw3", {"rwrwww", 0x9a } }, -{ "bicpsw", {"rw", 0x9b } }, -{ "orl3", {"rlrlwl", 0x9c } }, -{ "sbwc", {"rlml", 0x9d } }, -{ "suba", {"rlml", 0x9e } }, -{ "bgtru", {"bb", 0xa1 } }, -{ "cvdf", {"", 0xa6 } }, -{ "andb2", {"rbmb", 0xa8 } }, -{ "movzbl", {"rbwl", 0xa9 } }, -{ "andw2", {"rwmw", 0xaa } }, -{ "loadr", {"rwal", 0xab } }, -{ "andl2", {"rlml", 0xac } }, -{ "mtpr", {"rlrl", 0xad } }, -{ "ffs", {"rlwl", 0xae } }, -{ "blequ", {"bb", 0xb1 } }, -{ "negf", {"", 0xb6 } }, -{ "negd", {"", 0xb7 } }, -{ "andb3", {"rbrbwb", 0xb8 } }, -{ "movzbw", {"rbww", 0xb9 } }, -{ "andw3", {"rwrwww", 0xba } }, -{ "storer", {"rwal", 0xbb } }, -{ "andl3", {"rlrlwl", 0xbc } }, -{ "mfpr", {"rlwl", 0xbd } }, -{ "ffc", {"rlwl", 0xbe } }, -{ "calls", {"rbab", 0xbf } }, -{ "prober", {"rbabrl", 0xc0 } }, -{ "bvc", {"bb", 0xc1 } }, -{ "movs3", {"ababrw", 0xc2 } }, -{ "movzwl", {"rwwl", 0xc3 } }, -{ "addf", {"rl", 0xc6 } }, -{ "addd", {"rq", 0xc7 } }, -{ "xorb2", {"rbmb", 0xc8 } }, -{ "movob", {"rbwb", 0xc9 } }, -{ "xorw2", {"rwmw", 0xca } }, -{ "movow", {"rwww", 0xcb } }, -{ "xorl2", {"rlml", 0xcc } }, -{ "movpsl", {"wl", 0xcd } }, -{ "kcall", {"rw", 0xcf } }, -{ "probew", {"rbabrl", 0xd0 } }, -{ "bvs", {"bb", 0xd1 } }, -{ "cmps3", {"ababrw", 0xd2 } }, -{ "subf", {"rq", 0xd6 } }, -{ "subd", {"rq", 0xd7 } }, -{ "xorb3", {"rbrbwb", 0xd8 } }, -{ "pushb", {"rb", 0xd9 } }, -{ "xorw3", {"rwrwww", 0xda } }, -{ "pushw", {"rw", 0xdb } }, -{ "xorl3", {"rlrlwl", 0xdc } }, -{ "pushl", {"rl", 0xdd } }, -{ "insque", {"abab", 0xe0 } }, -{ "bcs", {"bb", 0xe1 } }, -{ "bgequ", {"bb", 0xe1 } }, -{ "mulf", {"rq", 0xe6 } }, -{ "muld", {"rq", 0xe7 } }, -{ "mnegb", {"rbwb", 0xe8 } }, -{ "movab", {"abwl", 0xe9 } }, -{ "mnegw", {"rwww", 0xea } }, -{ "movaw", {"awwl", 0xeb } }, -{ "mnegl", {"rlwl", 0xec } }, -{ "moval", {"alwl", 0xed } }, -{ "remque", {"ab", 0xf0 } }, -{ "bcc", {"bb", 0xf1 } }, -{ "blssu", {"bb", 0xf1 } }, -{ "divf", {"rq", 0xf6 } }, -{ "divd", {"rq", 0xf7 } }, -{ "movblk", {"alalrw", 0xf8 } }, -{ "pushab", {"ab", 0xf9 } }, -{ "pushaw", {"aw", 0xfb } }, -{ "casel", {"rlrlrl", 0xfc } }, -{ "pushal", {"al", 0xfd } }, -{ "callf", {"rbab", 0xfe } }, -{ "" , "" } /* empty is end sentinel */ - -}; diff --git a/gdb/tdesc.c b/gdb/tdesc.c deleted file mode 100755 index 4a38649..0000000 --- a/gdb/tdesc.c +++ /dev/null @@ -1,1650 +0,0 @@ -/* This file has been modified by Data General Corporation, November 1989. */ - -/* -This file provides an abstract interface to "tdesc" information. - It is designed to be used in a uniform manner by several kinds - of debuggers: - (1) code in live debugged process (e.g., a traceback routine) - (2) a separate-process debugger debugging a live process - (3) a separate-process debugger debugging a memory dump - - Dcontext model notes - * captures machine context - * partial: excludes memory - * frames - * kinds - * make one for starters, chain in reverse order to previous ones - * representation: pointer to opaque - * alloc/free protocol - - Overall model - * access functions - * handle - * error handling -*/ - - - -typedef int dc_boolean_t; /* range 0 .. 1 */ -#define DC_FALSE 0 -#define DC_TRUE 1 - - -typedef int dc_tristate_t; /* range 0 .. 2 */ -#define DC_NO 0 -#define DC_YES 1 -#define DC_MAYBE 2 - - -/* - A word is 32 bits of information. In memory, a word is word-aligned. - - A common and important use of dc_word_t is to represent values in the - target process, including (byte) addresses in the target process. - In this case, C arithmetic can be used to simulate machine address - arithmetic on the target. (Unsigned arithmetic is actually modulus - arithmetic.) -*/ -typedef unsigned int dc_word_t; - - -/* These bit operations number bits from 0 at the least significant end. */ -#define bit_test(word,bit) ((word) & (1 << (bit))) /* returns 0 or other */ -#define bit_value(word,bit) (((word) >> (bit)) & 1) /* returns 0 or 1 */ -#define bit_set(word,bit) ((word) |= (1 << (bit))) -#define bit_clear(word,bit) ((word) &= ~(1 << (bit))) -#define bit_assign(word, bit, bool) \ - if (bool) bit_set(word, bit); else bit_clear(word, bit) - - -/*----------------*/ - - -/* The exactness of locations may not be certainly known. */ -typedef dc_tristate_t dc_exactness_t; - - -/* - The model includes five kinds of contexts. Because each context - has an associated region and frame, these describe region kinds - and frame kinds as well. - [more description needed] - Currently, only call contexts exist. -*/ - -typedef int dc_kind_t; /* range 0 .. 4 */ -#define DC_CALL_KIND 0 -#define DC_SAVE_KIND 1 -#define DC_EXCEPTION_KIND 2 -#define DC_PROTECTION_KIND 3 -#define DC_SPECIAL_KIND 4 -#define DC_NUM_KINDS 5 - -#define DC_MIO_ENTRY_POINT (1<< 0) -#define DC_MIO_PROLOGUE_END (1<< 1) -#define DC_MIO_EPILOGUE_START (1<< 2) -#define DC_MIO_IMPLICIT_PROLOGUE_END (1<<16) -#define DC_MIO_LITERAL_ENTRY_POINT (1<<17) -#define DC_MIO_LITERAL_EPILOGUE_START (1<<18) - -#define DC_MII_PRECEDING_TDESC_END (1<<0) -#define DC_MII_FOLLOWING_TDESC_START (1<<1) - -typedef struct dc_debug_info { - unsigned int protocol; /* 1 for this structure */ - dc_word_t tdesc_ptr; - unsigned int text_words_count; - dc_word_t text_words_ptr; - unsigned int data_words_count; - dc_word_t data_words_ptr; -} dc_debug_info_t; - - -typedef struct tdesc_hdr { - unsigned int map_protocol; /* 1 for this structure */ - unsigned int end; /* address beyond end */ -} tdesc_hdr_t; - - -typedef struct tdesc_chunk_hdr { - int zeroes : 8; - int info_length : 22; - int info_alignment : 2; - unsigned int info_protocol; - dc_word_t start_address; - dc_word_t end_address; -} tdesc_chunk_hdr_t; - - -typedef struct tdesc_chunk_info1 { - int variant : 8; /* 1 for this structure */ - int register_save_mask : 17; - int pad1 : 1; - int return_address_info_discriminant : 1; - int frame_address_register : 5; - unsigned int frame_address_offset; - unsigned int return_address_info; - unsigned int register_save_offset; -} tdesc_chunk_info1_t; - - -typedef struct tdesc_chunk1 { - tdesc_chunk_hdr_t hdr; - tdesc_chunk_info1_t info; -} tdesc_chunk1_t; - - -typedef struct dc_mstate { - dc_word_t reg[32]; /* general registers */ - dc_word_t xip; - dc_word_t nip; - dc_word_t fip; - dc_word_t fpsr; - dc_word_t fpcr; - dc_word_t psr; -} dc_mstate_t; - - -typedef struct dc_map_info_in { - dc_word_t flags; - dc_word_t preceding_tdesc_end; - dc_word_t following_tdesc_start; -} dc_map_info_in_t; - - -typedef struct dc_map_info_out { - dc_word_t flags; - dc_word_t entry_point; - dc_word_t prologue_end; - dc_word_t epilogue_start; -} dc_map_info_out_t; - - -#if 0 - - void error_fcn (env, continuable, message) - dc_word_t env; /* environment (arbitrary datum) */ - dc_boolean_t continuable; /* whether error function may return */ - char *message; /* string (no trailing newline) */ - - /* In the future, we probably want the error_fcn to be: */ - void error_fcn (env, continuable, code, ...) - dc_word_t env; /* environment (arbitrary datum) */ - dc_boolean_t continuable; /* whether error function may return */ - int code; /* error code */ - ... /* parameters to message associated - with the code */ - - void read_fcn (env, memory, length, buffer) - dc_word_t env; /* environment (arbitrary datum) */ - dc_word_t memory; /* start address in image */ - int length; /* in bytes */ - char *buffer; /* start address of buffer */ - /* There are no alignment assumptions for the read function. */ - - void write_fcn (env, memory, length, buffer) - dc_word_t env; /* environment (arbitrary datum) */ - dc_word_t memory; /* start address in image */ - int length; /* in bytes */ - char *buffer; /* start address of buffer */ - /* There are no alignment assumptions for the write function. */ - /* The write function is optional. It must be provided if changes - to writable registers are to be made. */ - - void exec_fcn (env, mstate) - dc_word_t env; /* environment (arbitrary datum) */ - dc_mstate_t *mstate; /* machine state (read-write) */ - /* The execute function is optional. It would be used (in the future) - by the implementation of a procedurally specified tdesc mechanism. */ - -#endif - -/*----------------*/ - - -#ifndef NULL -#define NULL ((void *) 0) -#endif - -extern char *malloc(); -extern char *calloc(); -extern void qsort(); - - -/* - At initialization, create a tdesc table from the tdesc info. - A tdesc table is simply a sorted array of tdesc elements. - A tdesc element is the last 6 words of the tdesc chunk. - We require that all tdesc chunks have info protocol 1. -*/ - -typedef struct tdesc_elem { - dc_word_t start_address; - dc_word_t end_address; - tdesc_chunk_info1_t info; -} tdesc_elem_t; - -typedef tdesc_elem_t *tdesc_table_t; - -void dc_correct_cr_data(); - -int dc_compare_tdesc_elems (elem1, elem2) - char *elem1, *elem2; -{ - dc_word_t s1, s2, e1, e2; - s1 = ((tdesc_elem_t *) elem1)->start_address; - s2 = ((tdesc_elem_t *) elem2)->start_address; - if (s1 < s2) return -1; - if (s1 > s2) return 1; - e1 = ((tdesc_elem_t *) elem1)->end_address; - e2 = ((tdesc_elem_t *) elem2)->end_address; - if (e1 < e2) return -1; - if (e1 > e2) return 1; - return 0; -} - - -typedef struct handle_info { - dc_word_t debug_info_ptr; - void (*error_fcn)(); - dc_word_t error_env; - void (*read_fcn)(); - dc_word_t read_env; - void (*write_fcn)(); /* NULL => absent */ - dc_word_t write_env; - void (*exec_fcn)(); /* NULL => absent */ - dc_word_t exec_env; - void (*map_fcn)(); /* NULL => absent */ - dc_word_t map_env; - tdesc_table_t tdesc_table; - int tdesc_table_size; -} handle_info_t; - -typedef handle_info_t *dc_handle_t; - - -/* - Errors detected in this module are funnelled through dc_error or dc_warn, - as appropriate. Both routines call dc_exception, which invokes the error - handler supplied by the user. - - Currently, dc_exception substitutes parameters into the message given - it and passes the resulting string to the user error handler. - In the future, dc_exception should simply pass an error code and - the parameters on to the user error handler. -*/ - -#include -extern int vsprintf(); - -/* Exit status for exception-processing machinery failure */ -#define DC_EXCEPTION_FAILURE 250 - -void dc_exception(continuable, args) - dc_boolean_t continuable; - va_list args; -{ - dc_handle_t handle; - char *format; - char buffer[1024]; - - handle = va_arg(args, dc_handle_t); - format = va_arg(args, char *); - (void) vsprintf(buffer, format, args); - (*(handle->error_fcn)) (handle->error_env, continuable, buffer); - if (!continuable) - exit(DC_EXCEPTION_FAILURE); /* User error handler should never return in this case. */ -} - - -void dc_error(va_alist) /* (handle, format, args... ) */ - va_dcl -{ - va_list args; - - va_start(args); - dc_exception(DC_FALSE, args); - va_end(args); -} - - -void dc_warn(va_alist) /* (handle, format, args... ) */ - va_dcl -{ - va_list args; - - va_start(args); - dc_exception(DC_TRUE, args); - va_end(args); -} - - - -#define MALLOC_FAILURE_MESSAGE "Heap space exhausted (malloc failed)." -#define CALLOC_FAILURE_MESSAGE "Heap space exhausted (Calloc failed)." - - -/* Commonize memory allocation call so failure diagnosis is easier */ - -char* dc_malloc( handle, size ) - dc_handle_t handle; - int size; -{ - char* space = malloc( size ); - if (space == (char *)NULL) - dc_error( handle, MALLOC_FAILURE_MESSAGE ); - - return space; -} - - -/* Commonize memory allocation call so failure diagnosis is easier */ - -char* dc_calloc( handle,nelem, size ) - dc_handle_t handle; - int nelem; - int size; -{ - char* space = calloc( nelem, size ); - if (space == (char *)NULL) - dc_error( handle, CALLOC_FAILURE_MESSAGE ); - - return space; -} - - -dc_word_t dc_read_word (handle, address) - dc_handle_t handle; - dc_word_t address; -{ - dc_word_t word; - (*(handle->read_fcn)) (handle->read_env, address, - sizeof(dc_word_t), (char *)(&(word))); - return word; -} - - -void dc_write_word (handle, address, value) - dc_handle_t handle; - dc_word_t address; - dc_word_t value; -{ - dc_word_t word; - word = value; - if (handle->write_fcn) { - (*(handle->write_fcn)) (handle->write_env, address, - sizeof(dc_word_t), (char *)(&(word))); - } else { - dc_error (handle, "Writing is disabled."); - } -} - - -void dc_write_masked_word (handle, address, mask, value) - dc_handle_t handle; - dc_word_t address; - dc_word_t mask; - dc_word_t value; -{ - dc_write_word (handle, address, - (value & mask) | (dc_read_word(handle, address) & ~mask)); -} - - -dc_handle_t dc_initiate (debug_info_ptr, - error_fcn, error_env, - read_fcn, read_env, - write_fcn, write_env, - exec_fcn, exec_env, - map_fcn, map_env) - dc_word_t debug_info_ptr; - void (*error_fcn)(); - dc_word_t error_env; - void (*read_fcn)(); - dc_word_t read_env; - void (*write_fcn)(); /* NULL => absent */ - dc_word_t write_env; - void (*exec_fcn)(); /* NULL => absent */ - dc_word_t exec_env; - void (*map_fcn)(); /* NULL => absent */ - dc_word_t map_env; - /* write_fcn may be given as NULL if no writing is required. */ - /* exec_fcn may be given as NULL if no execution is required. - Currently, no execution is required. It would be if the - implementation needed to invoke procedures in the debugged process. */ -{ - dc_handle_t handle; - unsigned int debug_info_protocol; - dc_debug_info_t debug_info; - unsigned int tdesc_map_protocol; - tdesc_hdr_t tdesc_hdr; - dc_word_t tdesc_info_start; - dc_word_t tdesc_info_end; - dc_word_t tdesc_info_length; - - /* Set up handle enough for dc_error. */ - handle = (dc_handle_t) malloc(sizeof(handle_info_t)); - /* Cant use dc_malloc() as handle is being created ... */ - /* if (handle == NULL) (*error_fcn)( error_env, MALLOC_FAILURE_MESSAGE ) */ - handle->error_fcn = error_fcn; - handle->error_env = error_env; - handle->read_fcn = read_fcn; - handle->read_env = read_env; - handle->write_fcn = write_fcn; - handle->write_env = write_env; - handle->exec_fcn = exec_fcn; - handle->exec_env = exec_env; -/****************************************************************/ -/* BUG 9/19/89 Found by hls. Map functions not initialized. */ -/****************************************************************/ - handle->map_fcn = map_fcn; - handle->map_env = map_env; - handle->debug_info_ptr = debug_info_ptr; - handle->tdesc_table = (tdesc_table_t)NULL; - - /* Find tdesc info. */ - if (debug_info_ptr) { - (*read_fcn) (read_env, debug_info_ptr, sizeof(unsigned int), - (char *)(&debug_info_protocol)); - if (debug_info_protocol != 1) - dc_error (handle, "Unrecognized debug info protocol: %d", - debug_info_protocol); - (*read_fcn) (read_env, debug_info_ptr, sizeof(dc_debug_info_t), - (char *)(&debug_info)); - (*read_fcn) (read_env, debug_info.tdesc_ptr, sizeof(unsigned int), - (char *)(&tdesc_map_protocol)); - if (tdesc_map_protocol != 1) - dc_error (handle, "Unrecognized tdesc map protocol: %d", - tdesc_map_protocol); - (*read_fcn) (read_env, debug_info.tdesc_ptr, sizeof(tdesc_hdr_t), - (char *)(&tdesc_hdr)); - tdesc_info_start = debug_info.tdesc_ptr + sizeof(tdesc_hdr_t); - tdesc_info_end = tdesc_hdr.end; - tdesc_info_length = tdesc_info_end - tdesc_info_start; - - /* Create tdesc table from tdesc info. */ - { - /* Over-allocate in order to avoid second pass over tdesc info. */ - tdesc_table_t tt = (tdesc_table_t) dc_malloc(handle, tdesc_info_length); - dc_word_t p = tdesc_info_start; - dc_word_t q = tdesc_info_end - sizeof(tdesc_chunk1_t); - int n = 0; - tdesc_chunk1_t chunk; - dc_word_t start_address, end_address; - int i; - - for (; p <= q; ) { - (*read_fcn) (read_env, p, sizeof(tdesc_chunk1_t), (char *)(&chunk)); - if (chunk.hdr.zeroes != 0) { - /* Skip padding. */ - p += sizeof(dc_word_t); - continue; - } - if (chunk.hdr.info_protocol != 1) { - dc_warn (handle, "Unrecognized tdesc info protocol: %d", - chunk.hdr.info_protocol); - goto next_chunk; - } - if (chunk.hdr.info_length != 16) { - dc_warn (handle, "Incorrect tdesc info length: %d", - chunk.hdr.info_length); - goto next_chunk; - } - if (chunk.hdr.info_alignment > 2) { - dc_warn (handle, "Incorrect tdesc info alignment: %d", - chunk.hdr.info_alignment); - goto next_chunk; - } - start_address = chunk.hdr.start_address; - end_address = chunk.hdr.end_address; - if ((start_address&3)!=0) { - dc_warn (handle, - "Tdesc start address is not word-aligned: %#.8X", - start_address); - goto next_chunk; - } - if ((end_address&3)!=0) { - dc_warn (handle, - "Tdesc end address is not word-aligned: %#.8X", - end_address); - goto next_chunk; - } - if (start_address > end_address) { - /* Note that the range may be null. */ - dc_warn (handle, - "Tdesc start address (%#.8X) follows end address (%#.8X).", - start_address, end_address); - goto next_chunk; - } - if (chunk.info.variant != 1) { - dc_warn (handle, "Invalid tdesc chunk variant: %d", - chunk.info.variant); - goto next_chunk; - } - if (chunk.info.pad1 != 0) { - dc_warn (handle, "Tdesc chunk padding is not zero."); - goto next_chunk; - } - if (chunk.info.return_address_info_discriminant != 0) { - if ((chunk.info.return_address_info & 3) != 0) { - dc_warn (handle, - "Tdesc return address offset is not word-aligned: %#.8X", - chunk.info.return_address_info); - goto next_chunk; - } - } else { - if ((chunk.info.return_address_info & ~31) != 0) { - dc_warn (handle, - "Invalid tdesc return address register: %d", - chunk.info.return_address_info); - goto next_chunk; - } - } - if ((chunk.info.register_save_offset & 3) != 0) { - dc_warn (handle, - "Tdesc register save offset is not word-aligned: %#.8X", - chunk.info.register_save_offset); - goto next_chunk; - } - - tt[n].start_address = start_address; - tt[n].end_address = end_address; - tt[n].info = chunk.info; - n++; - - next_chunk: - p += sizeof(tdesc_chunk1_t); - } - /* Leftover (less than a tdesc_chunk1_t in size) is padding or - in error. Ignore it in either case. */ - - if (n != 0) { - - /* Sort table by start address. */ - qsort ((char *)tt, n, sizeof(tdesc_elem_t), dc_compare_tdesc_elems); - - /* Check for overlap among tdesc chunks. */ - for (i=0; i<(n-1); i++) { - if (tt[i].end_address > tt[i+1].start_address) - dc_error (handle, "Text chunks overlap."); - } - } - - /* Finish setting up handle. */ - handle->tdesc_table = tt; - handle->tdesc_table_size = n; - } - } else { - handle->tdesc_table_size = 0; - } - - return (dc_handle_t) handle; -} - - -void dc_terminate (handle) - dc_handle_t handle; -{ - if (((dc_handle_t)handle)->tdesc_table) { - free((char *)(((dc_handle_t)handle)->tdesc_table)); - } - free((char *)handle); -} - - - -/* - - Dcontext Model - - For each interesting register (word-sized piece of machine state), - a word of value information is kept. This word may - be either the value of the register, or the address in - subject memory where the value can be found (and changed). In - addition, the register may be invalid (in which case the value - information is undefined). These three cases are encoded for - a given register in the same-numbered bit of two words of flags: - - flags[0] bit flags[1] bit meaning - ------------ ------------ ------- - 0 0 register is invalid; info is undefined - 0 1 register is readable; info is value - 1 0 register is writable; info is address - 1 1 (reserved) - - The general registers (r0-r31) are handled by reg_info and - reg_flags. The bit number for a register is that register's number. - The other registers are grouped together for convenience and are - handled by aux_info and aux_flags. The bit numbers for these - registers are: - - bit number register - ---------- -------- - 0 location - 1 SXIP - 2 SNIP - 3 SFIP - 4 FPSR - 5 FPCR - - The SXIP, SNIP, and SFIP are the exception-time values of the - XIP, NIP, and FIP registers. They are valid only in the topmost frame. - (That is, in any context obtained from dc_previous_context, they - are invalid.) - - "location" is a pseudo-register of this model and represents the - location of the context. It is always valid. It also has an - exactness associated with it. The location and its exactness of a - context obtained from dc_previous_context are taken from the - return address and its exactness of the context given as an argument - to dc_previous_context. - - The following model is recommended for dealing with the partial - redundancy between location and the SXIP, SNIP, and SFIP values - in the topmost frame. The location should be set to either the - SNIP or SXIP value, and its exactness should be set to DC_NO. A - change to the register whose value the location is set to should - be accompanied by an identical change to the location. - - The PSR is handled separately, because it is a diverse collection - of flags. The PSR, as a whole, is always valid. A separate - psr_ind flag tells whether the psr_info data is a value or - an address. Each bit of the PSR has its own pair of flag bits to - mark validity and writability. - -*/ - - -/* The following value means "other", because state is stored in 2 bits. */ -#define DC_RESERVED 3 - - -#define RSTATE(flags, bit) \ - ((bit_value((flags)[0], bit) << 1) + bit_value((flags)[1], bit)) - -#define REG_STATE(dcontext, reg) RSTATE(dcontext->reg_flags, reg) -#define AUX_STATE(dcontext, reg) RSTATE(dcontext->aux_flags, reg) -#define PSR_STATE(dcontext, reg) RSTATE(dcontext->psr_flags, reg) - - -#define SET_INVALID(flags, bit) \ - { bit_clear ((flags)[0], bit); bit_clear ((flags)[1], bit); } - -#define SET_READABLE(flags, bit) \ - { bit_clear ((flags)[0], bit); bit_set ((flags)[1], bit); } - -#define SET_WRITABLE(flags, bit) \ - { bit_set ((flags)[0], bit); bit_clear ((flags)[1], bit); } - -#define ASSIGN_RSTATE(to_flags, to_bit, from_flags, from_bit) \ - { bit_assign ((to_flags)[0], to_bit, bit_value((from_flags)[0], from_bit));\ - bit_assign ((to_flags)[1], to_bit, bit_value((from_flags)[1], from_bit));} - - -#define CHECK_REG_READ(dcontext, reg) \ - if (REG_STATE(dcontext, reg) == DC_INVALID) \ - dc_error (dcontext->handle, \ - "General register %d is not readable.", reg) - -#define CHECK_REG_WRITE(dcontext, reg) \ - if (REG_STATE(dcontext, reg) != DC_WRITABLE) \ - dc_error (dcontext->handle, \ - "General register %d is not writable.", reg) - -#define CHECK_AUX_READ(dcontext, reg) \ - if (AUX_STATE(dcontext, reg) == DC_INVALID) \ - dc_error (dcontext->handle, \ - "Auxiliary register %d is not readable.", reg) - -#define CHECK_AUX_WRITE(dcontext, reg) \ - if (AUX_STATE(dcontext, reg) != DC_WRITABLE) \ - dc_error (dcontext->handle, \ - "Auxiliary register %d is not writable.", reg) - - - -#define DC_REG_RA 1 -#define DC_REG_FP 30 -#define DC_REG_SP 31 -#define DC_NUM_REG 32 - -#define DC_AUX_LOC 0 - /* DC_AUX_LOC must be first, with value 0 */ -#define DC_AUX_SXIP 1 -#define DC_AUX_SNIP 2 -#define DC_AUX_SFIP 3 -#define DC_AUX_FPSR 4 -#define DC_AUX_FPCR 5 -#define DC_NUM_AUX 6 - - - -#define CHECK_REG(dcontext, reg) \ - if ((reg < 0) || (reg >= DC_NUM_REG)) \ - dc_error (dcontext->handle, \ - "Bad general register number: %d", reg) - -#define CHECK_AUX(dcontext, reg) \ - if ((reg < 1) || (reg >= DC_NUM_AUX)) \ - dc_error (dcontext->handle, \ - "Bad auxiliary register number: %d", reg) - /* CHECK_AUX is not used for location pseudo-register. */ - -#define CHECK_BIT(dcontext, bit) \ - if ((bit < 0) || (bit >= 32)) \ - dc_error (dcontext->handle, \ - "Bad bit number: %d", bit) - - - -typedef struct cr_value { - int reg; - unsigned int off; - } dc_cr_value_t; - -#define DC_UNDEF 32 - -/* - A "dc_cr_value" represents an execution-time value symbolically, in - terms of the initial value of a register (the value on entry to - the procedure being analyzed) and a known offset. A value with - a 'reg' field value of 0 through 31 represents the value obtained - by summing (using 32-bit modulus arithmetic) the initial value of - register 'reg' and the value 'off'. Note that the value (0,k) - represents the constant value k, that (31,0) represents the CFA, and - that (1,0) represents the return address. A value with a 'reg' field - of DC_UNDEF represents an indeterminable value; in this case the - 'off' field is undefined. Other values of 'reg' are erroneous. -*/ - -typedef struct cr_data { - dc_cr_value_t reg_val[DC_NUM_REG]; - dc_word_t saved; - dc_word_t how; - unsigned int where[DC_NUM_REG]; -} dc_cr_data_t; - -/* - 'cr_data' collects all the information needed to represent the - symbolic machine state during code reading. - - The 'reg_val' array gives the current dc_cr_value for each register. - - The 'saved', 'how', and 'where' fields combine to describe what - registers have been saved, and where. The 'saved' and 'how' fields - are implicitly bit arrays over 0..31, where the numbering is from - 0 on the right. (Hence, 1<handle, dcontext->reg_info, dcontext->reg_flags, reg) - -#define SET_REG_VALUE(dcontext, reg, value) \ - dc_set_value(dcontext->handle, dcontext->reg_info, dcontext->reg_flags, reg, \ - value) - -#define GET_AUX_VALUE(dcontext, reg) \ - dc_get_value(dcontext->handle, dcontext->aux_info, dcontext->aux_flags, reg) - -#define SET_AUX_VALUE(dcontext, reg, value) \ - dc_set_value(dcontext->handle, dcontext->aux_info, dcontext->aux_flags, reg, \ - value) - - - -void dc_check_dcontext (dc) - dc_dcontext_t dc; - /* Check consistency of information supplied to make a dcontext. */ -{ - int i; - - if ((REG_STATE(dc, 0) != DC_READABLE) || (dc->reg_info[0] != 0)) - dc_error (dc->handle, "Register 0 is misspecified"); - for (i = 1; i < DC_NUM_REG; i++) - if (REG_STATE(dc, i) == DC_RESERVED) - dc_error (dc->handle, - "State for general register %d is incorrect", i); - for (i = 0; i < DC_NUM_AUX; i++) - if (AUX_STATE(dc, i) == DC_RESERVED) - dc_error (dc->handle, - "State for auxiliary register %d is incorrect", i); - if (AUX_STATE(dc, DC_AUX_LOC) == DC_INVALID) - dc_error (dc->handle, "Location is specified as invalid"); - if (GET_AUX_VALUE(dc, DC_AUX_LOC) == 0) - dc_error (dc->handle, "Location is zero."); - if (dc->loc_exact >= 3) - dc_error (dc->handle, "Location exactness is incorrectly specified: %d", - dc->loc_exact); - if (dc->psr_ind >= 2) - dc_error (dc->handle, - "PSR indirection flag is incorrectly specified: %d", - dc->psr_ind); - for (i = 0; i < 32; i++) - if (PSR_STATE(dc, i) == DC_RESERVED) - dc_error (dc->handle, "State for PSR bit %d is incorrect", i); -} - - - -tdesc_elem_t * dc_tdesc_lookup (loc, tt, tt_size, map_info_in_ptr) - dc_word_t loc; - tdesc_table_t tt; - int tt_size; - dc_map_info_in_t *map_info_in_ptr; - /* Return address of tdesc_elem_t for given location, or NULL if - there is no tdesc chunk for the location. - */ -{ - int l = 0; - int h = tt_size; - int m; - - if (tt_size == 0) { - map_info_in_ptr->flags = 0; - return (tdesc_elem_t *)NULL; - } - for (;;) { - m = (l + h) / 2; - if (m == l) break; - if (loc >= tt[m].start_address) - l = m; - else - h = m; - } - if (loc >= tt[m].end_address) { - map_info_in_ptr->preceding_tdesc_end = tt[m].end_address; - if (m+1 < tt_size) { - map_info_in_ptr->following_tdesc_start = tt[m+1].start_address; - map_info_in_ptr->flags = DC_MII_PRECEDING_TDESC_END | - DC_MII_FOLLOWING_TDESC_START; - } else { - map_info_in_ptr->flags = DC_MII_PRECEDING_TDESC_END; - } - return (tdesc_elem_t *)NULL; - } else if (loc < tt[m].start_address) { - map_info_in_ptr->following_tdesc_start = tt[m].start_address; - map_info_in_ptr->flags = DC_MII_FOLLOWING_TDESC_START; - return (tdesc_elem_t *)NULL; - } else { - return (&tt[m]); - } -} - - - -dc_dcontext_t dc_make_dcontext (handle, - reg_info, reg_flags, - aux_info, aux_flags, loc_exact, - psr_info, psr_ind, psr_flags) - dc_handle_t handle; - dc_word_t reg_info[DC_NUM_REG]; - dc_word_t reg_flags[2]; - dc_word_t aux_info[DC_NUM_AUX]; - dc_word_t aux_flags[2]; - dc_exactness_t loc_exact; - dc_word_t psr_info; - dc_boolean_t psr_ind; - dc_word_t psr_flags[2]; -{ - dc_dcontext_t dc = (dc_dcontext_t) dc_malloc (handle, sizeof(dcontext_info_t)); - int i; - dc_map_info_in_t map_info_in; - - /* Fill in supplied content. */ - dc->handle = ((dc_handle_t)handle); - for (i = 0; i < DC_NUM_REG; i++) dc->reg_info[i] = reg_info[i]; - for (i = 0; i < 2; i++) dc->reg_flags[i] = reg_flags[i]; - for (i = 0; i < DC_NUM_AUX; i++) dc->aux_info[i] = aux_info[i]; - for (i = 0; i < 2; i++) dc->aux_flags[i] = aux_flags[i]; - dc->loc_exact = loc_exact; - dc->psr_info = psr_info; - dc->psr_ind = psr_ind; - for (i = 0; i < 2; i++) dc->psr_flags[i] = psr_flags[i]; - - dc_check_dcontext(dc); - - /* Find tdesc information for the text chunk. */ - { -/***************************************************************/ -/* BUG 8/16/89 Found by hls. Not zeroing EV bits of location. */ -/* SHOULD USE dc_location()! */ -/* dc_word_t loc = GET_AUX_VALUE(dc, DC_AUX_LOC); */ -/***************************************************************/ - dc_word_t loc = GET_AUX_VALUE(dc, DC_AUX_LOC) & ~3; - tdesc_elem_t *tep = - dc_tdesc_lookup(loc, ((dc_handle_t)handle)->tdesc_table, - ((dc_handle_t)handle)->tdesc_table_size,&map_info_in); - if (tep) { - dc->code_reading = 0; - dc->info_ptr.tdesc_elem_ptr = tep; - } else { - dc->code_reading = 1; - if (!dc->handle->map_fcn) { - dc_error (dc->handle, "No tdesc information for %#.8X and no map function supplied.",loc); - } -/****************************************************************/ -/* BUG 9/18/89 Found by hls. Not using dc_malloc() */ -/* dc->info_ptr.cr_data_ptr= (dc_cr_data_t *)malloc(sizeof(dc_cr_data_t )); */ -/****************************************************************/ - dc->info_ptr.cr_data_ptr= (dc_cr_data_t *)dc_calloc(dc->handle,1,sizeof(dc_cr_data_t )); - dc_read_code(loc,dc,map_info_in,dc->info_ptr.cr_data_ptr); - } - } - - return (dc_dcontext_t) dc; -} - - - -void dc_free_dcontext (dcontext) - dc_dcontext_t dcontext; -{ -/****************************************************************/ -/* BUG 9/19/89 Found by hls. Freeing non-pointer value. */ -/* free((char *)dcontext->code_reading); */ -/****************************************************************/ - if (dcontext->code_reading) - free((char *)dcontext->info_ptr.cr_data_ptr); - free((char *)dcontext); -} - - - -dc_register_state_t dc_location_state (dcontext) - dc_dcontext_t dcontext; -{ - return AUX_STATE(((dc_dcontext_t)dcontext), DC_AUX_LOC); -} - - -dc_exactness_t dc_location_exactness (dcontext) - dc_dcontext_t dcontext; -{ - return ((dc_dcontext_t)dcontext)->loc_exact; -} - - -dc_word_t dc_location (dcontext) - dc_dcontext_t dcontext; - /* Return high 30 bits only. */ -{ - /* Don't need: CHECK_AUX_READ (((dc_dcontext_t)dcontext), DC_AUX_LOC); */ - return GET_AUX_VALUE (((dc_dcontext_t)dcontext), DC_AUX_LOC) & ~3; -} - - -dc_boolean_t dc_location_in_text_chunk( dcontext, value ) - dc_dcontext_t dcontext; - dc_word_t value; -{ - /* Check that new location is still within same text chunk. */ - tdesc_elem_t *tep = ((dc_dcontext_t)dcontext)->info_ptr.tdesc_elem_ptr; -/********************************************************************/ -/* Bug in predicate -- LS adjusted according to OCS documentation.. */ -/* if ((value < tep->start_address) || (value >= tep->end_address))*/ -/********************************************************************/ - if ((value >= tep->start_address) && (value < tep->end_address)) - return DC_TRUE; - else - return DC_FALSE; - -} - - -void dc_set_location (dcontext, value) - dc_dcontext_t dcontext; - dc_word_t value; - /* Set high 30 bits only. */ -{ - if (dc_location_in_text_chunk( dcontext, value ) != DC_TRUE) - dc_warn (((dc_dcontext_t)dcontext)->handle, - "New location is not in same text chunk."); - - CHECK_AUX_WRITE (((dc_dcontext_t)dcontext), DC_AUX_LOC); - dc_write_masked_word (((dc_dcontext_t)dcontext)->handle, - ((dc_dcontext_t)dcontext)->aux_info[DC_AUX_LOC], ~3, value); -} - - - -dc_register_state_t dc_general_register_state (dcontext, reg) - dc_dcontext_t dcontext; - int reg; -{ - CHECK_REG (((dc_dcontext_t)dcontext), reg); - return REG_STATE(((dc_dcontext_t)dcontext), reg); -} - - -dc_word_t dc_general_register (dcontext, reg) - dc_dcontext_t dcontext; - int reg; -{ - CHECK_REG (((dc_dcontext_t)dcontext), reg); - CHECK_REG_READ (((dc_dcontext_t)dcontext), reg); - return GET_REG_VALUE(((dc_dcontext_t)dcontext), reg); -} - - -void dc_set_general_register (dcontext, reg, value) - dc_dcontext_t dcontext; - int reg; - dc_word_t value; -{ - CHECK_REG (((dc_dcontext_t)dcontext), reg); - CHECK_REG_WRITE (((dc_dcontext_t)dcontext), reg); - SET_REG_VALUE (((dc_dcontext_t)dcontext), reg, value); -} - - - -dc_register_state_t dc_auxiliary_register_state (dcontext, reg) - dc_dcontext_t dcontext; - int reg; -{ - CHECK_AUX (((dc_dcontext_t)dcontext), reg); - return AUX_STATE(((dc_dcontext_t)dcontext), reg); -} - - -dc_word_t dc_auxiliary_register (dcontext, reg) - dc_dcontext_t dcontext; - int reg; -{ - CHECK_AUX (((dc_dcontext_t)dcontext), reg); - CHECK_AUX_READ (((dc_dcontext_t)dcontext), reg); - return GET_AUX_VALUE(((dc_dcontext_t)dcontext), reg); -} - - -void dc_set_auxiliary_register (dcontext, reg, value) - dc_dcontext_t dcontext; - int reg; - dc_word_t value; -{ - CHECK_AUX (((dc_dcontext_t)dcontext), reg); - CHECK_AUX_WRITE (((dc_dcontext_t)dcontext), reg); - SET_AUX_VALUE (((dc_dcontext_t)dcontext), reg, value); -} - - - -dc_register_state_t dc_psr_register_bit_state (dcontext, bit) - dc_dcontext_t dcontext; - int bit; -{ - CHECK_BIT (((dc_dcontext_t)dcontext), bit); - return PSR_STATE(((dc_dcontext_t)dcontext), bit); -} - - -dc_word_t dc_psr_register (dcontext) - dc_dcontext_t dcontext; -{ - if (((dc_dcontext_t)dcontext)->psr_ind) { - return dc_read_word(((dc_dcontext_t)dcontext)->handle, - ((dc_dcontext_t)dcontext)->psr_info); - } else { - return ((dc_dcontext_t)dcontext)->psr_info; - } -} - - -void dc_set_psr_register (dcontext, mask, value) - dc_dcontext_t dcontext; - dc_word_t mask; - dc_word_t value; - /* Set bits of PSR corresponding to 1 bits in mask. */ -{ - if (((dc_dcontext_t)dcontext)->psr_ind) { - if (((((dc_dcontext_t)dcontext)->psr_flags[0] & mask) != mask) || - ((((dc_dcontext_t)dcontext)->psr_flags[1] & mask) != 0)) - dc_error (((dc_dcontext_t)dcontext)->handle, - "Some PSR bits specified are not writable."); - dc_write_masked_word (((dc_dcontext_t)dcontext)->handle, - ((dc_dcontext_t)dcontext)->psr_info, mask, value); - } else { - dc_error (((dc_dcontext_t)dcontext)->handle, "PSR is not writable."); - } -} - - - -dc_word_t dc_frame_address (dcontext) - dc_dcontext_t dcontext; -{ - if (!dcontext->code_reading) { - tdesc_elem_t *tep = ((dc_dcontext_t)dcontext)->info_ptr.tdesc_elem_ptr; - return dc_general_register(dcontext, - tep->info.frame_address_register) + tep->info.frame_address_offset; - } else { - if (dcontext->info_ptr.cr_data_ptr->reg_val[DC_REG_FP].reg == DC_REG_SP) { - return (dc_general_register(dcontext,DC_REG_FP) - - dcontext->info_ptr.cr_data_ptr->reg_val[DC_REG_FP].off); - } - if (dcontext->info_ptr.cr_data_ptr->reg_val[DC_REG_SP].reg == DC_REG_SP) { - return (dc_general_register(dcontext,DC_REG_SP) - - dcontext->info_ptr.cr_data_ptr->reg_val[DC_REG_SP].off); - } - dc_error (((dc_dcontext_t)dcontext)->handle, "Cannot locate frame pointer."); - } -} - - - -dc_kind_t dc_context_kind (dcontext) - dc_dcontext_t dcontext; -{ - return DC_CALL_KIND; -} - - - - -/* operations valid for call contexts only */ - - -dc_register_state_t dc_return_address_state (dcontext) - dc_dcontext_t dcontext; -{ - tdesc_elem_t *tep = ((dc_dcontext_t)dcontext)->info_ptr.tdesc_elem_ptr; - int reg; - - if (!dcontext->code_reading) { - if (tep->info.return_address_info_discriminant) { - return DC_WRITABLE; - } else { - return REG_STATE(((dc_dcontext_t)dcontext), tep->info.return_address_info); - } - } else { - reg= DC_REG_RA; - if (bit_test(dcontext->info_ptr.cr_data_ptr->saved,DC_REG_RA)) { - if (bit_test(dcontext->info_ptr.cr_data_ptr->how,DC_REG_RA)) { - return DC_WRITABLE; - } else { - reg= dcontext->info_ptr.cr_data_ptr->where[DC_REG_RA]; - } - } - return REG_STATE(((dc_dcontext_t)dcontext),reg); - - - } -} - - -dc_exactness_t dc_return_address_exactness (dcontext) - dc_dcontext_t dcontext; -{ - return DC_MAYBE; -} - - -dc_word_t dc_return_address (dcontext) - dc_dcontext_t dcontext; - /* Return high 30 bits only. */ -{ - tdesc_elem_t *tep = ((dc_dcontext_t)dcontext)->info_ptr.tdesc_elem_ptr; - dc_word_t rai = tep->info.return_address_info; - dc_word_t val; - int reg; - - if (!dcontext->code_reading) { - if (tep->info.return_address_info_discriminant) { - val = dc_read_word (((dc_dcontext_t)dcontext)->handle, - dc_frame_address(dcontext) + rai); - } else { - val = dc_general_register (dcontext, rai); - } - } else { - reg=DC_REG_RA; - if (bit_test(dcontext->info_ptr.cr_data_ptr->saved,reg)) { - if (bit_test(dcontext->info_ptr.cr_data_ptr->how,reg)) { - val = dc_read_word (((dc_dcontext_t)dcontext)->handle, - dc_frame_address(dcontext) + - (dcontext->info_ptr.cr_data_ptr->where[reg])); - } else { - reg= dcontext->info_ptr.cr_data_ptr->where[DC_REG_RA]; - val = dc_general_register (dcontext, reg); - } - } else { - val = dc_general_register (dcontext, reg); - } - } - return val & ~3; -} - - -void dc_set_return_address (dcontext, value) - dc_dcontext_t dcontext; - dc_word_t value; - /* Set high 30 bits only. */ -{ - if (!dcontext->code_reading) { - tdesc_elem_t *tep = ((dc_dcontext_t)dcontext)->info_ptr.tdesc_elem_ptr; - dc_word_t rai = tep->info.return_address_info; - - if (tep->info.return_address_info_discriminant) { - dc_write_masked_word (((dc_dcontext_t)dcontext)->handle, - dc_frame_address(dcontext) + rai, ~3, value); - } else { - dc_set_general_register (dcontext, rai, - (value & ~3) | (dc_general_register(dcontext, rai) & 3)); - } - } else { - if (bit_test(dcontext->info_ptr.cr_data_ptr->saved,DC_REG_RA)) { - if (bit_test(dcontext->info_ptr.cr_data_ptr->how,DC_REG_RA)) { - dc_write_masked_word (((dc_dcontext_t)dcontext)->handle, - dc_frame_address(dcontext) - + dcontext->info_ptr.cr_data_ptr->where[DC_REG_RA], ~3, value); - } else { - dc_set_general_register( dcontext, - dcontext->info_ptr.cr_data_ptr->where[DC_REG_RA]); - } - } else { - dc_set_general_register( dcontext, - dcontext->info_ptr.cr_data_ptr->where[DC_REG_RA]); - } - } -} - - - -/* operations valid for save contexts only */ - -/* (none) */ - - - -/* operations valid for exception contexts only */ - - -void dc_get_exception_info (dcontext, handler, datum) - dc_dcontext_t dcontext; - dc_word_t *handler; - dc_word_t *datum; -{ - dc_error (((dc_dcontext_t)dcontext)->handle, - "dc_get_exception_info is not yet implemented."); -} - - - -/* operations valid for protection contexts only */ - - -void dc_get_protection_info (dcontext, handler, datum) - dc_dcontext_t dcontext; - dc_word_t *handler; - dc_word_t *datum; -{ - dc_error (((dc_dcontext_t)dcontext)->handle, - "dc_get_protection_info is not yet implemented."); -} - - - -/* operations valid for special contexts only */ - - -void dc_get_special_info (dcontext, kind, datum) - dc_dcontext_t dcontext; - dc_word_t *kind; - dc_word_t *datum; -{ - dc_error (((dc_dcontext_t)dcontext)->handle, - "dc_get_special_info is not yet implemented."); -} - - - -/* operations valid for all contexts (again) */ - - -dc_dcontext_t dc_previous_dcontext (dcontext) - dc_dcontext_t dcontext; - /* Return NULL if there is no previous context. */ -{ - dc_dcontext_t old = (dc_dcontext_t) dcontext; - dcontext_info_t new; /* to serve as temporary storage only */ - tdesc_elem_t *tep; - dc_cr_data_t *cdp; - dc_word_t cfa; - int rsm; - dc_word_t offset; - dc_word_t rai; - int r; - - if (dc_return_address_state((dc_dcontext_t)old) == DC_INVALID) - dc_error (old->handle, "Return address is invalid."); - - if (dc_return_address((dc_dcontext_t)old) == 0) - return (dc_dcontext_t)NULL; /* end of the chain */ - - /* Copy over old contents. */ - new = *old; - - cfa = dc_frame_address(old); - /* Restore stack pointer. */ - new.reg_info[DC_REG_SP] = cfa; - SET_READABLE (new.reg_flags, DC_REG_SP); - - /* Invalidate temporary registers. */ - for (r = 1; r <= 13; r++) SET_INVALID (new.reg_flags, r); - - if (!old->code_reading) { - tep = old->info_ptr.tdesc_elem_ptr; - /* Restore preserved registers. */ - rsm = tep->info.register_save_mask; - offset = cfa + tep->info.register_save_offset; - for (r = 14; r <= 30; r++) { - if (bit_test(rsm, 30-r)) { - new.reg_info[r] = offset; - SET_WRITABLE (new.reg_flags, r); - offset += sizeof(dc_word_t); - } - } - - /* Set location from old return address. */ - rai = tep->info.return_address_info; - if (tep->info.return_address_info_discriminant) { - new.aux_info[DC_AUX_LOC] = cfa + rai; - SET_WRITABLE (new.aux_flags, DC_AUX_LOC); - } else { - new.aux_info[DC_AUX_LOC] = old->reg_info[rai]; - ASSIGN_RSTATE (new.aux_flags, DC_AUX_LOC, old->reg_flags, rai); - } - } else { - cdp = old->info_ptr.cr_data_ptr; - - /* Restore preserved registers. */ - for (r = 14; r <= 30; r++) { - if (bit_test(cdp->saved,r)) { - if (bit_test(cdp->how,r)){ /* saved in the frame */ - new.reg_info[r] = cfa+cdp->where[r]; - SET_WRITABLE (new.reg_flags, r); - } else { /* saved in the in a register */ - new.reg_info[r] = dc_general_register(old,cdp->where[r]); - ASSIGN_RSTATE (new.aux_flags, r, old->reg_flags, cdp->where[r]); - } - } /* not saved, therefore, already valid , no else*/ - } - - /* Set location from old return address. */ - if (bit_test(cdp->saved,DC_REG_RA)) { - if (bit_test(cdp->how,DC_REG_RA)){ /* saved in the frame */ - new.aux_info[DC_AUX_LOC] = - new.reg_info[DC_REG_RA] = cfa+cdp->where[DC_REG_RA]; - SET_WRITABLE (new.reg_flags, DC_REG_RA); - SET_WRITABLE (new.aux_flags, DC_AUX_LOC); - } else { /* saved in the in a register */ - new.reg_info[DC_REG_RA] = - new.aux_info[DC_AUX_LOC] = - dc_general_register(old,cdp->where[DC_REG_RA]); - ASSIGN_RSTATE (new.aux_flags, DC_AUX_LOC, - old->reg_flags, cdp->where[DC_REG_RA]); - } - } else { /* not saved, therefore, already valid , set DC_AUX_LOC only*/ - new.aux_info[DC_AUX_LOC] = - dc_general_register(old,DC_REG_RA); - ASSIGN_RSTATE (new.aux_flags, DC_AUX_LOC, - old->reg_flags, DC_REG_RA); - } - } - - /* Invalidate instruction pointers. */ - SET_INVALID (new.aux_flags, DC_AUX_SXIP); - SET_INVALID (new.aux_flags, DC_AUX_SNIP); - SET_INVALID (new.aux_flags, DC_AUX_SFIP); - - /* No change to FCR registers. */ - - /* No change to PSR register. */ - - return dc_make_dcontext ((dc_handle_t)new.handle, - new.reg_info, new.reg_flags, - new.aux_info, new.aux_flags, new.loc_exact, - new.psr_info, new.psr_ind, new.psr_flags); -} - - - -/* extensions for nonlocal goto */ - -#if 0 - -typedef - struct label { - ??? - } label_t; - - -label_t dc_make_label (dcontext, location) - dc_dcontext_t dcontext; - dc_word_t location; -{ -} - -#endif - -/* procedure for reading code */ - -dc_read_code(loc,dc,map_info_in,cdp) -dc_word_t loc; -dc_dcontext_t dc; -dc_cr_data_t *cdp; -dc_map_info_in_t map_info_in; -{ -dc_map_info_out_t map_info_out; -dc_word_t pc; -dc_boolean_t found_branch=DC_FALSE; -dc_word_t instr; - - (*dc->handle->map_fcn)(dc->handle->map_env,loc,map_info_in,&map_info_out); - if (map_info_out.flags & DC_MIO_ENTRY_POINT - && (!(map_info_in.flags & DC_MII_PRECEDING_TDESC_END) - || map_info_out.entry_point >= map_info_in.preceding_tdesc_end - || map_info_out.flags & DC_MIO_LITERAL_ENTRY_POINT)) { - dc_init_cr_data(cdp,(tdesc_elem_t *)NULL); - pc= map_info_out.entry_point; - } else if (map_info_in.flags & DC_MII_PRECEDING_TDESC_END) { - /**/ - /* tdesc_lookup gets the tep for the preceeding tdesc information - /* so we call it with one less than the preceding tdesc end since - /* tdesc information is exclusive of the ending address - /**/ - dc_init_cr_data(cdp, - dc_tdesc_lookup(map_info_in.preceding_tdesc_end-1, - ((dc_handle_t)dc->handle)->tdesc_table, - ((dc_handle_t)dc->handle)->tdesc_table_size, - &map_info_in)); - pc= map_info_in.preceding_tdesc_end; - } else { - dc_error (dc->handle, "Insufficient information for code reading."); - } - for (;;pc+=4) { - if (pc==loc) { - return (DC_TRUE); - } - instr= dc_read_word(dc->handle,pc); - found_branch= dc_decode_finds_branch(dc,instr); - if ((map_info_out.flags & DC_MIO_PROLOGUE_END) - && (pc==map_info_out.prologue_end)) { - break; - } - if (found_branch) { - if (DC_MIO_IMPLICIT_PROLOGUE_END & map_info_out.flags) { - break; - } else { - dc_error (dc->handle, "Found branch before end of prologue."); - } - } - } - if (!(map_info_out.flags & DC_MIO_LITERAL_EPILOGUE_START) - && (map_info_out.epilogue_start >= loc - || !(map_info_out.flags & DC_MIO_EPILOGUE_START))) { - return (DC_TRUE); - } - dc_correct_cr_data(cdp,dc->handle); - for (pc=map_info_out.epilogue_start;pchandle,pc); - if (dc_decode_finds_branch(dc,instr)) { - return (DC_FALSE); - } - } - return (DC_TRUE); - -} - - - -dc_init_cr_data(cdp,tep) -dc_cr_data_t *cdp; -tdesc_elem_t *tep; -{ -int reg; -dc_word_t rai; -dc_word_t raid; -dc_word_t rsm; -dc_word_t frpos; - - if (tep){ - - /* Start off with all registers undefined and none saved. */ - for (reg = 0; reg < DC_NUM_REG; reg++) { - cdp->reg_val[reg].reg = DC_UNDEF; - } - cdp->saved = 0; - - /* Overwrite with what tdesc element says. */ - - cdp->reg_val[tep->info.frame_address_register].reg = DC_REG_SP; - cdp->reg_val[tep->info.frame_address_register].off = - - tep->info.frame_address_offset; - - rai = tep->info.return_address_info; - raid = tep->info.return_address_info_discriminant; - if (raid || rai != DC_REG_RA) { - bit_set(cdp->saved,DC_REG_RA); - bit_assign(cdp->how,DC_REG_RA,raid); - cdp->where[DC_REG_RA] = rai; - } - - rsm = tep->info.register_save_mask; - frpos = tep->info.register_save_offset; - for (reg = 14; reg <= 30; reg++) { - if (bit_test(rsm, 30-reg)) { - bit_set(cdp->saved,reg); - bit_set(cdp->how,reg); - cdp->where[reg] = frpos; - frpos += sizeof(dc_word_t); - } else { - cdp->reg_val[reg].reg = reg; - cdp->reg_val[reg].off = 0; - } - } - - cdp->reg_val[0].reg = 0; /* guarantee what hardware does */ - cdp->reg_val[0].off = 0; - - } else { - /* Each register has its own initial value. */ - for (reg = 0; reg < DC_NUM_REG; reg++) { - cdp->reg_val[reg].reg = reg; - cdp->reg_val[reg].off = 0; - } - /* No register is yet saved. */ - cdp->saved = 0; - cdp->how = 0; - } -} -void dc_correct_cr_data(cdp,handle) -dc_cr_data_t *cdp; -dc_handle_t handle; -{ -long sr,r; -dc_word_t save_regs = 0; /* registers used to save others */ - for (r = 1; r < DC_REG_SP; r++) { - if (bit_test(cdp->saved,r) && !bit_test(cdp->how,r)) { - sr = cdp->where[r]; - if (bit_test(save_regs,sr)) { - dc_error(handle, "Same register used to save two others."); - } - bit_set(save_regs,sr); - } - } - for (r = 1; r < DC_REG_FP; r++) { - if ((r < 14 || bit_test(cdp->saved,r)) && !bit_test(save_regs,r)) { - cdp->reg_val[r].reg = DC_UNDEF; - } - } - if (bit_test(cdp->saved,DC_REG_FP) && - cdp->reg_val[DC_REG_FP].reg == DC_REG_SP) { /* is r30 the far? */ - cdp->reg_val[DC_REG_SP].reg = DC_UNDEF; /* trash sp */ - } else if (cdp->reg_val[DC_REG_SP].reg == DC_REG_SP) { /* is r31 the far? */ - if (bit_test(cdp->saved,DC_REG_FP) && !bit_test(save_regs,DC_REG_FP)) { - cdp->reg_val[DC_REG_FP].reg = DC_UNDEF; /* trash r30 */ - } - } -} diff --git a/gdb/tdesc.h b/gdb/tdesc.h deleted file mode 100755 index 3936330..0000000 --- a/gdb/tdesc.h +++ /dev/null @@ -1,329 +0,0 @@ -/* This file has been modified by Data General Corporation, November 1989. */ - -#ifndef _tdesc_h -#define _tdesc_h -#ifdef __STDC__ -#define _ARGS(x) x -#else -#define _ARGS(x) () -#endif - -/* - This file provides an abstract interface to "tdesc" information. - It is designed to be used in a uniform manner by several kinds - of debuggers: - (1) code in live debugged process (e.g., a traceback routine) - (2) a separate-process debugger debugging a live process - (3) a separate-process debugger debugging a memory dump - - Dcontext model notes - * captures machine context - * partial: excludes memory - * frames - * kinds - * make one for starters, chain in reverse order to previous ones - * representation: pointer to opaque - * alloc/free protocol - - Overall model - * access functions - * handle - * error handling -*/ - - - -typedef int dc_boolean_t; /* range 0 .. 1 */ -#define DC_FALSE 0 -#define DC_TRUE 1 - - -typedef int dc_tristate_t; /* range 0 .. 2 */ -#define DC_NO 0 -#define DC_YES 1 -#define DC_MAYBE 2 - - -#define DC_MII_PRECEDING_TDESC_END (1<<0) -#define DC_MII_FOLLOWING_TDESC_START (1<<1) - -#define DC_MIO_ENTRY_POINT (1<< 0) -#define DC_MIO_PROLOGUE_END (1<< 1) -#define DC_MIO_EPILOGUE_START (1<< 2) -#define DC_MIO_IMPLICIT_PROLOGUE_END (1<<16) -#define DC_MIO_LITERAL_ENTRY_POINT (1<<17) -#define DC_MIO_LITERAL_EPILOGUE_START (1<<18) - - -/* - A word is 32 bits of information. In memory, a word is word-aligned. - - A common and important use of word_t is to represent values in the - target process, including (byte) addresses in the target process. - In this case, C arithmetic can be used to simulate machine address - arithmetic on the target. (Unsigned arithmetic is actually modulus - arithmetic.) -*/ -typedef unsigned int dc_word_t; - - -/*----------------*/ - - -/* The exactness of locations may not be certainly known. */ -typedef dc_tristate_t dc_exactness_t; - - -/* - The model includes five kinds of contexts. Because each context - has an associated region and frame, these describe region kinds - and frame kinds as well. - [more description needed] - Currently, only call contexts exist. -*/ - -typedef int dc_kind_t; /* range 0 .. 4 */ -#define DC_CALL_KIND 0 -#define DC_SAVE_KIND 1 -#define DC_EXCEPTION_KIND 2 -#define DC_PROTECTION_KIND 3 -#define DC_SPECIAL_KIND 4 -#define DC_NUM_KINDS 5 - - -typedef struct dc_debug_info { - unsigned int protocol; /* 1 for this structure */ - dc_word_t tdesc_ptr; - unsigned int text_words_count; - dc_word_t text_words_ptr; - unsigned int data_words_count; - dc_word_t data_words_ptr; -} dc_debug_info_t; - - -typedef struct dc_mstate { - dc_word_t reg[32]; /* general registers */ - dc_word_t xip; - dc_word_t nip; - dc_word_t fip; - dc_word_t fpsr; - dc_word_t fpcr; - dc_word_t psr; -} dc_mstate_t; - - - -#if 0 - - void error_fcn (env, continuable, message) - dc_word_t env; /* environment (arbitrary datum) */ - boolean_t continuable; /* whether error function may return */ - char *message; /* string (no trailing newline) */ - - /* In the future, we probably want the error_fcn to be: */ - void error_fcn (env, continuable, code, ...) - dc_word_t env; /* environment (arbitrary datum) */ - boolean_t continuable; /* whether error function may return */ - int code; /* error code */ - ... /* parameters to message associated - with the code */ - - void read_fcn (env, memory, length, buffer) - dc_word_t env; /* environment (arbitrary datum) */ - dc_word_t memory; /* start address in image */ - int length; /* in bytes */ - char *buffer; /* start address of buffer */ - /* There are no alignment assumptions for the read function. */ - - void write_fcn (env, memory, length, buffer) - dc_word_t env; /* environment (arbitrary datum) */ - dc_word_t memory; /* start address in image */ - int length; /* in bytes */ - char *buffer; /* start address of buffer */ - /* There are no alignment assumptions for the write function. */ - /* The write function is optional. It must be provided if changes - to writable registers are to be made. */ - - void exec_fcn (env, mstate) - dc_word_t env; /* environment (arbitrary datum) */ - dc_mstate_t *mstate; /* machine state (read-write) */ - /* The execute function is optional. It would be used (in the future) - by the implementation of a procedurally specified tdesc mechanism. */ - -#endif - -/*----------------*/ - - -typedef struct dc_map_info_in { - dc_word_t flags; - dc_word_t preceding_tdesc_end; - dc_word_t following_tdesc_start; -} dc_map_info_in_t; - - -typedef struct dc_map_info_out { - dc_word_t flags; - dc_word_t entry_point; - dc_word_t prologue_end; - dc_word_t epilogue_start; -} dc_map_info_out_t; - - -typedef void *dc_handle_t; - -typedef void (*tdesc_error_fcn_type) _ARGS(( - dc_word_t env, /* environment (arbitrary datum) */ - dc_boolean_t continuable, /* whether error function may return */ - const char *message /* string (no trailing newline) */ -)); -typedef void (*tdesc_io_fcn_type) _ARGS(( - dc_word_t env, /* environment (arbitrary datum) */ - dc_word_t memory, /* start address in image */ - int length, /* in bytes */ - void *buffer /* start address of buffer */ -)); -typedef void (*tdesc_exec_fcn_type) _ARGS(( - dc_word_t env, /* environment (arbitrary datum) */ - dc_mstate_t *mstate /* machine state (read-write) */ -)); -typedef void (*tdesc_map_fcn_type) _ARGS(( - dc_word_t map_env, - dc_word_t loc, - dc_map_info_in_t map_info_in, - dc_map_info_out_t *map_info_out -)); - - -extern dc_handle_t dc_initiate _ARGS(( - dc_word_t debug_info_ptr, - tdesc_error_fcn_type error_fcn, - dc_word_t error_env, - tdesc_io_fcn_type read_fcn, - dc_word_t read_env, - tdesc_io_fcn_type write_fcn, /* NULL => absent */ - dc_word_t write_env, - tdesc_exec_fcn_type exec_fcn, /* NULL => absent */ - dc_word_t exec_env, - tdesc_map_fcn_type map_fcn, /* NULL => absent */ - dc_word_t map_env -)); -extern void dc_terminate _ARGS(( - dc_handle_t handle -)); - -typedef int dc_register_state_t; /* range 0 to 2 */ - -#define DC_INVALID 0 -#define DC_READABLE 1 -#define DC_WRITABLE 2 - -#define DC_NUM_REG 32 - -#define DC_AUX_LOC 0 -#define DC_AUX_SXIP 1 -#define DC_AUX_SNIP 2 -#define DC_AUX_SFIP 3 -#define DC_AUX_FPSR 4 -#define DC_AUX_FPCR 5 -#define DC_NUM_AUX 6 - - -typedef void *dc_dcontext_t; - -extern dc_dcontext_t dc_make_dcontext _ARGS(( - dc_handle_t handle, - dc_word_t reg_info[DC_NUM_REG], - dc_word_t reg_flags[2], - dc_word_t aux_info[DC_NUM_AUX], - dc_word_t aux_flags[2], - dc_exactness_t loc_exact, - dc_word_t psr_info, - dc_boolean_t psr_ind, - dc_word_t psr_flags[2] -)); -extern void dc_free_dcontext _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_register_state_t dc_location_state _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_exactness_t dc_location_exactness _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_word_t dc_location _ARGS(( - dc_dcontext_t dcontext -)); -extern void dc_set_location _ARGS(( - dc_dcontext_t dcontext, - dc_word_t value -)); -extern dc_register_state_t dc_general_register_state _ARGS(( - dc_dcontext_t dcontext, - int reg -)); -extern dc_word_t dc_general_register _ARGS(( - dc_dcontext_t dcontext, - int reg -)); -extern void dc_set_general_register _ARGS(( - dc_dcontext_t dcontext, - int reg, - dc_word_t value -)); -extern dc_register_state_t dc_auxiliary_register_state _ARGS(( - dc_dcontext_t dcontext, - int reg -)); -extern dc_word_t dc_auxiliary_register _ARGS(( - dc_dcontext_t dcontext, - int reg -)); -extern void dc_set_auxiliary_register _ARGS(( - dc_dcontext_t dcontext, - int reg, - dc_word_t value -)); -extern dc_register_state_t dc_psr_register_bit_state _ARGS(( - dc_dcontext_t dcontext, - int bit -)); -extern dc_word_t dc_psr_register _ARGS(( - dc_dcontext_t dcontext -)); -extern void dc_set_psr_register _ARGS(( - dc_dcontext_t dcontext, - dc_word_t mask, - dc_word_t value -)); -extern dc_word_t dc_frame_address _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_kind_t dc_context_kind _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_register_state_t dc_return_address_state _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_exactness_t dc_return_address_exactness _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_word_t dc_return_address _ARGS(( - dc_dcontext_t dcontext -)); -extern void dc_set_return_address _ARGS(( - dc_dcontext_t dcontext, - dc_word_t value -)); -extern void dc_get_exception_info(); -extern void dc_get_protection_info(); -extern void dc_get_special_info(); -extern dc_dcontext_t dc_previous_dcontext _ARGS(( - dc_dcontext_t dcontext -)); -extern dc_boolean_t dc_location_in_text_chunk _ARGS(( - dc_dcontext_t dcontext, - dc_word_t value -)); - -#endif diff --git a/gdb/tm-altosgas.h b/gdb/tm-altosgas.h deleted file mode 100644 index c20030c..0000000 --- a/gdb/tm-altosgas.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Definitions to make GDB run on an Altos 3068 using COFF encapsulation. - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define COFF_ENCAPSULATE - -#include "m-altos.h" - -#define NAMES_HAVE_UNDERSCORE diff --git a/gdb/tm-hppabsd.h b/gdb/tm-hppabsd.h index 577bb9b..e69de29 100644 --- a/gdb/tm-hppabsd.h +++ b/gdb/tm-hppabsd.h @@ -1,6 +0,0 @@ -/* Parameters for execution on an HP PA-RISC machine running BSD, for GDB. - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). */ - -/* It's all just the common stuff. */ -#include "tm-hppa.h" diff --git a/gdb/tm-hppahpux.h b/gdb/tm-hppahpux.h index 130365d..e69de29 100644 --- a/gdb/tm-hppahpux.h +++ b/gdb/tm-hppahpux.h @@ -1,39 +0,0 @@ -/* Parameters for execution on an HP PA-RISC machine, running HPUX, for GDB. - Copyright 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Mostly it's common to all HPPA's. */ -#include "tm-hppa.h" - -/* Saved PC's are different, since there is millicode. */ -extern CORE_ADDR millicode_start, millicode_end; - -/* Immediately after a function call, return the saved pc. - Can't go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - -#undef SAVED_PC_AFTER_CALL -#define SAVED_PC_AFTER_CALL(frame) \ - ((get_frame_pc (frame) >= millicode_start \ - && get_frame_pc (frame) < millicode_end) ? \ - read_register (31) & ~3 \ - : read_register (RP_REGNUM) & ~3) diff --git a/gdb/tm-i386v-g.h b/gdb/tm-i386v-g.h deleted file mode 100644 index 669284a..0000000 --- a/gdb/tm-i386v-g.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Macro definitions for i386 using the GNU object file format. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* - * Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu) - * July 1988 - * - * i386gnu: COFF_ENCAPSULATE - */ - - -#define COFF_ENCAPSULATE - -#include "tm-i386v.h" - -#define NAMES_HAVE_UNDERSCORE diff --git a/gdb/tm-sun4os5.h b/gdb/tm-sun4os5.h index 942fb87..e69de29 100644 --- a/gdb/tm-sun4os5.h +++ b/gdb/tm-sun4os5.h @@ -1,54 +0,0 @@ -/* Macro definitions for GDB for a Sun 4 running SunOS 5. - Copyright (C) 1989, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "tm-sparc.h" - -#include "tm-sysv4.h" - -#undef STACK_END_ADDRESS -#define STACK_END_ADDRESS 0xf8000000 - -#if 0 /* Setjmp/longjmp are not as well doc'd in SunOS 5.x yet */ - -/* Offsets into jmp_buf. Not defined by Sun, but at least documented in a - comment in ! */ - -#define JB_ELEMENT_SIZE 4 /* Size of each element in jmp_buf */ - -#define JB_ONSSTACK 0 -#define JB_SIGMASK 1 -#define JB_SP 2 -#define JB_PC 3 -#define JB_NPC 4 -#define JB_PSR 5 -#define JB_G1 6 -#define JB_O0 7 -#define JB_WBCNT 8 - -/* Figure out where the longjmp will land. We expect that we have just entered - longjmp and haven't yet setup the stack frame, so the args are still in the - output regs. %o0 (O0_REGNUM) points at the jmp_buf structure from which we - extract the pc (JB_PC) that we will land at. The pc is copied into ADDR. - This routine returns true on success */ - -extern int -get_longjmp_target PARAMS ((CORE_ADDR *)); - -#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR) -#endif /* 0 */ diff --git a/gdb/tm-svr4.h b/gdb/tm-svr4.h index f1eea20..e69de29 100755 --- a/gdb/tm-svr4.h +++ b/gdb/tm-svr4.h @@ -1,37 +0,0 @@ -/* Macro definitions for GDB on all SVR4 target systems. - Copyright (C) 1991, Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygint) - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Support for SVR4 shared libraries. */ - -#define CLEAR_SOLIB clear_solib -extern void clear_solib (); /* solib.c */ - -#define SOLIB_ADD(filename, from_tty, targ) solib_add (filename, from_tty, targ) -extern void solib_add (); /* solib.c */ - -#define SOLIB_CREATE_INFERIOR_HOOK solib_create_inferior_hook -extern void solib_create_inferior_hook(); /* solib.c */ - -/* If we can't set a breakpoint, and it's in a shared library, just - disable it. */ - -#define DISABLE_UNSETTABLE_BREAK(addr) solib_address(addr) -extern int solib_address (); /* solib.c */ - diff --git a/gdb/tm-vxworks68.h b/gdb/tm-vxworks68.h deleted file mode 100755 index a3cd7c2..0000000 --- a/gdb/tm-vxworks68.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Parameters for execution on VxWorks 68k's, for GDB, the GNU debugger. - Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#define GDBINIT_FILENAME ".vxgdbinit" - -#define DEFAULT_PROMPT "(vxgdb) " - -/* Kludge... */ -#include "tm-sun3.h" - -/* We have more complex, useful breakpoints on the target. */ -#undef DECR_PC_AFTER_BREAK -#define DECR_PC_AFTER_BREAK 0 - -/* We are guaranteed to have a zero frame pointer at bottom of stack, too. */ -#undef FRAME_CHAIN -#undef FRAME_CHAIN_VALID - -/* Takes the current frame-struct pointer and returns the chain-pointer - to get to the calling frame. - - If our current frame pointer is zero, we're at the top; else read out - the saved FP from memory pointed to by the current FP. */ - -#define FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0) - -/* If the chain pointer is zero (either because the saved value fetched - by FRAME_CHAIN was zero, or because the current FP was zero so FRAME_CHAIN - never fetched anything), we are at the top of the stack. */ - -#define FRAME_CHAIN_VALID(chain, thisframe) (chain != 0) diff --git a/gdb/tm-vxworks960.h b/gdb/tm-vxworks960.h deleted file mode 100755 index fc5c214..0000000 --- a/gdb/tm-vxworks960.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Parameters for VxWorks Intel 960's, for GDB, the GNU debugger. - Copyright (C) 1986-1991 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB. - -GDB is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 1, or (at your option) -any later version. - -GDB is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include "tm-i960.h" - -#define GDBINIT_FILENAME ".vxgdbinit" - -#define DEFAULT_PROMPT "(vxgdb) " - -/* We have more complex, useful breakpoints on the target. - Amount ip must be decremented by after a breakpoint. */ - -#define DECR_PC_AFTER_BREAK 0 - -/* We are guaranteed to have a zero frame pointer at bottom of stack, too. */ - -#define FRAME_CHAIN_VALID(chain, thisframe) (chain != 0) - -/* Breakpoint patching is handled at the target end in VxWorks. */ -/* #define BREAKPOINT {0x00, 0x3e, 0x00, 0x66} */ - -/* Not needed, because we don't support core files: - #define KERNEL_U_ADDR - #define REGISTER_U_ADDR(addr, blockend, regno) - */ - -/* Address of end of stack space. - This doesn't matter for VxWorks, because it's only used - in manipulation of core files, which we don't support. */ - -/* #define STACK_END_ADDR (0xfe000000) */ diff --git a/gdb/vax-opcode.h b/gdb/vax-opcode.h deleted file mode 100755 index 594e635..0000000 --- a/gdb/vax-opcode.h +++ /dev/null @@ -1,382 +0,0 @@ -/* Vax opcde list. - Copyright (C) 1989, Free Software Foundation, Inc. - -This file is part of GDB and GAS. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef vax_opcodeT -#define vax_opcodeT int -#endif /* no vax_opcodeT */ - -struct vot_wot /* vax opcode table: wot to do with this */ - /* particular opcode */ -{ - char * args; /* how to compile said opcode */ - vax_opcodeT code; /* op-code (may be > 8 bits!) */ -}; - -struct vot /* vax opcode text */ -{ - char * name; /* opcode name: lowercase string [key] */ - struct vot_wot detail; /* rest of opcode table [datum] */ -}; - -#define vot_how args -#define vot_code code -#define vot_detail detail -#define vot_name name - -const static struct vot -votstrs[] = -{ -{ "halt", {"", 0x00 } }, -{ "nop", {"", 0x01 } }, -{ "rei", {"", 0x02 } }, -{ "bpt", {"", 0x03 } }, -{ "ret", {"", 0x04 } }, -{ "rsb", {"", 0x05 } }, -{ "ldpctx", {"", 0x06 } }, -{ "svpctx", {"", 0x07 } }, -{ "cvtps", {"rwabrwab", 0x08 } }, -{ "cvtsp", {"rwabrwab", 0x09 } }, -{ "index", {"rlrlrlrlrlwl", 0x0a } }, -{ "crc", {"abrlrwab", 0x0b } }, -{ "prober", {"rbrwab", 0x0c } }, -{ "probew", {"rbrwab", 0x0d } }, -{ "insque", {"abab", 0x0e } }, -{ "remque", {"abwl", 0x0f } }, -{ "bsbb", {"bb", 0x10 } }, -{ "brb", {"bb", 0x11 } }, -{ "bneq", {"bb", 0x12 } }, -{ "bnequ", {"bb", 0x12 } }, -{ "beql", {"bb", 0x13 } }, -{ "beqlu", {"bb", 0x13 } }, -{ "bgtr", {"bb", 0x14 } }, -{ "bleq", {"bb", 0x15 } }, -{ "jsb", {"ab", 0x16 } }, -{ "jmp", {"ab", 0x17 } }, -{ "bgeq", {"bb", 0x18 } }, -{ "blss", {"bb", 0x19 } }, -{ "bgtru", {"bb", 0x1a } }, -{ "blequ", {"bb", 0x1b } }, -{ "bvc", {"bb", 0x1c } }, -{ "bvs", {"bb", 0x1d } }, -{ "bcc", {"bb", 0x1e } }, -{ "bgequ", {"bb", 0x1e } }, -{ "blssu", {"bb", 0x1f } }, -{ "bcs", {"bb", 0x1f } }, -{ "addp4", {"rwabrwab", 0x20 } }, -{ "addp6", {"rwabrwabrwab", 0x21 } }, -{ "subp4", {"rwabrwab", 0x22 } }, -{ "subp6", {"rwabrwabrwab", 0x23 } }, -{ "cvtpt", {"rwababrwab", 0x24 } }, -{ "mulp", {"rwabrwabrwab", 0x25 } }, -{ "cvttp", {"rwababrwab", 0x26 } }, -{ "divp", {"rwabrwabrwab", 0x27 } }, -{ "movc3", {"rwabab", 0x28 } }, -{ "cmpc3", {"rwabab", 0x29 } }, -{ "scanc", {"rwababrb", 0x2a } }, -{ "spanc", {"rwababrb", 0x2b } }, -{ "movc5", {"rwabrbrwab", 0x2c } }, -{ "cmpc5", {"rwabrbrwab", 0x2d } }, -{ "movtc", {"rwabrbabrwab", 0x2e } }, -{ "movtuc", {"rwabrbabrwab", 0x2f } }, -{ "bsbw", {"bw", 0x30 } }, -{ "brw", {"bw", 0x31 } }, -{ "cvtwl", {"rwwl", 0x32 } }, -{ "cvtwb", {"rwwb", 0x33 } }, -{ "movp", {"rwabab", 0x34 } }, -{ "cmpp3", {"rwabab", 0x35 } }, -{ "cvtpl", {"rwabwl", 0x36 } }, -{ "cmpp4", {"rwabrwab", 0x37 } }, -{ "editpc", {"rwababab", 0x38 } }, -{ "matchc", {"rwabrwab", 0x39 } }, -{ "locc", {"rbrwab", 0x3a } }, -{ "skpc", {"rbrwab", 0x3b } }, -{ "movzwl", {"rwwl", 0x3c } }, -{ "acbw", {"rwrwmwbw", 0x3d } }, -{ "movaw", {"awwl", 0x3e } }, -{ "pushaw", {"aw", 0x3f } }, -{ "addf2", {"rfmf", 0x40 } }, -{ "addf3", {"rfrfwf", 0x41 } }, -{ "subf2", {"rfmf", 0x42 } }, -{ "subf3", {"rfrfwf", 0x43 } }, -{ "mulf2", {"rfmf", 0x44 } }, -{ "mulf3", {"rfrfwf", 0x45 } }, -{ "divf2", {"rfmf", 0x46 } }, -{ "divf3", {"rfrfwf", 0x47 } }, -{ "cvtfb", {"rfwb", 0x48 } }, -{ "cvtfw", {"rfww", 0x49 } }, -{ "cvtfl", {"rfwl", 0x4a } }, -{ "cvtrfl", {"rfwl", 0x4b } }, -{ "cvtbf", {"rbwf", 0x4c } }, -{ "cvtwf", {"rwwf", 0x4d } }, -{ "cvtlf", {"rlwf", 0x4e } }, -{ "acbf", {"rfrfmfbw", 0x4f } }, -{ "movf", {"rfwf", 0x50 } }, -{ "cmpf", {"rfrf", 0x51 } }, -{ "mnegf", {"rfwf", 0x52 } }, -{ "tstf", {"rf", 0x53 } }, -{ "emodf", {"rfrbrfwlwf", 0x54 } }, -{ "polyf", {"rfrwab", 0x55 } }, -{ "cvtfd", {"rfwd", 0x56 } }, - /* opcode 57 is not defined yet */ -{ "adawi", {"rwmw", 0x58 } }, - /* opcode 59 is not defined yet */ - /* opcode 5a is not defined yet */ - /* opcode 5b is not defined yet */ -{ "insqhi", {"abaq", 0x5c } }, -{ "insqti", {"abaq", 0x5d } }, -{ "remqhi", {"aqwl", 0x5e } }, -{ "remqti", {"aqwl", 0x5f } }, -{ "addd2", {"rdmd", 0x60 } }, -{ "addd3", {"rdrdwd", 0x61 } }, -{ "subd2", {"rdmd", 0x62 } }, -{ "subd3", {"rdrdwd", 0x63 } }, -{ "muld2", {"rdmd", 0x64 } }, -{ "muld3", {"rdrdwd", 0x65 } }, -{ "divd2", {"rdmd", 0x66 } }, -{ "divd3", {"rdrdwd", 0x67 } }, -{ "cvtdb", {"rdwb", 0x68 } }, -{ "cvtdw", {"rdww", 0x69 } }, -{ "cvtdl", {"rdwl", 0x6a } }, -{ "cvtrdl", {"rdwl", 0x6b } }, -{ "cvtbd", {"rbwd", 0x6c } }, -{ "cvtwd", {"rwwd", 0x6d } }, -{ "cvtld", {"rlwd", 0x6e } }, -{ "acbd", {"rdrdmdbw", 0x6f } }, -{ "movd", {"rdwd", 0x70 } }, -{ "cmpd", {"rdrd", 0x71 } }, -{ "mnegd", {"rdwd", 0x72 } }, -{ "tstd", {"rd", 0x73 } }, -{ "emodd", {"rdrbrdwlwd", 0x74 } }, -{ "polyd", {"rdrwab", 0x75 } }, -{ "cvtdf", {"rdwf", 0x76 } }, - /* opcode 77 is not defined yet */ -{ "ashl", {"rbrlwl", 0x78 } }, -{ "ashq", {"rbrqwq", 0x79 } }, -{ "emul", {"rlrlrlwq", 0x7a } }, -{ "ediv", {"rlrqwlwl", 0x7b } }, -{ "clrd", {"wd", 0x7c } }, -{ "clrg", {"wg", 0x7c } }, -{ "clrq", {"wd", 0x7c } }, -{ "movq", {"rqwq", 0x7d } }, -{ "movaq", {"aqwl", 0x7e } }, -{ "movad", {"adwl", 0x7e } }, -{ "pushaq", {"aq", 0x7f } }, -{ "pushad", {"ad", 0x7f } }, -{ "addb2", {"rbmb", 0x80 } }, -{ "addb3", {"rbrbwb", 0x81 } }, -{ "subb2", {"rbmb", 0x82 } }, -{ "subb3", {"rbrbwb", 0x83 } }, -{ "mulb2", {"rbmb", 0x84 } }, -{ "mulb3", {"rbrbwb", 0x85 } }, -{ "divb2", {"rbmb", 0x86 } }, -{ "divb3", {"rbrbwb", 0x87 } }, -{ "bisb2", {"rbmb", 0x88 } }, -{ "bisb3", {"rbrbwb", 0x89 } }, -{ "bicb2", {"rbmb", 0x8a } }, -{ "bicb3", {"rbrbwb", 0x8b } }, -{ "xorb2", {"rbmb", 0x8c } }, -{ "xorb3", {"rbrbwb", 0x8d } }, -{ "mnegb", {"rbwb", 0x8e } }, -{ "caseb", {"rbrbrb", 0x8f } }, -{ "movb", {"rbwb", 0x90 } }, -{ "cmpb", {"rbrb", 0x91 } }, -{ "mcomb", {"rbwb", 0x92 } }, -{ "bitb", {"rbrb", 0x93 } }, -{ "clrb", {"wb", 0x94 } }, -{ "tstb", {"rb", 0x95 } }, -{ "incb", {"mb", 0x96 } }, -{ "decb", {"mb", 0x97 } }, -{ "cvtbl", {"rbwl", 0x98 } }, -{ "cvtbw", {"rbww", 0x99 } }, -{ "movzbl", {"rbwl", 0x9a } }, -{ "movzbw", {"rbww", 0x9b } }, -{ "rotl", {"rbrlwl", 0x9c } }, -{ "acbb", {"rbrbmbbw", 0x9d } }, -{ "movab", {"abwl", 0x9e } }, -{ "pushab", {"ab", 0x9f } }, -{ "addw2", {"rwmw", 0xa0 } }, -{ "addw3", {"rwrwww", 0xa1 } }, -{ "subw2", {"rwmw", 0xa2 } }, -{ "subw3", {"rwrwww", 0xa3 } }, -{ "mulw2", {"rwmw", 0xa4 } }, -{ "mulw3", {"rwrwww", 0xa5 } }, -{ "divw2", {"rwmw", 0xa6 } }, -{ "divw3", {"rwrwww", 0xa7 } }, -{ "bisw2", {"rwmw", 0xa8 } }, -{ "bisw3", {"rwrwww", 0xa9 } }, -{ "bicw2", {"rwmw", 0xaa } }, -{ "bicw3", {"rwrwww", 0xab } }, -{ "xorw2", {"rwmw", 0xac } }, -{ "xorw3", {"rwrwww", 0xad } }, -{ "mnegw", {"rwww", 0xae } }, -{ "casew", {"rwrwrw", 0xaf } }, -{ "movw", {"rwww", 0xb0 } }, -{ "cmpw", {"rwrw", 0xb1 } }, -{ "mcomw", {"rwww", 0xb2 } }, -{ "bitw", {"rwrw", 0xb3 } }, -{ "clrw", {"ww", 0xb4 } }, -{ "tstw", {"rw", 0xb5 } }, -{ "incw", {"mw", 0xb6 } }, -{ "decw", {"mw", 0xb7 } }, -{ "bispsw", {"rw", 0xb8 } }, -{ "bicpsw", {"rw", 0xb9 } }, -{ "popr", {"rw", 0xba } }, -{ "pushr", {"rw", 0xbb } }, -{ "chmk", {"rw", 0xbc } }, -{ "chme", {"rw", 0xbd } }, -{ "chms", {"rw", 0xbe } }, -{ "chmu", {"rw", 0xbf } }, -{ "addl2", {"rlml", 0xc0 } }, -{ "addl3", {"rlrlwl", 0xc1 } }, -{ "subl2", {"rlml", 0xc2 } }, -{ "subl3", {"rlrlwl", 0xc3 } }, -{ "mull2", {"rlml", 0xc4 } }, -{ "mull3", {"rlrlwl", 0xc5 } }, -{ "divl2", {"rlml", 0xc6 } }, -{ "divl3", {"rlrlwl", 0xc7 } }, -{ "bisl2", {"rlml", 0xc8 } }, -{ "bisl3", {"rlrlwl", 0xc9 } }, -{ "bicl2", {"rlml", 0xca } }, -{ "bicl3", {"rlrlwl", 0xcb } }, -{ "xorl2", {"rlml", 0xcc } }, -{ "xorl3", {"rlrlwl", 0xcd } }, -{ "mnegl", {"rlwl", 0xce } }, -{ "casel", {"rlrlrl", 0xcf } }, -{ "movl", {"rlwl", 0xd0 } }, -{ "cmpl", {"rlrl", 0xd1 } }, -{ "mcoml", {"rlwl", 0xd2 } }, -{ "bitl", {"rlrl", 0xd3 } }, -{ "clrf", {"wf", 0xd4 } }, -{ "clrl", {"wl", 0xd4 } }, -{ "tstl", {"rl", 0xd5 } }, -{ "incl", {"ml", 0xd6 } }, -{ "decl", {"ml", 0xd7 } }, -{ "adwc", {"rlml", 0xd8 } }, -{ "sbwc", {"rlml", 0xd9 } }, -{ "mtpr", {"rlrl", 0xda } }, -{ "mfpr", {"rlwl", 0xdb } }, -{ "movpsl", {"wl", 0xdc } }, -{ "pushl", {"rl", 0xdd } }, -{ "moval", {"alwl", 0xde } }, -{ "movaf", {"afwl", 0xde } }, -{ "pushal", {"al", 0xdf } }, -{ "pushaf", {"af", 0xdf } }, -{ "bbs", {"rlabbb", 0xe0 } }, -{ "bbc", {"rlabbb", 0xe1 } }, -{ "bbss", {"rlabbb", 0xe2 } }, -{ "bbcs", {"rlabbb", 0xe3 } }, -{ "bbsc", {"rlabbb", 0xe4 } }, -{ "bbcc", {"rlabbb", 0xe5 } }, -{ "bbssi", {"rlabbb", 0xe6 } }, -{ "bbcci", {"rlabbb", 0xe7 } }, -{ "blbs", {"rlbb", 0xe8 } }, -{ "blbc", {"rlbb", 0xe9 } }, -{ "ffs", {"rlrbvbwl", 0xea } }, -{ "ffc", {"rlrbvbwl", 0xeb } }, -{ "cmpv", {"rlrbvbrl", 0xec } }, -{ "cmpzv", {"rlrbvbrl", 0xed } }, -{ "extv", {"rlrbvbwl", 0xee } }, -{ "extzv", {"rlrbvbwl", 0xef } }, -{ "insv", {"rlrlrbvb", 0xf0 } }, -{ "acbl", {"rlrlmlbw", 0xf1 } }, -{ "aoblss", {"rlmlbb", 0xf2 } }, -{ "aobleq", {"rlmlbb", 0xf3 } }, -{ "sobgeq", {"mlbb", 0xf4 } }, -{ "sobgtr", {"mlbb", 0xf5 } }, -{ "cvtlb", {"rlwb", 0xf6 } }, -{ "cvtlw", {"rlww", 0xf7 } }, -{ "ashp", {"rbrwabrbrwab", 0xf8 } }, -{ "cvtlp", {"rlrwab", 0xf9 } }, -{ "callg", {"abab", 0xfa } }, -{ "calls", {"rlab", 0xfb } }, -{ "xfc", {"", 0xfc } }, - /* undefined opcodes here */ -{ "cvtdh", {"rdwh", 0x32fd } }, -{ "cvtgf", {"rgwh", 0x33fd } }, -{ "addg2", {"rgmg", 0x40fd } }, -{ "addg3", {"rgrgwg", 0x41fd } }, -{ "subg2", {"rgmg", 0x42fd } }, -{ "subg3", {"rgrgwg", 0x43fd } }, -{ "mulg2", {"rgmg", 0x44fd } }, -{ "mulg3", {"rgrgwg", 0x45fd } }, -{ "divg2", {"rgmg", 0x46fd } }, -{ "divg3", {"rgrgwg", 0x47fd } }, -{ "cvtgb", {"rgwb", 0x48fd } }, -{ "cvtgw", {"rgww", 0x49fd } }, -{ "cvtgl", {"rgwl", 0x4afd } }, -{ "cvtrgl", {"rgwl", 0x4bfd } }, -{ "cvtbg", {"rbwg", 0x4cfd } }, -{ "cvtwg", {"rwwg", 0x4dfd } }, -{ "cvtlg", {"rlwg", 0x4efd } }, -{ "acbg", {"rgrgmgbw", 0x4ffd } }, -{ "movg", {"rgwg", 0x50fd } }, -{ "cmpg", {"rgrg", 0x51fd } }, -{ "mnegg", {"rgwg", 0x52fd } }, -{ "tstg", {"rg", 0x53fd } }, -{ "emodg", {"rgrwrgwlwg", 0x54fd } }, -{ "polyg", {"rgrwab", 0x55fd } }, -{ "cvtgh", {"rgwh", 0x56fd } }, - /* undefined opcodes here */ -{ "addh2", {"rhmh", 0x60fd } }, -{ "addh3", {"rhrhwh", 0x61fd } }, -{ "subh2", {"rhmh", 0x62fd } }, -{ "subh3", {"rhrhwh", 0x63fd } }, -{ "mulh2", {"rhmh", 0x64fd } }, -{ "mulh3", {"rhrhwh", 0x65fd } }, -{ "divh2", {"rhmh", 0x66fd } }, -{ "divh3", {"rhrhwh", 0x67fd } }, -{ "cvthb", {"rhwb", 0x68fd } }, -{ "cvthw", {"rhww", 0x69fd } }, -{ "cvthl", {"rhwl", 0x6afd } }, -{ "cvtrhl", {"rhwl", 0x6bfd } }, -{ "cvtbh", {"rbwh", 0x6cfd } }, -{ "cvtwh", {"rwwh", 0x6dfd } }, -{ "cvtlh", {"rlwh", 0x6efd } }, -{ "acbh", {"rhrhmhbw", 0x6ffd } }, -{ "movh", {"rhwh", 0x70fd } }, -{ "cmph", {"rhrh", 0x71fd } }, -{ "mnegh", {"rhwh", 0x72fd } }, -{ "tsth", {"rh", 0x73fd } }, -{ "emodh", {"rhrwrhwlwh", 0x74fd } }, -{ "polyh", {"rhrwab", 0x75fd } }, -{ "cvthg", {"rhwg", 0x76fd } }, - /* undefined opcodes here */ -{ "clrh", {"wh", 0x7cfd } }, -{ "clro", {"wo", 0x7cfd } }, -{ "movo", {"rowo", 0x7dfd } }, -{ "movah", {"ahwl", 0x7efd } }, -{ "movao", {"aowl", 0x7efd } }, -{ "pushah", {"ah", 0x7ffd } }, -{ "pushao", {"ao", 0x7ffd } }, - /* undefined opcodes here */ -{ "cvtfh", {"rfwh", 0x98fd } }, -{ "cvtfg", {"rfwg", 0x99fd } }, - /* undefined opcodes here */ -{ "cvthf", {"rhwf", 0xf6fd } }, -{ "cvthd", {"rhwd", 0xf7fd } }, - /* undefined opcodes here */ -{ "bugl", {"rl", 0xfdff } }, -{ "bugw", {"rw", 0xfeff } }, - /* undefined opcodes here */ - -{ "" , "" } /* empty is end sentinel */ - -}; /* votstrs */ - -/* end: vax.opcode.h */ diff --git a/gdb/xm-hppabsd.h b/gdb/xm-hppabsd.h index 7e5a4c5..e69de29 100644 --- a/gdb/xm-hppabsd.h +++ b/gdb/xm-hppabsd.h @@ -1,52 +0,0 @@ -/* Parameters for hosting on an HPPA PA-RISC machine, running BSD, for GDB. - Copyright 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* This is a big-endian host. */ - -#define HOST_BYTE_ORDER BIG_ENDIAN - -/* Avoid "INT_MIN redefined" warnings -- by defining it here, exactly - the same as in the system file. */ -#undef INT_MIN -#define INT_MIN 0x80000000 - -#ifndef hp800 -#define USG -#endif - - -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ - sp = hp_push_arguments(nargs, args, sp, struct_return, struct_addr) - -#define KERNEL_U_ADDR 0 - -/* What a coincidence! */ -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ addr = (int)(blockend) + REGISTER_BYTE (regno);} - -#define U_REGS_OFFSET 0 - -#ifndef SEEK_SET -# define SEEK_SET 0 /* Set file pointer to "offset" */ -# define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif /* SEEK_SET */ diff --git a/gdb/xm-hppahpux.h b/gdb/xm-hppahpux.h index 83cb839..e69de29 100644 --- a/gdb/xm-hppahpux.h +++ b/gdb/xm-hppahpux.h @@ -1,46 +0,0 @@ -/* Parameters for hosting on an HPPA-RISC machine running HPUX, for GDB. - Copyright 1991, 1992 Free Software Foundation, Inc. - - Contributed by the Center for Software Science at the - University of Utah (pa-gdb-bugs@cs.utah.edu). - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Host is big-endian. */ -#define HOST_BYTE_ORDER BIG_ENDIAN - -/* Avoid "INT_MIN redefined" warnings -- by defining it here, exactly - the same as in the system file. */ -#undef INT_MIN -#define INT_MIN 0x80000000 - -#ifndef hp800 -#define USG -#endif - -#define HAVE_TERMIO - -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ - sp = hp_push_arguments(nargs, args, sp, struct_return, struct_addr) - -#define KERNEL_U_ADDR 0 - -/* What a coincidence! */ -#define REGISTER_U_ADDR(addr, blockend, regno) \ -{ addr = (int)(blockend) + REGISTER_BYTE (regno);} - -#define U_REGS_OFFSET 0 diff --git a/gdb/xm-sun4os5.h b/gdb/xm-sun4os5.h index 5749319..e69de29 100644 --- a/gdb/xm-sun4os5.h +++ b/gdb/xm-sun4os5.h @@ -1,61 +0,0 @@ -/* Macro definitions for running gdb on a Sun 4 running sunos 5. - Copyright 1989, 1992 Free Software Foundation, Inc. - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* Most of what we know is generic to SPARC hosts. */ - -#include "xm-sparc.h" - -/* Pick up more stuff from the generic SVR4 host include file. */ - -#include "xm-sysv4.h" - -/* SVR4's can't seem to agree on what to call the type that contains the - general registers. Kludge around it with a #define. */ - -#define gregset_t prgreg_t -#define fpregset_t prfpregset_t - -/* The native Sun compiler complains about using volatile - to indicate functions that never return. So shut it up by simply - defining away "NORETURN", which is normally defined to "volatile". */ - -#ifndef __GNUC__ -# define NORETURN /**/ -#endif - -/* Large alloca's fail because the attempt to increase the stack limit in - main() fails because shared libraries are allocated just below the initial - stack limit. The SunOS kernel will not allow the stack to grow into - the area occupied by the shared libraries. Sun knows about this bug - but has no obvious fix for it. */ -#define BROKEN_LARGE_ALLOCA - -/* If you expect to use the mmalloc package to obtain mapped symbol files, - for now you have to specify some parameters that determine how gdb places - the mappings in it's address space. See the comments in map_to_address() - for details. This is expected to only be a short term solution. Yes it - is a kludge. - FIXME: Make this more automatic. */ - -#define MMAP_BASE_ADDRESS 0xE0000000 /* First mapping here */ -#define MMAP_INCREMENT 0x01000000 /* Increment to next mapping */ - -/* These are not currently used in SVR4 (but should be, FIXME!). */ -#undef DO_DEFERRED_STORES -#undef CLEAR_DEFERRED_STORES diff --git a/gdb/xm-svr4.h b/gdb/xm-svr4.h index f4c4a53..e69de29 100755 --- a/gdb/xm-svr4.h +++ b/gdb/xm-svr4.h @@ -1,56 +0,0 @@ -/* Definitions for running gdb on a host machine running any flavor of SVR4. - Copyright (C) 1991, Free Software Foundation, Inc. - Written by Fred Fish at Cygnus Support (fnf@cygint) - -This file is part of GDB. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* SVR4 has /proc support, so use it instead of ptrace. */ - -#define USE_PROC_FS - -/* SVR4 has termio facilities. */ - -#define HAVE_TERMIO - -/* TIOCGETC and TIOCGLTC are picked up somewhere, but struct tchars - and struct ltchars are not. This makes problems for inflow.c. - It is unknown at this time if this is a generic SVR4 problem or - one just limited to the initial SVR4 port host machine. */ - -#define TIOCGETC_BROKEN -#define TIOCGLTC_BROKEN - -/* SVR4 is a derivative of System V Release 3 (USG) */ - -#define USG - -/* Get rid of any system-imposed stack limit if possible. */ - -/* #define SET_STACK_LIMIT_HUGE */ - -/* SVR4 machines can easily do attach and detach via /proc (procfs.c) - support */ - -#define ATTACH_DETACH - -/* If we are using SVR4 /proc instead of ptrace, use CREATE_INFERIOR_HOOK - to do internal /proc initialization. */ - -#ifdef USE_PROC_FS -#define CREATE_INFERIOR_HOOK(pid) inferior_proc_init(pid) -#endif - -- cgit v1.1