Johns release

This commit is contained in:
K. Richard Pixley 1991-03-28 16:28:29 +00:00
parent bd5635a1e2
commit dd3b648e8b
246 changed files with 59132 additions and 0 deletions

15
gdb/.gdbinit Normal file
View file

@ -0,0 +1,15 @@
echo Setting up the environment for debugging gdb.\n
b fatal
b info_command
commands
silent
return
end
define rr
run
end
set prompt (top-gdb)

163
gdb/Convex.notes Normal file
View file

@ -0,0 +1,163 @@
@node Convex,,, Top
@appendix Convex-specific info
@cindex Convex notes
Scalar registers are 64 bits long, which is a pain since
left half of an S register frequently contains noise.
Therefore there are two ways to obtain the value of an S register.
@table @kbd
@item $s0
returns the low half of the register as an int
@item $S0
returns the whole register as a long long
@end table
You can print the value in floating point by using @samp{p/f $s0} or @samp{p/f $S0}
to print a single or double precision value.
@cindex vector registers
Vector registers are handled similarly, with @samp{$V0} denoting the whole
64-bit register and @kbd{$v0} denoting the 32-bit low half; @samp{p/f $v0}
or @samp{p/f $V0} can be used to examine the register in floating point.
The length of the vector registers is taken from @samp{$vl}.
Individual elements of a vector register are denoted in the obvious way;
@samp{print $v3[9]} prints the tenth element of register @kbd{v3}, and
@samp{set $v3[9] = 1234} alters it.
@kbd{$vl} and @kbd{$vs} are int, and @kbd{$vm} is an int vector.
Elements of @kbd{$vm} can't be assigned to.
@cindex communication registers
@kindex info comm-registers
Communication registers have names @kbd{$C0 .. $C63}, with @kbd{$c0 .. $c63}
denoting the low-order halves. @samp{info comm-registers} will print them
all out, and tell which are locked. (A communication register is
locked when a value is sent to it, and unlocked when the value is
received.) Communication registers are, of course, global to all
threads, so it does not matter what the currently selected thread is.
@samp{info comm-reg @var{name}} prints just that one communication
register; @samp{name} may also be a communication register number
@samp{nn} or @samp{0xnn}.
@samp{info comm-reg @var{address}} prints the contents of the resource
structure at that address.
@kindex info psw
The command @samp{info psw} prints the processor status word @kbd{$ps}
bit by bit.
@kindex set base
GDB normally prints all integers in base 10, but the leading
@kbd{0x80000000} of pointers is intolerable in decimal, so the default
output radix has been changed to try to print addresses appropriately.
The @samp{set base} command can be used to change this.
@table @code
@item set base 10
Integer values always print in decimal.
@item set base 16
Integer values always print in hex.
@item set base
Go back to the initial state, which prints integer values in hex if they
look like pointers (specifically, if they start with 0x8 or 0xf in the
stack), otherwise in decimal.
@end table
@kindex set pipeline
When an exception such as a bus error or overflow happens, usually the PC
is several instructions ahead by the time the exception is detected.
The @samp{set pipe} command will disable this.
@table @code
@item set pipeline off
Forces serial execution of instructions; no vector chaining and no
scalar instruction overlap. With this, exceptions are detected with
the PC pointing to the instruction after the one in error.
@item set pipeline on
Returns to normal, fast, execution. This is the default.
@end table
@cindex parallel
In a parallel program, multiple threads may be executing, each
with its own registers, stack, and local memory. When one of them
hits a breakpoint, that thread is selected. Other threads do
not run while the thread is in the breakpoint.
@kindex 1cont
The selected thread can be single-stepped, given signals, and so
on. Any other threads remain stopped. When a @samp{cont} command is given,
all threads are resumed. To resume just the selected thread, use
the command @samp{1cont}.
@kindex thread
The @samp{thread} command will show the active threads and the
instruction they are about to execute. The selected thread is marked
with an asterisk. The command @samp{thread @var{n}} will select thread @var{n},
shifting the debugger's attention to it for single-stepping,
registers, local memory, and so on.
@kindex info threads
The @samp{info threads} command will show what threads, if any, have
invisibly hit breakpoints or signals and are waiting to be noticed.
@kindex set parallel
The @samp{set parallel} command controls how many threads can be active.
@table @code
@item set parallel off
One thread. Requests by the program that other threads join in
(spawn and pfork instructions) do not cause other threads to start up.
This does the same thing as the @samp{limit concurrency 1} command.
@item set parallel fixed
All CPUs are assigned to your program whenever it runs. When it
executes a pfork or spawn instruction, it begins parallel execution
immediately. This does the same thing as the @samp{mpa -f} command.
@item set parallel on
One or more threads. Spawn and pfork cause CPUs to join in when and if
they are free. This is the default. It is very good for system
throughput, but not very good for finding bugs in parallel code. If you
suspect a bug in parallel code, you probably want @samp{set parallel fixed.}
@end table
@subsection Limitations
WARNING: Convex GDB evaluates expressions in long long, because S
registers are 64 bits long. However, GDB expression semantics are not
exactly C semantics. This is a bug, strictly speaking, but it's not one I
know how to fix. If @samp{x} is a program variable of type int, then it
is also type int to GDB, but @samp{x + 1} is long long, as is @samp{x + y}
or any other expression requiring computation. So is the expression
@samp{1}, or any other constant. You only really have to watch out for
calls. The innocuous expression @samp{list_node (0x80001234)} has an
argument of type long long. You must explicitly cast it to int.
It is not possible to continue after an uncaught fatal signal by using
@samp{signal 0}, @samp{return}, @samp{jump}, or anything else. The difficulty is with
Unix, not GDB.
I have made no big effort to make such things as single-stepping a
@kbd{join} instruction do something reasonable. If the program seems to
hang when doing this, type @kbd{ctrl-c} and @samp{cont}, or use
@samp{thread} to shift to a live thread. Single-stepping a @kbd{spawn}
instruction apparently causes new threads to be born with their T bit set;
this is not handled gracefully. When a thread has hit a breakpoint, other
threads may have invisibly hit the breakpoint in the background; if you
clear the breakpoint gdb will be surprised when threads seem to continue
to stop at it. All of these situations produce spurious signal 5 traps;
if this happens, just type @samp{cont}. If it becomes a nuisance, use
@samp{handle 5 nostop}. (It will ask if you are sure. You are.)
There is no way in GDB to store a float in a register, as with
@kbd{set $s0 = 3.1416}. The identifier @kbd{$s0} denotes an integer,
and like any C expression which assigns to an integer variable, the
right-hand side is casted to type int. If you should need to do
something like this, you can assign the value to @kbd{@{float@} ($sp-4)}
and then do @kbd{set $s0 = $sp[-4]}. Same deal with @kbd{set $v0[69] = 6.9}.

506
gdb/Makefile.dist Executable file
View file

@ -0,0 +1,506 @@
##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
# 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
MALLOC_CFLAGS =
# Where is the "include" directory? Traditionally ../include or ./include
INCLUDE_DIR = ${srcdir}/../include
INCLUDE_DEP = $$(INCLUDE_DIR)
# Where is the BFD library? Traditionally ../bfd or ./bfd
BFD_DIR = ${srcdir}/../bfd
BFD_DEP = $$(BFD_DIR)
# All the includes used for CFLAGS and for lint.
# -I. for config files.
# -I${srcdir} for <obstack.h>, possibly 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)
# define this to be "obstack.o" if you don't have the obstack library installed
# so that the dependencies work right.
OBSTACK = obstack.o
# Requires GNU getopt_long features.
GETOPT = getopt.o getopt1.o
# Where is the getopt directory? Traditionally ../getopt or ./getopt
GETOPT_DIR = ${srcdir}/../getopt
GETOPT_DEP = $$(GETOPT_DIR)
# 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}/libbfd.a
CDEPS = ${XM_CDEPS} ${TM_CDEPS} ${BFD_DIR}/libbfd.a
ADD_FILES = ${OBSTACK} ${REGEX} ${ALLOCA} ${GNU_MALLOC} ${GETOPT}
ADD_DEPS = ${OBSTACK} ${REGEX1} ${ALLOCA1} ${GNU_MALLOC} ${GETOPT}
VERSION = 3.94.2
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 convex-opcode.h pyr-opcode.h mips-opcode.h \
am29k-opcode.h
REMOTE_EXAMPLES = remote-sa.m68k.shar remote-multi.shar
MALLOCSRC = gmalloc.c mcheck.c ansidecl.h stdlib.h gmalloc.h stddef.h
GETOPTSRC = $(GETOPT_DIR)/getopt.c $(GETOPT_DIR)/getopt1.c
POSSLIBS_MAINDIR = obstack.h obstack.c regex.c regex.h alloca.c \
$(MALLOCSRC)
POSSLIBS = $(POSSLIBS_MAINDIR) $(GETOPTSRC)
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.srcdir \
createtags munch config.gdb config.status \
ChangeLog ChangeLog-3.x \
README TODO TAGS WHATS.NEW \
gdb.texinfo gdb-int.texinfo gdbrc.tex threecol.tex \
.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 \
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) $(GETOPTSRC) $(DEPFILES) copying.c obstack.c version.c
#setopt load_flags $(CFLAGS) -I$(BFD_DIR)
#load ./init.c $(SFILES)
#unload ${srcdir}/expread.y
#load ${srcdir}/expread.tab.c readline/libreadline.a
#load copying.c version.c
#load obstack.c $(GETOPTSRC)
#load `echo " "$(DEPFILES) | sed -e 's/\.o/.c/g' -e 's, , ../,g'`
#load ${BFD_DIR}/libbfd.a -ltermcap
##void mcheck(a) void (*a)(); { }
# 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.srcdir $(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 <alldeps.tmp | uniq | \
sed -e 's/arm-convert.o/arm-convert.s/' \
-e 's!^Onindy.o!nindy-share/Onindy.c!' \
-e 's!^nindy.o!nindy-share/nindy.c!' \
-e 's!ttybreak.o!nindy-share/ttybreak.c!' \
-e 's!ttyflush.o!nindy-share/ttyflush.c!' \
-e 's!xdr_ld.o!vx-share/xdr_ld.c!' \
-e 's!xdr_ptrace.o!vx-share/xdr_ptrace.c!' \
-e 's!xdr_rdb.o!vx-share/xdr_rdb.c!' \
-e 's!xdr_regs.o!vx-share/xdr_regs.c!' \
-e 's/\.o/.c/' \
>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 <allparam.tmp | uniq | awk 'BEGIN {printf "ALLPARAM="} \
NR == 0 {printf $$0;} \
NR != 0 {printf "\\\n" $$0} \
END {printf "\n\n"}' >>alldeps.mak;
sort <allconfig.tmp | uniq | awk 'BEGIN {printf "ALLCONFIG="} \
NR == 0 {printf $$0;} \
NR != 0 {printf "\\\n" $$0} \
END {printf "\n\n"}' >>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.tmp sed -e 's/ [xt]m.h/& config.status/g' \
-e 's; vx-share/; $${srcdir}/vx-share/;g' \
-e 's; nindy-share/; $${srcdir}/nindy-share/;g' \
-e 's; $(INCLUDE_DIR)/; $(INCLUDE_DEP)/;g' \
-e 's; [a-z0-9./]*bfd/; $(BFD_DEP)/;g' \
-e 's; [a-z0-9./]*getopt/; $(GETOPT_DEP)/;g' \
-e 's; \./; $${srcdir}/;g' \
>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.
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]
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.dvi : gdb.texinfo
tex gdb.texinfo
texindex gdb.??
tex gdb.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.
getopt1.o: $(GETOPT_DIR)/getopt1.c
${CC} -c ${CFLAGS} $(GETOPT_DIR)/getopt1.c
getopt.o: $(GETOPT_DIR)/getopt.c
${CC} -c ${CFLAGS} $(GETOPT_DIR)/getopt.c
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 -Dnounderscore `echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'`

1
gdb/Makefile.srcdir Executable file
View file

@ -0,0 +1 @@
srcdir=.

97
gdb/Projects Normal file
View file

@ -0,0 +1,97 @@
Suggested projects for aspiring or current GDB hackers
======================================================
(You should probably chat with bug-gdb@cygnus.com to make sure that
no one else is doing the project you chose).
Rewrite proceed, wait_for_inferior, and normal_stop to clean them up.
Suggestions:
1) Make each test in wait_for_inferior a seperate subroutine
call.
2) Combine wait_for_inferior and normal_stop to clean up
communication via global variables.
3) See if you can find some way to clean up the global
variables that are used; possibly group them by data flow
and information content?
Work out some kind of way to allow running the inferior to be done as
a sub-execution of, eg. breakpoint command lists. Currently running
the inferior interupts any command list execution. This would require
some rewriting of wait_for_inferior & friends, and hence should
probably be done in concert with the above.
Add function arguments to gdb user defined functions.
Add convenience variables that refer to exec file, symbol file,
selected frame source file, selected frame function, selected frame
line number, etc.
Add a "suspend" subcommand of the "continue" command to suspend gdb
while continuing execution of the subprocess. Useful when you are
debugging servers and you want to dodge out and initiate a connection
to a server running under gdb.
Work out and implement a reasonably general mechanism for multi-threaded
processies. There are parts of one implemented in convex-dep.c, if
you want an example.
Add stab information to allow reasonable debugging of inline functions
(possibly they should show up on a stack backtrace? With a note
indicating that they weren't "real"?).
Implement support for specifying arbitrary locations of stack frames
(in practice, this usually requires specification of both the top and
bottom of the stack frame (fp and sp), since you *must* retrieve the
pc that was saved in the innermost frame).
Modify the naked "until" command to step until past the current source
line, rather than past the current pc value. This is tricky simply
because the low level routines have no way of specifying a multi-line
step range, and there is no way of saying "don't print stuff when we
stop" from above (otherwise could just call step many times).
Modify the handling of symbols grouped through BINCL/EINCL stabs to
allocate a partial symtab for each BINCL/EINCL grouping. This will
seriously decrease the size of inter-psymtab dependencies and hence
lessen the amount that needs to be read in when a new source file is
accessed.
Do an "x/i $pc" after each stepi or nexti.
Modify all of the disassemblers to use printf_filtered to get correct
more filtering.
Modify gdb to work correctly with Pascal.
Rewrite macros that handle frame chaining and frameless functions.
They should be able to tell the difference between start, main, and a
frameless function called from main.
Work out what information would need to be included in an executable
by the compiler to allow gdb to debug functions which do not have a
frame pointer. Modify gdb and gcc to do this.
When `attached' to a program (via either OS support or remote
debugging), gdb should arrange to catch signals which the terminal
might send, as it is unlikely that the program will be able to notice
them. SIGINT and SIGTSTP are obvious examples.
Enhance the gdb manual with extra examples where needed.
Arrange for list_command not to use decode_line_1 and thus not require
symbols to be read in simply to read a source file.
Allow patching of executables, a la "adb -w".
Improve the target interface so that targets can be stacked; e.g. an
exec file and a core file (memory references that the core file can't
satisfy are directed to the exec file); those two plus a child process.
The child doesn't let any refs through, but when the child terminates,
you are back to debugging the core file -- you might even want to swap
back and forth between the two, or between two core files.
# Local Variables:
# mode: text
# End:

325
gdb/TODO Normal file
View file

@ -0,0 +1,325 @@
gdb bug list
John Gilmore, gnu@cygnus.com
This bug list is probably not up to date or accurate, but it reflects
some known bugs in gdb, if you are into bug-hunting.
Update the TODO list with all the lists of gdb bugs lying around on paper.
"share" command should not need to be manually run. It should be run
as soon as possible, automatically, both on "run" and on core files.
It should be possible to use symbols from shared libraries before we know
exactly where the libraries will be loaded. E.g. "b perror" before running
the program. This could maybe be done as an extension of the "breakpoint
re-evaluation" after new symbols are loaded.
Make single_step() insert and remove breakpoints in one operation.
Speed up single stepping by avoiding extraneous ptrace calls.
Speed up single stepping by not inserting and removing breakpoints
each time the inferior starts and stops.
Speed up watchpoints by not single-stepping them, but do something
faster like single-line execution.
Update gdb.texinfo to include doc on the directory structure and
the various tricks of building gdb.
Do a tutorial in gdb.texinfo on how to do simple things in gdb.
E.g. how to set a breakpoint that just prints something and continues.
How to break on aborts. Etc.
Do a "new features" section for release 4.
Provide "voodoo" debugging of core files. This creates a zombie
process as a child of the debugger, and loads it up with the data,
stack, and regs of the core file. This allows you to call functions
in the executable, to manipulate the data in the core file.
GDB reopens the source file on every line, as you "next" through it.
Referencing the vtbl member of a struct doesn't work. It prints OK
if you print the struct, but it gets 0 if you try to deref it.
Persistent command history: A feature where you could save off a list
of the commands you did, so you can edit it into something that will bring
the target to the same place every time you source it. Sun wants it.
This would also be useful for automated fast watchpointing; if you go
past the place where it watchpoints, you just start it over again and
do it more carefully.
Deal with the Sun ptrace bug that loses the registers if the stack is
paged out.
Finish the C++ exception handling stub routines. Lint points them out
as unused statics functions.
"i source" only shows you info about files that it can read. When it
can't read a file and complains, you can't see any info about it, like
where it was compiled. Perhaps "i source" should take an argument
like that of "list".
See if coredep.c's fetch_core_registers can be used on more machines.
E.g. MIPS (mips-xdep.c).
coredep.c is completely broken. Needs work just to compile, it uses
"u" and doesn't declare it, etc.
unpack_double() does not handle IEEE float on the target unless the host
is also IEEE. Death on a vax.
Test cross-debugging Unix-to-Unix.
Check the RAPP remote protocol. What is it? It's in Makefile.dist
and one ChangeLog entry.
Set up interface between GDB and INFO so that you can hop into interactive
INFO and back out again. When running under Emacs, should use Emacs
info, else fork the info program. Installation of GDB should install
its texinfo files into the info tree automagically, including the readline
texinfo files..
Improve backtrace output to avoid line wraps. Prettify it.
"help address" ought to find the "help set addressprint" entry.
Remove the VTBL internal guts from printouts of C++ structs, unless
vtblprint is set.
Remove "at 0xnnnn" from the "b foo" response, if !addressprint and if
it matches the source line indicated.
The prompt at end of screen should accept space as well as CR.
"List" should put you into a pseudo-"more" where you can hit space
to get more, forever to eof.
Check STORE_RETURN_VALUE on all architectures. Check near it in tm-sparc.h
for other bogosities.
Check for storage leaks in GDB, I'm sure there are a lot!
vtblprint of a vtbl should demangle the names it's printing.
Backtrace should point out what the currently selected frame is, in its
display, perhaps showing ">3 foo (bar, ...)" rather than "#3 foo (bar, ...)".
"i program" should work for core files, and display more info, like what
actually caused it to die.
Hitting ^Z to an inferior doesn't work right, it takes several continues
to make it actually go.
"i fun" doesn't show misc function vector symbols.
"x/10i" should shorten the long name, if any, on subsequent lines.
Check through the code for FIXME comments and fix them. dbxread.c,
blockframe.c, and plenty more.
"next" over a function that longjumps, never stops until next time you happen
to get to that spot by accident. E.g. "n" over execute_command which has
an error.
Watchpoints seem not entirely reliable.
"set zeroprint off", don't bother printing members of structs which are entirely
zero. Useful for those big structs with few useful members.
GDB does four ioctl's for every command, probably switching terminal modes
to/from inferior or for readline or something.
terminal_ours versus terminal_inferior: cache state. Switch should be a noop
if the state is the same, too.
ptype $i6 = void??!
Clean up invalid_float handling so gdb doesn't coredump when it tries to
access a NaN. While this might work on SPARC, other machines are not
configured right.
"b value_at ; commands ; continue ; end" stops EVERY OTHER TIME!
Then once you enter a command, it does the command, runs two more
times, and then stops again! Bizarre... (This behaviour has been
modified, but it is not yet 100% predictable when e.g. the commands
call functions in the child, and while there, the child is interrupted
with a signal, or hits a breakpoint.)
Symbol completion with TAB does not unmangle names!
help completion, help history should work.
Symbol completion doesn't handle e.g. W::f. (symtab.c,
make_symbol_completion_list).
AMD version: ^C should do ^Ak to stop ebmon.
Check that we can handle stack trace through varargs AND alloca in same
function, on 29K.
wait_for_inferior loops forever if wait() gives it an error.
"i frame" arg formatting sucks. Should wrap lines.
"bt" arg formatting needs the same treatment .
"i frame" shows wrong "arglist at" location, doesn't show where the args
should be found, only their actual values.
Symbolic display of addrs, (& disassembly prefixes), don't show static
fns, e.g. enable_command in gdb.
'ptype yylval' ==> "union YYSTYPE { ..... }". However, it is not a
union YYSTYPE, but is simply a YYSTYPE, which is a typedef for an
unnamed union.
"show all" should work.
There should be a way for "set" commands to validate the new setting
before it takes effect.
The "display" command should become the "always" command, e.g.
"always print XXX"
"always p/xxx XXX"
"always echo foo"
"always call XXX"
"always x/i $pc", etc.
A mess of floating point opcodes are missing from sparc-opcode.h.
Also, a little program should test the table for bits that are
overspecified or underspecified. E.g. if the must-be-ones bits
and the must-be-zeroes bits leave some fields unexamined, and the format
string leaves them unprinted, then point this out. If multiple
non-alias patterns match, point this out too. Finally, there should
be a sparc-optest.s file that tries each pattern out. This file
should end up coming back the same (modulo transformation comments)
if fed to "gas" then the .o is fed to gdb for disassembly.
Merge the xxx-opcode.h files with gas again...
Eliminate all the core_file_command's in all the xdep files.
Eliminate separate declarations of registers[] everywhere.
"ena d" is ambiguous, why? "ena delete" seems to think it is a command!
Line numbers are off in some spots. In proceed() at 1st "oneproc = 1",
it seems to run that statement, but it doesn't actually.
Perhaps the tdep and xdep files, and the tm and xm files, into a config
subdirectory. If not, at least straighten out their names so that
they all start with the machine name.
inferior_status should include stop_print_frame. It won't need to be
reset in wait_for_inferior after bpstat_stop_status call, then.
i line VAR produces "Line number not known for symbol ``var''.". I
thought we were stashing that info now!
Make sure we can handle executables with no symbol info, e.g. /bin/csh.
We should be able to write to executables that aren't running.
We should be able to write to random files at hex offsets like adb.
Tiemann: It is very painful to look at fp registers that hold
double precision values. GDB is happy to show them to you as single
precision, but you cannot look at them as doubles. Perhaps casting
should be changed to make this work; or maybe a new "set" option that
sets the default fp precision to single, double, or quad. This is not
urgent, but would be nice to get into GDB 4.0.
Make "target xxx" command interruptible.
Handle add_file with separate text, data, and bss addresses. Maybe
handle separate addresses for each segment in the object file?
Handle free_named_symtab to cope with multiply-loaded object files
in a dynamic linking environment. Should remember the last copy loaded,
but not get too snowed if it finds references to the older copy.
Implement have_memory, have_stack, have_registers, have_execution.
Memory: core, exec, child, vxworks even without child.
stack: core, child, vxworks with child
registers: core, child, vxworks with child
execution: child, vxworks with child.
The original BFD core dump reading routine would itself coredump when fed
a garbage file as a core file. Does the current one?
Breakpoints should not be inserted and deleted all the time. Only the
one(s) there should be removed when we have to step over one. Support
breakpoints that don't have to be removed to step over them.
Stop reading stop_registers!
Generalize and Standardize the RPC interface to a target program,
improve it beyond the "ptrace" interface, and see if it can become a standard
for remote debugging. Is WRS interested in donating their target-end
code?
Remove all references to:
text_offset
data_offset
text_data_start
text_end
exec_data_offset
...
now that we have BFD. All remaining are in machine dependent files.
When quitting with a running program, if a core file was previously
examined, you get "Couldn't read float regs from core file"...if
indeed it can't. generic_mourn_inferior...
...
Check signal argument to remote proceed's and error if set.
Handle floating point registers in core files under BFD. Currently
they are punted.
Sort help and info output.
Re-organize help categories into things that tend to fit on a screen
and hang together.
When trying to print source lines but you can't find the file,
print the file name and line number, and leave it selected anyway
so "i source" will show it.
renote-nindy.c handles interrupts poorly; it error()s out of badly
chosen places, e.g. leaving current_frame zero, which causes core dumps
on the next command.
Add in commands like ADB's for searching for patterns, etc. We should
be able to examine and patch raw unsymboled binaries as well in gdb as
we can in adb. (E.g. increase the timeout in /bin/login without source).
Those xdep files that call register_addr without defining it are
probably simply broken. When reconfiguring this part of gdb, I could
only make guesses about how to redo some of those files, and I
probably guessed wrong, or left them "for later" when I have a
machine that can attempt to build them.
Use the complain() mechanism for handling all the error() calls in dbxread.c,
and in similar situations in coffread.c and mipsread.c.
When doing "step" or "next", if a few lines of source are skipped between
the previous line and the current one, print those lines, not just the
last line of a multiline statement.
When searching for C++ superclasses in value_cast in valops.c, we must
not search the "fields", only the "superclasses". There might be a
struct with a field name that matches the superclass name. This can
happen when the struct was defined before the superclass (before the
name became a typedef).
For "float point[15];":
ptype &point[4] ==> Attempt to take address of non-lvalue.
p &point[4] ==> Dereferences point[4] rather than giving you point+4.
Fix symbol reading in the presence of interrupts. It currently leaves a
cleanup to blow away the entire symbol table when a QUIT occurs.

223
gdb/WHATS.NEW Executable file
View file

@ -0,0 +1,223 @@
GDB 4.0 -- what has changed since 3.5?
* New Facilities
Gdb now paginates its output, with a ``more''-like interface. You can
set the screen width and screen height with new ``set'' commands; they
default to your terminal settings. Wide output is wrapped at good
places to make the output more readable.
Gdb now reads its input via the ``readline'' interface. This provides
inline editing of commands, using familiar Emacs or VI commands (like
``tcsh'' or the korn shell); history substitutions a la the C shell;
and storage and recall of your command history across debugging
sessions. The default is Emacs mode; to switch temporarily to vi mode,
use control-meta-J or ESC control-j. You can switch permanently to vi
mode by putting the line ``set editing-mode vi'' in the file .inputrc
in your home directory. For full details, see the description in
readline/inc-readline.texinfo and readline/inc-history.texinfo.
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. It 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 "gdbrc.tex".
* 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.
caution 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 write 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.
screen-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.
screen-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 screen-height'' and
``set screen-width'' instead.
addressprint 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.
arrayprint on/off: Prettyprint arrays. New convenient format! Default
is OFF.
demangle on/off: Print C++ symbols in "source" form if on, "raw" form if off.
asm-demangle on/off: Same, for assembler level printouts like instructions.
vtblprint 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; GCC includes this information. If GDB can't find
your source file in the current directory, type "dir .".
* Features removed in this release
``info types'' has been removed, since it printed builtin types in a
confusing fashion, and did not do useful things with typedefs. ``ptype''
or ``whatis'' are more useful commands for dealing with types..
* Configuring GDB for compilation
For normal use, type ``config.gdb host''. Hosts now handled are:
3b1 altos altosgas arm bigmips convex hp300bsd hp300hpux i386v i386v-g
i386v32 i386v32-g isi littlemips m88k merlin news news1000 none np1 pn
pyramid sun2os3 sun2os4 sun386 sun3os3 sun3os4 sun4os3 sun4os4 symmetry
umax vax
Type config.gdb +host to get a full description of each host.
You can now build gdb conveniently for several architectures from the
same sources. If config.gdb is run from a subdirectory, it configures
the Makefile to use source files from '..'. Each subdirectory can be
indpendently configured. An explicit source file directory can also
be specified with the +srcdir=xxx option. Due to obscure search rules
in the C preprocessor, if you have previously built gdb in the main
directory, run 'make cleanconfig' in the top level directory before
building it in a subdirectory.
GDB now handles cross debugging. If you are remotely debugging between
two different machines, type ``config.gdb host target''.
Host is the machine where gdb will run; target is the machine
where the program that you are debugging will run.
Type config.gdb +target to get a full description of each target.

196
gdb/alldeps.mak Normal file
View file

@ -0,0 +1,196 @@
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\
hp300hpux-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\
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\
symmetry-tdep.c\
symmetry-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-vxworks68.h\
tm-vxworks960.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/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/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/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/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

191
gdb/alloca.c Normal file
View file

@ -0,0 +1,191 @@
/*
alloca -- (mostly) portable public-domain implementation -- D A Gwyn
last edit: 86/05/30 rms
include config.h, since on VMS it renames some symbols.
Use xmalloc instead of malloc.
This implementation of the PWB library alloca() function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
It should work under any C implementation that uses an
actual procedure stack (as opposed to a linked list of
frames). There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca()-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection.
*/
#ifndef lint
static char SCCSid[] = "@(#)alloca.c 1.1"; /* for the "what" utility */
#endif
#ifdef emacs
#include "config.h"
#ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
#ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
#endif /* STACK_DIRECTION undefined */
#endif static
#endif emacs
#ifdef __STDC__
typedef void *pointer; /* generic pointer type */
#else
typedef char *pointer; /* generic pointer type */
#endif
#define NULL 0 /* null pointer constant */
extern void free();
extern pointer xmalloc();
/*
Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#ifndef STACK_DIRECTION
#define STACK_DIRECTION 0 /* direction unknown */
#endif
#if STACK_DIRECTION != 0
#define STACK_DIR STACK_DIRECTION /* known at compile-time */
#else /* STACK_DIRECTION == 0; need run-time code */
static int stack_dir; /* 1 or -1 once known */
#define STACK_DIR stack_dir
static void
find_stack_direction (/* void */)
{
static char *addr = NULL; /* address of first
`dummy', once known */
auto char dummy; /* to get stack address */
if (addr == NULL)
{ /* initial entry */
addr = &dummy;
find_stack_direction (); /* recurse once */
}
else /* second entry */
if (&dummy > addr)
stack_dir = 1; /* stack grew upward */
else
stack_dir = -1; /* stack grew downward */
}
#endif /* STACK_DIRECTION == 0 */
/*
An "alloca header" is used to:
(a) chain together all alloca()ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc()
alignment chunk size. The following default should work okay.
*/
#ifndef ALIGN_SIZE
#define ALIGN_SIZE sizeof(double)
#endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* to force sizeof(header) */
struct
{
union hdr *next; /* for chaining headers */
char *deep; /* for stack depth measure */
} h;
} header;
/*
alloca( size ) returns a pointer to at least `size' bytes of
storage which will be automatically reclaimed upon exit from
the procedure that called alloca(). Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32.
*/
static header *last_alloca_header = NULL; /* -> last alloca header */
pointer
alloca (size) /* returns pointer to storage */
unsigned size; /* # bytes to allocate */
{
auto char probe; /* probes stack depth: */
register char *depth = &probe;
#if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* unknown growth direction */
find_stack_direction ();
#endif
/* Reclaim garbage, defined as all alloca()ed storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* traverses linked list */
for (hp = last_alloca_header; hp != NULL;)
if (STACK_DIR > 0 && hp->h.deep > depth
|| STACK_DIR < 0 && hp->h.deep < depth)
{
register header *np = hp->h.next;
free ((pointer) hp); /* collect garbage */
hp = np; /* -> next header */
}
else
break; /* rest are not deeper */
last_alloca_header = hp; /* -> last valid storage */
}
if (size == 0)
return NULL; /* no allocation required */
/* Allocate combined header + user data storage. */
{
register pointer new = xmalloc (sizeof (header) + size);
/* address of header */
((header *)new)->h.next = last_alloca_header;
((header *)new)->h.deep = depth;
last_alloca_header = (header *)new;
/* User storage begins just after header. */
return (pointer)((char *)new + sizeof(header));
}
}

166
gdb/altos-xdep.c Normal file
View file

@ -0,0 +1,166 @@
/* Low level interface to ptrace, for GDB when running under m68k SVR2 Unix
on Altos 3068. Report bugs to Jyrki Kuoppala <jkp@cs.hut.fi>
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. */
#include <stdio.h>
#include "defs.h"
#include "param.h"
#include "frame.h"
#include "inferior.h"
#ifdef USG
#include <sys/types.h>
#endif
#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#ifdef USG
#include <sys/page.h>
#ifdef ALTOS
#include <sys/net.h>
#include <errno.h>
#endif
#endif
#include "gdbcore.h"
#include <sys/user.h> /* After a.out.h */
#include <sys/file.h>
#include <sys/stat.h>
/* Work with core dump and executable files, for GDB.
This code would be in core.c if it weren't machine-dependent. */
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;
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);
data_start = exec_data_start;
#if !defined (NBPG)
#define NBPG NBPP
#endif
#if !defined (UPAGES)
#define UPAGES USIZE
#endif
data_end = data_start + NBPG * u.u_dsize;
stack_start = stack_end - NBPG * u.u_ssize;
data_offset = NBPG * UPAGES + exec_data_start % NBPG /* Not sure about this //jkp */;
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 = (int) u.u_state;
if (reg_offset > NBPG * UPAGES)
reg_offset -= KERNEL_U_ADDR;
bcopy (&u.u_exdata, &core_aouthdr, sizeof (AOUTHDR));
printf ("Core file is from \"%s\".\n", u.u_comm);
/* I don't know where to find this info.
So, for now, mark it as not available. */
N_SET_MAGIC (core_aouthdr, 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
|| (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);
}
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");
}

271
gdb/am29k-opcode.h Normal file
View file

@ -0,0 +1,271 @@
/* Table of opcodes for the AMD 29000
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Jim Kingdon.
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 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; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
struct am29k_opcode {
/* Name of the instruction. */
char *name;
/* Opcode (i.e. most significant byte of the word). */
unsigned char opcode;
/* A string of characters which describe the operands.
Valid characters are:
, Itself. The character appears in the assembly code.
a RA. The register number is in bits 8-15 of the instruction.
b RB. The register number is in bits 0-7 of the instruction.
c RC. The register number is in bits 16-23 of the instruction.
i An immediate operand is in bits 0-7 of the instruction.
x Bits 0-7 and 16-23 of the instruction are bits 0-7 and 8-15
(respectively) of the immediate operand.
h Same as x but the instruction contains bits 16-31 of the
immediate operand.
X Same as x but bits 16-31 of the signed immediate operand
are set to 1 (thus the operand is always negative).
P,A Bits 0-7 and 16-23 of the instruction are bits 2-9 and 10-17
(respectively) of the immediate operand.
P=PC-relative, sign-extended to 32 bits.
A=Absolute, zero-extended to 32 bits.
e CE bit (bit 23) for a load/store instruction.
n Control field (bits 16-22) for a load/store instruction.
v Immediate operand in bits 16-23 of the instruction.
(used for trap numbers).
s SA. Special-purpose register number in bits 8-15
of the instruction.
u UI--bit 7 of the instruction.
r RND--bits 4-6 of the instruction.
d FD--bits 2-3 of the instruction.
f FS--bits 0-1 of the instruction. */
char *args;
};
static struct am29k_opcode am29k_opcodes[] =
{
{ "add", 0x14, "c,a,b" },
{ "add", 0x15, "c,a,i" },
{ "addc", 0x1c, "c,a,b" },
{ "addc", 0x1d, "c,a,i" },
{ "addcs", 0x18, "c,a,b" },
{ "addcs", 0x19, "c,a,i" },
{ "addcu", 0x1a, "c,a,b" },
{ "addcu", 0x1b, "c,a,i" },
{ "adds", 0x10, "c,a,b" },
{ "adds", 0x11, "c,a,i" },
{ "addu", 0x12, "c,a,b" },
{ "addu", 0x13, "c,a,i" },
{ "and", 0x90, "c,a,b" },
{ "and", 0x91, "c,a,i" },
{ "andn", 0x9c, "c,a,b" },
{ "andn", 0x9d, "c,a,i" },
{ "aseq", 0x70, "v,a,b" },
{ "aseq", 0x71, "v,a,i" },
{ "asge", 0x5c, "v,a,b" },
{ "asge", 0x5d, "v,a,i" },
{ "asgeu", 0x5e, "v,a,b" },
{ "asgeu", 0x5f, "v,a,i" },
{ "asgt", 0x58, "v,a,b" },
{ "asgt", 0x59, "v,a,i" },
{ "asgtu", 0x5a, "v,a,b" },
{ "asgtu", 0x5b, "v,a,i" },
{ "asle", 0x54, "v,a,b" },
{ "asle", 0x55, "v,a,i" },
{ "asleu", 0x56, "v,a,b" },
{ "asleu", 0x57, "v,a,i" },
{ "aslt", 0x50, "v,a,b" },
{ "aslt", 0x51, "v,a,i" },
{ "asltu", 0x52, "v,a,b" },
{ "asltu", 0x53, "v,a,i" },
{ "asneq", 0x72, "v,a,b" },
{ "asneq", 0x73, "v,a,i" },
{ "call", 0xa8, "a,P" },
{ "call", 0xa9, "a,A" },
{ "calli", 0xc8, "a,b" },
{ "class", 0xe6, "c,a,f" },
{ "clz", 0x08, "c,b" },
{ "clz", 0x09, "c,i" },
{ "const", 0x03, "a,x" },
{ "consth", 0x02, "a,h" },
{ "consthz", 0x05, "a,h" },
{ "constn", 0x01, "a,X" },
{ "convert", 0xe4, "c,a,u,r,d,f" },
{ "cpbyte", 0x2e, "c,a,b" },
{ "cpbyte", 0x2f, "c,a,i" },
{ "cpeq", 0x60, "c,a,b" },
{ "cpeq", 0x61, "c,a,i" },
{ "cpge", 0x4c, "c,a,b" },
{ "cpge", 0x4d, "c,a,i" },
{ "cpgeu", 0x4e, "c,a,b" },
{ "cpgeu", 0x4f, "c,a,i" },
{ "cpgt", 0x48, "c,a,b" },
{ "cpgt", 0x49, "c,a,i" },
{ "cpgtu", 0x4a, "c,a,b" },
{ "cpgtu", 0x4b, "c,a,i" },
{ "cple", 0x44, "c,a,b" },
{ "cple", 0x45, "c,a,i" },
{ "cpleu", 0x46, "c,a,b" },
{ "cpleu", 0x47, "c,a,i" },
{ "cplt", 0x40, "c,a,b" },
{ "cplt", 0x41, "c,a,i" },
{ "cpltu", 0x42, "c,a,b" },
{ "cpltu", 0x43, "c,a,i" },
{ "cpneq", 0x62, "c,a,b" },
{ "cpneq", 0x63, "c,a,i" },
{ "dadd", 0xf1, "c,a,b" },
{ "ddiv", 0xf7, "c,a,b" },
{ "deq", 0xeb, "c,a,b" },
{ "dge", 0xef, "c,a,b" },
{ "dgt", 0xed, "c,a,b" },
{ "div", 0x6a, "c,a,b" },
{ "div", 0x6b, "c,a,i" },
{ "div0", 0x68, "c,b" },
{ "div0", 0x69, "c,i" },
{ "divide", 0xe1, "c,a,b" },
{ "dividu", 0xe3, "c,a,b" },
{ "divl", 0x6c, "c,a,b" },
{ "divl", 0x6d, "c,a,i" },
{ "divrem", 0x6e, "c,a,b" },
{ "divrem", 0x6f, "c,a,i" },
{ "dmac", 0xd9, "F,C,a,b" },
{ "dmsm", 0xdb, "c,a,b" },
{ "dmul", 0xf5, "c,a,b" },
{ "dsub", 0xf3, "c,a,b" },
{ "emulate", 0xd7, "v,a,b" },
{ "exbyte", 0x0a, "c,a,b" },
{ "exbyte", 0x0b, "c,a,i" },
{ "exhw", 0x7c, "c,a,b" },
{ "exhw", 0x7d, "c,a,i" },
{ "exhws", 0x7e, "c,a" },
{ "extract", 0x7a, "c,a,b" },
{ "extract", 0x7b, "c,a,i" },
{ "fadd", 0xf0, "c,a,b" },
{ "fdiv", 0xf6, "c,a,b" },
{ "fdmul", 0xf9, "c,a,b" },
{ "feq", 0xea, "c,a,b" },
{ "fge", 0xee, "c,a,b" },
{ "fgt", 0xec, "c,a,b" },
{ "fmac", 0xd8, "F,C,a,b" },
{ "fmsm", 0xda, "c,a,b" },
{ "fmul", 0xf4, "c,a,b" },
{ "fsub", 0xf2, "c,a,b" },
{ "halt", 0x89, "" },
{ "inbyte", 0x0c, "c,a,b" },
{ "inbyte", 0x0d, "c,a,i" },
{ "inhw", 0x78, "c,a,b" },
{ "inhw", 0x79, "c,a,i" },
{ "inv", 0x9f, "" },
{ "iret", 0x88, "" },
{ "iretinv", 0x8c, "" },
{ "jmp", 0xa0, "P" },
{ "jmp", 0xa1, "A" },
{ "jmpf", 0xa4, "a,P" },
{ "jmpf", 0xa5, "a,A" },
{ "jmpfdec", 0xb4, "a,P" },
{ "jmpfdec", 0xb5, "a,A" },
{ "jmpfi", 0xc4, "a,b" },
{ "jmpi", 0xc0, "b" },
{ "jmpt", 0xac, "a,P" },
{ "jmpt", 0xad, "a,A" },
{ "jmpti", 0xcc, "a,b" },
{ "load", 0x16, "e,n,a,b" },
{ "load", 0x17, "e,n,a,i" },
{ "loadl", 0x06, "e,n,a,b" },
{ "loadl", 0x07, "e,n,a,i" },
{ "loadm", 0x36, "e,n,a,b" },
{ "loadm", 0x37, "e,n,a,i" },
{ "loadset", 0x26, "e,n,a,b" },
{ "loadset", 0x27, "e,n,a,i" },
{ "mfacc", 0xe9, "c,d,f" },
{ "mfsr", 0xc6, "c,s" },
{ "mftlb", 0xb6, "c,a" },
{ "mtacc", 0xe8, "c,d,f" },
{ "mtsr", 0xce, "s,b" },
{ "mtsrim", 0x04, "s,x" },
{ "mttlb", 0xbe, "a,b" },
{ "mul", 0x64, "c,a,b" },
{ "mul", 0x65, "c,a,i" },
{ "mull", 0x66, "c,a,b" },
{ "mull", 0x67, "c,a,i" },
{ "multiplu", 0xe2, "c,a,b" },
{ "multiply", 0xe0, "c,a,b" },
{ "multm", 0xde, "c,a,b" },
{ "multmu", 0xdf, "c,a,b" },
{ "mulu", 0x74, "c,a,b" },
{ "mulu", 0x75, "c,a,i" },
{ "nand", 0x9a, "c,a,b" },
{ "nand", 0x9b, "c,a,i" },
{ "nor", 0x98, "c,a,b" },
{ "nor", 0x99, "c,a,i" },
{ "or", 0x92, "c,a,b" },
{ "or", 0x93, "c,a,i" },
{ "orn", 0xaa, "c,a,b" },
{ "orn", 0xab, "c,a,i" },
/* The description of "setip" in Chapter 8 ("instruction set") of the user's
manual claims that these are absolute register numbers. But section
7.2.1 explains that they are not. The latter is correct, so print
these normally ("lr0", "lr5", etc.). */
{ "setip", 0x9e, "c,a,b" },
{ "sll", 0x80, "c,a,b" },
{ "sll", 0x81, "c,a,i" },
{ "sqrt", 0xe5, "c,a,f" },
{ "sra", 0x86, "c,a,b" },
{ "sra", 0x87, "c,a,i" },
{ "srl", 0x82, "c,a,b" },
{ "srl", 0x83, "c,a,i" },
{ "store", 0x1e, "e,n,a,b" },
{ "store", 0x1f, "e,n,a,i" },
{ "storel", 0x0e, "e,n,a,b" },
{ "storel", 0x0f, "e,n,a,i" },
{ "storem", 0x3e, "e,n,a,b" },
{ "storem", 0x3f, "e,n,a,i" },
{ "sub", 0x24, "c,a,b" },
{ "sub", 0x25, "c,a,i" },
{ "subc", 0x2c, "c,a,b" },
{ "subc", 0x2d, "c,a,i" },
{ "subcs", 0x28, "c,a,b" },
{ "subcs", 0x29, "c,a,i" },
{ "subcu", 0x2a, "c,a,b" },
{ "subcu", 0x2b, "c,a,i" },
{ "subr", 0x34, "c,a,b" },
{ "subr", 0x35, "c,a,i" },
{ "subrc", 0x3c, "c,a,b" },
{ "subrc", 0x3d, "c,a,i" },
{ "subrcs", 0x38, "c,a,b" },
{ "subrcs", 0x39, "c,a,i" },
{ "subrcu", 0x3a, "c,a,b" },
{ "subrcu", 0x3b, "c,a,i" },
{ "subrs", 0x30, "c,a,b" },
{ "subrs", 0x31, "c,a,i" },
{ "subru", 0x32, "c,a,b" },
{ "subru", 0x33, "c,a,i" },
{ "subs", 0x20, "c,a,b" },
{ "subs", 0x21, "c,a,i" },
{ "subu", 0x22, "c,a,b" },
{ "subu", 0x23, "c,a,i" },
{ "xnor", 0x96, "c,a,b" },
{ "xnor", 0x97, "c,a,i" },
{ "xor", 0x94, "c,a,b" },
{ "xor", 0x95, "c,a,i" }
};
#define NUM_OPCODES ((sizeof am29k_opcodes) / (sizeof am29k_opcodes[0]))

296
gdb/am29k-pinsn.c Normal file
View file

@ -0,0 +1,296 @@
/* Instruction printing code for the AMD 29000
Copyright (C) 1990 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Jim Kingdon.
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 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; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "defs.h"
#include "target.h"
#include "am29k-opcode.h"
/* Print a symbolic representation of a general-purpose
register number NUM on STREAM.
NUM is a number as found in the instruction, not as found in
debugging symbols; it must be in the range 0-255. */
static void
print_general (num, stream)
int num;
FILE *stream;
{
if (num < 128)
fprintf_filtered (stream, "gr%d", num);
else
fprintf_filtered (stream, "lr%d", num - 128);
}
/* Like print_general but a special-purpose register.
The mnemonics used by the AMD assembler are not quite the same
as the ones in the User's Manual. We use the ones that the
assembler uses. */
static void
print_special (num, stream)
int num;
FILE *stream;
{
/* Register names of registers 0-SPEC0_NUM-1. */
static char *spec0_names[] = {
"vab", "ops", "cps", "cfg", "cha", "chd", "chc", "rbp", "tmc", "tmr",
"pc0", "pc1", "pc2", "mmu", "lru"
};
#define SPEC0_NUM ((sizeof spec0_names) / (sizeof spec0_names[0]))
/* Register names of registers 128-128+SPEC128_NUM-1. */
static char *spec128_names[] = {
"ipc", "ipa", "ipb", "q", "alu", "bp", "fc", "cr"
};
#define SPEC128_NUM ((sizeof spec128_names) / (sizeof spec128_names[0]))
/* Register names of registers 160-160+SPEC160_NUM-1. */
static char *spec160_names[] = {
"fpe", "inte", "fps", "sr163", "exop"
};
#define SPEC160_NUM ((sizeof spec160_names) / (sizeof spec160_names[0]))
if (num < SPEC0_NUM)
fprintf_filtered (stream, spec0_names[num]);
else if (num >= 128 && num < 128 + SPEC128_NUM)
fprintf_filtered (stream, spec128_names[num-128]);
else if (num >= 160 && num < 160 + SPEC160_NUM)
fprintf_filtered (stream, spec160_names[num-160]);
else
fprintf_filtered (stream, "sr%d", num);
}
/* Is an instruction with OPCODE a delayed branch? */
static int
is_delayed_branch (opcode)
int opcode;
{
return (opcode == 0xa8 || opcode == 0xa9 || opcode == 0xa0 || opcode == 0xa1
|| opcode == 0xa4 || opcode == 0xa5
|| opcode == 0xb4 || opcode == 0xb5
|| opcode == 0xc4 || opcode == 0xc0
|| opcode == 0xac || opcode == 0xad
|| opcode == 0xcc);
}
/* Now find the four bytes of INSN and put them in *INSN{0,8,16,24}.
Note that the amd can be set up as either
big or little-endian (the tm file says which) and we can't assume
the host machine is the same. */
static void
find_bytes (insn, insn0, insn8, insn16, insn24)
char *insn;
unsigned char *insn0;
unsigned char *insn8;
unsigned char *insn16;
unsigned char *insn24;
{
#if TARGET_BYTE_ORDER == BIG_ENDIAN
*insn24 = insn[0];
*insn16 = insn[1];
*insn8 = insn[2];
*insn0 = insn[3];
#else /* Little-endian. */
*insn24 = insn[3];
*insn16 = insn[2];
*insn8 = insn[1];
*insn0 = insn[0];
#endif /* Little-endian. */
}
/* Print one instruction from MEMADDR on STREAM.
Return the size of the instruction (always 4 on am29k). */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
FILE *stream;
{
/* The raw instruction. */
char insn[4];
/* The four bytes of the instruction. */
unsigned char insn24, insn16, insn8, insn0;
struct am29k_opcode *opcode;
read_memory (memaddr, &insn[0], 4);
find_bytes (insn, &insn0, &insn8, &insn16, &insn24);
/* The opcode is always in insn24. */
for (opcode = &am29k_opcodes[0];
opcode < &am29k_opcodes[NUM_OPCODES];
++opcode)
{
if (insn24 == opcode->opcode)
{
char *s;
fprintf_filtered (stream, "%s ", opcode->name);
for (s = opcode->args; *s != '\0'; ++s)
{
switch (*s)
{
case 'a':
print_general (insn8, stream);
break;
case 'b':
print_general (insn0, stream);
break;
case 'c':
print_general (insn16, stream);
break;
case 'i':
fprintf_filtered (stream, "%d", insn0);
break;
case 'x':
fprintf_filtered (stream, "%d", (insn16 << 8) + insn0);
break;
case 'h':
fprintf_filtered (stream, "0x%x",
(insn16 << 24) + (insn0 << 16));
break;
case 'X':
fprintf_filtered (stream, "%d",
((insn16 << 8) + insn0) | 0xffff0000);
break;
case 'P':
/* This output looks just like absolute addressing, but
maybe that's OK (it's what the GDB 68k and EBMON
29k disassemblers do). */
/* All the shifting is to sign-extend it. p*/
print_address
(memaddr +
(((int)((insn16 << 10) + (insn0 << 2)) << 14) >> 14),
stream);
break;
case 'A':
print_address ((insn16 << 10) + (insn0 << 2), stream);
break;
case 'e':
fprintf_filtered (stream, "%d", insn16 >> 7);
break;
case 'n':
fprintf_filtered (stream, "0x%x", insn16 & 0x7f);
break;
case 'v':
fprintf_filtered (stream, "%#x", insn16);
break;
case 's':
print_special (insn8, stream);
break;
case 'u':
fprintf_filtered (stream, "%d", insn0 >> 7);
break;
case 'r':
fprintf_filtered (stream, "%d", (insn0 >> 4) & 7);
break;
case 'd':
fprintf_filtered (stream, "%d", (insn0 >> 2) & 3);
break;
case 'f':
fprintf_filtered (stream, "%d", insn0 & 3);
break;
case 'F':
fprintf_filtered (stream, "%d", (insn0 >> 18) & 15);
break;
case 'C':
fprintf_filtered (stream, "%d", (insn0 >> 16) & 3);
break;
default:
fprintf_filtered (stream, "%c", *s);
}
}
/* Now we look for a const,consth pair of instructions,
in which case we try to print the symbolic address. */
if (insn24 == 2) /* consth */
{
int errcode;
char prev_insn[4];
unsigned char prev_insn0, prev_insn8, prev_insn16, prev_insn24;
errcode = target_read_memory (memaddr - 4,
&prev_insn[0],
4);
if (errcode == 0)
{
/* If it is a delayed branch, we need to look at the
instruction before the delayed brach to handle
things like
const _foo
call _printf
consth _foo
*/
find_bytes (prev_insn, &prev_insn0, &prev_insn8,
&prev_insn16, &prev_insn24);
if (is_delayed_branch (prev_insn24))
{
errcode = target_read_memory
(memaddr - 8, &prev_insn[0], 4);
find_bytes (prev_insn, &prev_insn0, &prev_insn8,
&prev_insn16, &prev_insn24);
}
}
/* If there was a problem reading memory, then assume
the previous instruction was not const. */
if (errcode == 0)
{
/* Is it const to the same register? */
if (prev_insn24 == 3
&& prev_insn8 == insn8)
{
fprintf_filtered (stream, "\t; ");
print_address (((insn16 << 24) + (insn0 << 16)
+ (prev_insn16 << 8) + (prev_insn0)),
stream);
}
}
}
return 4;
}
}
fprintf_filtered (stream, ".word %#8x",
(insn24 << 24) + (insn16 << 16) + (insn8 << 8) + insn0);
return 4;
}

695
gdb/am29k-tdep.c Normal file
View file

@ -0,0 +1,695 @@
/* Target-machine dependent code for the AMD 29000
Copyright (C) 1990 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Jim Kingdon.
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 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; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "gdbcore.h"
#include <stdio.h>
#include "frame.h"
#include "value.h"
#include "param.h"
#include "symtab.h"
#include "inferior.h"
/* Structure to hold cached info about function prologues. */
struct prologue_info
{
CORE_ADDR pc; /* First addr after fn prologue */
unsigned rsize, msize; /* register stack frame size, mem stack ditto */
unsigned mfp_used : 1; /* memory frame pointer used */
unsigned rsize_valid : 1; /* Validity bits for the above */
unsigned msize_valid : 1;
unsigned mfp_valid : 1;
};
/* Examine the prologue of a function which starts at PC. Return
the first addess past the prologue. If MSIZE is non-NULL, then
set *MSIZE to the memory stack frame size. If RSIZE is non-NULL,
then set *RSIZE to the register stack frame size (not including
incoming arguments and the return address & frame pointer stored
with them). If no prologue is found, *RSIZE is set to zero.
If no prologue is found, or a prologue which doesn't involve
allocating a memory stack frame, then set *MSIZE to zero.
Note that both msize and rsize are in bytes. This is not consistent
with the _User's Manual_ with respect to rsize, but it is much more
convenient.
If MFP_USED is non-NULL, *MFP_USED is set to nonzero if a memory
frame pointer is being used. */
CORE_ADDR
examine_prologue (pc, rsize, msize, mfp_used)
CORE_ADDR pc;
unsigned *msize;
unsigned *rsize;
int *mfp_used;
{
long insn;
CORE_ADDR p = pc;
int misc_index = find_pc_misc_function (pc);
struct prologue_info *mi = 0;
if (misc_index >= 0)
mi = (struct prologue_info *)misc_function_vector[misc_index].misc_info;
if (mi != 0)
{
int valid = 1;
if (rsize != NULL)
{
*rsize = mi->rsize;
valid &= mi->rsize_valid;
}
if (msize != NULL)
{
*msize = mi->msize;
valid &= mi->msize_valid;
}
if (mfp_used != NULL)
{
*mfp_used = mi->mfp_used;
valid &= mi->mfp_valid;
}
if (valid)
return mi->pc;
}
if (rsize != NULL)
*rsize = 0;
if (msize != NULL)
*msize = 0;
if (mfp_used != NULL)
*mfp_used = 0;
/* Prologue must start with subtracting a constant from gr1.
Normally this is sub gr1,gr1,<rsize * 4>. */
insn = read_memory_integer (p, 4);
if ((insn & 0xffffff00) != 0x25010100)
{
/* If the frame is large, instead of a single instruction it
might be a pair of instructions:
const <reg>, <rsize * 4>
sub gr1,gr1,<reg>
*/
int reg;
/* Possible value for rsize. */
unsigned int rsize0;
if ((insn & 0xff000000) != 0x03000000)
{
p = pc;
goto done;
}
reg = (insn >> 8) & 0xff;
rsize0 = (((insn >> 8) & 0xff00) | (insn & 0xff));
p += 4;
insn = read_memory_integer (p, 4);
if ((insn & 0xffffff00) != 0x24010100
|| (insn & 0xff) != reg)
{
p = pc;
goto done;
}
if (rsize != NULL)
*rsize = rsize0;
}
else
{
if (rsize != NULL)
*rsize = (insn & 0xff);
}
p += 4;
/* Next instruction must be asgeu V_SPILL,gr1,rab. */
insn = read_memory_integer (p, 4);
if (insn != 0x5e40017e)
{
p = pc;
goto done;
}
p += 4;
/* Next instruction usually sets the frame pointer (lr1) by adding
<size * 4> from gr1. However, this can (and high C does) be
deferred until anytime before the first function call. So it is
OK if we don't see anything which sets lr1. */
/* Normally this is just add lr1,gr1,<size * 4>. */
insn = read_memory_integer (p, 4);
if ((insn & 0xffffff00) == 0x15810100)
p += 4;
else
{
/* However, for large frames it can be
const <reg>, <size *4>
add lr1,gr1,<reg>
*/
int reg;
CORE_ADDR q;
if ((insn & 0xff000000) == 0x03000000)
{
reg = (insn >> 8) & 0xff;
q = p + 4;
insn = read_memory_integer (q, 4);
if ((insn & 0xffffff00) == 0x14810100
&& (insn & 0xff) == reg)
p = q;
}
}
/* Next comes "add lr{<rsize-1>},msp,0", but only if a memory
frame pointer is in use. We just check for add lr<anything>,msp,0;
we don't check this rsize against the first instruction, and
we don't check that the trace-back tag indicates a memory frame pointer
is in use.
The recommended instruction is actually "sll lr<whatever>,msp,0".
We check for that, too. Originally Jim Kingdon's code seemed
to be looking for a "sub" instruction here, but the mask was set
up to lose all the time. */
insn = read_memory_integer (p, 4);
if (((insn & 0xff80ffff) == 0x15807d00) /* add */
|| ((insn & 0xff80ffff) == 0x81807d00) ) /* sll */
{
p += 4;
if (mfp_used != NULL)
*mfp_used = 1;
}
/* Next comes a subtraction from msp to allocate a memory frame,
but only if a memory frame is
being used. We don't check msize against the trace-back tag.
Normally this is just
sub msp,msp,<msize>
*/
insn = read_memory_integer (p, 4);
if ((insn & 0xffffff00) == 0x257d7d00)
{
p += 4;
if (msize != NULL)
*msize = insn & 0xff;
}
else
{
/* For large frames, instead of a single instruction it might
be
const <reg>, <msize>
consth <reg>, <msize> ; optional
sub msp,msp,<reg>
*/
int reg;
unsigned msize0;
CORE_ADDR q = p;
if ((insn & 0xff000000) == 0x03000000)
{
reg = (insn >> 8) & 0xff;
msize0 = ((insn >> 8) & 0xff00) | (insn & 0xff);
q += 4;
insn = read_memory_integer (q, 4);
/* Check for consth. */
if ((insn & 0xff000000) == 0x02000000
&& (insn & 0x0000ff00) == reg)
{
msize0 |= (insn << 8) & 0xff000000;
msize0 |= (insn << 16) & 0x00ff0000;
q += 4;
insn = read_memory_integer (q, 4);
}
/* Check for sub msp,msp,<reg>. */
if ((insn & 0xffffff00) == 0x247d7d00
&& (insn & 0xff) == reg)
{
p = q + 4;
if (msize != NULL)
*msize = msize0;
}
}
}
done:
if (misc_index >= 0)
{
if (mi == 0)
{
/* Add a new cache entry. */
mi = (struct prologue_info *)xmalloc (sizeof (struct prologue_info));
misc_function_vector[misc_index].misc_info = (char *)mi;
mi->rsize_valid = 0;
mi->msize_valid = 0;
mi->mfp_valid = 0;
}
/* else, cache entry exists, but info is incomplete. */
mi->pc = p;
if (rsize != NULL)
{
mi->rsize = *rsize;
mi->rsize_valid = 1;
}
if (msize != NULL)
{
mi->msize = *msize;
mi->msize_valid = 1;
}
if (mfp_used != NULL)
{
mi->mfp_used = *mfp_used;
mi->mfp_valid = 1;
}
}
return p;
}
/* Advance PC across any function entry prologue instructions
to reach some "real" code. */
CORE_ADDR
skip_prologue (pc)
CORE_ADDR pc;
{
return examine_prologue (pc, (unsigned *)NULL, (unsigned *)NULL,
(int *)NULL);
}
/* Initialize the frame. In addition to setting "extra" frame info,
we also set ->frame because we use it in a nonstandard way, and ->pc
because we need to know it to get the other stuff. See the diagram
of stacks and the frame cache in tm-29k.h for more detail. */
static void
init_frame_info (innermost_frame, fci)
int innermost_frame;
struct frame_info *fci;
{
CORE_ADDR p;
long insn;
unsigned rsize;
unsigned msize;
int mfp_used;
struct symbol *func;
p = fci->pc;
if (innermost_frame)
fci->frame = read_register (GR1_REGNUM);
else
fci->frame = fci->next_frame + fci->next->rsize;
#if CALL_DUMMY_LOCATION == ON_STACK
This wont work;
#else
if (PC_IN_CALL_DUMMY (p, 0, 0))
#endif
{
fci->rsize = DUMMY_FRAME_RSIZE;
/* This doesn't matter since we never try to get locals or args
from a dummy frame. */
fci->msize = 0;
/* Dummy frames always use a memory frame pointer. */
fci->saved_msp =
read_register_stack_integer (fci->frame + DUMMY_FRAME_RSIZE - 4, 4);
return;
}
func = find_pc_function (p);
if (func != NULL)
p = BLOCK_START (SYMBOL_BLOCK_VALUE (func));
else
{
/* Search backward to find the trace-back tag. However,
do not trace back beyond the start of the text segment
(just as a sanity check to avoid going into never-never land). */
while (p >= text_start
&& ((insn = read_memory_integer (p, 4)) & 0xff000000) != 0)
p -= 4;
if (p < text_start)
{
/* Couldn't find the trace-back tag.
Something strange is going on. */
fci->saved_msp = 0;
fci->rsize = 0;
fci->msize = 0;
return;
}
else
/* Advance to the first word of the function, i.e. the word
after the trace-back tag. */
p += 4;
}
/* We've found the start of the function. Since High C interchanges
the meanings of bits 23 and 22 (as of Jul 90), and we
need to look at the prologue anyway to figure out
what rsize is, ignore the contents of the trace-back tag. */
examine_prologue (p, &rsize, &msize, &mfp_used);
fci->rsize = rsize;
fci->msize = msize;
if (innermost_frame)
{
fci->saved_msp = read_register (MSP_REGNUM) + msize;
}
else
{
if (mfp_used)
fci->saved_msp =
read_register_stack_integer (fci->frame + rsize - 1, 4);
else
fci->saved_msp = fci->next->saved_msp + msize;
}
}
void
init_extra_frame_info (fci)
struct frame_info *fci;
{
if (fci->next == 0)
/* Assume innermost frame. May produce strange results for "info frame"
but there isn't any way to tell the difference. */
init_frame_info (1, fci);
else
/* We're in get_prev_frame_info.
Take care of everything in init_frame_pc. */
;
}
void
init_frame_pc (fromleaf, fci)
int fromleaf;
struct frame_info *fci;
{
fci->pc = (fromleaf ? SAVED_PC_AFTER_CALL (fci->next) :
fci->next ? FRAME_SAVED_PC (fci->next) : read_pc ());
init_frame_info (0, fci);
}
/* Local variables (i.e. LOC_LOCAL) are on the memory stack, with their
offsets being relative to the memory stack pointer (high C) or
saved_msp (gcc). */
CORE_ADDR
frame_locals_address (fi)
struct frame_info *fi;
{
struct block *b = block_for_pc (fi->pc);
/* If compiled without -g, assume GCC. */
if (b == NULL || BLOCK_GCC_COMPILED (b))
return fi->saved_msp;
else
return fi->saved_msp - fi->msize;
}
/* Routines for reading the register stack. The caller gets to treat
the register stack as a uniform stack in memory, from address $gr1
straight through $rfb and beyond. */
/* Analogous to read_memory except the length is understood to be 4.
Also, myaddr can be NULL (meaning don't bother to read), and
if actual_mem_addr is non-NULL, store there the address that it
was fetched from (or if from a register the offset within
registers). Set *LVAL to lval_memory or lval_register, depending
on where it came from. */
void
read_register_stack (memaddr, myaddr, actual_mem_addr, lval)
CORE_ADDR memaddr;
char *myaddr;
CORE_ADDR *actual_mem_addr;
enum lval_type *lval;
{
long rfb = read_register (RFB_REGNUM);
long rsp = read_register (RSP_REGNUM);
if (memaddr < rfb)
{
/* It's in a register. */
int regnum = (memaddr - rsp) / 4 + LR0_REGNUM;
if (regnum < LR0_REGNUM || regnum > LR0_REGNUM + 127)
error ("Attempt to read register stack out of range.");
if (myaddr != NULL)
read_register_gen (regnum, myaddr);
if (lval != NULL)
*lval = lval_register;
if (actual_mem_addr != NULL)
*actual_mem_addr = REGISTER_BYTE (regnum);
}
else
{
/* It's in the memory portion of the register stack. */
if (myaddr != NULL)
read_memory (memaddr, myaddr, 4);
if (lval != NULL)
*lval = lval_memory;
if (actual_mem_addr != NULL)
*actual_mem_addr == memaddr;
}
}
/* Analogous to read_memory_integer
except the length is understood to be 4. */
long
read_register_stack_integer (memaddr, len)
CORE_ADDR memaddr;
int len;
{
long buf;
read_register_stack (memaddr, &buf, NULL, NULL);
SWAP_TARGET_AND_HOST (&buf, 4);
return buf;
}
/* Copy 4 bytes from GDB memory at MYADDR into inferior memory
at MEMADDR and put the actual address written into in
*ACTUAL_MEM_ADDR. */
static void
write_register_stack (memaddr, myaddr, actual_mem_addr)
CORE_ADDR memaddr;
char *myaddr;
CORE_ADDR *actual_mem_addr;
{
long rfb = read_register (RFB_REGNUM);
long rsp = read_register (RSP_REGNUM);
if (memaddr < rfb)
{
/* It's in a register. */
int regnum = (memaddr - rsp) / 4 + LR0_REGNUM;
if (regnum < LR0_REGNUM || regnum > LR0_REGNUM + 127)
error ("Attempt to read register stack out of range.");
if (myaddr != NULL)
write_register (regnum, *(long *)myaddr);
if (actual_mem_addr != NULL)
*actual_mem_addr = NULL;
}
else
{
/* It's in the memory portion of the register stack. */
if (myaddr != NULL)
write_memory (memaddr, myaddr, 4);
if (actual_mem_addr != NULL)
*actual_mem_addr == memaddr;
}
}
/* Find register number REGNUM relative to FRAME and put its
(raw) contents in *RAW_BUFFER. Set *OPTIMIZED if the variable
was optimized out (and thus can't be fetched). If the variable
was fetched from memory, set *ADDRP to where it was fetched from,
otherwise it was fetched from a register.
The argument RAW_BUFFER must point to aligned memory. */
void
get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
char *raw_buffer;
int *optimized;
CORE_ADDR *addrp;
FRAME frame;
int regnum;
enum lval_type *lvalp;
{
struct frame_info *fi = get_frame_info (frame);
CORE_ADDR addr;
enum lval_type lval;
/* Once something has a register number, it doesn't get optimized out. */
if (optimized != NULL)
*optimized = 0;
if (regnum == RSP_REGNUM)
{
if (raw_buffer != NULL)
*(CORE_ADDR *)raw_buffer = fi->frame;
if (lvalp != NULL)
*lvalp = not_lval;
return;
}
else if (regnum == PC_REGNUM)
{
if (raw_buffer != NULL)
*(CORE_ADDR *)raw_buffer = fi->pc;
/* Not sure we have to do this. */
if (lvalp != NULL)
*lvalp = not_lval;
return;
}
else if (regnum == MSP_REGNUM)
{
if (raw_buffer != NULL)
{
if (fi->next != NULL)
*(CORE_ADDR *)raw_buffer = fi->next->saved_msp;
else
*(CORE_ADDR *)raw_buffer = read_register (MSP_REGNUM);
}
/* The value may have been computed, not fetched. */
if (lvalp != NULL)
*lvalp = not_lval;
return;
}
else if (regnum < LR0_REGNUM || regnum >= LR0_REGNUM + 128)
{
/* These registers are not saved over procedure calls,
so just print out the current values. */
if (raw_buffer != NULL)
*(CORE_ADDR *)raw_buffer = read_register (regnum);
if (lvalp != NULL)
*lvalp = lval_register;
if (addrp != NULL)
*addrp = REGISTER_BYTE (regnum);
return;
}
addr = fi->frame + (regnum - LR0_REGNUM) * 4;
if (raw_buffer != NULL)
read_register_stack (addr, raw_buffer, &addr, &lval);
if (lvalp != NULL)
*lvalp = lval;
if (addrp != NULL)
*addrp = addr;
}
/* Discard from the stack the innermost frame,
restoring all saved registers. */
void
pop_frame ()
{
FRAME frame = get_current_frame ();
struct frame_info *fi = get_frame_info (frame);
CORE_ADDR rfb = read_register (RFB_REGNUM);
CORE_ADDR gr1 = fi->frame + fi->rsize;
CORE_ADDR lr1;
CORE_ADDR ret_addr;
int i;
/* If popping a dummy frame, need to restore registers. */
if (PC_IN_CALL_DUMMY (read_register (PC_REGNUM),
read_register (SP_REGNUM),
FRAME_FP (fi)))
{
for (i = 0; i < DUMMY_SAVE_SR128; ++i)
write_register
(SR_REGNUM (i + 128),
read_register (LR0_REGNUM + DUMMY_ARG / 4 + i));
for (i = 0; i < DUMMY_SAVE_GR96; ++i)
write_register
(GR96_REGNUM + i,
read_register (LR0_REGNUM + DUMMY_ARG / 4 + DUMMY_SAVE_SR128 + i));
}
/* Restore the memory stack pointer. */
write_register (MSP_REGNUM, fi->saved_msp);
/* Restore the register stack pointer. */
write_register (GR1_REGNUM, gr1);
/* Check whether we need to fill registers. */
lr1 = read_register (LR0_REGNUM + 1);
if (lr1 > rfb)
{
/* Fill. */
int num_bytes = lr1 - rfb;
int i;
long word;
write_register (RAB_REGNUM, read_register (RAB_REGNUM) + num_bytes);
write_register (RFB_REGNUM, lr1);
for (i = 0; i < num_bytes; i += 4)
{
/* Note: word is in host byte order. */
word = read_memory_integer (rfb + i, 4);
write_register (LR0_REGNUM + ((rfb - gr1) % 0x80) + i / 4, word);
}
}
ret_addr = read_register (LR0_REGNUM);
write_register (PC_REGNUM, ret_addr);
write_register (NPC_REGNUM, ret_addr + 4);
flush_cached_frames ();
set_current_frame (create_new_frame (0, read_pc()));
}
/* Push an empty stack frame, to record the current PC, etc. */
void
push_dummy_frame ()
{
long w;
CORE_ADDR rab, gr1;
CORE_ADDR msp = read_register (MSP_REGNUM);
int i;
/* Save the PC. */
write_register (LR0_REGNUM, read_register (PC_REGNUM));
/* Allocate the new frame. */
gr1 = read_register (GR1_REGNUM) - DUMMY_FRAME_RSIZE;
write_register (GR1_REGNUM, gr1);
rab = read_register (RAB_REGNUM);
if (gr1 < rab)
{
/* We need to spill registers. */
int num_bytes = rab - gr1;
CORE_ADDR rfb = read_register (RFB_REGNUM);
int i;
long word;
write_register (RFB_REGNUM, rfb - num_bytes);
write_register (RAB_REGNUM, gr1);
for (i = 0; i < num_bytes; i += 4)
{
/* Note: word is in target byte order. */
read_register_gen (LR0_REGNUM + i / 4, &word, 4);
write_memory (rfb - num_bytes + i, &word, 4);
}
}
/* There are no arguments in to the dummy frame, so we don't need
more than rsize plus the return address and lr1. */
write_register (LR0_REGNUM + 1, gr1 + DUMMY_FRAME_RSIZE + 2 * 4);
/* Set the memory frame pointer. */
write_register (LR0_REGNUM + DUMMY_FRAME_RSIZE / 4 - 1, msp);
/* Allocate arg_slop. */
write_register (MSP_REGNUM, msp - 16 * 4);
/* Save registers. */
for (i = 0; i < DUMMY_SAVE_SR128; ++i)
write_register (LR0_REGNUM + DUMMY_ARG / 4 + i,
read_register (SR_REGNUM (i + 128)));
for (i = 0; i < DUMMY_SAVE_GR96; ++i)
write_register (LR0_REGNUM + DUMMY_ARG / 4 + DUMMY_SAVE_SR128 + i,
read_register (GR96_REGNUM + i));
}

93
gdb/ansidecl.h Executable file
View file

@ -0,0 +1,93 @@
/* Copyright (C) 1989 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library 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.
The GNU C Library 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 the GNU C Library; see the file COPYING. If not, write to
the Free Software Foundation, 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 */

16
gdb/arm-convert.s Normal file
View file

@ -0,0 +1,16 @@
.text
.global _convert_from_extended
_convert_from_extended:
ldfe f0,[a1]
stfd f0,[a2]
movs pc,lr
.global _convert_to_extended
_convert_to_extended:
ldfd f0,[a1]
stfe f0,[a2]
movs pc,lr

271
gdb/arm-pinsn.c Normal file
View file

@ -0,0 +1,271 @@
/* Print ARM instructions 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 <stdio.h>
#include <ctype.h>
#include <assert.h>
#include "defs.h"
#include "param.h"
#include "symtab.h"
#include "arm-opcode.h"
extern char *reg_names[];
static char *shift_names[] = {
"lsl", "lsr", "asr", "ror",
};
static char *cond_names[] = {
"eq", "ne", "cs", "cc", "mi", "pl", "vs", "vc",
"hi", "ls", "ge", "lt", "gt", "le", "", "nv"
};
static char float_precision[] = "sdep";
static char float_rounding[] = " pmz";
static float float_immed[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 0.5, 10.0 };
static void print_ldr_str_offset();
static void print_ldc_stc_offset();
static long immediate_value();
/* Print the ARM instruction at address MEMADDR in debugged memory,
on STREAM. Returns length of the instruction, in bytes. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
FILE *stream;
{
unsigned long ins;
register struct opcode *op;
register char *p;
register int i, c;
int s, e, val;
ins = read_memory_integer(memaddr, 4);
for (i = 0, op = opcodes; i < N_OPCODES; i++, op++)
if ((ins & op->mask) == op->value) break;
assert(i != N_OPCODES);
for (p = op->assembler; *p;) {
c = *p++;
if (c == '%') {
s = e = 0;
while (isdigit(*p))
s = s*10 + (*p++ - '0');
if (*p == '-') {
p++;
while (isdigit(*p))
e = e*10 + (*p++ - '0');
} else
e = s;
assert(s >= 0 && s <= 31 && e >= 0 && e <= 31);
val = (ins >> s) & ((1 << (e + 1 - s)) - 1);
switch (*p++) {
case '%' :
putc('%', stream);
break;
case 'd' :
fprintf(stream, "%d", val);
break;
case 'x' :
fprintf(stream, "%x", val);
break;
case 'r' :
assert(val >= 0 && val <= 15);
fprintf(stream, "%s", reg_names[val]);
break;
case 'c' :
fprintf(stream, "%s", cond_names[ins >> 28]);
break;
case '\'' :
assert(*p);
c = *p++;
if (val)
putc(c, stream);
break;
case '`' :
assert(*p);
c = *p++;
if (!val)
putc(c, stream);
break;
case '?' :
assert(*p);
c = *p++;
assert(*p);
if (val)
p++;
else
c = *p++;
putc(c, stream);
break;
case 'p' :
if (((ins >> 12) & 0xf) == 0xf)
putc('p', stream);
break;
case 'o' :
if (ins & (1<<25)) {
int immed = immediate_value(ins & 0xfff);
fprintf (stream, "#%d (0x%x)", immed, immed);
} else {
int operand2 = ins & 0xfff;
/* in operand2 :
bits 0-3 are the base register
bits 5-6 are the shift (0=lsl, 1=lsr, 2=asr, 3=ror)
if bit 4 is zero then bits 7-11 are an immediate shift count
else bit 7 must be zero and bits 8-11 are the register
to be used as a shift count.
Note: no shift at all is encoded as "reg lsl #0" */
fprintf (stream, "%s", reg_names[operand2 & 0xf]);
if (operand2 & 0xff0) {
/* ror #0 is really rrx (rotate right extend) */
if ((operand2 & 0xff0) == 0x060)
fprintf (stream, ", rrx");
else {
fprintf (stream, ", %s ",
shift_names[(operand2 >> 5) & 3]);
if (operand2 & (1<<4)) /* register shift */
fprintf (stream, "%s",
reg_names[operand2 >> 8]);
else /* immediate shift */
fprintf (stream, "#%d",
operand2 >> 7);
}
}
}
break;
case 'a' :
fprintf (stream, "[%s", reg_names[(ins >> 16) & 0xf]);
if (ins & (1<<24)) {
fprintf (stream, ", ");
print_ldr_str_offset (ins, stream);
putc (']', stream);
if (ins & (1<<21)) putc('!', stream);
/* If it is a pc relative load, then it is probably
a constant so print it */
if (((ins >> 16) & 0xf) == 15 &&
(ins & (1<<25)) == 0 &&
(ins & (1<<20))) {
int addr = memaddr + 8 +
(ins & 0xfff) * ((ins & (1<<23)) ? 1 : -1);
fprintf (stream, " (contents=");
print_address (read_memory_integer(addr, 4), stream);
fprintf (stream, ")");
}
} else {
fprintf (stream, "]," );
print_ldr_str_offset (ins, stream);
}
break;
case 'b' :
print_address (memaddr + 8 + (((int)ins << 8) >> 6), stream);
break;
case 'A' :
fprintf (stream, "[%s", reg_names[(ins >> 16) & 0xf]);
if (ins & (1<<24)) {
fprintf (stream, ", ");
print_ldc_stc_offset (ins, stream);
putc(']', stream);
if (ins & (1<<21))
putc('!', stream);
} else {
fprintf (stream, "], ");
print_ldc_stc_offset (ins, stream);
}
break;
case 'm' :
{
int regnum, first = 1;
putc('{', stream);
for (regnum = 0; regnum < 16; regnum++)
if (ins & (1<<regnum)) {
if (!first)
putc (',', stream);
first = 0;
fprintf (stream, "%s", reg_names[regnum]);
}
putc('}', stream);
}
break;
case 'P' :
val = ((ins >> 18) & 2) | ((ins >> 7) & 1);
putc(float_precision[val], stream);
break;
case 'Q' :
val = ((ins >> 21) & 2) | ((ins >> 15) & 1);
putc(float_precision[val], stream);
break;
case 'R' :
val = ((ins >> 5) & 3);
if (val) putc(float_rounding[val], stream);
break;
case 'f' :
assert(val >= 0 && val <= 15);
if (val > 7)
fprintf (stream, "#%3.1f", float_immed[val - 8]);
else
fprintf (stream, "f%d", val);
break;
default:
abort();
}
} else
putc(c, stream);
}
return 4;
}
static long
immediate_value(operand)
int operand;
{
int val = operand & 0xff;
int shift = 2*(operand >> 8);
/* immediate value is (val ror shift) */
return (val >> shift) | (val << (32 - shift));
}
static void
print_ldr_str_offset(ins, stream)
unsigned long ins;
FILE *stream;
{
if ((ins & (1<<25)) == 0)
fprintf (stream, "#%d",
(ins & 0xfff) * ((ins & (1<<23)) ? 1 : -1));
else {
fprintf (stream, "%s%s", reg_names[ins & 0xf],
(ins & (1<<23)) ? "" : "-");
if (ins & 0xff0)
fprintf (stream, ", %s #%d",
shift_names[(ins >> 5) & 3],
(ins >> 7) & 0x1f);
}
}
static void
print_ldc_stc_offset(ins, stream)
unsigned long ins;
FILE *stream;
{
fprintf (stream, "#%d",
4 * (ins & 0xff) * ((ins & (1<<23)) ? 1 : -1));
}

274
gdb/arm-xdep.c Normal file
View file

@ -0,0 +1,274 @@
/* Acorn Risc Machine host machine support.
Copyright (C) 1988, 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 "defs.h"
#include "param.h"
#include "frame.h"
#include "inferior.h"
#include "arm-opcode.h"
#include <stdio.h>
#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
#define N_TXTADDR(hdr) 0x8000
#define N_DATADDR(hdr) (hdr.a_text + 0x8000)
#include "gdbcore.h"
#include <sys/user.h> /* After a.out.h */
#include <sys/file.h>
#include <sys/stat.h>
#include <errno.h>
void
fetch_inferior_registers (regno)
int regno;
{
register int regno;
register unsigned int regaddr;
char buf[MAX_REGISTER_RAW_SIZE];
register int i;
struct user u;
unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR;
registers_fetched ();
for (regno = 0; regno < 16; regno++)
{
regaddr = offset + regno * 4;
*(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, regaddr, 0);
if (regno == PC_REGNUM)
*(int *)&buf[0] = GET_PC_PART(*(int *)&buf[0]);
supply_register (regno, buf);
}
*(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, offset + PC*4);
supply_register (PS_REGNUM, buf); /* set virtual register ps same as pc */
/* read the floating point registers */
offset = (char *) &u.u_fp_regs - (char *)&u;
*(int *)buf = ptrace (PT_READ_U, inferior_pid, offset, 0);
supply_register (FPS_REGNUM, buf);
for (regno = 16; regno < 24; regno++) {
regaddr = offset + 4 + 12 * (regno - 16);
for (i = 0; i < 12; i += sizeof(int))
*(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, regaddr + i, 0);
supply_register (regno, 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). */
store_inferior_registers (regno)
int regno;
{
register unsigned int regaddr;
char buf[80];
struct user u;
unsigned long value;
unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR;
if (regno >= 0) {
if (regno >= 16) return;
regaddr = offset + 4 * regno;
errno = 0;
value = read_register(regno);
if (regno == PC_REGNUM)
value = SET_PC_PART(read_register (PS_REGNUM), value);
ptrace (PT_WRITE_U, inferior_pid, regaddr, value);
if (errno != 0)
{
sprintf (buf, "writing register number %d", regno);
perror_with_name (buf);
}
}
else for (regno = 0; regno < 15; regno++)
{
regaddr = offset + regno * 4;
errno = 0;
value = read_register(regno);
if (regno == PC_REGNUM)
value = SET_PC_PART(read_register (PS_REGNUM), value);
ptrace (6, inferior_pid, regaddr, value);
if (errno != 0)
{
sprintf (buf, "writing all regs, number %d", regno);
perror_with_name (buf);
}
}
}
/* Work with core dump and executable files, for GDB.
This code would be in core.c if it weren't machine-dependent. */
/* Structure to describe the chain of shared libraries used
by the execfile.
e.g. prog shares Xt which shares X11 which shares c. */
struct shared_library {
struct exec_header header;
char name[SHLIBLEN];
CORE_ADDR text_start; /* CORE_ADDR of 1st byte of text, this file */
long data_offset; /* offset of data section in file */
int chan; /* file descriptor for the file */
struct shared_library *shares; /* library this one shares */
};
static struct shared_library *shlib = 0;
/* Hook for `exec_file_command' command to call. */
extern void (*exec_file_display_hook) ();
static CORE_ADDR unshared_text_start;
/* extended header from exec file (for shared library info) */
static struct exec_header exec_header;
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;
unsigned int reg_offset, fp_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 = stack_end - 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 = (int) u.u_ar0;
if (reg_offset > NBPG * UPAGES)
reg_offset -= KERNEL_U_ADDR;
fp_reg_offset = (char *) &u.u_fp_regs - (char *)&u;
/* I don't know where to find this info.
So, for now, mark it as not available. */
N_SET_MAGIC (core_aouthdr, 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];
if (regno < 16)
val = lseek (corechan, reg_offset + 4 * regno, 0);
else if (regno < 24)
val = lseek (corechan, fp_reg_offset + 4 + 12*(regno - 24), 0);
else if (regno == 24)
val = lseek (corechan, fp_reg_offset, 0);
else if (regno == 25)
val = lseek (corechan, reg_offset + 4 * PC, 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 == PC_REGNUM)
*(int *)buf = GET_PC_PART(*(int *)buf);
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");
}

1150
gdb/command.c Normal file

File diff suppressed because it is too large Load diff

185
gdb/config.gdb Executable file
View file

@ -0,0 +1,185 @@
#!/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.srcdir
grep -s "source ${srcdir}/.gdbinit" .gdbinit 2>/dev/null || \
echo "source ${srcdir}/.gdbinit" >> .gdbinit
if [ ! -d readline ]; then
mkdir readline
# This could be a symlink, but getting the name right (because
# srcdir can be either relative or absolute) would be hairy.
cp ${srcdir}/readline/Makefile readline
fi
esac
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

1
gdb/config.status Executable file
View file

@ -0,0 +1 @@
GDB is now set up for host machine none and target machine none.

27
gdb/config/3b1.mh Normal file
View file

@ -0,0 +1,27 @@
# AT&T 3b1/Unix pc
# 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.
# I don't think cc has been tried. -traditional for <sys/ioctl.h>
# (not sure whether necessary).
CC= gcc -traditional
# GCC runs out of virtual memory.
PINSN_CC= cc
XDEPFILES= infptrace.o coredep.o
XM_FILE= xm-3b1.h

21
gdb/config/3b1.mt Normal file
View file

@ -0,0 +1,21 @@
# AT&T 3b1/Unix pc
# Copyright (C) 1990-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.
TDEPFILES= exec.o m68k-pinsn.o
TM_FILE= tm-3b1.h

24
gdb/config/altos.mh Normal file
View file

@ -0,0 +1,24 @@
# Altos 3068 (68k, System V release 2)
# 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.
XDEPFILES= infptrace.o altos-xdep.o
XM_FILE= xm-altos.h
REGEX=regex.o
REGEX1=regex.o
SYSV_DEFINE=-DSYSV

21
gdb/config/altos.mt Normal file
View file

@ -0,0 +1,21 @@
# Altos 3068 (68k, System V release 2)
# 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.
TDEPFILES= m68k-pinsn.o exec.o
TM_FILE= tm-altos.h

27
gdb/config/altosgas.mh Normal file
View file

@ -0,0 +1,27 @@
# Altos 3068 (68k, System V release 2), using COFF encapsulation
# Copyright (C) 1989, 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.
#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

24
gdb/config/altosgas.mt Normal file
View file

@ -0,0 +1,24 @@
# Altos 3068 (68k, System V release 2), using COFF encapsulation
# 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.
#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

23
gdb/config/am29k Executable file
View file

@ -0,0 +1,23 @@
# AMD 29000 on EB29K board over a serial line.
# Copyright (C) 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.
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

21
gdb/config/arm.mh Normal file
View file

@ -0,0 +1,21 @@
# Acorn RISC machine running RISCiX (4.3bsd)
# 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.
XDEPFILES= infptrace.o arm-xdep.o arm-convert.o
XM_FILE= xm-arm.h

21
gdb/config/arm.mt Normal file
View file

@ -0,0 +1,21 @@
# Acorn RISC machine running RISCiX (4.3bsd)
# Copyright (C) 1990-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.
TDEPFILES= arm-tdep.o arm-pinsn.o
TM_FILE= tm-arm.h

21
gdb/config/bigmips.mh Normal file
View file

@ -0,0 +1,21 @@
# Big-endian MIPS machine such as Sony News
# 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.
XDEPFILES= infptrace.o mips-xdep.o coredep.o
XM_FILE= xm-bigmips.h

21
gdb/config/bigmips.mt Normal file
View file

@ -0,0 +1,21 @@
# Big-endian MIPS machine such as Sony News
# Copyright (C) 1989, 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.
TDEPFILES= mips-pinsn.o mips-tdep.o mipsread.o exec.o
TM_FILE= tm-bigmips.h

21
gdb/config/convex.mh Normal file
View file

@ -0,0 +1,21 @@
# Convex Unix (4bsd)
# 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.
XDEPFILES= convex-xdep.o
XM_FILE= xm-convex.h

21
gdb/config/convex.mt Normal file
View file

@ -0,0 +1,21 @@
# Convex Unix (4bsd)
# Copyright (C) 1990-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.
TDEPFILES= convex-tdep.o convex-pinsn.o
TM_FILE= tm-convex.h

21
gdb/config/hp300bsd.mh Normal file
View file

@ -0,0 +1,21 @@
# Hewlett-Packard 9000 series 300, running BSD
# 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.
XDEPFILES= infptrace.o coredep.o
XM_FILE= xm-hp300bsd.h

21
gdb/config/hp300bsd.mt Normal file
View file

@ -0,0 +1,21 @@
# Hewlett-Packard 9000 series 300, running BSD
# Copyright (C) 1990-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.
TDEPFILES= exec.o m68k-pinsn.o
TM_FILE= tm-hp300bsd.h

33
gdb/config/hp300hpux.mh Normal file
View file

@ -0,0 +1,33 @@
# Hewlett-Packard 9000 series 300, running HPUX
# 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.
# The following is true because gcc uses a different .o file format
# than the native HPUX compiler
#msg If you compile GDB with GCC on HPUX, you must make sure
#msg that the `nm' used in `munch' is GNU nm
#msg
# The headers in the directory hp-include override system headers
# and tell GDB to use BSD executable file format (hence -Ihp-include)
XDEPFILES= infptrace.o hp300hpux-xdep.o
XM_FILE= xm-hp300hpux.h
SYSV_DEFINE=-DSYSV
REGEX=regex.o
REGEX1=regex.o
ALLOCA=alloca.o

28
gdb/config/hp300hpux.mt Normal file
View file

@ -0,0 +1,28 @@
# Hewlett-Packard 9000 series 300, running HPUX
# Copyright (C) 1990-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.
#msg Note that GDB only can read symbols from programs that were
#msg compiled with GCC
#msg
# The headers in the directory hp-include override system headers
# and tell GDB to use BSD executable file format (hence -Ihp-include)
TM_CFLAGS=-Ihp-include
TDEPFILES= exec.o m68k-pinsn.o
TM_FILE= tm-hp300hpux.h

25
gdb/config/i386v-g.mh Normal file
View file

@ -0,0 +1,25 @@
# Intel 386 running System V, using COFF encapsulation
# 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.
XDEPFILES= infptrace.o coredep.o i386-xdep.o
XM_FILE= xm-i386v.h
XM_CLIBS= -lPW
SYSV_DEFINE=-DSYSV
REGEX=regex.o
REGEX1=regex.o

25
gdb/config/i386v-g.mt Normal file
View file

@ -0,0 +1,25 @@
# Intel 386 running System V, using COFF encapsulation
# Copyright (C) 1990-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.
#msg Use of the COFF encapsulation features requires the GNU binary utilities
#msg to be ahead of their System V counterparts in your path.
#msg
TDEPFILES= exec.o i386-tdep.o i386-pinsn.o
TM_FILE= tm-i386v-g.h

25
gdb/config/i386v.mh Normal file
View file

@ -0,0 +1,25 @@
# Intel 386 running System V
# 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.
XDEPFILES= infptrace.o coredep.o i386-xdep.o
XM_FILE= xm-i386v.h
XM_CLIBS= -lPW
SYSV_DEFINE=-DSYSV
REGEX=regex.o
REGEX1=regex.o

21
gdb/config/i386v.mt Normal file
View file

@ -0,0 +1,21 @@
# Intel 386 running System V
# 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.
TDEPFILES= exec.o i386-tdep.o i386-pinsn.o
TM_FILE= tm-i386v.h

25
gdb/config/i386v32-g.mh Normal file
View file

@ -0,0 +1,25 @@
# Intel 386 running System V release 2, using COFF encapsulation
# 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.
XDEPFILES= infptrace.o coredep.o i386-xdep.o
XM_FILE= xm-i386v32.h
XM_CLIBS= -lPW
SYSV_DEFINE=-DSYSV
REGEX=regex.o
REGEX1=regex.o

24
gdb/config/i386v32-g.mt Normal file
View file

@ -0,0 +1,24 @@
# Intel 386 running System V release 2, using COFF encapsulation
# Copyright (C) 1990-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.
#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

25
gdb/config/i386v32.mh Normal file
View file

@ -0,0 +1,25 @@
# Intel 386 running System V release 2
# 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.
XDEPFILES= infptrace.o coredep.o i386-xdep.o
XM_FILE= xm-i386v32.h
XM_CLIBS= -lPW
SYSV_DEFINE=-DSYSV
REGEX=regex.o
REGEX1=regex.o

21
gdb/config/i386v32.mt Normal file
View file

@ -0,0 +1,21 @@
# Intel 386 running System V release 2
# 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.
TDEPFILES= exec.o i386-tdep.o i386-pinsn.o
TM_FILE= tm-i386v.h

23
gdb/config/i960.mt Normal file
View file

@ -0,0 +1,23 @@
# Intel 80960, under NINDY or under VxWorks, selected at runtime.
# Copyright (C) 1990-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.
#msg
#msg You must specify either "nindy960" or "vxworks960"; there is no
#msg generic i960 target any more.
#msg

21
gdb/config/isi.mh Normal file
View file

@ -0,0 +1,21 @@
# ISI Optimum V (3.05) under 4.3bsd.
# 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.
XDEPFILES= infptrace.o coredep.o
XM_FILE= xm-isi.h

21
gdb/config/isi.mt Normal file
View file

@ -0,0 +1,21 @@
# ISI Optimum V (3.05) under 4.3bsd.
# Copyright (C) 1990-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.
TDEPFILES= exec.o m68k-pinsn.o
TM_FILE= tm-isi.h

21
gdb/config/littlemips.mh Normal file
View file

@ -0,0 +1,21 @@
# Little-endian MIPS machine such as DECstation.
# 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.
XDEPFILES= infptrace.o mips-xdep.o coredep.o
XM_FILE= xm-mips.h

21
gdb/config/littlemips.mt Normal file
View file

@ -0,0 +1,21 @@
# Little-endian MIPS machine such as DECstation.
# Copyright (C) 1989, 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.
TDEPFILES= mips-pinsn.o mips-tdep.o mipsread.o exec.o
TM_FILE= tm-mips.h

21
gdb/config/m88k.mh Normal file
View file

@ -0,0 +1,21 @@
# Motorola 88000 running DGUX
# 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.
XDEPFILES=
XM_FILE= xm-88k.h

23
gdb/config/m88k.mt Normal file
View file

@ -0,0 +1,23 @@
# Motorola 88000 running DGUX
# 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.
TDEPFILES= tdesc.o
TM_CLIBS= tdesc/libdc.o
TM_CDEPS= tdesc/libdc.o
TM_FILE= tm-88k.h

24
gdb/config/merlin.mh Normal file
View file

@ -0,0 +1,24 @@
# Merlin running utek 2.1
# 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.
XDEPFILES= infptrace.o coredep.o
XM_FILE= xm-merlin.h
# See SHELL_FILE in m-merlin.h for a explanation of this.
M_INSTALL=cp /bin/sh /usr/local/lib/gdb-sh; \
chmod ogu+rw /usr/local/lib/gdb-sh

21
gdb/config/merlin.mt Normal file
View file

@ -0,0 +1,21 @@
# Merlin running utek 2.1
# Copyright (C) 1990-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.
TDEPFILES= exec.o ns32k-pinsn.o
TM_FILE= tm-merlin.h

28
gdb/config/mh-vax Executable file
View file

@ -0,0 +1,28 @@
# DEC VAX running BSD or Ultrix
# Copyright (C) 1989, 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.
# 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
XM_FILE= xm-vax.h

21
gdb/config/news.mh Normal file
View file

@ -0,0 +1,21 @@
# Sony news series 700/800/900 (68020) running NewsOS version 3.
# Copyright (C) 1989, 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.
XDEPFILES= infptrace.o coredep.o news-xdep.o
XM_FILE= xm-news.h

21
gdb/config/news.mt Normal file
View file

@ -0,0 +1,21 @@
# Sony news series 700/800/900 (68020) running NewsOS version 3.
# 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.
TDEPFILES= m68k-pinsn.o exec.o
TM_FILE= tm-news.h

21
gdb/config/news1000.mh Normal file
View file

@ -0,0 +1,21 @@
# Sony news series 1000 (68030) running NewsOS version 3.
# Copyright (C) 1989, 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.
XDEPFILES= infptrace.o coredep.o news-xdep.o
XM_FILE= xm-news1000.h

21
gdb/config/news1000.mt Normal file
View file

@ -0,0 +1,21 @@
# Sony news series 1000 (68030) running NewsOS version 3.
# 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.
TDEPFILES= m68k-pinsn.o exec.o
TM_FILE= tm-news.h

22
gdb/config/nindy960.mt Normal file
View file

@ -0,0 +1,22 @@
# Intel 80960, in an embedded system under the NINDY monitor
# Copyright (C) 1990-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.
TDEPFILES= exec.o i960-pinsn.o i960-tdep.o nindy-tdep.o remote-nindy.o nindy.o Onindy.o ttybreak.o ttyflush.o
TM_FILE= tm-nindy960.h
TM_CFLAGS=

21
gdb/config/none.mh Normal file
View file

@ -0,0 +1,21 @@
# 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.

3
gdb/config/none.mt Normal file
View file

@ -0,0 +1,3 @@
# "no target".
# This can be used to build you a Makefile that only runs administrative
# commands like 'clean', 'gdb.tar.Z', etc.

21
gdb/config/np1.mh Normal file
View file

@ -0,0 +1,21 @@
# Gould NP1
# 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.
XDEPFILES= infptrace.o gould-xdep.o
XM_FILE= xm-np1.h

21
gdb/config/np1.mt Normal file
View file

@ -0,0 +1,21 @@
# Gould NP1
# Copyright (C) 1990-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.
TDEPFILES= exec.o gould-pinsn.o
TM_FILE= tm-np1.h

21
gdb/config/pn.mh Normal file
View file

@ -0,0 +1,21 @@
# Gould Powernode
# 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.
XDEPFILES= infptrace.o coredep.o
XM_FILE= xm-pn.h

21
gdb/config/pn.mt Normal file
View file

@ -0,0 +1,21 @@
# Gould Powernode
# Copyright (C) 1990-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.
TDEPFILES= exec.o gould-pinsn.o
TM_FILE= tm-pn.h

25
gdb/config/pyramid.mh Normal file
View file

@ -0,0 +1,25 @@
# Pyramidax under OSx 4.0 (4.2bsd).
# 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.
#msg If you don't compile GDB with GCC, you'll need to add
#msg ALLOCA=alloca.o and ALLOCA1=alloca.o to the Makefile.
#msg
XDEPFILES= pyr-xdep.o infptrace.o
XM_FILE= xm-pyr.h

25
gdb/config/pyramid.mt Normal file
View file

@ -0,0 +1,25 @@
# Pyramid under OSx 4.0 (4.2bsd).
# Copyright (C) 1990-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.
#msg Note that GDB on Pyramids only works with GCC,
#msg at least for some programs.
#msg
TDEPFILES= pyr-pinsn.o pyr-tdep.o exec.o
TM_FILE= tm-pyr.h

21
gdb/config/sun2os3.mh Normal file
View file

@ -0,0 +1,21 @@
# Sun 2, running SunOS 3
# 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.
XDEPFILES= infptrace.o sun3-xdep.o
XM_FILE= xm-sun2.h

26
gdb/config/sun2os3.mt Normal file
View file

@ -0,0 +1,26 @@
# Sun 2, running SunOS 3
# 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.
# 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 m68k-tdep.o
TM_FILE= tm-sun2.h

21
gdb/config/sun2os4.mh Normal file
View file

@ -0,0 +1,21 @@
# Sun 2, running SunOS 4
# 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.
XDEPFILES= infptrace.o sun3-xdep.o
XM_FILE= xm-sun2.h

26
gdb/config/sun2os4.mt Normal file
View file

@ -0,0 +1,26 @@
# Sun 2, running SunOS 4
# 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.
# 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-sun2os4.h

26
gdb/config/sun3.mh Normal file
View file

@ -0,0 +1,26 @@
# Sun 3, running SunOS 4
# 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.
# 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
XDEPFILES= infptrace.o sun3-xdep.o
XM_FILE= xm-sun3os4.h

21
gdb/config/sun3.mt Normal file
View file

@ -0,0 +1,21 @@
# Sun 3, running SunOS 4, as a target system
# 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.
TDEPFILES= exec.o m68k-pinsn.o solib.o m68k-tdep.o
TM_FILE= tm-sun3os4.h

21
gdb/config/sun386.mh Normal file
View file

@ -0,0 +1,21 @@
# Sun 386i
# 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.
XDEPFILES= infptrace.o sun386-xdep.o
XM_FILE= xm-sun386.h

21
gdb/config/sun386.mt Normal file
View file

@ -0,0 +1,21 @@
# Sun 386i target configuration file.
# 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.
TDEPFILES= exec.o i386-pinsn.o solib.o
TM_FILE= tm-sun386.h

21
gdb/config/sun3os3.mh Normal file
View file

@ -0,0 +1,21 @@
# Sun 3, running SunOS 3
# 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.
XDEPFILES= infptrace.o sun3-xdep.o
XM_FILE= xm-sun3.h

26
gdb/config/sun3os3.mt Normal file
View file

@ -0,0 +1,26 @@
# Sun 3, running SunOS 3
# 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.
# 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 m68k-tdep.o
TM_FILE= tm-sun3.h

26
gdb/config/sun3os4.mh Normal file
View file

@ -0,0 +1,26 @@
# Sun 3, running SunOS 4
# 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.
# 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
XDEPFILES= infptrace.o sun3-xdep.o
XM_FILE= xm-sun3os4.h

21
gdb/config/sun3os4.mt Normal file
View file

@ -0,0 +1,21 @@
# Sun 3, running SunOS 4, as a target system
# 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.
TDEPFILES= exec.o m68k-pinsn.o solib.o m68k-tdep.o
TM_FILE= tm-sun3os4.h

21
gdb/config/sun4.mh Normal file
View file

@ -0,0 +1,21 @@
# Sun 4 or Sparcstation, running SunOS 4
# 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.
XDEPFILES= infptrace.o sparc-xdep.o
XM_FILE= xm-sun4os4.h

26
gdb/config/sun4.mt Normal file
View file

@ -0,0 +1,26 @@
# Sun 4 or Sparcstation, running SunOS 4
# 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.
# 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 solib.o
TM_FILE= tm-sun4os4.h

21
gdb/config/sun4os3.mh Normal file
View file

@ -0,0 +1,21 @@
# Sun 4 or Sparcstation, running SunOS 3
# 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.
XDEPFILES= infptrace.o sparc-xdep.o
XM_FILE= xm-sparc.h

26
gdb/config/sun4os3.mt Normal file
View file

@ -0,0 +1,26 @@
# Sun 4 or Sparcstation, running SunOS 3
# 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.
# 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

21
gdb/config/sun4os4.mh Normal file
View file

@ -0,0 +1,21 @@
# Sun 4 or Sparcstation, running SunOS 4
# 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.
XDEPFILES= infptrace.o sparc-xdep.o
XM_FILE= xm-sun4os4.h

26
gdb/config/sun4os4.mt Normal file
View file

@ -0,0 +1,26 @@
# Sun 4 or Sparcstation, running SunOS 4
# 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.
# 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 solib.o
TM_FILE= tm-sun4os4.h

21
gdb/config/symmetry.mh Normal file
View file

@ -0,0 +1,21 @@
# Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387.
# 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.
XDEPFILES= infptrace.o symmetry-xdep.o
XM_FILE= xm-symmetry.h

21
gdb/config/symmetry.mt Normal file
View file

@ -0,0 +1,21 @@
# Sequent Symmetry running Dynix 3.0, with Weitek 1167 or i387.
# Copyright (C) 1990-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.
TDEPFILES= symmetry-tdep.o i386-pinsn.o
TM_FILE= tm-symmetry.h

21
gdb/config/umax.mh Normal file
View file

@ -0,0 +1,21 @@
# Encore running umax 4.2
# 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.
XDEPFILES= infptrace.o umax-xdep.o
XM_FILE= xm-umax.h

21
gdb/config/umax.mt Normal file
View file

@ -0,0 +1,21 @@
# Encore running umax 4.2
# 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.
TDEPFILES= exec.o ns32k-pinsn.o
TM_FILE= tm-umax.h

21
gdb/config/vax.mt Normal file
View file

@ -0,0 +1,21 @@
# DEC VAX running BSD or Ultrix
# 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.
TDEPFILES= vax-pinsn.o exec.o
TM_FILE= tm-vax.h

21
gdb/config/vxworks68.mt Normal file
View file

@ -0,0 +1,21 @@
# VxWorks running on a 68000, as a target system
# Copyright (C) 1990-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.
TDEPFILES= exec.o m68k-pinsn.o m68k-tdep.o remote-vx.o xdr_ld.o xdr_ptrace.o xdr_rdb.o xdr_regs.o
TM_FILE= tm-vxworks68.h

23
gdb/config/vxworks960.mt Normal file
View file

@ -0,0 +1,23 @@
# VxWorks running on an Intel 960, as a target system
# Copyright (C) 1990-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.
TDEPFILES= exec.o i960-pinsn.o i960-tdep.o remote-vx.o xdr_ld.o xdr_ptrace.o xdr_rdb.o xdr_regs.o
TM_FILE= tm-vxworks960.h
# Define this for the vx-share routines, which don't see param.h.
TM_CFLAGS= -DI80960

1677
gdb/convex-opcode.h Executable file

File diff suppressed because it is too large Load diff

314
gdb/convex-pinsn.c Normal file
View file

@ -0,0 +1,314 @@
/* Print Convex instructions 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 <stdio.h>
#include "defs.h"
#include "param.h"
#include "symtab.h"
/* reg (fmt_field, inst_field) --
the {first,second,third} operand of instruction as fmt_field = [ijk]
gets the value of the field from the [ijk] position of the instruction */
#define reg(a,b) ((char (*)[3])(op[fmt->a]))[inst.f0.b]
/* lit (fmt_field) -- field [ijk] is a literal (PSW, VL, eg) */
#define lit(i) op[fmt->i]
/* aj[j] -- name for A register j */
#define aj ((char (*)[3])(op[A]))
union inst {
struct {
unsigned : 7;
unsigned i : 3;
unsigned j : 3;
unsigned k : 3;
unsigned : 16;
unsigned : 32;
} f0;
struct {
unsigned : 8;
unsigned indir : 1;
unsigned len : 1;
unsigned j : 3;
unsigned k : 3;
unsigned : 16;
unsigned : 32;
} f1;
unsigned char byte[8];
unsigned short half[4];
char signed_byte[8];
short signed_half[4];
};
struct opform {
int mask; /* opcode mask */
int shift; /* opcode align */
struct formstr *formstr[3]; /* ST, E0, E1 */
};
struct formstr {
unsigned lop:8, rop:5; /* opcode */
unsigned fmt:5; /* inst format */
unsigned i:5, j:5, k:2; /* operand formats */
};
#include "convex-opcode.h"
unsigned char formdecode [] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
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,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
4,4,4,4,4,4,4,4,5,5,5,5,6,6,7,8,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,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 opform opdecode[] = {
0x7e00, 9, format0, e0_format0, e1_format0,
0x3f00, 8, format1, e0_format1, e1_format1,
0x1fc0, 6, format2, e0_format2, e1_format2,
0x0fc0, 6, format3, e0_format3, e1_format3,
0x0700, 8, format4, e0_format4, e1_format4,
0x03c0, 6, format5, e0_format5, e1_format5,
0x01f8, 3, format6, e0_format6, e1_format6,
0x00f8, 3, format7, e0_format7, e1_format7,
0x0000, 0, formatx, formatx, formatx,
0x0f80, 7, formatx, formatx, formatx,
0x0f80, 7, formatx, formatx, formatx,
};
/* Print the instruction at address MEMADDR in debugged memory,
on STREAM. Returns length of the instruction, in bytes. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
FILE *stream;
{
union inst inst;
struct formstr *fmt;
register int format, op1, pfx;
int l;
read_memory (memaddr, &inst, sizeof inst);
/* Remove and note prefix, if present */
pfx = inst.half[0];
if ((pfx & 0xfff0) == 0x7ef0)
{
pfx = ((pfx >> 3) & 1) + 1;
*(long long *) &inst = *(long long *) &inst.half[1];
}
else pfx = 0;
/* Split opcode into format.op1 and look up in appropriate table */
format = formdecode[inst.byte[0]];
op1 = (inst.half[0] & opdecode[format].mask) >> opdecode[format].shift;
if (format == 9)
{
if (pfx)
fmt = formatx;
else if (inst.f1.j == 0)
fmt = &format1a[op1];
else if (inst.f1.j == 1)
fmt = &format1b[op1];
else
fmt = formatx;
}
else
fmt = &opdecode[format].formstr[pfx][op1];
/* Print it */
if (fmt->fmt == xxx)
{
/* noninstruction */
fprintf (stream, "0x%04x", pfx ? pfx : inst.half[0]);
return 2;
}
if (pfx)
pfx = 2;
fprintf (stream, "%s%s%s", lop[fmt->lop], rop[fmt->rop],
&" "[strlen(lop[fmt->lop]) + strlen(rop[fmt->rop])]);
switch (fmt->fmt)
{
case rrr: /* three register */
fprintf (stream, "%s,%s,%s", reg(i,i), reg(j,j), reg(k,k));
return pfx + 2;
case rr: /* two register */
fprintf (stream, "%s,%s", reg(i,j), reg(j,k));
return pfx + 2;
case rxr: /* two register, reversed i and j fields */
fprintf (stream, "%s,%s", reg(i,k), reg(j,j));
return pfx + 2;
case r: /* one register */
fprintf (stream, "%s", reg(i,k));
return pfx + 2;
case nops: /* no operands */
return pfx + 2;
case nr: /* short immediate, one register */
fprintf (stream, "#%d,%s", inst.f0.j, reg(i,k));
return pfx + 2;
case pcrel: /* pc relative */
print_address (memaddr + 2 * inst.signed_byte[1], stream);
return pfx + 2;
case lr: /* literal, one register */
fprintf (stream, "%s,%s", lit(i), reg(j,k));
return pfx + 2;
case rxl: /* one register, literal */
fprintf (stream, "%s,%s", reg(i,k), lit(j));
return pfx + 2;
case rlr: /* register, literal, register */
fprintf (stream, "%s,%s,%s", reg(i,j), lit(j), reg(k,k));
return pfx + 2;
case rrl: /* register, register, literal */
fprintf (stream, "%s,%s,%s", reg(i,j), reg(j,k), lit(k));
return pfx + 2;
case iml: /* immediate, literal */
if (inst.f1.len)
{
fprintf (stream, "#%#x,%s",
(inst.signed_half[1] << 16) + inst.half[2], lit(i));
return pfx + 6;
}
else
{
fprintf (stream, "#%d,%s", inst.signed_half[1], lit(i));
return pfx + 4;
}
case imr: /* immediate, register */
if (inst.f1.len)
{
fprintf (stream, "#%#x,%s",
(inst.signed_half[1] << 16) + inst.half[2], reg(i,k));
return pfx + 6;
}
else
{
fprintf (stream, "#%d,%s", inst.signed_half[1], reg(i,k));
return pfx + 4;
}
case a1r: /* memory, register */
l = print_effa (inst, stream);
fprintf (stream, ",%s", reg(i,k));
return pfx + l;
case a1l: /* memory, literal */
l = print_effa (inst, stream);
fprintf (stream, ",%s", lit(i));
return pfx + l;
case a2r: /* register, memory */
fprintf (stream, "%s,", reg(i,k));
return pfx + print_effa (inst, stream);
case a2l: /* literal, memory */
fprintf (stream, "%s,", lit(i));
return pfx + print_effa (inst, stream);
case a3: /* memory */
return pfx + print_effa (inst, stream);
case a4: /* system call */
l = 29; goto a4a5;
case a5: /* trap */
l = 27;
a4a5:
if (inst.f1.len)
{
unsigned int m = (inst.signed_half[1] << 16) + inst.half[2];
fprintf (stream, "#%d,#%d", m >> l, m & (-1 >> (32-l)));
return pfx + 6;
}
else
{
unsigned int m = inst.signed_half[1];
fprintf (stream, "#%d,#%d", m >> l, m & (-1 >> (32-l)));
return pfx + 4;
}
}
}
/* print effective address @nnn(aj), return instruction length */
int print_effa (inst, stream)
union inst inst;
FILE *stream;
{
int n, l;
if (inst.f1.len)
{
n = (inst.signed_half[1] << 16) + inst.half[2];
l = 6;
}
else
{
n = inst.signed_half[1];
l = 4;
}
if (inst.f1.indir)
printf ("@");
if (!inst.f1.j)
{
print_address (n, stream);
return l;
}
fprintf (stream, (n & 0xf0000000) == 0x80000000 ? "%#x(%s)" : "%d(%s)",
n, aj[inst.f1.j]);
return l;
}

934
gdb/convex-tdep.c Normal file
View file

@ -0,0 +1,934 @@
/* Convex stuff for GDB.
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. */
#include <stdio.h>
#include "defs.h"
#include "param.h"
#include "command.h"
#include "symtab.h"
#include "value.h"
#include "frame.h"
#include "inferior.h"
#include "wait.h"
#include <signal.h>
#include <fcntl.h>
#include "gdbcore.h"
#include <sys/param.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <sys/ioctl.h>
#include <sys/pcntl.h>
#include <sys/thread.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include "gdbcmd.h"
exec_file_command (filename, from_tty)
char *filename;
int from_tty;
{
int val;
int n;
struct stat st_exec;
/* Eliminate all traces of old exec file.
Mark text segment as empty. */
if (execfile)
free (execfile);
execfile = 0;
data_start = 0;
data_end = 0;
text_start = 0;
text_end = 0;
exec_data_start = 0;
exec_data_end = 0;
if (execchan >= 0)
close (execchan);
execchan = -1;
n_exec = 0;
/* 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);
if (myread (execchan, &filehdr, sizeof filehdr) < 0)
perror_with_name (filename);
if (! IS_SOFF_MAGIC (filehdr.h_magic))
error ("%s: not an executable file.", filename);
if (myread (execchan, &opthdr, filehdr.h_opthdr) <= 0)
perror_with_name (filename);
/* Read through the section headers.
For text, data, etc, record an entry in the exec file map.
Record text_start and text_end. */
lseek (execchan, (long) filehdr.h_scnptr, 0);
for (n = 0; n < filehdr.h_nscns; n++)
{
if (myread (execchan, &scnhdr, sizeof scnhdr) < 0)
perror_with_name (filename);
if ((scnhdr.s_flags & S_TYPMASK) >= S_TEXT
&& (scnhdr.s_flags & S_TYPMASK) <= S_COMON)
{
exec_map[n_exec].mem_addr = scnhdr.s_vaddr;
exec_map[n_exec].mem_end = scnhdr.s_vaddr + scnhdr.s_size;
exec_map[n_exec].file_addr = scnhdr.s_scnptr;
exec_map[n_exec].type = scnhdr.s_flags & S_TYPMASK;
n_exec++;
if ((scnhdr.s_flags & S_TYPMASK) == S_TEXT)
{
text_start = scnhdr.s_vaddr;
text_end = scnhdr.s_vaddr + scnhdr.s_size;
}
}
}
fstat (execchan, &st_exec);
exec_mtime = st_exec.st_mtime;
validate_files ();
}
else if (from_tty)
printf_filtered ("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);
}
/* Read data from SOFF exec or core file.
Return 0 on success, EIO if address out of bounds. */
int
xfer_core_file (memaddr, myaddr, len)
CORE_ADDR memaddr;
char *myaddr;
int len;
{
register int i;
register int n;
register int val;
int xferchan;
char **xferfile;
int fileptr;
int returnval = 0;
while (len > 0)
{
xferfile = 0;
xferchan = 0;
/* Determine which file the next bunch of addresses reside in,
and where in the file. Set the file's read/write pointer
to point at the proper place for the desired address
and set xferfile and xferchan for the correct file.
If desired address is nonexistent, leave them zero.
i is set to the number of bytes that can be handled
along with the next address. */
i = len;
for (n = 0; n < n_core; n++)
{
if (memaddr >= core_map[n].mem_addr && memaddr < core_map[n].mem_end
&& (core_map[n].thread == -1
|| core_map[n].thread == inferior_thread))
{
i = min (len, core_map[n].mem_end - memaddr);
fileptr = core_map[n].file_addr + memaddr - core_map[n].mem_addr;
if (core_map[n].file_addr)
{
xferfile = &corefile;
xferchan = corechan;
}
break;
}
else if (core_map[n].mem_addr >= memaddr
&& core_map[n].mem_addr < memaddr + i)
i = core_map[n].mem_addr - memaddr;
}
if (!xferfile)
for (n = 0; n < n_exec; n++)
{
if (memaddr >= exec_map[n].mem_addr
&& memaddr < exec_map[n].mem_end)
{
i = min (len, exec_map[n].mem_end - memaddr);
fileptr = exec_map[n].file_addr + memaddr
- exec_map[n].mem_addr;
if (exec_map[n].file_addr)
{
xferfile = &execfile;
xferchan = execchan;
}
break;
}
else if (exec_map[n].mem_addr >= memaddr
&& exec_map[n].mem_addr < memaddr + i)
i = exec_map[n].mem_addr - memaddr;
}
/* Now we know which file to use.
Set up its pointer and transfer the data. */
if (xferfile)
{
if (*xferfile == 0)
if (xferfile == &execfile)
error ("No program file to examine.");
else
error ("No core dump file or running program to examine.");
val = lseek (xferchan, fileptr, 0);
if (val < 0)
perror_with_name (*xferfile);
val = myread (xferchan, myaddr, i);
if (val < 0)
perror_with_name (*xferfile);
}
/* If this address is for nonexistent memory,
read zeros if reading, or do nothing if writing. */
else
{
bzero (myaddr, i);
returnval = EIO;
}
memaddr += i;
myaddr += i;
len -= i;
}
return returnval;
}
/* Here from info files command to print an address map. */
print_maps ()
{
struct pmap ptrs[200];
int n;
/* ID strings for core and executable file sections */
static char *idstr[] =
{
"0", "text", "data", "tdata", "bss", "tbss",
"common", "ttext", "ctx", "tctx", "10", "11", "12",
};
for (n = 0; n < n_core; n++)
{
core_map[n].which = 0;
ptrs[n] = core_map[n];
}
for (n = 0; n < n_exec; n++)
{
exec_map[n].which = 1;
ptrs[n_core+n] = exec_map[n];
}
qsort (ptrs, n_core + n_exec, sizeof *ptrs, ptr_cmp);
for (n = 0; n < n_core + n_exec; n++)
{
struct pmap *p = &ptrs[n];
if (n > 0)
{
if (p->mem_addr < ptrs[n-1].mem_end)
p->mem_addr = ptrs[n-1].mem_end;
if (p->mem_addr >= p->mem_end)
continue;
}
printf_filtered ("%08x .. %08x %-6s %s\n",
p->mem_addr, p->mem_end, idstr[p->type],
p->which ? execfile : corefile);
}
}
/* Compare routine to put file sections in order.
Sort into increasing order on address, and put core file sections
before exec file sections if both files contain the same addresses. */
static ptr_cmp (a, b)
struct pmap *a, *b;
{
if (a->mem_addr != b->mem_addr) return a->mem_addr - b->mem_addr;
return a->which - b->which;
}
/* Trapped internal variables are used to handle special registers.
A trapped i.v. calls a hook here every time it is dereferenced,
to provide a new value for the variable, and it calls a hook here
when a new value is assigned, to do something with the value.
The vector registers are $vl, $vs, $vm, $vN, $VN (N in 0..7).
The communication registers are $cN, $CN (N in 0..63).
They not handled as regular registers because it's expensive to
read them, and their size varies, and they have too many names. */
/* Return 1 if NAME is a trapped internal variable, else 0. */
int
is_trapped_internalvar (name)
char *name;
{
if ((name[0] == 'c' || name[0] == 'C')
&& name[1] >= '0' && name[1] <= '9'
&& (name[2] == '\0'
|| (name[2] >= '0' && name[2] <= '9'
&& name[3] == '\0' && name[1] != '0'))
&& atoi (&name[1]) < 64) return 1;
if ((name[0] == 'v' || name[0] == 'V')
&& (((name[1] & -8) == '0' && name[2] == '\0')
|| !strcmp (name, "vl")
|| !strcmp (name, "vs")
|| !strcmp (name, "vm")))
return 1;
else return 0;
}
/* Return the value of trapped internal variable VAR */
value
value_of_trapped_internalvar (var)
struct internalvar *var;
{
char *name = var->name;
value val;
struct type *type;
long len = *read_vector_register (VL_REGNUM);
if (len <= 0 || len > 128) len = 128;
if (!strcmp (name, "vl"))
{
val = value_from_long (builtin_type_int,
(LONGEST) *read_vector_register_1 (VL_REGNUM));
}
else if (!strcmp (name, "vs"))
{
val = value_from_long (builtin_type_int,
(LONGEST) *read_vector_register_1 (VS_REGNUM));
}
else if (!strcmp (name, "vm"))
{
long vm[4];
long i, *p;
bcopy (read_vector_register_1 (VM_REGNUM), vm, sizeof vm);
type = vector_type (builtin_type_int, len);
val = allocate_value (type);
p = (long *) VALUE_CONTENTS (val);
for (i = 0; i < len; i++)
*p++ = !! (vm[3 - (i >> 5)] & (1 << (i & 037)));
}
else if (name[0] == 'V')
{
type = vector_type (builtin_type_long_long, len);
val = allocate_value (type);
bcopy (read_vector_register_1 (name[1] - '0'),
VALUE_CONTENTS (val), TYPE_LENGTH (type));
}
else if (name[0] == 'v')
{
long *p1, *p2;
type = vector_type (builtin_type_long, len);
val = allocate_value (type);
p1 = read_vector_register_1 (name[1] - '0');
p2 = (long *) VALUE_CONTENTS (val);
while (--len >= 0) {p1++; *p2++ = *p1++;}
}
else if (name[0] == 'c')
val = value_from_long (builtin_type_int,
read_comm_register (atoi (&name[1])));
else if (name[0] == 'C')
val = value_from_long (builtin_type_long_long,
read_comm_register (atoi (&name[1])));
VALUE_LVAL (val) = lval_internalvar;
VALUE_INTERNALVAR (val) = var;
return val;
}
/* Construct the type for a vector register's value --
array[LENGTH] of ELEMENT_TYPE. */
static struct type *
vector_type (element_type, length)
struct type *element_type;
long length;
{
struct type *type = (struct type *) xmalloc (sizeof (struct type));
bzero (type, sizeof type);
TYPE_CODE (type) = TYPE_CODE_ARRAY;
TYPE_TARGET_TYPE (type) = element_type;
TYPE_LENGTH (type) = length * TYPE_LENGTH (TYPE_TARGET_TYPE (type));
return type;
}
/* Handle a new value assigned to a trapped internal variable */
void
set_trapped_internalvar (var, val, bitpos, bitsize, offset)
struct internalvar *var;
value val;
int bitpos, bitsize, offset;
{
char *name = var->name;
long long newval = value_as_long (val);
if (!strcmp (name, "vl"))
write_vector_register (VL_REGNUM, 0, newval);
else if (!strcmp (name, "vs"))
write_vector_register (VS_REGNUM, 0, newval);
else if (name[0] == 'c' || name[0] == 'C')
write_comm_register (atoi (&name[1]), newval);
else if (!strcmp (name, "vm"))
error ("can't assign to $vm");
else
{
offset /= bitsize / 8;
write_vector_register (name[1] - '0', offset, newval);
}
}
/* Print an integer value when no format was specified. gdb normally
prints these values in decimal, but the the leading 0x80000000 of
pointers produces intolerable 10-digit negative numbers.
If it looks like an address, print it in hex instead. */
decout (stream, type, val)
FILE *stream;
struct type *type;
LONGEST val;
{
long lv = val;
switch (output_radix)
{
case 0:
if ((lv == val || (unsigned) lv == val)
&& ((lv & 0xf0000000) == 0x80000000
|| ((lv & 0xf0000000) == 0xf0000000 && lv < STACK_END_ADDR)))
{
fprintf_filtered (stream, "%#x", lv);
return;
}
case 10:
fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%llu" : "%lld", val);
return;
case 8:
if (TYPE_LENGTH (type) <= sizeof lv)
fprintf_filtered (stream, "%#o", lv);
else
fprintf_filtered (stream, "%#llo", val);
return;
case 16:
if (TYPE_LENGTH (type) <= sizeof lv)
fprintf_filtered (stream, "%#x", lv);
else
fprintf_filtered (stream, "%#llx", val);
return;
}
}
/* Change the default output radix to 10 or 16, or set it to 0 (heuristic).
This command is mostly obsolete now that the print command allows
formats to apply to aggregates, but is still handy occasionally. */
static void
set_base_command (arg)
char *arg;
{
int new_radix;
if (!arg)
output_radix = 0;
else
{
new_radix = atoi (arg);
if (new_radix != 10 && new_radix != 16 && new_radix != 8)
error ("base must be 8, 10 or 16, or null");
else output_radix = new_radix;
}
}
/* Turn pipelining on or off in the inferior. */
static void
set_pipelining_command (arg)
char *arg;
{
if (!arg)
{
sequential = !sequential;
printf_filtered ("%s\n", sequential ? "off" : "on");
}
else if (!strcmp (arg, "on"))
sequential = 0;
else if (!strcmp (arg, "off"))
sequential = 1;
else error ("valid args are `on', to allow instructions to overlap, or\n\
`off', to prevent it and thereby pinpoint exceptions.");
}
/* Enable, disable, or force parallel execution in the inferior. */
static void
set_parallel_command (arg)
char *arg;
{
struct rlimit rl;
int prevparallel = parallel;
if (!strncmp (arg, "fixed", strlen (arg)))
parallel = 2;
else if (!strcmp (arg, "on"))
parallel = 1;
else if (!strcmp (arg, "off"))
parallel = 0;
else error ("valid args are `on', to allow multiple threads, or\n\
`fixed', to force multiple threads, or\n\
`off', to run with one thread only.");
if ((prevparallel == 0) != (parallel == 0) && inferior_pid)
printf_filtered ("will take effect at next run.\n");
getrlimit (RLIMIT_CONCUR, &rl);
rl.rlim_cur = parallel ? rl.rlim_max : 1;
setrlimit (RLIMIT_CONCUR, &rl);
if (inferior_pid)
set_fixed_scheduling (inferior_pid, parallel == 2);
}
/* Add a new name for an existing command. */
static void
alias_command (arg)
char *arg;
{
static char *aliaserr = "usage is `alias NEW OLD', no args allowed";
char *newname = arg;
struct cmd_list_element *new, *old;
if (!arg)
error_no_arg ("newname oldname");
new = lookup_cmd (&arg, cmdlist, "", -1);
if (new && !strncmp (newname, new->name, strlen (new->name)))
{
newname = new->name;
if (!(*arg == '-'
|| (*arg >= 'a' && *arg <= 'z')
|| (*arg >= 'A' && *arg <= 'Z')
|| (*arg >= '0' && *arg <= '9')))
error (aliaserr);
}
else
{
arg = newname;
while (*arg == '-'
|| (*arg >= 'a' && *arg <= 'z')
|| (*arg >= 'A' && *arg <= 'Z')
|| (*arg >= '0' && *arg <= '9'))
arg++;
if (*arg != ' ' && *arg != '\t')
error (aliaserr);
*arg = '\0';
arg++;
}
old = lookup_cmd (&arg, cmdlist, "", 0);
if (*arg != '\0')
error (aliaserr);
if (new && !strncmp (newname, new->name, strlen (new->name)))
{
char *tem;
if (new->class == (int) class_user || new->class == (int) class_alias)
tem = "Redefine command \"%s\"? ";
else
tem = "Really redefine built-in command \"%s\"? ";
if (!query (tem, new->name))
error ("Command \"%s\" not redefined.", new->name);
}
add_com (newname, class_alias, old->function, old->doc);
}
/* Print the current thread number, and any threads with signals in the
queue. */
thread_info ()
{
struct threadpid *p;
if (have_inferior_p ())
{
ps.pi_buffer = (char *) &comm_registers;
ps.pi_nbytes = sizeof comm_registers;
ps.pi_offset = 0;
ps.pi_thread = inferior_thread;
ioctl (inferior_fd, PIXRDCREGS, &ps);
}
printf_filtered ("Current thread %d stopped with signal %d.%d (%s).\n",
inferior_thread, stop_signal, stop_sigcode,
subsig_name (stop_signal, stop_sigcode));
for (p = signal_stack; p->pid; p--)
printf_filtered ("Thread %d stopped with signal %d.%d (%s).\n",
p->thread, p->signo, p->subsig,
subsig_name (p->signo, p->subsig));
if (iscrlbit (comm_registers.crctl.lbits.cc, 64+13))
printf_filtered ("New thread start pc %#x\n",
(long) (comm_registers.crreg.pcpsw >> 32));
}
/* Return string describing a signal.subcode number */
static char *
subsig_name (signo, subcode)
int signo, subcode;
{
static char *subsig4[] = {
"error exit", "privileged instruction", "unknown",
"unknown", "undefined opcode",
0};
static char *subsig5[] = {0,
"breakpoint", "single step", "fork trap", "exec trap", "pfork trap",
"join trap", "idle trap", "last thread", "wfork trap",
"process breakpoint", "trap instruction",
0};
static char *subsig8[] = {0,
"int overflow", "int divide check", "float overflow",
"float divide check", "float underflow", "reserved operand",
"sqrt error", "exp error", "ln error", "sin error", "cos error",
0};
static char *subsig10[] = {0,
"invalid inward ring address", "invalid outward ring call",
"invalid inward ring return", "invalid syscall gate",
"invalid rtn frame length", "invalid comm reg address",
"invalid trap gate",
0};
static char *subsig11[] = {0,
"read access denied", "write access denied", "execute access denied",
"segment descriptor fault", "page table fault", "data reference fault",
"i/o access denied", "levt pte invalid",
0};
static char **subsig_list[] =
{0, 0, 0, 0, subsig4, subsig5, 0, 0, subsig8, 0, subsig10, subsig11, 0};
int i;
char *p = signo < NSIG ? sys_siglist[signo] : "unknown";
if (signo >= (sizeof subsig_list / sizeof *subsig_list)
|| !subsig_list[signo])
return p;
for (i = 1; subsig_list[signo][i]; i++)
if (i == subcode)
return subsig_list[signo][subcode];
return p;
}
/* Print a compact display of thread status, essentially x/i $pc
for all active threads. */
static void
threadstat ()
{
int t;
for (t = 0; t < n_threads; t++)
if (thread_state[t] == PI_TALIVE)
{
printf_filtered ("%d%c %08x%c %d.%d ", t,
(t == inferior_thread ? '*' : ' '), thread_pc[t],
(thread_is_in_kernel[t] ? '#' : ' '),
thread_signal[t], thread_sigcode[t]);
print_insn (thread_pc[t], stdout);
printf_filtered ("\n");
}
}
/* Change the current thread to ARG. */
set_thread_command (arg)
char *arg;
{
int thread;
if (!arg)
{
threadstat ();
return;
}
thread = parse_and_eval_address (arg);
if (thread < 0 || thread > n_threads || thread_state[thread] != PI_TALIVE)
error ("no such thread.");
select_thread (thread);
stop_pc = read_pc ();
flush_cached_frames ();
set_current_frame (create_new_frame (read_register (FP_REGNUM),
read_pc ()));
select_frame (get_current_frame (), 0);
print_sel_frame (1);
}
/* Here on CONT command; gdb's dispatch address is changed to come here.
Set global variable ALL_CONTINUE to tell resume() that it should
start up all threads, and that a thread switch will not blow gdb's
mind. */
static void
convex_cont_command (proc_count_exp, from_tty)
char *proc_count_exp;
int from_tty;
{
all_continue = 1;
cont_command (proc_count_exp, from_tty);
}
/* Here on 1CONT command. Resume only the current thread. */
one_cont_command (proc_count_exp, from_tty)
char *proc_count_exp;
int from_tty;
{
cont_command (proc_count_exp, from_tty);
}
/* Print the contents and lock bits of all communication registers,
or just register ARG if ARG is a communication register,
or the 3-word resource structure in memory at address ARG. */
comm_registers_info (arg)
char *arg;
{
int i, regnum;
if (arg)
{
if (sscanf (arg, "0x%x", &regnum) == 1
|| sscanf (arg, "%d", &regnum) == 1)
{
if (regnum > 0)
regnum &= ~0x8000;
}
else if (sscanf (arg, "$c%d", &regnum) == 1)
;
else if (sscanf (arg, "$C%d", &regnum) == 1)
;
else
regnum = parse_and_eval_address (arg);
if (regnum >= 64)
error ("%s: invalid register name.", arg);
/* if we got a (user) address, examine the resource struct there */
if (regnum < 0)
{
static int buf[3];
read_memory (regnum, buf, sizeof buf);
printf_filtered ("%08x %08x%08x%s\n", regnum, buf[1], buf[2],
buf[0] & 0xff ? " locked" : "");
return;
}
}
ps.pi_buffer = (char *) &comm_registers;
ps.pi_nbytes = sizeof comm_registers;
ps.pi_offset = 0;
ps.pi_thread = inferior_thread;
ioctl (inferior_fd, PIXRDCREGS, &ps);
for (i = 0; i < 64; i++)
if (!arg || i == regnum)
printf_filtered ("%2d 0x8%03x %016llx%s\n", i, i,
comm_registers.crreg.r4[i],
(iscrlbit (comm_registers.crctl.lbits.cc, i)
? " locked" : ""));
}
/* Print the psw */
static void
psw_info (arg)
char *arg;
{
struct pswbit
{
int bit;
int pos;
char *text;
};
static struct pswbit pswbit[] =
{
{ 0x80000000, -1, "A carry" },
{ 0x40000000, -1, "A integer overflow" },
{ 0x20000000, -1, "A zero divide" },
{ 0x10000000, -1, "Integer overflow enable" },
{ 0x08000000, -1, "Trace" },
{ 0x06000000, 25, "Frame length" },
{ 0x01000000, -1, "Sequential" },
{ 0x00800000, -1, "S carry" },
{ 0x00400000, -1, "S integer overflow" },
{ 0x00200000, -1, "S zero divide" },
{ 0x00100000, -1, "Zero divide enable" },
{ 0x00080000, -1, "Floating underflow" },
{ 0x00040000, -1, "Floating overflow" },
{ 0x00020000, -1, "Floating reserved operand" },
{ 0x00010000, -1, "Floating zero divide" },
{ 0x00008000, -1, "Floating error enable" },
{ 0x00004000, -1, "Floating underflow enable" },
{ 0x00002000, -1, "IEEE" },
{ 0x00001000, -1, "Sequential stores" },
{ 0x00000800, -1, "Intrinsic error" },
{ 0x00000400, -1, "Intrinsic error enable" },
{ 0x00000200, -1, "Trace thread creates" },
{ 0x00000100, -1, "Thread init trap" },
{ 0x000000e0, 5, "Reserved" },
{ 0x0000001f, 0, "Intrinsic error code" },
{0, 0, 0},
};
long psw;
struct pswbit *p;
if (arg)
psw = parse_and_eval_address (arg);
else
psw = read_register (PS_REGNUM);
for (p = pswbit; p->bit; p++)
{
if (p->pos < 0)
printf_filtered ("%08x %s %s\n", p->bit,
(psw & p->bit) ? "yes" : "no ", p->text);
else
printf_filtered ("%08x %3d %s\n", p->bit,
(psw & p->bit) >> p->pos, p->text);
}
}
_initialize_convex_dep ()
{
add_com ("alias", class_support, alias_command,
"Add a new name for an existing command.");
add_cmd ("base", class_vars, set_base_command,
"Change the integer output radix to 8, 10 or 16\n\
or use just `set base' with no args to return to the ad-hoc default,\n\
which is 16 for integers that look like addresses, 10 otherwise.",
&setlist);
add_cmd ("pipeline", class_run, set_pipelining_command,
"Enable or disable overlapped execution of instructions.\n\
With `set pipe off', exceptions are reported with\n\
$pc pointing at the instruction after the faulting one.\n\
The default is `set pipe on', which runs faster.",
&setlist);
add_cmd ("parallel", class_run, set_parallel_command,
"Enable or disable multi-threaded execution of parallel code.\n\
`set parallel off' means run the program on a single CPU.\n\
`set parallel fixed' means run the program with all CPUs assigned to it.\n\
`set parallel on' means run the program on any CPUs that are available.",
&setlist);
add_com ("1cont", class_run, one_cont_command,
"Continue the program, activating only the current thread.\n\
Args are the same as the `cont' command.");
add_com ("thread", class_run, set_thread_command,
"Change the current thread, the one under scrutiny and control.\n\
With no arg, show the active threads, the current one marked with *.");
add_info ("threads", thread_info,
"List status of active threads.");
add_info ("comm-registers", comm_registers_info,
"List communication registers and their contents.\n\
A communication register name as argument means describe only that register.\n\
An address as argument means describe the resource structure at that address.\n\
`Locked' means that the register has been sent to but not yet received from.");
add_info ("psw", psw_info,
"Display $ps, the processor status word, bit by bit.\n\
An argument means display that value's interpretation as a psw.");
add_cmd ("convex", no_class, 0, "Convex-specific commands.\n\
32-bit registers $pc $ps $sp $ap $fp $a1-5 $s0-7 $v0-7 $vl $vs $vm $c0-63\n\
64-bit registers $S0-7 $V0-7 $C0-63\n\
\n\
info threads display info on stopped threads waiting to signal\n\
thread display list of active threads\n\
thread N select thread N (its registers, stack, memory, etc.)\n\
step, next, etc step selected thread only\n\
1cont continue selected thread only\n\
cont continue all threads\n\
info comm-registers display contents of comm register(s) or a resource struct\n\
info psw display processor status word $ps\n\
set base N change integer radix used by `print' without a format\n\
set pipeline off exceptions are precise, $pc points after the faulting insn\n\
set pipeline on normal mode, $pc is somewhere ahead of faulting insn\n\
set parallel off program runs on a single CPU\n\
set parallel fixed all CPUs are assigned to the program\n\
set parallel on normal mode, parallel execution on random available CPUs\n\
",
&cmdlist);
}

983
gdb/convex-xdep.c Normal file
View file

@ -0,0 +1,983 @@
/* Convex stuff for GDB.
Copyright (C) 1990-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 <stdio.h>
#include "defs.h"
#include "param.h"
#include "command.h"
#include "symtab.h"
#include "value.h"
#include "frame.h"
#include "inferior.h"
#include "wait.h"
#include <signal.h>
#include <fcntl.h>
#include "gdbcore.h"
#include <sys/param.h>
#include <sys/dir.h>
#include <sys/user.h>
#include <sys/ioctl.h>
#include <sys/pcntl.h>
#include <sys/thread.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <convex/vmparam.h>
#include <convex/filehdr.h>
#include <convex/opthdr.h>
#include <convex/scnhdr.h>
#include <convex/core.h>
/* Per-thread data, read from the inferior at each stop and written
back at each resume. */
/* Number of active threads.
Tables are valid for thread numbers less than this. */
static int n_threads;
#define MAXTHREADS 8
/* Thread state. The remaining data is valid only if this is PI_TALIVE. */
static int thread_state[MAXTHREADS];
/* Stop pc, signal, signal subcode */
static int thread_pc[MAXTHREADS];
static int thread_signal[MAXTHREADS];
static int thread_sigcode[MAXTHREADS];
/* Thread registers.
If thread is selected, the regs are in registers[] instead. */
static char thread_regs[MAXTHREADS][REGISTER_BYTES];
/* 1 if the top frame on the thread's stack was a context frame,
meaning that the kernel is up to something and we should not
touch the thread at all except to resume it. */
static char thread_is_in_kernel[MAXTHREADS];
/* The currently selected thread's number. */
static int inferior_thread;
/* Inferior process's file handle and a process control block
to feed args to ioctl with. */
static int inferior_fd;
static struct pcntl ps;
/* SOFF file headers for exec or core file. */
static FILEHDR filehdr;
static OPTHDR opthdr;
static SCNHDR scnhdr;
/* Address maps constructed from section headers of exec and core files.
Defines process address -> file address translation. */
struct pmap
{
long mem_addr; /* process start address */
long mem_end; /* process end+1 address */
long file_addr; /* file start address */
long thread; /* -1 shared; 0,1,... thread-local */
long type; /* S_TEXT S_DATA S_BSS S_TBSS etc */
long which; /* used to sort map for info files */
};
static int n_exec, n_core;
static struct pmap exec_map[100];
static struct pmap core_map[100];
/* Offsets in the core file of core_context and core_tcontext blocks. */
static int context_offset;
static int tcontext_offset[MAXTHREADS];
/* Core file control blocks. */
static struct core_context_v70 c;
static struct core_tcontext_v70 tc;
static struct user u;
static thread_t th;
static proc_t pr;
/* The registers of the currently selected thread. */
extern char registers[REGISTER_BYTES];
/* Vector and communication registers from core dump or from inferior.
These are read on demand, ie, not normally valid. */
static struct vecst vector_registers;
static struct creg_ctx comm_registers;
/* Flag, set on a vanilla CONT command and cleared when the inferior
is continued. */
static int all_continue;
/* Flag, set when the inferior is continued by a vanilla CONT command,
cleared if it is continued for any other purpose. */
static int thread_switch_ok;
/* Stack of signals recieved from threads but not yet delivered to gdb. */
struct threadpid
{
int pid;
int thread;
int signo;
int subsig;
int pc;
};
static struct threadpid signal_stack_bot[100];
static struct threadpid *signal_stack = signal_stack_bot;
/* How to detect empty stack -- bottom frame is all zero. */
#define signal_stack_is_empty() (signal_stack->pid == 0)
/* Mode controlled by SET PIPE command, controls the psw SEQ bit
which forces each instruction to complete before the next one starts. */
static int sequential = 0;
/* Mode controlled by the SET PARALLEL command. Values are:
0 concurrency limit 1 thread, dynamic scheduling
1 no concurrency limit, dynamic scheduling
2 no concurrency limit, fixed scheduling */
static int parallel = 1;
/* Mode controlled by SET BASE command, output radix for unformatted
integer typeout, as in argument lists, aggregates, and so on.
Zero means guess whether it's an address (hex) or not (decimal). */
static int output_radix = 0;
/* Signal subcode at last thread stop. */
static int stop_sigcode;
/* Hack, see wait() below. */
static int exec_trap_timer;
#include "gdbcmd.h"
/* Nonzero if we are debugging an attached outside process
rather than an inferior. */
extern int attach_flag;
static struct type *vector_type ();
static long *read_vector_register ();
static long *read_vector_register_1 ();
static void write_vector_register ();
static REGISTER_TYPE read_comm_register ();
static void write_comm_register ();
static void convex_cont_command ();
static void thread_continue ();
static void select_thread ();
static void scan_stack ();
static void set_fixed_scheduling ();
static char *subsig_name ();
static void psw_info ();
static sig_noop ();
static ptr_cmp ();
extern char *sys_siglist[];
/* Execute ptrace. Convex V7 replaced ptrace with pattach.
Allow ptrace (0) as a no-op. */
int
call_ptrace (request, pid, procaddr, buf)
int request, pid, procaddr, buf;
{
if (request == 0)
return;
error ("no ptrace");
}
/* Replacement for system execle routine.
Convert it to an equivalent exect, which pattach insists on. */
execle (name, argv)
char *name, *argv;
{
char ***envp = (char ***) &argv;
while (*envp++) ;
signal (SIGTRAP, sig_noop);
exect (name, &argv, *envp);
}
/* Stupid handler for stupid trace trap that otherwise causes
startup to stupidly hang. */
static sig_noop ()
{}
/* Read registers from inferior into registers[] array.
For convex, they are already there, read in when the inferior stops. */
void
fetch_inferior_registers (regno)
int regno;
{
}
/* Store our register values back into the inferior.
For Convex, do this only once, right before resuming inferior. */
store_inferior_registers (regno)
int regno;
{
}
/* Copy LEN bytes from inferior's memory starting at MEMADDR
to debugger memory starting at MYADDR.
On failure (cannot read from inferior, usually because address is out
of bounds) returns the value of errno. */
int
read_inferior_memory (memaddr, myaddr, len)
CORE_ADDR memaddr;
char *myaddr;
int len;
{
errno = 0;
while (len > 0)
{
/* little-known undocumented max request size */
int i = (len < 12288) ? len : 12288;
lseek (inferior_fd, memaddr, 0);
read (inferior_fd, myaddr, i);
memaddr += i;
myaddr += i;
len -= i;
}
if (errno)
bzero (myaddr, len);
return errno;
}
/* Copy LEN bytes of data from debugger memory at MYADDR
to inferior's memory at MEMADDR.
Returns errno on failure (cannot write the inferior) */
int
write_inferior_memory (memaddr, myaddr, len)
CORE_ADDR memaddr;
char *myaddr;
int len;
{
errno = 0;
lseek (inferior_fd, memaddr, 0);
write (inferior_fd, myaddr, len);
return errno;
}
/* Here from create_inferior when the inferior process has been created
and started up. We must do a pattach to grab it for debugging.
Also, intercept the CONT command by altering its dispatch address. */
create_inferior_hook (pid)
int pid;
{
static char cont[] = "cont";
static char cont1[] = "c";
char *linep = cont;
char *linep1 = cont1;
char **line = &linep;
char **line1 = &linep1;
struct cmd_list_element *c;
c = lookup_cmd (line, cmdlist, "", 0);
c->function = convex_cont_command;
c = lookup_cmd (line1, cmdlist, "", 0);
c->function = convex_cont_command;
inferior_fd = pattach (pid, O_EXCL);
if (inferior_fd < 0)
perror_with_name ("pattach");
inferior_thread = 0;
set_fixed_scheduling (pid, parallel == 2);
}
/* Attach process PID for debugging. */
attach (pid)
int pid;
{
int fd = pattach (pid, O_EXCL);
if (fd < 0)
perror_with_name ("pattach");
attach_flag = 1;
/* wait for strange kernel reverberations to go away */
sleep (1);
setpgrp (pid, pid);
inferior_fd = fd;
inferior_thread = 0;
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;
{
signal_stack = signal_stack_bot;
thread_continue (-1, 0, signal);
ioctl (inferior_fd, PIXDETACH, &ps);
close (inferior_fd);
inferior_fd = 0;
attach_flag = 0;
}
/* Kill off the inferior process. */
kill_inferior ()
{
if (inferior_pid == 0)
return;
ioctl (inferior_fd, PIXTERMINATE, 0);
wait (0);
target_mourn_inferior ();
}
/* This is used when GDB is exiting. It gives less chance of error.*/
kill_inferior_fast ()
{
if (inferior_pid == 0)
return;
ioctl (inferior_fd, PIXTERMINATE, 0);
wait (0);
}
/* Read vector register REG, and return a pointer to the value. */
static long *
read_vector_register (reg)
int reg;
{
if (have_inferior_p ())
{
errno = 0;
ps.pi_buffer = (char *) &vector_registers;
ps.pi_nbytes = sizeof vector_registers;
ps.pi_offset = 0;
ps.pi_thread = inferior_thread;
ioctl (inferior_fd, PIXRDVREGS, &ps);
if (errno)
bzero (&vector_registers, sizeof vector_registers);
}
else if (corechan >= 0)
{
lseek (corechan, tcontext_offset[inferior_thread], 0);
if (myread (corechan, &tc, sizeof tc) < 0)
perror_with_name (corefile);
lseek (corechan, tc.core_thread_p, 0);
if (myread (corechan, &th, sizeof th) < 0)
perror_with_name (corefile);
lseek (corechan, tc.core_vregs_p, 0);
if (myread (corechan, &vector_registers, 16*128) < 0)
perror_with_name (corefile);
vector_registers.vm[0] = th.t_vect_ctx.vc_vm[0];
vector_registers.vm[1] = th.t_vect_ctx.vc_vm[1];
vector_registers.vls = th.t_vect_ctx.vc_vls;
}
return read_vector_register_1 (reg);
}
/* Return a pointer to vector register REG, which must already have been
fetched from the inferior or core file. */
static long *
read_vector_register_1 (reg)
int reg;
{
switch (reg)
{
case VM_REGNUM:
return (long *) vector_registers.vm;
case VS_REGNUM:
return (long *) &vector_registers.vls;
case VL_REGNUM:
return 1 + (long *) &vector_registers.vls;
default:
return (long *) &vector_registers.vr[reg];
}
}
/* Write vector register REG, element ELEMENT, new value VAL.
NB: must use read-modify-write on the entire vector state,
since pattach does not do offsetted writes correctly. */
static void
write_vector_register (reg, element, val)
int reg, element;
REGISTER_TYPE val;
{
if (have_inferior_p ())
{
errno = 0;
ps.pi_thread = inferior_thread;
ps.pi_offset = 0;
ps.pi_buffer = (char *) &vector_registers;
ps.pi_nbytes = sizeof vector_registers;
ioctl (inferior_fd, PIXRDVREGS, &ps);
switch (reg)
{
case VL_REGNUM:
vector_registers.vls =
(vector_registers.vls & 0xffffffff00000000LL)
+ (unsigned long) val;
break;
case VS_REGNUM:
vector_registers.vls =
(val << 32) + (unsigned long) vector_registers.vls;
break;
default:
vector_registers.vr[reg].el[element] = val;
break;
}
ioctl (inferior_fd, PIXWRVREGS, &ps);
if (errno)
perror_with_name ("writing vector register");
}
}
/* Return the contents of communication register NUM. */
static REGISTER_TYPE
read_comm_register (num)
int num;
{
if (have_inferior_p ())
{
ps.pi_buffer = (char *) &comm_registers;
ps.pi_nbytes = sizeof comm_registers;
ps.pi_offset = 0;
ps.pi_thread = inferior_thread;
ioctl (inferior_fd, PIXRDCREGS, &ps);
}
return comm_registers.crreg.r4[num];
}
/* Store a new value VAL into communication register NUM.
NB: Must use read-modify-write on the whole comm register set
since pattach does not do offsetted writes correctly. */
static void
write_comm_register (num, val)
int num;
REGISTER_TYPE val;
{
if (have_inferior_p ())
{
ps.pi_buffer = (char *) &comm_registers;
ps.pi_nbytes = sizeof comm_registers;
ps.pi_offset = 0;
ps.pi_thread = inferior_thread;
ioctl (inferior_fd, PIXRDCREGS, &ps);
comm_registers.crreg.r4[num] = val;
ioctl (inferior_fd, PIXWRCREGS, &ps);
}
}
/* Resume execution of the inferior process.
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
void
resume (step, signal)
int step;
int signal;
{
errno = 0;
if (step || signal)
thread_continue (inferior_thread, step, signal);
else
thread_continue (-1, 0, 0);
}
/* Maybe resume some threads.
THREAD is which thread to resume, or -1 to resume them all.
STEP and SIGNAL are as in resume.
Global variable ALL_CONTINUE is set when we are here to do a
`cont' command; otherwise we may be doing `finish' or a call or
something else that will not tolerate an automatic thread switch.
If there are stopped threads waiting to deliver signals, and
ALL_CONTINUE, do not actually resume anything. gdb will do a wait
and see one of the stopped threads in the queue. */
static void
thread_continue (thread, step, signal)
int thread, step, signal;
{
int n;
/* If we are to continue all threads, but not for the CONTINUE command,
pay no attention and continue only the selected thread. */
if (thread < 0 && ! all_continue)
thread = inferior_thread;
/* If we are not stepping, we have now executed the continue part
of a CONTINUE command. */
if (! step)
all_continue = 0;
/* Allow wait() to switch threads if this is an all-out continue. */
thread_switch_ok = thread < 0;
/* If there are threads queued up, don't resume. */
if (thread_switch_ok && ! signal_stack_is_empty ())
return;
/* OK, do it. */
for (n = 0; n < n_threads; n++)
if (thread_state[n] == PI_TALIVE)
{
select_thread (n);
if ((thread < 0 || n == thread) && ! thread_is_in_kernel[n])
{
/* Blam the trace bits in the stack's saved psws to match
the desired step mode. This is required so that
single-stepping a return doesn't restore a psw with a
clear trace bit and fly away, and conversely,
proceeding through a return in a routine that was
stepped into doesn't cause a phantom break by restoring
a psw with the trace bit set. */
scan_stack (PSW_T_BIT, step);
scan_stack (PSW_S_BIT, sequential);
}
ps.pi_buffer = registers;
ps.pi_nbytes = REGISTER_BYTES;
ps.pi_offset = 0;
ps.pi_thread = n;
if (! thread_is_in_kernel[n])
if (ioctl (inferior_fd, PIXWRREGS, &ps))
perror_with_name ("PIXWRREGS");
if (thread < 0 || n == thread)
{
ps.pi_pc = 1;
ps.pi_signo = signal;
if (ioctl (inferior_fd, step ? PIXSTEP : PIXCONTINUE, &ps) < 0)
perror_with_name ("PIXCONTINUE");
}
}
if (ioctl (inferior_fd, PIXRUN, &ps) < 0)
perror_with_name ("PIXRUN");
}
/* Replacement for system wait routine.
The system wait returns with one or more threads stopped by
signals. Put stopped threads on a stack and return them one by
one, so that it appears that wait returns one thread at a time.
Global variable THREAD_SWITCH_OK is set when gdb can tolerate wait
returning a new thread. If it is false, then only one thread is
running; we will do a real wait, the thread will do something, and
we will return that. */
pid_t
wait (w)
union wait *w;
{
int pid;
if (!w)
return wait3 (0, 0, 0);
/* Do a real wait if we were told to, or if there are no queued threads. */
if (! thread_switch_ok || signal_stack_is_empty ())
{
int thread;
pid = wait3 (w, 0, 0);
if (!WIFSTOPPED (*w) || pid != inferior_pid)
return pid;
/* The inferior has done something and stopped. Read in all the
threads' registers, and queue up any signals that happened. */
if (ioctl (inferior_fd, PIXGETTHCOUNT, &ps) < 0)
perror_with_name ("PIXGETTHCOUNT");
n_threads = ps.pi_othdcnt;
for (thread = 0; thread < n_threads; thread++)
{
ps.pi_thread = thread;
if (ioctl (inferior_fd, PIXGETSUBCODE, &ps) < 0)
perror_with_name ("PIXGETSUBCODE");
thread_state[thread] = ps.pi_otstate;
if (ps.pi_otstate == PI_TALIVE)
{
select_thread (thread);
ps.pi_buffer = registers;
ps.pi_nbytes = REGISTER_BYTES;
ps.pi_offset = 0;
ps.pi_thread = thread;
if (ioctl (inferior_fd, PIXRDREGS, &ps) < 0)
perror_with_name ("PIXRDREGS");
registers_fetched ();
thread_pc[thread] = read_pc ();
thread_signal[thread] = ps.pi_osigno;
thread_sigcode[thread] = ps.pi_osigcode;
/* If the thread's stack has a context frame
on top, something fucked is going on. I do not
know what, but do I know this: the only thing you
can do with such a thread is continue it. */
thread_is_in_kernel[thread] =
((read_register (PS_REGNUM) >> 25) & 3) == 0;
/* Signals push an extended frame and then fault
with a ridiculous pc. Pop the frame. */
if (thread_pc[thread] > STACK_END_ADDR)
{
POP_FRAME;
if (is_break_pc (thread_pc[thread]))
thread_pc[thread] = read_pc () - 2;
else
thread_pc[thread] = read_pc ();
write_register (PC_REGNUM, thread_pc[thread]);
}
if (ps.pi_osigno || ps.pi_osigcode)
{
signal_stack++;
signal_stack->pid = pid;
signal_stack->thread = thread;
signal_stack->signo = thread_signal[thread];
signal_stack->subsig = thread_sigcode[thread];
signal_stack->pc = thread_pc[thread];
}
/* The following hackery is caused by a unix 7.1 feature:
the inferior's fixed scheduling mode is cleared when
it execs the shell (since the shell is not a parallel
program). So, note the 5.4 trap we get when
the shell does its exec, then catch the 5.0 trap
that occurs when the debuggee starts, and set fixed
scheduling mode properly. */
if (ps.pi_osigno == 5 && ps.pi_osigcode == 4)
exec_trap_timer = 1;
else
exec_trap_timer--;
if (ps.pi_osigno == 5 && exec_trap_timer == 0)
set_fixed_scheduling (pid, parallel == 2);
}
}
if (signal_stack_is_empty ())
error ("no active threads?!");
}
/* Select the thread that stopped, and return *w saying why. */
select_thread (signal_stack->thread);
stop_signal = signal_stack->signo;
stop_sigcode = signal_stack->subsig;
WSETSTOP (*w, signal_stack->signo);
w->w_thread = signal_stack->thread;
return (signal_stack--)->pid;
}
/* Select thread THREAD -- its registers, stack, per-thread memory.
This is the only routine that may assign to inferior_thread
or thread_regs[]. */
static void
select_thread (thread)
int thread;
{
if (thread == inferior_thread)
return;
bcopy (registers, thread_regs[inferior_thread], REGISTER_BYTES);
ps.pi_thread = inferior_thread = thread;
if (have_inferior_p ())
ioctl (inferior_fd, PISETRWTID, &ps);
bcopy (thread_regs[thread], registers, REGISTER_BYTES);
}
/* Routine to set or clear a psw bit in the psw and also all psws
saved on the stack. Quits when we get to a frame in which the
saved psw is correct. */
static void
scan_stack (bit, val)
long bit, val;
{
long ps = read_register (PS_REGNUM);
long fp;
if (val ? !(ps & bit) : (ps & bit))
{
ps ^= bit;
write_register (PS_REGNUM, ps);
fp = read_register (FP_REGNUM);
while (fp & 0x80000000)
{
ps = read_memory_integer (fp + 4, 4);
if (val ? (ps & bit) : !(ps & bit))
break;
ps ^= bit;
write_memory (fp + 4, &ps, 4);
fp = read_memory_integer (fp + 8, 4);
}
}
}
/* Set fixed scheduling (alliant mode) of process PID to ARG (0 or 1). */
static void
set_fixed_scheduling (pid, arg)
int arg;
{
struct pattributes pattr;
getpattr (pid, &pattr);
pattr.pattr_pfixed = arg;
setpattr (pid, &pattr);
}
void
core_file_command (filename, from_tty)
char *filename;
int from_tty;
{
int n;
/* 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;
n_core = 0;
/* 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);
if (myread (corechan, &filehdr, sizeof filehdr) < 0)
perror_with_name (filename);
if (!IS_CORE_SOFF_MAGIC (filehdr.h_magic))
error ("%s: not a core file.\n", filename);
if (myread (corechan, &opthdr, filehdr.h_opthdr) < 0)
perror_with_name (filename);
/* Read through the section headers.
For text, data, etc, record an entry in the core file map.
For context and tcontext, record the file address of
the context blocks. */
lseek (corechan, (long) filehdr.h_scnptr, 0);
n_threads = 0;
for (n = 0; n < filehdr.h_nscns; n++)
{
if (myread (corechan, &scnhdr, sizeof scnhdr) < 0)
perror_with_name (filename);
if ((scnhdr.s_flags & S_TYPMASK) >= S_TEXT
&& (scnhdr.s_flags & S_TYPMASK) <= S_COMON)
{
core_map[n_core].mem_addr = scnhdr.s_vaddr;
core_map[n_core].mem_end = scnhdr.s_vaddr + scnhdr.s_size;
core_map[n_core].file_addr = scnhdr.s_scnptr;
core_map[n_core].type = scnhdr.s_flags & S_TYPMASK;
if (core_map[n_core].type != S_TBSS
&& core_map[n_core].type != S_TDATA
&& core_map[n_core].type != S_TTEXT)
core_map[n_core].thread = -1;
else if (n_core == 0
|| core_map[n_core-1].mem_addr != scnhdr.s_vaddr)
core_map[n_core].thread = 0;
else
core_map[n_core].thread = core_map[n_core-1].thread + 1;
n_core++;
}
else if ((scnhdr.s_flags & S_TYPMASK) == S_CONTEXT)
context_offset = scnhdr.s_scnptr;
else if ((scnhdr.s_flags & S_TYPMASK) == S_TCONTEXT)
tcontext_offset[n_threads++] = scnhdr.s_scnptr;
}
/* Read the context block, struct user, struct proc,
and the comm regs. */
lseek (corechan, context_offset, 0);
if (myread (corechan, &c, sizeof c) < 0)
perror_with_name (filename);
lseek (corechan, c.core_user_p, 0);
if (myread (corechan, &u, sizeof u) < 0)
perror_with_name (filename);
lseek (corechan, c.core_proc_p, 0);
if (myread (corechan, &pr, sizeof pr) < 0)
perror_with_name (filename);
comm_registers = pr.p_creg;
/* Core file apparently is really there. Make it really exist
for xfer_core_file so we can do read_memory on it. */
if (filename[0] == '/')
corefile = savestring (filename, strlen (filename));
else
corefile = concat (current_directory, "/", filename);
printf_filtered ("Program %s ", u.u_comm);
/* Read the thread registers and fill in the thread_xxx[] data. */
for (n = 0; n < n_threads; n++)
{
select_thread (n);
lseek (corechan, tcontext_offset[n], 0);
if (myread (corechan, &tc, sizeof tc) < 0)
perror_with_name (corefile);
lseek (corechan, tc.core_thread_p, 0);
if (myread (corechan, &th, sizeof th) < 0)
perror_with_name (corefile);
lseek (corechan, tc.core_syscall_context_p, 0);
if (myread (corechan, registers, REGISTER_BYTES) < 0)
perror_with_name (corefile);
thread_signal[n] = th.t_cursig;
thread_sigcode[n] = th.t_code;
thread_state[n] = th.t_state;
thread_pc[n] = read_pc ();
if (thread_pc[n] > STACK_END_ADDR)
{
POP_FRAME;
if (is_break_pc (thread_pc[n]))
thread_pc[n] = read_pc () - 2;
else
thread_pc[n] = read_pc ();
write_register (PC_REGNUM, thread_pc[n]);
}
printf_filtered ("thread %d received signal %d, %s\n",
n, thread_signal[n],
thread_signal[n] < NSIG
? sys_siglist[thread_signal[n]]
: "(undocumented)");
}
/* Select an interesting thread -- also-rans died with SIGKILL,
so find one that didn't. */
for (n = 0; n < n_threads; n++)
if (thread_signal[n] != 0 && thread_signal[n] != SIGKILL)
{
select_thread (n);
stop_signal = thread_signal[n];
stop_sigcode = thread_sigcode[n];
break;
}
core_aouthdr.a_magic = 0;
flush_cached_frames ();
set_current_frame (create_new_frame (read_register (FP_REGNUM),
read_pc ()));
select_frame (get_current_frame (), 0);
validate_files ();
print_sel_frame (1);
}
else if (from_tty)
printf_filtered ("No core file now.\n");
}

447
gdb/core.c Normal file
View file

@ -0,0 +1,447 @@
/* Work with core dump and executable files, for GDB.
Copyright (C) 1986, 1987, 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 <stdio.h>
#include <errno.h>
#include <signal.h>
#include "defs.h"
#include "param.h"
#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "symtab.h"
#include "command.h"
#include "bfd.h"
#include "target.h"
#include "gdbcore.h"
extern int xfer_memory ();
extern void child_attach (), child_create_inferior ();
extern int sys_nerr;
extern char *sys_errlist[];
extern char *sys_siglist[];
extern char registers[];
/* Hook for `exec_file_command' command to call. */
void (*exec_file_display_hook) () = NULL;
struct section_table *core_sections, *core_sections_end;
/* Binary file diddling handle for the core file. */
bfd *core_bfd = NULL;
/* Forward decl */
extern struct target_ops core_ops;
/* Discard all vestiges of any previous core file
and mark data and stack spaces as empty. */
void
core_close (quitting)
int quitting;
{
if (core_bfd) {
free (bfd_get_filename (core_bfd));
bfd_close (core_bfd);
core_bfd = NULL;
}
}
/* This routine opens and sets up the core file bfd */
void
core_open (filename, from_tty)
char *filename;
int from_tty;
{
char *p;
int siggy;
struct cleanup *old_chain;
char *temp;
bfd *temp_bfd;
int ontop;
if (!filename)
{
error (core_bfd?
"No core file specified. (Use `detach' to stop debugging a core file.)"
: "No core file specified.");
}
filename = tilde_expand (filename);
if (filename[0] != '/') {
temp = concat (current_directory, "/", filename);
free (filename);
filename = temp;
}
old_chain = make_cleanup (free, filename);
temp_bfd = bfd_openr (filename, NULL);
if (temp_bfd == NULL)
{
perror_with_name (filename);
}
if (!bfd_check_format (temp_bfd, bfd_core))
{
bfd_close (temp_bfd);
error ("\"%s\" does not appear to be a core dump", filename);
}
/* Looks semi-reasonable. Toss the old core file and work on the new. */
discard_cleanups (old_chain); /* Don't free filename any more */
unpush_target (&core_ops);
core_bfd = temp_bfd;
old_chain = make_cleanup (core_close, core_bfd);
validate_files ();
/* Find the data section */
if (build_section_table (core_bfd, &core_sections, &core_sections_end))
error ("Can't find sections in `%s': %s", bfd_get_filename(core_bfd),
bfd_errmsg (bfd_error));
ontop = !push_target (&core_ops);
p = bfd_core_file_failing_command (core_bfd);
if (p)
printf ("Core file invoked as `%s'.\n", p);
siggy = bfd_core_file_failing_signal (core_bfd);
if (siggy > 0)
printf ("Program terminated with signal %d, %s.\n", siggy,
siggy < NSIG ? sys_siglist[siggy] : "(undocumented)");
if (ontop) {
/* Fetch all registers from core file */
target_fetch_registers (-1);
set_current_frame ( create_new_frame (read_register (FP_REGNUM),
read_pc ()));
select_frame (get_current_frame (), 0);
/* FIXME, handle shared library reading here. */
print_sel_frame (0); /* Print the top frame and source line */
} else {
printf (
"Warning: you won't be able to access this core file until you terminate\n\
your %s; do ``info files''\n", current_target->to_longname);
}
discard_cleanups (old_chain);
}
void
core_detach (args, from_tty)
char *args;
int from_tty;
{
dont_repeat ();
if (args)
error ("Too many arguments");
pop_target ();
if (from_tty)
printf ("No core file now.\n");
}
/* Backward compatability with old way of specifying core files. */
void
core_file_command (filename, from_tty)
char *filename;
int from_tty;
{
if (!filename)
core_detach (filename, from_tty);
else
core_open (filename, from_tty);
}
/* Call this to specify the hook for exec_file_command to call back.
This is called from the x-window display code. */
void
specify_exec_file_hook (hook)
void (*hook) ();
{
exec_file_display_hook = hook;
}
/* The exec file must be closed before running an inferior.
If it is needed again after the inferior dies, it must
be reopened. */
void
close_exec_file ()
{
#ifdef FIXME
if (exec_bfd)
bfd_tempclose (exec_bfd);
#endif
}
void
reopen_exec_file ()
{
#ifdef FIXME
if (exec_bfd)
bfd_reopen (exec_bfd);
#endif
}
/* If we have both a core file and an exec file,
print a warning if they don't go together.
This should really check that the core file came
from that exec file, but I don't know how to do it. */
void
validate_files ()
{
if (exec_bfd && core_bfd)
{
if (core_file_matches_executable_p (core_bfd, exec_bfd))
printf ("Warning: core file does not match specified executable file.\n");
else if (bfd_get_mtime(exec_bfd) > bfd_get_mtime(core_bfd))
printf ("Warning: exec file is newer than core file.\n");
}
}
/* Return the name of the executable file as a string.
ERR nonzero means get error if there is none specified;
otherwise return 0 in that case. */
char *
get_exec_file (err)
int err;
{
if (exec_bfd) return bfd_get_filename(exec_bfd);
if (!err) return NULL;
error ("No executable file specified.\n\
Use the \"file\" or \"exec-file\" command.");
return NULL;
}
static void
core_files_info ()
{
struct section_table *p;
printf ("\tCore file `%s'.\n", bfd_get_filename(core_bfd));
for (p = core_sections; p < core_sections_end; p++)
printf("\tcore file from 0x%08x to 0x%08x is %s\n",
p->addr, p->endaddr,
bfd_section_name (core_bfd, p->sec_ptr));
}
void
memory_error (status, memaddr)
int status;
CORE_ADDR memaddr;
{
if (status == EIO)
{
/* Actually, address between memaddr and memaddr + len
was out of bounds. */
error ("Cannot access memory: address 0x%x out of bounds.", memaddr);
}
else
{
if (status >= sys_nerr || status < 0)
error ("Error accessing memory address 0x%x: unknown error (%d).",
memaddr, status);
else
error ("Error accessing memory address 0x%x: %s.",
memaddr, sys_errlist[status]);
}
}
/* Same as target_read_memory, but report an error if can't read. */
void
read_memory (memaddr, myaddr, len)
CORE_ADDR memaddr;
char *myaddr;
int len;
{
int status;
status = target_read_memory (memaddr, myaddr, len);
if (status != 0)
memory_error (status, memaddr);
}
/* Same as target_write_memory, but report an error if can't write. */
void
write_memory (memaddr, myaddr, len)
CORE_ADDR memaddr;
char *myaddr;
int len;
{
int status;
status = target_write_memory (memaddr, myaddr, len);
if (status != 0)
memory_error (status, memaddr);
}
/* Read an integer from debugged memory, given address and number of bytes. */
long
read_memory_integer (memaddr, len)
CORE_ADDR memaddr;
int len;
{
char cbuf;
short sbuf;
int ibuf;
long lbuf;
if (len == sizeof (char))
{
read_memory (memaddr, &cbuf, len);
return cbuf;
}
if (len == sizeof (short))
{
read_memory (memaddr, (char *)&sbuf, len);
SWAP_TARGET_AND_HOST (&sbuf, sizeof (short));
return sbuf;
}
if (len == sizeof (int))
{
read_memory (memaddr, (char *)&ibuf, len);
SWAP_TARGET_AND_HOST (&ibuf, sizeof (int));
return ibuf;
}
if (len == sizeof (lbuf))
{
read_memory (memaddr, (char *)&lbuf, len);
SWAP_TARGET_AND_HOST (&lbuf, sizeof (lbuf));
return lbuf;
}
error ("Cannot handle integers of %d bytes.", len);
return -1; /* for lint */
}
/* Read or write the core file.
Args are address within core file, address within gdb address-space,
length, and a flag indicating whether to read or write.
Result is a length:
0: We cannot handle this address and length.
> 0: We have handled N bytes starting at this address.
(If N == length, we did it all.) We might be able
to handle more bytes beyond this length, but no
promises.
< 0: We cannot handle this address, but if somebody
else handles (-N) bytes, we can start from there.
The actual work is done by xfer_memory in exec.c, which we share
in common with exec_xfer_memory(). */
static int
core_xfer_memory (memaddr, myaddr, len, write)
CORE_ADDR memaddr;
char *myaddr;
int len;
int write;
{
return xfer_memory (memaddr, myaddr, len, write,
core_bfd, core_sections, core_sections_end);
}
/* Get the registers out of a core file. This is the machine-
independent part. Fetch_core_registers is the machine-dependent
part, typically implemented in the xm-file for each architecture. */
static int
get_core_registers (regno)
int regno;
{
sec_ptr reg_sec;
unsigned size;
char *the_regs;
reg_sec = bfd_get_section_by_name (core_bfd, ".reg");
size = bfd_section_size (core_bfd, reg_sec);
the_regs = alloca (size);
if (bfd_get_section_contents (core_bfd, reg_sec, the_regs,
(unsigned)0, size))
{
fetch_core_registers (the_regs, size, 0);
}
else
{
fprintf (stderr, "Couldn't fetch registers from core file: %s\n",
bfd_errmsg (bfd_error));
}
/* Now do it again for the float registers, if they exist. */
reg_sec = bfd_get_section_by_name (core_bfd, ".reg2");
if (reg_sec) {
size = bfd_section_size (core_bfd, reg_sec);
the_regs = alloca (size);
if (bfd_get_section_contents (core_bfd, reg_sec, the_regs,
(unsigned)0, size))
{
fetch_core_registers (the_regs, size, 2);
}
else
{
fprintf (stderr, "Couldn't fetch register set 2 from core file: %s\n",
bfd_errmsg (bfd_error));
}
}
registers_fetched();
return 0; /* FIXME, what result goes here? */
}
struct target_ops core_ops = {
"core", "Local core dump file",
core_open, core_close,
child_attach, core_detach, 0, 0, /* resume, wait */
get_core_registers,
0, 0, 0, 0, /* store_regs, prepare_to_store, conv_to, conv_from */
core_xfer_memory, core_files_info,
0, 0, /* core_insert_breakpoint, core_remove_breakpoint, */
0, 0, 0, 0, 0, /* terminal stuff */
0, 0, 0, 0, 0, /* kill, load, add_syms, call fn, lookup sym */
child_create_inferior, 0, /* mourn_inferior */
core_stratum, 0, /* next */
0, 1, 1, 1, 0, /* all mem, mem, stack, regs, exec */
OPS_MAGIC, /* Always the last thing */
};
void
_initialize_core()
{
add_com ("core-file", class_files, core_file_command,
"Use FILE as core dump for examining memory and registers.\n\
No arg means have no core file. This command has been superseded by the\n\
`target core' and `detach' commands.");
add_target (&core_ops);
}

86
gdb/coredep.c Normal file
View file

@ -0,0 +1,86 @@
/* Extract registers from a "standard" core file, for GDB.
Copyright (C) 1988-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. */
/* core.c is supposed to be the more machine-independent aspects of this;
this file is more machine-specific. */
#include "defs.h"
#include "param.h"
#include "gdbcore.h"
/* Some of these are needed on various systems, perhaps, to expand
REGISTER_U_ADDR appropriately? */
/* #include <sys/core.h> */
#include <sys/param.h>
#include <sys/dir.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/user.h>
/* Extract the register values out of the core file and store
them where `read_register' will find them. */
void
fetch_core_registers (core_reg_sect, core_reg_size)
char *core_reg_sect;
unsigned core_reg_size;
{
register int regno;
register unsigned int addr;
int bad_reg = -1;
for (regno = 0; regno < NUM_REGS; regno++)
{
addr = register_addr (regno, core_reg_size);
if (addr >= core_reg_size) {
if (bad_reg < 0)
bad_reg = regno;
} else {
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 */

1001
gdb/cplus-dem.c Normal file

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more