GDB-4.12 from ports with support for shlibs but not the kernel.

This is a greatly pared down version of the full gdb-4.12, all the
config stuff has been removed and the supporting libraries have
been stripped to a minimum. This is a 1.1.5 only port, I'll do a
more complete port for 2.0 which will have all the config stuff
and will install the gnu support libraries as system libraries like
we do for readline.

There wasn't much point for 1.1.5 since only gdb would use them so I
went for saving space instead. For 2.0 I'll config all the
other gnu tools to use them as well.
This commit is contained in:
Paul Richards 1994-06-10 13:42:18 +00:00
parent b95c0fbacd
commit ea8c7ac7d0
258 changed files with 164071 additions and 0 deletions

View file

@ -0,0 +1,72 @@
PROG = gdb
BINDIR= /usr/bin
SRCS = main.c blockframe.c breakpoint.c findvar.c stack.c thread.c \
source.c values.c eval.c valops.c valarith.c valprint.c printcmd.c \
symtab.c symfile.c symmisc.c infcmd.c infrun.c command.c utils.c \
expprint.c environ.c gdbtypes.c copying.c i386-tdep.c i386-pinsn.c \
freebsd-solib.c ser-unix.c exec.c fork-child.c infptrace.c inftarg.c \
corelow.c coredep.c freebsd-nat.c remote.c dcache.c remote-utils.c \
mem-break.c target.c putenv.c parse.c language.c buildsym.c \
objfiles.c minsyms.c maint.c demangle.c dbxread.c coffread.c \
elfread.c dwarfread.c mipsread.c stabsread.c core.c c-lang.c \
ch-lang.c m2-lang.c complaints.c typeprint.c c-typeprint.c \
ch-typeprint.c m2-typeprint.c c-valprint.c cp-valprint.c ch-valprint.c \
m2-valprint.c nlmread.c serial.c inflow.c regex.c init.c \
c-exp.tab.c ch-exp.tab.c m2-exp.tab.c version.c i386-dis.c dis-buf.c
c-exp.tab.c: $(.CURDIR)/c-exp.y
yacc -d -p c_ $(.CURDIR)/c-exp.y
sed -e '/extern.*malloc/d' -e '/extern.*realloc/d' -e '/extern.*free/d' \
-e '/include.*malloc.h/d' -e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' < y.tab.c > c-exp.new
rm y.tab.c
mv c-exp.new ./c-exp.tab.c
ch-exp.tab.c: $(.CURDIR)/ch-exp.y
yacc -d -p ch_ $(.CURDIR)/ch-exp.y
sed -e '/extern.*malloc/d' -e '/extern.*realloc/d' -e '/extern.*free/d' \
-e '/include.*malloc.h/d' -e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' < y.tab.c > ch-exp.new
rm y.tab.c
mv ch-exp.new ./ch-exp.tab.c
m2-exp.tab.c: $(.CURDIR)/m2-exp.y
yacc -d -p m2_ $(.CURDIR)/m2-exp.y
sed -e '/extern.*malloc/d' -e '/extern.*realloc/d' -e '/extern.*free/d' \
-e '/include.*malloc.h/d' -e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' < y.tab.c > m2-exp.new
rm y.tab.c
mv m2-exp.new ./m2-exp.tab.c
CFLAGS+= -I$(.CURDIR)/. -I/usr/include/readline -I$(.CURDIR)/../bfd
CFLAGS+= -DTRAD_CORE
LDADD+= -lreadline -ltermcap
.if exists(${.CURDIR}/../libiberty/obj)
LDADD+= -L${.CURDIR}/../libiberty/obj -liberty
DPADD+= ${.CURDIR}/../libiberty/obj/libiberty.a
.else
LDADD+= -L${.CURDIR}/../libiberty/ -liberty
DPADD+= ${.CURDIR}/../libiberty/libiberty.a
.endif
.if exists(${.CURDIR}/../bfd/obj)
LDADD+= -L${.CURDIR}/../bfd/obj -lbfd
DPADD+= ${.CURDIR}/../bfd/obj/libbfd.a
.else
LDADD+= -L${.CURDIR}/../bfd/ -lbfd
DPADD+= ${.CURDIR}/../bfd/libbfd.a
.endif
.if exists(${.CURDIR}/../mmalloc/obj)
LDADD+= -L${.CURDIR}/../mmalloc/obj -lmmalloc
DPADD+= ${.CURDIR}/../mmalloc/obj/libmmalloc.a
.else
LDADD+= -L${.CURDIR}/../mmalloc/ -lmmalloc
DPADD+= ${.CURDIR}/../mmalloc/libmmalloc.a
.endif
.include <bsd.prog.mk>

View file

@ -0,0 +1,371 @@
.\" Copyright (c) 1991 Free Software Foundation
.\" See section COPYING for conditions for redistribution
.\" $Id: gdb.1,v 1.1.1.1 1993/10/30 21:59:13 jkh Exp $
.TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools"
.SH NAME
gdb \- The GNU Debugger
.SH SYNOPSIS
.na
.TP
.B gdb
.RB "[\|" \-help "\|]"
.RB "[\|" \-nx "\|]"
.RB "[\|" \-q "\|]"
.RB "[\|" \-batch "\|]"
.RB "[\|" \-cd=\c
.I dir\c
\|]
.RB "[\|" \-f "\|]"
.RB "[\|" "\-b\ "\c
.IR bps "\|]"
.RB "[\|" "\-tty="\c
.IR dev "\|]"
.RB "[\|" "\-s "\c
.I symfile\c
\&\|]
.RB "[\|" "\-e "\c
.I prog\c
\&\|]
.RB "[\|" "\-se "\c
.I prog\c
\&\|]
.RB "[\|" "\-c "\c
.I core\c
\&\|]
.RB "[\|" "\-x "\c
.I cmds\c
\&\|]
.RB "[\|" "\-d "\c
.I dir\c
\&\|]
.RB "[\|" \c
.I prog\c
.RB "[\|" \c
.IR core \||\| procID\c
\&\|]\&\|]
.ad b
.SH DESCRIPTION
The purpose of a debugger such as GDB is to allow you to see what is
going on ``inside'' another program while it executes\(em\&or what another
program was doing at the moment it crashed.
GDB can do four main kinds of things (plus other things in support of
these) to help you catch bugs in the act:
.TP
\ \ \ \(bu
Start your program, specifying anything that might affect its behavior.
.TP
\ \ \ \(bu
Make your program stop on specified conditions.
.TP
\ \ \ \(bu
Examine what has happened, when your program has stopped.
.TP
\ \ \ \(bu
Change things in your program, so you can experiment with correcting the
effects of one bug and go on to learn about another.
.PP
You can use GDB to debug programs written in C, C++, and Modula-2.
Fortran support will be added when a GNU Fortran compiler is ready.
GDB is invoked with the shell command \c
.B gdb\c
\&. Once started, it reads
commands from the terminal until you tell it to exit with the GDB
command \c
.B quit\c
\&. You can get online help from \c
.B gdb\c
\& itself
by using the command \c
.B help\c
\&.
You can run \c
.B gdb\c
\& with no arguments or options; but the most
usual way to start GDB is with one argument or two, specifying an
executable program as the argument:
.sp
.br
gdb\ program
.br
.sp
You can also start with both an executable program and a core file specified:
.sp
.br
gdb\ program\ core
.br
.sp
You can, instead, specify a process ID as a second argument, if you want
to debug a running process:
.sp
.br
gdb\ program\ 1234
.br
.sp
would attach GDB to process \c
.B 1234\c
\& (unless you also have a file
named `\|\c
.B 1234\c
\&\|'; GDB does check for a core file first).
Here are some of the most frequently needed GDB commands:
.TP
.B break \fR[\|\fIfile\fB:\fR\|]\fIfunction
\&
Set a breakpoint at \c
.I function\c
\& (in \c
.I file\c
\&).
.TP
.B run \fR[\|\fIarglist\fR\|]
Start your program (with \c
.I arglist\c
\&, if specified).
.TP
.B bt
Backtrace: display the program stack.
.TP
.BI print " expr"\c
\&
Display the value of an expression.
.TP
.B c
Continue running your program (after stopping, e.g. at a breakpoint).
.TP
.B next
Execute next program line (after stopping); step \c
.I over\c
\& any
function calls in the line.
.TP
.B step
Execute next program line (after stopping); step \c
.I into\c
\& any
function calls in the line.
.TP
.B help \fR[\|\fIname\fR\|]
Show information about GDB command \c
.I name\c
\&, or general information
about using GDB.
.TP
.B quit
Exit from GDB.
.PP
For full details on GDB, see \c
.I
Using GDB: A Guide to the GNU Source-Level Debugger\c
\&, by Richard M. Stallman and Roland H. Pesch. The same text is available online
as the \c
.B gdb\c
\& entry in the \c
.B info\c
\& program.
.SH OPTIONS
Any arguments other than options specify an executable
file and core file (or process ID); that is, the first argument
encountered with no
associated option flag is equivalent to a `\|\c
.B \-se\c
\&\|' option, and the
second, if any, is equivalent to a `\|\c
.B \-c\c
\&\|' option if it's the name of a file. Many options have
both long and short forms; both are shown here. The long forms are also
recognized if you truncate them, so long as enough of the option is
present to be unambiguous. (If you prefer, you can flag option
arguments with `\|\c
.B +\c
\&\|' rather than `\|\c
.B \-\c
\&\|', though we illustrate the
more usual convention.)
All the options and command line arguments you give are processed
in sequential order. The order makes a difference when the
`\|\c
.B \-x\c
\&\|' option is used.
.TP
.B \-help
.TP
.B \-h
List all options, with brief explanations.
.TP
.BI "\-symbols=" "file"\c
.TP
.BI "\-s " "file"\c
\&
Read symbol table from file \c
.I file\c
\&.
.TP
.BI "\-exec=" "file"\c
.TP
.BI "\-e " "file"\c
\&
Use file \c
.I file\c
\& as the executable file to execute when
appropriate, and for examining pure data in conjunction with a core
dump.
.TP
.BI "\-se=" "file"\c
\&
Read symbol table from file \c
.I file\c
\& and use it as the executable
file.
.TP
.BI "\-core=" "file"\c
.TP
.BI "\-c " "file"\c
\&
Use file \c
.I file\c
\& as a core dump to examine.
.TP
.BI "\-command=" "file"\c
.TP
.BI "\-x " "file"\c
\&
Execute GDB commands from file \c
.I file\c
\&.
.TP
.BI "\-directory=" "directory"\c
.TP
.BI "\-d " "directory"\c
\&
Add \c
.I directory\c
\& to the path to search for source files.
.PP
.TP
.B \-nx
.TP
.B \-n
Do not execute commands from any `\|\c
.B .gdbinit\c
\&\|' initialization files.
Normally, the commands in these files are executed after all the
command options and arguments have been processed.
.TP
.B \-quiet
.TP
.B \-q
``Quiet''. Do not print the introductory and copyright messages. These
messages are also suppressed in batch mode.
.TP
.B \-batch
Run in batch mode. Exit with status \c
.B 0\c
\& after processing all the command
files specified with `\|\c
.B \-x\c
\&\|' (and `\|\c
.B .gdbinit\c
\&\|', if not inhibited).
Exit with nonzero status if an error occurs in executing the GDB
commands in the command files.
Batch mode may be useful for running GDB as a filter, for example to
download and run a program on another computer; in order to make this
more useful, the message
.sp
.br
Program\ exited\ normally.
.br
.sp
(which is ordinarily issued whenever a program running under GDB control
terminates) is not issued when running in batch mode.
.TP
.BI "\-cd=" "directory"\c
\&
Run GDB using \c
.I directory\c
\& as its working directory,
instead of the current directory.
.TP
.B \-fullname
.TP
.B \-f
Emacs sets this option when it runs GDB as a subprocess. It tells GDB
to output the full file name and line number in a standard,
recognizable fashion each time a stack frame is displayed (which
includes each time the program stops). This recognizable format looks
like two `\|\c
.B \032\c
\&\|' characters, followed by the file name, line number
and character position separated by colons, and a newline. The
Emacs-to-GDB interface program uses the two `\|\c
.B \032\c
\&\|' characters as
a signal to display the source code for the frame.
.TP
.BI "\-b " "bps"\c
\&
Set the line speed (baud rate or bits per second) of any serial
interface used by GDB for remote debugging.
.TP
.BI "\-tty=" "device"\c
\&
Run using \c
.I device\c
\& for your program's standard input and output.
.PP
.SH "SEE ALSO"
.RB "`\|" gdb "\|'"
entry in
.B info\c
\&;
.I
Using GDB: A Guide to the GNU Source-Level Debugger\c
, Richard M. Stallman and Roland H. Pesch, July 1991.
.SH COPYING
Copyright (c) 1991 Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
.PP
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
.PP
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.

View file

@ -0,0 +1,323 @@
/* Native-dependent code for BSD Unix running on i386's, for GDB.
Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include <machine/reg.h>
/* this table must line up with REGISTER_NAMES in tm-i386.h */
/* symbols like 'tEAX' come from <machine/reg.h> */
static int tregmap[] =
{
tEAX, tECX, tEDX, tEBX,
tESP, tEBP, tESI, tEDI,
tEIP, tEFLAGS, tCS, tSS
};
#ifdef sEAX
static int sregmap[] =
{
sEAX, sECX, sEDX, sEBX,
sESP, sEBP, sESI, sEDI,
sEIP, sEFLAGS, sCS, sSS
};
#endif
/* blockend is the value of u.u_ar0, and points to the
place where ES is stored. */
int
i386_register_u_addr (blockend, regnum)
int blockend;
int regnum;
{
/* The following condition is a kludge to get at the proper register map
depending upon the state of pcb_flag.
The proper condition would be
if (u.u_pcb.pcb_flag & FM_TRAP)
but that would require a ptrace call here and wouldn't work
for corefiles. */
#ifdef sEAX
if (blockend < 0x1fcc)
return (blockend + 4 * tregmap[regnum]);
else
return (blockend + 4 * sregmap[regnum]);
#else
return (blockend + 4 * tregmap[regnum]);
#endif
}
#ifdef FLOAT_INFO
#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <a.out.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/uio.h>
#define curpcb Xcurpcb /* XXX avoid leaking declaration from pcb.h */
#include <sys/user.h>
#undef curpcb
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/ptrace.h>
#define fpstate save87
#define U_FPSTATE(u) u.u_pcb.pcb_savefpu
i387_to_double (from, to)
char *from;
char *to;
{
long *lp;
/* push extended mode on 387 stack, then pop in double mode
*
* first, set exception masks so no error is generated -
* number will be rounded to inf or 0, if necessary
*/
asm ("pushl %eax"); /* grab a stack slot */
asm ("fstcw (%esp)"); /* get 387 control word */
asm ("movl (%esp),%eax"); /* save old value */
asm ("orl $0x3f,%eax"); /* mask all exceptions */
asm ("pushl %eax");
asm ("fldcw (%esp)"); /* load new value into 387 */
asm ("movl 8(%ebp),%eax");
asm ("fldt (%eax)"); /* push extended number on 387 stack */
asm ("fwait");
asm ("movl 12(%ebp),%eax");
asm ("fstpl (%eax)"); /* pop double */
asm ("fwait");
asm ("popl %eax"); /* flush modified control word */
asm ("fnclex"); /* clear exceptions */
asm ("fldcw (%esp)"); /* restore original control word */
asm ("popl %eax"); /* flush saved copy */
}
double_to_i387 (from, to)
char *from;
char *to;
{
/* push double mode on 387 stack, then pop in extended mode
* no errors are possible because every 64-bit pattern
* can be converted to an extended
*/
asm ("movl 8(%ebp),%eax");
asm ("fldl (%eax)");
asm ("fwait");
asm ("movl 12(%ebp),%eax");
asm ("fstpt (%eax)");
asm ("fwait");
}
struct env387
{
unsigned short control;
unsigned short r0;
unsigned short status;
unsigned short r1;
unsigned short tag;
unsigned short r2;
unsigned long eip;
unsigned short code_seg;
unsigned short opcode;
unsigned long operand;
unsigned short operand_seg;
unsigned short r3;
unsigned char regs[8][10];
};
void
print_387_control_word (control)
unsigned int control;
{
printf ("control 0x%04x: ", control);
printf ("compute to ");
switch ((control >> 8) & 3)
{
case 0: printf ("24 bits; "); break;
case 1: printf ("(bad); "); break;
case 2: printf ("53 bits; "); break;
case 3: printf ("64 bits; "); break;
}
printf ("round ");
switch ((control >> 10) & 3)
{
case 0: printf ("NEAREST; "); break;
case 1: printf ("DOWN; "); break;
case 2: printf ("UP; "); break;
case 3: printf ("CHOP; "); break;
}
if (control & 0x3f)
{
printf ("mask:");
if (control & 0x0001) printf (" INVALID");
if (control & 0x0002) printf (" DENORM");
if (control & 0x0004) printf (" DIVZ");
if (control & 0x0008) printf (" OVERF");
if (control & 0x0010) printf (" UNDERF");
if (control & 0x0020) printf (" LOS");
printf (";");
}
printf ("\n");
if (control & 0xe080) printf ("warning: reserved bits on 0x%x\n",
control & 0xe080);
}
void
print_387_status_word (status)
unsigned int status;
{
printf ("status 0x%04x: ", status);
if (status & 0xff)
{
printf ("exceptions:");
if (status & 0x0001) printf (" INVALID");
if (status & 0x0002) printf (" DENORM");
if (status & 0x0004) printf (" DIVZ");
if (status & 0x0008) printf (" OVERF");
if (status & 0x0010) printf (" UNDERF");
if (status & 0x0020) printf (" LOS");
if (status & 0x0040) printf (" FPSTACK");
printf ("; ");
}
printf ("flags: %d%d%d%d; ",
(status & 0x4000) != 0,
(status & 0x0400) != 0,
(status & 0x0200) != 0,
(status & 0x0100) != 0);
printf ("top %d\n", (status >> 11) & 7);
}
static
print_387_status (status, ep)
unsigned short status;
struct env387 *ep;
{
int i;
int bothstatus;
int top;
int fpreg;
unsigned char *p;
bothstatus = ((status != 0) && (ep->status != 0));
if (status != 0)
{
if (bothstatus)
printf ("u: ");
print_387_status_word ((unsigned int)status);
}
if (ep->status != 0)
{
if (bothstatus)
printf ("e: ");
print_387_status_word ((unsigned int)ep->status);
}
print_387_control_word ((unsigned int)ep->control);
printf ("last exception: ");
printf ("opcode 0x%x; ", ep->opcode);
printf ("pc 0x%x:0x%x; ", ep->code_seg, ep->eip);
printf ("operand 0x%x:0x%x\n", ep->operand_seg, ep->operand);
top = (ep->status >> 11) & 7;
printf (" regno tag msb lsb value\n");
for (fpreg = 7; fpreg >= 0; fpreg--)
{
int st_regno;
double val;
/* The physical regno `fpreg' is only relevant as an index into the
* tag word. Logical `%st' numbers are required for indexing `p->regs.
*/
st_regno = (fpreg + 8 - top) & 0x7;
printf ("%%st(%d) %s ", st_regno, fpreg == top ? "=>" : " ");
switch ((ep->tag >> (fpreg * 2)) & 3)
{
case 0: printf ("valid "); break;
case 1: printf ("zero "); break;
case 2: printf ("trap "); break;
case 3: printf ("empty "); break;
}
for (i = 9; i >= 0; i--)
printf ("%02x", ep->regs[st_regno][i]);
i387_to_double (ep->regs[st_regno], (char *)&val);
printf (" %g\n", val);
}
}
i386_float_info ()
{
struct user u; /* just for address computations */
int i;
/* fpstate defined in <sys/user.h> */
struct fpstate *fpstatep;
char buf[sizeof (struct fpstate) + 2 * sizeof (int)];
unsigned int uaddr;
char fpvalid;
unsigned int rounded_addr;
unsigned int rounded_size;
/*extern int corechan;*/
int skip;
extern int inferior_pid;
uaddr = (char *)&U_FPSTATE(u) - (char *)&u;
if (inferior_pid)
{
int *ip;
rounded_addr = uaddr & -sizeof (int);
rounded_size = (((uaddr + sizeof (struct fpstate)) - uaddr) +
sizeof (int) - 1) / sizeof (int);
skip = uaddr - rounded_addr;
ip = (int *)buf;
for (i = 0; i < rounded_size; i++)
{
*ip++ = ptrace (PT_READ_U, inferior_pid, (caddr_t)rounded_addr, 0);
rounded_addr += sizeof (int);
}
}
else
{
printf("float info: can't do a core file (yet)\n");
return;
#if 0
if (lseek (corechan, uaddr, 0) < 0)
perror_with_name ("seek on core file");
if (myread (corechan, buf, sizeof (struct fpstate)) < 0)
perror_with_name ("read from core file");
skip = 0;
#endif
}
print_387_status (0, (struct env387 *)buf);
}
#endif

View file

@ -0,0 +1,44 @@
/* Native-dependent definitions for Intel 386 running BSD Unix, for GDB.
Copyright 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef NM_FREEBSD_H
#define NM_FREEBSD_H
/* Be shared lib aware */
#include "solib.h"
/* This is the amount to subtract from u.u_ar0
to get the offset in the core file of the register values. */
#include <machine/vmparam.h>
#define KERNEL_U_ADDR USRSTACK
/* #undef FLOAT_INFO /* No float info yet */
#define FLOAT_INFO extern i386_float_info (); \
i386_float_info ()
#define REGISTER_U_ADDR(addr, blockend, regno) \
(addr) = i386_register_u_addr ((blockend),(regno));
extern int
i386_register_u_addr PARAMS ((int, int));
#define PTRACE_ARG3_TYPE char*
#endif /* NM_FREEBSD_H */

View file

@ -0,0 +1,76 @@
/* Macro definitions for i386 running under BSD Unix.
Copyright 1986, 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Override number of expected traps from sysv. */
#define START_INFERIOR_TRAPS_EXPECTED 2
/* Most definitions from sysv could be used. */
#include "tm-i386v.h"
/* 386BSD cannot handle the segment registers. */
/* BSDI can't handle them either. */
#undef NUM_REGS
#define NUM_REGS 10
/* On 386 bsd, sigtramp is above the user stack and immediately below
the user area. Using constants here allows for cross debugging.
These are tested for BSDI but should work on 386BSD. */
#define SIGTRAMP_START 0xfdbfdfc0
#define SIGTRAMP_END 0xfdbfe000
/* The following redefines make backtracing through sigtramp work.
They manufacture a fake sigtramp frame and obtain the saved pc in sigtramp
from the sigcontext structure which is pushed by the kernel on the
user stack, along with a pointer to it. */
/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
chain-pointer.
In the case of the i386, the frame's nominal address
is the address of a 4-byte word containing the calling frame's address. */
#undef FRAME_CHAIN
#define FRAME_CHAIN(thisframe) \
(thisframe->signal_handler_caller \
? thisframe->frame \
: (!inside_entry_file ((thisframe)->pc) \
? read_memory_integer ((thisframe)->frame, 4) \
: 0))
/* A macro that tells us whether the function invocation represented
by FI does not have a frame on the stack associated with it. If it
does not, FRAMELESS is set to 1, else 0. */
#undef FRAMELESS_FUNCTION_INVOCATION
#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
do { \
if ((FI)->signal_handler_caller) \
(FRAMELESS) = 0; \
else \
(FRAMELESS) = frameless_look_for_prologue(FI); \
} while (0)
/* Saved Pc. Get it from sigcontext if within sigtramp. */
/* Offset to saved PC in sigcontext, from <sys/signal.h>. */
#define SIGCONTEXT_PC_OFFSET 20
#undef FRAME_SAVED_PC(FRAME)
#define FRAME_SAVED_PC(FRAME) \
(((FRAME)->signal_handler_caller \
? sigtramp_saved_pc (FRAME) \
: read_memory_integer ((FRAME)->frame + 4, 4)) \
)

View file

@ -0,0 +1,3 @@
char *version = "4.11";
char *host_canonical = "i386-unknown-freebsd";
char *target_canonical = "i386-unknown-freebsd";

View file

@ -0,0 +1,31 @@
/* Host-dependent definitions for Intel 386 running BSD Unix, for GDB.
Copyright 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HOST_BYTE_ORDER LITTLE_ENDIAN
#include <machine/limits.h> /* for INT_MIN, to avoid "INT_MIN
redefined" warnings from defs.h */
/* psignal() is in <signal.h>. */
#define PSIGNAL_IN_SIGNAL_H
/* Get rid of any system-imposed stack limit if possible. */
#define SET_STACK_LIMIT_HUGE

481
gnu/usr.bin/gdb/COPYING.LIB Normal file
View file

@ -0,0 +1,481 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View file

@ -0,0 +1,15 @@
This is a greatly pared down version of GDB-4.12 for FreeBSD 1.1.5 that
supports debugging of shared executables and the new a.out format.
I've collapsed some of the directories and removed lots of files from others.
All that's included is those necessary to compile on FreeBSD 1.1.5, this was
to keep the replacement for GDB-3 compact since none of the multiple
architecture stuff is used. All the documentation has been put in the doc/
directory.
A full port of each library will probably be done for FreeBSD 2.0 and
included as system libraries so that other build tools can share them.
At that time a more complete port of GDB-4 will be done that allows
configuration for different systems and uses the full libraries.
paul@freefall.cdrom.com

1
gnu/usr.bin/gdb/VERSION Normal file
View file

@ -0,0 +1 @@
4.11

339
gnu/usr.bin/gdb/bfd/COPYING Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -0,0 +1,17 @@
LIB = bfd
SRCS = archive.c archures.c bfd.c cache.c coffgen.c core.c ctor.c \
format.c init.c libbfd.c opncls.c reloc.c seclet.c section.c syms.c \
targets.c ecoff.c elf.c srec.c freebsd386.c aout32.c stab-syms.c \
cpu-i386.c trad-core.c
CFLAGS+= -I$(.CURDIR)/. -I$(.CURDIR)/../gdb/.
CFLAGS+= -DDEFAULT_VECTOR=freebsd386_vec -DSELECT_VECS='&freebsd386_vec' \
-DSELECT_ARCHITECTURES='bfd_i386_arch'
NOPROFILE=no
NOPIC=no
install:
@echo -n
.include <bsd.lib.mk>

View file

@ -0,0 +1,7 @@
This is a greatly pared down libbfd directory. Only what's required to build
gdb-4.12 on FreeBSD was kept.
This is temporary. In FreeBSD 2.0 a fully ported libbfd will likely appear
as a system library for use by all the build tools.
paul@freefall.cdrom.com

View file

@ -0,0 +1 @@
2.2

View file

@ -0,0 +1,429 @@
/* Define a target vector and some small routines for a variant of a.out.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "aout/aout64.h"
#include "aout/stab_gnu.h"
#include "aout/ar.h"
/*#include "libaout.h"*/
extern CONST struct reloc_howto_struct * NAME(aout,reloc_type_lookup) ();
/* Set parameters about this a.out file that are machine-dependent.
This routine is called from some_aout_object_p just before it returns. */
#ifndef MY_callback
static bfd_target *
DEFUN(MY(callback),(abfd),
bfd *abfd)
{
struct internal_exec *execp = exec_hdr (abfd);
/* Calculate the file positions of the parts of a newly read aout header */
obj_textsec (abfd)->_raw_size = N_TXTSIZE(*execp);
/* The virtual memory addresses of the sections */
obj_textsec (abfd)->vma = N_TXTADDR(*execp);
obj_datasec (abfd)->vma = N_DATADDR(*execp);
obj_bsssec (abfd)->vma = N_BSSADDR(*execp);
/* The file offsets of the sections */
obj_textsec (abfd)->filepos = N_TXTOFF (*execp);
obj_datasec (abfd)->filepos = N_DATOFF (*execp);
/* The file offsets of the relocation info */
obj_textsec (abfd)->rel_filepos = N_TRELOFF(*execp);
obj_datasec (abfd)->rel_filepos = N_DRELOFF(*execp);
/* The file offsets of the string table and symbol table. */
obj_sym_filepos (abfd) = N_SYMOFF (*execp);
obj_str_filepos (abfd) = N_STROFF (*execp);
/* Determine the architecture and machine type of the object file. */
#ifdef SET_ARCH_MACH
SET_ARCH_MACH(abfd, *execp);
#else
bfd_default_set_arch_mach(abfd, DEFAULT_ARCH, 0);
#endif
/* Don't set sizes now -- can't be sure until we know arch & mach.
Sizes get set in set_sizes callback, later. */
#if 0
adata(abfd).page_size = PAGE_SIZE;
#ifdef SEGMENT_SIZE
adata(abfd).segment_size = SEGMENT_SIZE;
#else
adata(abfd).segment_size = PAGE_SIZE;
#endif
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
#endif
return abfd->xvec;
}
#endif
#ifndef MY_object_p
/* Finish up the reading of an a.out file header */
static bfd_target *
DEFUN(MY(object_p),(abfd),
bfd *abfd)
{
struct external_exec exec_bytes; /* Raw exec header from file */
struct internal_exec exec; /* Cleaned-up exec header */
bfd_target *target;
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
!= EXEC_BYTES_SIZE) {
bfd_error = wrong_format;
return 0;
}
#ifdef NO_SWAP_MAGIC
memcpy (&exec.a_info, exec_bytes.e_info, sizeof(exec.a_info));
#else
exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
#endif /* NO_SWAP_MAGIC */
if (N_BADMAG (exec)) return 0;
#ifdef MACHTYPE_OK
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
#endif
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec);
target = NAME(aout,some_aout_object_p) (abfd, &exec, MY(callback));
#ifdef ENTRY_CAN_BE_ZERO
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
* means that it isn't obvious if EXEC_P should be set.
* All of the following must be true for an executable:
* There must be no relocations, the bfd can be neither an
* archive nor an archive element, and the file must be executable. */
if (exec.a_trsize + exec.a_drsize == 0
&& bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
{
struct stat buf;
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
abfd->flags |= EXEC_P;
}
#endif /* ENTRY_CAN_BE_ZERO */
return target;
}
#define MY_object_p MY(object_p)
#endif
#ifndef MY_mkobject
static boolean
DEFUN(MY(mkobject),(abfd),
bfd *abfd)
{
if (NAME(aout,mkobject)(abfd) == false)
return false;
#if 0 /* Sizes get set in set_sizes callback, later, after we know
the architecture and machine. */
adata(abfd).page_size = PAGE_SIZE;
#ifdef SEGMENT_SIZE
adata(abfd).segment_size = SEGMENT_SIZE;
#else
adata(abfd).segment_size = PAGE_SIZE;
#endif
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
#endif
return true;
}
#define MY_mkobject MY(mkobject)
#endif
/* Write an object file.
Section contents have already been written. We write the
file header, symbols, and relocation. */
#ifndef MY_write_object_contents
static boolean
DEFUN(MY(write_object_contents),(abfd),
bfd *abfd)
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
#if CHOOSE_RELOC_SIZE
CHOOSE_RELOC_SIZE(abfd);
#else
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
#endif
WRITE_HEADERS(abfd, execp);
return true;
}
#define MY_write_object_contents MY(write_object_contents)
#endif
#ifndef MY_set_sizes
static boolean
DEFUN(MY(set_sizes),(abfd), bfd *abfd)
{
adata(abfd).page_size = PAGE_SIZE;
#ifdef SEGMENT_SIZE
adata(abfd).segment_size = SEGMENT_SIZE;
#else
adata(abfd).segment_size = PAGE_SIZE;
#endif
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return true;
}
#define MY_set_sizes MY(set_sizes)
#endif
#ifndef MY_backend_data
static CONST struct aout_backend_data MY(backend_data) = {
0, /* zmagic contiguous */
0, /* text incl header */
0, /* text vma? */
MY_set_sizes,
0, /* exec header is counted */
};
#define MY_backend_data &MY(backend_data)
#endif
/* We assume BFD generic archive files. */
#ifndef MY_openr_next_archived_file
#define MY_openr_next_archived_file bfd_generic_openr_next_archived_file
#endif
#ifndef MY_generic_stat_arch_elt
#define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt
#endif
#ifndef MY_slurp_armap
#define MY_slurp_armap bfd_slurp_bsd_armap
#endif
#ifndef MY_slurp_extended_name_table
#define MY_slurp_extended_name_table _bfd_slurp_extended_name_table
#endif
#ifndef MY_write_armap
#define MY_write_armap bsd_write_armap
#endif
#ifndef MY_truncate_arname
#define MY_truncate_arname bfd_bsd_truncate_arname
#endif
/* No core file defined here -- configure in trad-core.c separately. */
#ifndef MY_core_file_failing_command
#define MY_core_file_failing_command _bfd_dummy_core_file_failing_command
#endif
#ifndef MY_core_file_failing_signal
#define MY_core_file_failing_signal _bfd_dummy_core_file_failing_signal
#endif
#ifndef MY_core_file_matches_executable_p
#define MY_core_file_matches_executable_p \
_bfd_dummy_core_file_matches_executable_p
#endif
#ifndef MY_core_file_p
#define MY_core_file_p _bfd_dummy_target
#endif
#ifndef MY_bfd_debug_info_start
#define MY_bfd_debug_info_start bfd_void
#endif
#ifndef MY_bfd_debug_info_end
#define MY_bfd_debug_info_end bfd_void
#endif
#ifndef MY_bfd_debug_info_accumulate
#define MY_bfd_debug_info_accumulate \
(void (*) PARAMS ((bfd*, struct sec *))) bfd_void
#endif
#ifndef MY_core_file_failing_command
#define MY_core_file_failing_command NAME(aout,core_file_failing_command)
#endif
#ifndef MY_core_file_failing_signal
#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)
#endif
#ifndef MY_core_file_matches_executable_p
#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)
#endif
#ifndef MY_slurp_armap
#define MY_slurp_armap NAME(aout,slurp_armap)
#endif
#ifndef MY_slurp_extended_name_table
#define MY_slurp_extended_name_table NAME(aout,slurp_extended_name_table)
#endif
#ifndef MY_truncate_arname
#define MY_truncate_arname NAME(aout,truncate_arname)
#endif
#ifndef MY_write_armap
#define MY_write_armap NAME(aout,write_armap)
#endif
#ifndef MY_close_and_cleanup
#define MY_close_and_cleanup NAME(aout,close_and_cleanup)
#endif
#ifndef MY_set_section_contents
#define MY_set_section_contents NAME(aout,set_section_contents)
#endif
#ifndef MY_get_section_contents
#define MY_get_section_contents NAME(aout,get_section_contents)
#endif
#ifndef MY_new_section_hook
#define MY_new_section_hook NAME(aout,new_section_hook)
#endif
#ifndef MY_get_symtab_upper_bound
#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)
#endif
#ifndef MY_get_symtab
#define MY_get_symtab NAME(aout,get_symtab)
#endif
#ifndef MY_get_reloc_upper_bound
#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)
#endif
#ifndef MY_canonicalize_reloc
#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)
#endif
#ifndef MY_make_empty_symbol
#define MY_make_empty_symbol NAME(aout,make_empty_symbol)
#endif
#ifndef MY_print_symbol
#define MY_print_symbol NAME(aout,print_symbol)
#endif
#ifndef MY_get_symbol_info
#define MY_get_symbol_info NAME(aout,get_symbol_info)
#endif
#ifndef MY_get_lineno
#define MY_get_lineno NAME(aout,get_lineno)
#endif
#ifndef MY_set_arch_mach
#define MY_set_arch_mach NAME(aout,set_arch_mach)
#endif
#ifndef MY_openr_next_archived_file
#define MY_openr_next_archived_file NAME(aout,openr_next_archived_file)
#endif
#ifndef MY_find_nearest_line
#define MY_find_nearest_line NAME(aout,find_nearest_line)
#endif
#ifndef MY_generic_stat_arch_elt
#define MY_generic_stat_arch_elt NAME(aout,generic_stat_arch_elt)
#endif
#ifndef MY_sizeof_headers
#define MY_sizeof_headers NAME(aout,sizeof_headers)
#endif
#ifndef MY_bfd_debug_info_start
#define MY_bfd_debug_info_start NAME(aout,bfd_debug_info_start)
#endif
#ifndef MY_bfd_debug_info_end
#define MY_bfd_debug_info_end NAME(aout,bfd_debug_info_end)
#endif
#ifndef MY_bfd_debug_info_accumulat
#define MY_bfd_debug_info_accumulat NAME(aout,bfd_debug_info_accumulat)
#endif
#ifndef MY_reloc_howto_type_lookup
#define MY_reloc_howto_type_lookup NAME(aout,reloc_type_lookup)
#endif
#ifndef MY_make_debug_symbol
#define MY_make_debug_symbol 0
#endif
/* Aout symbols normally have leading underscores */
#ifndef MY_symbol_leading_char
#define MY_symbol_leading_char '_'
#endif
/* Aout archives normally use spaces for padding */
#ifndef AR_PAD_CHAR
#define AR_PAD_CHAR ' '
#endif
#ifndef MY_BFD_TARGET
bfd_target MY(vec) =
{
TARGETNAME, /* name */
bfd_target_aout_flavour,
#ifdef TARGET_IS_BIG_ENDIAN_P
true, /* target byte order (big) */
true, /* target headers byte order (big) */
#else
false, /* target byte order (little) */
false, /* target headers byte order (little) */
#endif
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
MY_symbol_leading_char,
AR_PAD_CHAR, /* ar_pad_char */
15, /* ar_max_namelen */
3, /* minimum alignment */
#ifdef TARGET_IS_BIG_ENDIAN_P
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
#else
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
#endif
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
bfd_generic_archive_p, MY_core_file_p},
{bfd_false, MY_mkobject, /* bfd_set_format */
_bfd_generic_mkarchive, bfd_false},
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
_bfd_write_archive_contents, bfd_false},
MY_core_file_failing_command,
MY_core_file_failing_signal,
MY_core_file_matches_executable_p,
MY_slurp_armap,
MY_slurp_extended_name_table,
MY_truncate_arname,
MY_write_armap,
MY_close_and_cleanup,
MY_set_section_contents,
MY_get_section_contents,
MY_new_section_hook,
MY_get_symtab_upper_bound,
MY_get_symtab,
MY_get_reloc_upper_bound,
MY_canonicalize_reloc,
MY_make_empty_symbol,
MY_print_symbol,
MY_get_symbol_info,
MY_get_lineno,
MY_set_arch_mach,
MY_openr_next_archived_file,
MY_find_nearest_line,
MY_generic_stat_arch_elt,
MY_sizeof_headers,
MY_bfd_debug_info_start,
MY_bfd_debug_info_end,
MY_bfd_debug_info_accumulate,
bfd_generic_get_relocated_section_contents,
bfd_generic_relax_section,
bfd_generic_seclet_link,
MY_reloc_howto_type_lookup,
MY_make_debug_symbol,
(PTR) MY_backend_data,
};
#endif /* MY_BFD_TARGET */

View file

@ -0,0 +1,23 @@
/* BFD back-end for 32-bit a.out files.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define ARCH_SIZE 32
#include "aoutx.h"

2568
gnu/usr.bin/gdb/bfd/aoutx.h Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,731 @@
/* BFD library support routines for architectures.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
Architectures
BFD's idea of an architecture is implimented in
<<archures.c>>. BFD keeps one atom in a BFD describing the
architecture of the data attached to the BFD; a pointer to a
<<bfd_arch_info_type>>.
Pointers to structures can be requested independently of a bfd
so that an architecture's information can be interrogated
without access to an open bfd.
The arch information is provided by each architecture package.
The set of default architectures is selected by the #define
<<SELECT_ARCHITECTURES>>. This is normally set up in the
<<config/target.mt>> file of your choice. If the name is not
defined, then all the architectures supported are included.
When BFD starts up, all the architectures are called with an
initialize method. It is up to the architecture back end to
insert as many items into the list of architectures as it wants to;
generally this would be one for each machine and one for the
default case (an item with a machine field of 0).
*/
/*
SUBSECTION
bfd_architecture
DESCRIPTION
This enum gives the object file's CPU architecture, in a
global sense --- i.e., what processor family does it belong to?
There is another field, which indicates what processor within
the family is in use. The machine gives a number which
distingushes different versions of the architecture,
containing for example 2 and 3 for Intel i960 KA and i960 KB,
and 68020 and 68030 for Motorola 68020 and 68030.
.enum bfd_architecture
.{
. bfd_arch_unknown, {* File arch not known *}
. bfd_arch_obscure, {* Arch known, not one of these *}
. bfd_arch_m68k, {* Motorola 68xxx *}
. bfd_arch_vax, {* DEC Vax *}
. bfd_arch_i960, {* Intel 960 *}
. {* The order of the following is important.
. lower number indicates a machine type that
. only accepts a subset of the instructions
. available to machines with higher numbers.
. The exception is the "ca", which is
. incompatible with all other machines except
. "core". *}
.
.#define bfd_mach_i960_core 1
.#define bfd_mach_i960_ka_sa 2
.#define bfd_mach_i960_kb_sb 3
.#define bfd_mach_i960_mc 4
.#define bfd_mach_i960_xa 5
.#define bfd_mach_i960_ca 6
.
. bfd_arch_a29k, {* AMD 29000 *}
. bfd_arch_sparc, {* SPARC *}
. bfd_arch_mips, {* MIPS Rxxxx *}
. bfd_arch_i386, {* Intel 386 *}
. bfd_arch_we32k, {* AT&T WE32xxx *}
. bfd_arch_tahoe, {* CCI/Harris Tahoe *}
. bfd_arch_i860, {* Intel 860 *}
. bfd_arch_romp, {* IBM ROMP PC/RT *}
. bfd_arch_alliant, {* Alliant *}
. bfd_arch_convex, {* Convex *}
. bfd_arch_m88k, {* Motorola 88xxx *}
. bfd_arch_pyramid, {* Pyramid Technology *}
. bfd_arch_h8300, {* Hitachi H8/300 *}
.#define bfd_mach_h8300 1
.#define bfd_mach_h8300h 2
. bfd_arch_rs6000, {* IBM RS/6000 *}
. bfd_arch_hppa, {* HP PA RISC *}
. bfd_arch_z8k, {* Zilog Z8000 *}
.#define bfd_mach_z8001 1
.#define bfd_mach_z8002 2
. bfd_arch_h8500, {* Hitachi H8/500 *}
. bfd_arch_sh, {* Hitachi SH *}
. bfd_arch_alpha, {* Dec Alpha *}
. bfd_arch_last
. };
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/*
SUBSECTION
bfd_arch_info
DESCRIPTION
This structure contains information on architectures for use
within BFD.
.
.typedef struct bfd_arch_info
.{
. int bits_per_word;
. int bits_per_address;
. int bits_per_byte;
. enum bfd_architecture arch;
. long mach;
. char *arch_name;
. CONST char *printable_name;
. unsigned int section_align_power;
. {* true if this is the default machine for the architecture *}
. boolean the_default;
. CONST struct bfd_arch_info * (*compatible)
. PARAMS ((CONST struct bfd_arch_info *a,
. CONST struct bfd_arch_info *b));
.
. boolean (*scan) PARAMS ((CONST struct bfd_arch_info *, CONST char *));
. {* How to disassemble an instruction, producing a printable
. representation on a specified stdio stream. This isn't
. defined for most processors at present, because of the size
. of the additional tables it would drag in, and because gdb
. wants to use a different interface. *}
. unsigned int (*disassemble) PARAMS ((bfd_vma addr, CONST char *data,
. PTR stream));
.
. struct bfd_arch_info *next;
.} bfd_arch_info_type;
*/
bfd_arch_info_type *bfd_arch_info_list;
/*
FUNCTION
bfd_printable_name
SYNOPSIS
CONST char *bfd_printable_name(bfd *abfd);
DESCRIPTION
Return a printable string representing the architecture and machine
from the pointer to the arch info structure
*/
CONST char *
DEFUN(bfd_printable_name, (abfd),
bfd *abfd)
{
return abfd->arch_info->printable_name;
}
/*
FUNCTION
bfd_scan_arch
SYNOPSIS
bfd_arch_info_type *bfd_scan_arch(CONST char *);
DESCRIPTION
This routine is provided with a string and tries to work out
if bfd supports any cpu which could be described with the name
provided. The routine returns a pointer to an arch_info
structure if a machine is found, otherwise NULL.
*/
bfd_arch_info_type *
DEFUN(bfd_scan_arch,(string),
CONST char *string)
{
struct bfd_arch_info *ap;
/* Look through all the installed architectures */
for (ap = bfd_arch_info_list;
ap != (bfd_arch_info_type *)NULL;
ap = ap->next) {
if (ap->scan(ap, string))
return ap;
}
return (bfd_arch_info_type *)NULL;
}
/*
FUNCTION
bfd_arch_get_compatible
SYNOPSIS
CONST bfd_arch_info_type *bfd_arch_get_compatible(
CONST bfd *abfd,
CONST bfd *bbfd);
DESCRIPTION
This routine is used to determine whether two BFDs'
architectures and achine types are compatible. It calculates
the lowest common denominator between the two architectures
and machine types implied by the BFDs and returns a pointer to
an arch_info structure describing the compatible machine.
*/
CONST bfd_arch_info_type *
DEFUN(bfd_arch_get_compatible,(abfd, bbfd),
CONST bfd *abfd AND
CONST bfd *bbfd)
{
return abfd->arch_info->compatible(abfd->arch_info,bbfd->arch_info);
}
/*
INTERNAL_DEFINITION
bfd_default_arch_struct
DESCRIPTION
The <<bfd_default_arch_struct>> is an item of
<<bfd_arch_info_type>> which has been initialized to a fairly
generic state. A BFD starts life by pointing to this
structure, until the correct back end has determined the real
architecture of the file.
.extern bfd_arch_info_type bfd_default_arch_struct;
*/
bfd_arch_info_type bfd_default_arch_struct =
{
32,32,8,bfd_arch_unknown,0,"unknown","unknown",2,true,
bfd_default_compatible,
bfd_default_scan,
0,
};
/*
FUNCTION
bfd_set_arch_info
SYNOPSIS
void bfd_set_arch_info(bfd *, bfd_arch_info_type *);
*/
void DEFUN(bfd_set_arch_info,(abfd, arg),
bfd *abfd AND
bfd_arch_info_type *arg)
{
abfd->arch_info = arg;
}
/*
INTERNAL_FUNCTION
bfd_default_set_arch_mach
SYNOPSIS
boolean bfd_default_set_arch_mach(bfd *abfd,
enum bfd_architecture arch,
unsigned long mach);
DESCRIPTION
Set the architecture and machine type in a bfd. This finds the
correct pointer to structure and inserts it into the arch_info
pointer.
*/
boolean DEFUN(bfd_default_set_arch_mach,(abfd, arch, mach),
bfd *abfd AND
enum bfd_architecture arch AND
unsigned long mach)
{
static struct bfd_arch_info *old_ptr = &bfd_default_arch_struct;
boolean found = false;
/* run through the table to find the one we want, we keep a little
cache to speed things up */
if (old_ptr == 0 || arch != old_ptr->arch || mach != old_ptr->mach) {
bfd_arch_info_type *ptr;
old_ptr = (bfd_arch_info_type *)NULL;
for (ptr = bfd_arch_info_list;
ptr != (bfd_arch_info_type *)NULL;
ptr= ptr->next) {
if (ptr->arch == arch &&
((ptr->mach == mach) || (ptr->the_default && mach == 0))) {
old_ptr = ptr;
found = true;
break;
}
}
if (found==false) {
/*looked for it and it wasn't there, so put in the default */
old_ptr = &bfd_default_arch_struct;
bfd_error = bad_value;
}
}
else {
/* it was in the cache */
found = true;
}
abfd->arch_info = old_ptr;
return found;
}
/*
FUNCTION
bfd_get_arch
SYNOPSIS
enum bfd_architecture bfd_get_arch(bfd *abfd);
DESCRIPTION
Returns the enumerated type which describes the supplied bfd's
architecture
*/
enum bfd_architecture DEFUN(bfd_get_arch, (abfd), bfd *abfd)
{
return abfd->arch_info->arch;
}
/*
FUNCTION
bfd_get_mach
SYNOPSIS
unsigned long bfd_get_mach(bfd *abfd);
DESCRIPTION
Returns the long type which describes the supplied bfd's
machine
*/
unsigned long
DEFUN(bfd_get_mach, (abfd), bfd *abfd)
{
return abfd->arch_info->mach;
}
/*
FUNCTION
bfd_arch_bits_per_byte
SYNOPSIS
unsigned int bfd_arch_bits_per_byte(bfd *abfd);
DESCRIPTION
Returns the number of bits in one of the architectures bytes
*/
unsigned int DEFUN(bfd_arch_bits_per_byte, (abfd), bfd *abfd)
{
return abfd->arch_info->bits_per_byte;
}
/*
FUNCTION
bfd_arch_bits_per_address
SYNOPSIS
unsigned int bfd_arch_bits_per_address(bfd *abfd);
DESCRIPTION
Returns the number of bits in one of the architectures addresses
*/
unsigned int DEFUN(bfd_arch_bits_per_address, (abfd), bfd *abfd)
{
return abfd->arch_info->bits_per_address;
}
extern void bfd_a29k_arch PARAMS ((void));
extern void bfd_alpha_arch PARAMS ((void));
extern void bfd_h8300_arch PARAMS ((void));
extern void bfd_h8500_arch PARAMS ((void));
extern void bfd_hppa_arch PARAMS ((void));
extern void bfd_i386_arch PARAMS ((void));
extern void bfd_i960_arch PARAMS ((void));
extern void bfd_m68k_arch PARAMS ((void));
extern void bfd_m88k_arch PARAMS ((void));
extern void bfd_mips_arch PARAMS ((void));
extern void bfd_rs6000_arch PARAMS ((void));
extern void bfd_sh_arch PARAMS ((void));
extern void bfd_sparc_arch PARAMS ((void));
extern void bfd_vax_arch PARAMS ((void));
extern void bfd_we32k_arch PARAMS ((void));
extern void bfd_z8k_arch PARAMS ((void));
static void (*archures_init_table[]) PARAMS ((void)) =
{
#ifdef SELECT_ARCHITECTURES
SELECT_ARCHITECTURES,
#else
bfd_a29k_arch,
bfd_alpha_arch,
bfd_h8300_arch,
bfd_h8500_arch,
bfd_hppa_arch,
bfd_i386_arch,
bfd_i960_arch,
bfd_m68k_arch,
bfd_m88k_arch,
bfd_mips_arch,
bfd_rs6000_arch,
bfd_sh_arch,
bfd_sparc_arch,
bfd_vax_arch,
bfd_we32k_arch,
bfd_z8k_arch,
#endif
0
};
/*
INTERNAL_FUNCTION
bfd_arch_init
SYNOPSIS
void bfd_arch_init(void);
DESCRIPTION
This routine initializes the architecture dispatch table by
calling all installed architecture packages and getting them
to poke around.
*/
void
DEFUN_VOID(bfd_arch_init)
{
void (**ptable) PARAMS ((void));
for (ptable = archures_init_table;
*ptable ;
ptable++)
{
(*ptable)();
}
}
/*
INTERNAL_FUNCTION
bfd_arch_linkin
SYNOPSIS
void bfd_arch_linkin(bfd_arch_info_type *);
DESCRIPTION
Link the provided arch info structure into the list
*/
void DEFUN(bfd_arch_linkin,(ptr),
bfd_arch_info_type *ptr)
{
ptr->next = bfd_arch_info_list;
bfd_arch_info_list = ptr;
}
/*
INTERNAL_FUNCTION
bfd_default_compatible
SYNOPSIS
CONST bfd_arch_info_type *bfd_default_compatible
(CONST bfd_arch_info_type *a,
CONST bfd_arch_info_type *b);
DESCRIPTION
The default function for testing for compatibility.
*/
CONST bfd_arch_info_type *
DEFUN(bfd_default_compatible,(a,b),
CONST bfd_arch_info_type *a AND
CONST bfd_arch_info_type *b)
{
if(a->arch != b->arch) return NULL;
if (a->mach > b->mach) {
return a;
}
if (b->mach > a->mach) {
return b;
}
return a;
}
/*
INTERNAL_FUNCTION
bfd_default_scan
SYNOPSIS
boolean bfd_default_scan(CONST struct bfd_arch_info *, CONST char *);
DESCRIPTION
The default function for working out whether this is an
architecture hit and a machine hit.
*/
boolean
DEFUN(bfd_default_scan,(info, string),
CONST struct bfd_arch_info *info AND
CONST char *string)
{
CONST char *ptr_src;
CONST char *ptr_tst;
unsigned long number;
enum bfd_architecture arch;
/* First test for an exact match */
if (strcmp(string, info->printable_name) == 0) return true;
/* See how much of the supplied string matches with the
architecture, eg the string m68k:68020 would match the 68k entry
up to the :, then we get left with the machine number */
for (ptr_src = string,
ptr_tst = info->arch_name;
*ptr_src && *ptr_tst;
ptr_src++,
ptr_tst++)
{
if (*ptr_src != *ptr_tst) break;
}
/* Chewed up as much of the architecture as will match, skip any
colons */
if (*ptr_src == ':') ptr_src++;
if (*ptr_src == 0) {
/* nothing more, then only keep this one if it is the default
machine for this architecture */
return info->the_default;
}
number = 0;
while (isdigit(*ptr_src)) {
number = number * 10 + *ptr_src - '0';
ptr_src++;
}
switch (number)
{
case 300:
arch = bfd_arch_h8300;
break;
case 500:
arch = bfd_arch_h8500;
break;
case 68010:
case 68020:
case 68030:
case 68040:
case 68332:
case 68050:
case 68000:
arch = bfd_arch_m68k;
break;
case 386:
case 80386:
case 486:
case 80486:
arch = bfd_arch_i386;
break;
case 29000:
arch = bfd_arch_a29k;
break;
case 8000:
arch = bfd_arch_z8k;
break;
case 32000:
arch = bfd_arch_we32k;
break;
case 860:
case 80860:
arch = bfd_arch_i860;
break;
case 960:
case 80960:
arch = bfd_arch_i960;
break;
case 2000:
case 3000:
case 4000:
case 4400:
arch = bfd_arch_mips;
break;
case 6000:
arch = bfd_arch_rs6000;
break;
default:
return false;
}
if (arch != info->arch)
return false;
if (number != info->mach)
return false;
return true;
}
/*
FUNCTION
bfd_get_arch_info
SYNOPSIS
bfd_arch_info_type * bfd_get_arch_info(bfd *);
*/
bfd_arch_info_type *
DEFUN(bfd_get_arch_info,(abfd),
bfd *abfd)
{
return abfd->arch_info;
}
/*
FUNCTION
bfd_lookup_arch
SYNOPSIS
bfd_arch_info_type *bfd_lookup_arch
(enum bfd_architecture
arch,
long machine);
DESCRIPTION
Look for the architecure info struct which matches the
arguments given. A machine of 0 will match the
machine/architecture structure which marks itself as the
default.
*/
bfd_arch_info_type *
DEFUN(bfd_lookup_arch,(arch, machine),
enum bfd_architecture arch AND
long machine)
{
bfd_arch_info_type *ap;
bfd_check_init();
for (ap = bfd_arch_info_list;
ap != (bfd_arch_info_type *)NULL;
ap = ap->next) {
if (ap->arch == arch &&
((ap->mach == machine)
|| (ap->the_default && machine == 0))) {
return ap;
}
}
return (bfd_arch_info_type *)NULL;
}
/*
FUNCTION
bfd_printable_arch_mach
SYNOPSIS
CONST char * bfd_printable_arch_mach
(enum bfd_architecture arch, unsigned long machine);
DESCRIPTION
Return a printable string representing the architecture and
machine type.
NB. The use of this routine is depreciated.
*/
CONST char *
DEFUN(bfd_printable_arch_mach,(arch, machine),
enum bfd_architecture arch AND
unsigned long machine)
{
bfd_arch_info_type *ap = bfd_lookup_arch(arch, machine);
if(ap) return ap->printable_name;
return "UNKNOWN!";
}

733
gnu/usr.bin/gdb/bfd/bfd.c Normal file
View file

@ -0,0 +1,733 @@
/* Generic BFD library interface and support routines.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
<<typedef bfd>>
A BFD is has type <<bfd>>; objects of this type are the
cornerstone of any application using <<libbfd>>. References
though the BFD and to data in the BFD give the entire BFD
functionality.
Here is the struct used to define the type <<bfd>>. This
contains the major data about the file, and contains pointers
to the rest of the data.
CODE_FRAGMENT
.
.struct _bfd
.{
. {* The filename the application opened the BFD with. *}
. CONST char *filename;
.
. {* A pointer to the target jump table. *}
. struct bfd_target *xvec;
.
. {* To avoid dragging too many header files into every file that
. includes `<<bfd.h>>', IOSTREAM has been declared as a "char
. *", and MTIME as a "long". Their correct types, to which they
. are cast when used, are "FILE *" and "time_t". The iostream
. is the result of an fopen on the filename. *}
. char *iostream;
.
. {* Is the file being cached *}
.
. boolean cacheable;
.
. {* Marks whether there was a default target specified when the
. BFD was opened. This is used to select what matching algorithm
. to use to chose the back end. *}
.
. boolean target_defaulted;
.
. {* The caching routines use these to maintain a
. least-recently-used list of BFDs *}
.
. struct _bfd *lru_prev, *lru_next;
.
. {* When a file is closed by the caching routines, BFD retains
. state information on the file here:
. *}
.
. file_ptr where;
.
. {* and here:*}
.
. boolean opened_once;
.
. {* Set if we have a locally maintained mtime value, rather than
. getting it from the file each time: *}
.
. boolean mtime_set;
.
. {* File modified time, if mtime_set is true: *}
.
. long mtime;
.
. {* Reserved for an unimplemented file locking extension.*}
.
. int ifd;
.
. {* The format which belongs to the BFD.*}
.
. bfd_format format;
.
. {* The direction the BFD was opened with*}
.
. enum bfd_direction {no_direction = 0,
. read_direction = 1,
. write_direction = 2,
. both_direction = 3} direction;
.
. {* Format_specific flags*}
.
. flagword flags;
.
. {* Currently my_archive is tested before adding origin to
. anything. I believe that this can become always an add of
. origin, with origin set to 0 for non archive files. *}
.
. file_ptr origin;
.
. {* Remember when output has begun, to stop strange things
. happening. *}
. boolean output_has_begun;
.
. {* Pointer to linked list of sections*}
. struct sec *sections;
.
. {* The number of sections *}
. unsigned int section_count;
.
. {* Stuff only useful for object files:
. The start address. *}
. bfd_vma start_address;
.
. {* Used for input and output*}
. unsigned int symcount;
.
. {* Symbol table for output BFD*}
. struct symbol_cache_entry **outsymbols;
.
. {* Pointer to structure which contains architecture information*}
. struct bfd_arch_info *arch_info;
.
. {* Stuff only useful for archives:*}
. PTR arelt_data;
. struct _bfd *my_archive;
. struct _bfd *next;
. struct _bfd *archive_head;
. boolean has_armap;
.
. {* Used by the back end to hold private data. *}
.
. union
. {
. struct aout_data_struct *aout_data;
. struct artdata *aout_ar_data;
. struct _oasys_data *oasys_obj_data;
. struct _oasys_ar_data *oasys_ar_data;
. struct coff_tdata *coff_obj_data;
. struct ecoff_tdata *ecoff_obj_data;
. struct ieee_data_struct *ieee_data;
. struct ieee_ar_data_struct *ieee_ar_data;
. struct srec_data_struct *srec_data;
. struct tekhex_data_struct *tekhex_data;
. struct elf_obj_tdata *elf_obj_data;
. struct nlm_obj_tdata *nlm_obj_data;
. struct bout_data_struct *bout_data;
. struct sun_core_struct *sun_core_data;
. struct trad_core_struct *trad_core_data;
. struct hppa_data_struct *hppa_data;
. struct hpux_core_struct *hpux_core_data;
. struct sgi_core_struct *sgi_core_data;
. struct lynx_core_struct *lynx_core_data;
. struct osf_core_struct *osf_core_data;
. PTR any;
. } tdata;
.
. {* Used by the application to hold private data*}
. PTR usrdata;
.
. {* Where all the allocated stuff under this BFD goes *}
. struct obstack memory;
.
. {* Is this really needed in addition to usrdata? *}
. asymbol **ld_symbols;
.};
.
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "coff/sym.h"
#include "libcoff.h"
#include "libecoff.h"
#undef obj_symbols
#include "libelf.h"
#undef strerror
extern char *strerror();
/** Error handling
o - Most functions return nonzero on success (check doc for
precise semantics); 0 or NULL on error.
o - Internal errors are documented by the value of bfd_error.
If that is system_call_error then check errno.
o - The easiest way to report this to the user is to use bfd_perror.
*/
bfd_ec bfd_error = no_error;
CONST char *CONST bfd_errmsgs[] = {
"No error",
"System call error",
"Invalid target",
"File in wrong format",
"Invalid operation",
"Memory exhausted",
"No symbols",
"No relocation info",
"No more archived files",
"Malformed archive",
"Symbol not found",
"File format not recognized",
"File format is ambiguous",
"Section has no contents",
"Nonrepresentable section on output",
"Symbol needs debug section which does not exist",
"Bad value",
"File truncated",
"#<Invalid error code>"
};
static
void
DEFUN(bfd_nonrepresentable_section,(abfd, name),
CONST bfd * CONST abfd AND
CONST char * CONST name)
{
fprintf(stderr,
"bfd error writing file %s, format %s can't represent section %s\n",
abfd->filename,
abfd->xvec->name,
name);
exit(1);
}
/*ARGSUSED*/
static
void
DEFUN(bfd_undefined_symbol,(relent, seclet),
CONST arelent *relent AND
CONST struct bfd_seclet *seclet)
{
asymbol *symbol = *(relent->sym_ptr_ptr);
fprintf(stderr, "bfd error relocating, symbol %s is undefined\n",
symbol->name);
exit(1);
}
/*ARGSUSED*/
static
void
DEFUN(bfd_reloc_value_truncated,(relent, seclet),
CONST arelent *relent AND
struct bfd_seclet *seclet)
{
fprintf(stderr, "bfd error relocating, value truncated\n");
exit(1);
}
/*ARGSUSED*/
static
void
DEFUN(bfd_reloc_is_dangerous,(relent, seclet),
CONST arelent *relent AND
CONST struct bfd_seclet *seclet)
{
fprintf(stderr, "bfd error relocating, dangerous\n");
exit(1);
}
bfd_error_vector_type bfd_error_vector =
{
bfd_nonrepresentable_section ,
bfd_undefined_symbol,
bfd_reloc_value_truncated,
bfd_reloc_is_dangerous,
};
CONST char *
bfd_errmsg (error_tag)
bfd_ec error_tag;
{
#ifndef errno
extern int errno;
#endif
if (error_tag == system_call_error)
return strerror (errno);
if ((((int)error_tag <(int) no_error) ||
((int)error_tag > (int)invalid_error_code)))
error_tag = invalid_error_code;/* sanity check */
return bfd_errmsgs [(int)error_tag];
}
void
DEFUN (bfd_default_error_trap, (error_tag),
bfd_ec error_tag)
{
fprintf(stderr, "bfd assert fail (%s)\n", bfd_errmsg(error_tag));
}
void (*bfd_error_trap) PARAMS ((bfd_ec)) = bfd_default_error_trap;
void (*bfd_error_nonrepresentabltrap) PARAMS ((bfd_ec)) = bfd_default_error_trap;
void
DEFUN(bfd_perror,(message),
CONST char *message)
{
if (bfd_error == system_call_error)
perror((char *)message); /* must be system error then... */
else {
if (message == NULL || *message == '\0')
fprintf (stderr, "%s\n", bfd_errmsg (bfd_error));
else
fprintf (stderr, "%s: %s\n", message, bfd_errmsg (bfd_error));
}
}
/** Symbols */
/*
FUNCTION
bfd_get_reloc_upper_bound
SYNOPSIS
unsigned int bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
DESCRIPTION
This function return the number of bytes required to store the
relocation information associated with section <<sect>>
attached to bfd <<abfd>>
*/
unsigned int
DEFUN(bfd_get_reloc_upper_bound,(abfd, asect),
bfd *abfd AND
sec_ptr asect)
{
if (abfd->format != bfd_object) {
bfd_error = invalid_operation;
return 0;
}
return BFD_SEND (abfd, _get_reloc_upper_bound, (abfd, asect));
}
/*
FUNCTION
bfd_canonicalize_reloc
SYNOPSIS
unsigned int bfd_canonicalize_reloc
(bfd *abfd,
asection *sec,
arelent **loc,
asymbol **syms);
DESCRIPTION
This function calls the back end associated with the open
<<abfd>> and translates the external form of the relocation
information attached to <<sec>> into the internal canonical
form. The table is placed into memory at <<loc>>, which has
been preallocated, usually by a call to
<<bfd_get_reloc_upper_bound>>.
The <<syms>> table is also needed for horrible internal magic
reasons.
*/
unsigned int
DEFUN(bfd_canonicalize_reloc,(abfd, asect, location, symbols),
bfd *abfd AND
sec_ptr asect AND
arelent **location AND
asymbol **symbols)
{
if (abfd->format != bfd_object) {
bfd_error = invalid_operation;
return 0;
}
return BFD_SEND (abfd, _bfd_canonicalize_reloc,
(abfd, asect, location, symbols));
}
/*
FUNCTION
bfd_set_file_flags
SYNOPSIS
boolean bfd_set_file_flags(bfd *abfd, flagword flags);
DESCRIPTION
This function attempts to set the flag word in the referenced
BFD structure to the value supplied.
Possible errors are:
o wrong_format - The target bfd was not of object format.
o invalid_operation - The target bfd was open for reading.
o invalid_operation -
The flag word contained a bit which was not applicable to the
type of file. eg, an attempt was made to set the D_PAGED bit
on a bfd format which does not support demand paging
*/
boolean
bfd_set_file_flags (abfd, flags)
bfd *abfd;
flagword flags;
{
if (abfd->format != bfd_object) {
bfd_error = wrong_format;
return false;
}
if (bfd_read_p (abfd)) {
bfd_error = invalid_operation;
return false;
}
bfd_get_file_flags (abfd) = flags;
if ((flags & bfd_applicable_file_flags (abfd)) != flags) {
bfd_error = invalid_operation;
return false;
}
return true;
}
/*
FUNCTION
bfd_set_reloc
SYNOPSIS
void bfd_set_reloc
(bfd *abfd, asection *sec, arelent **rel, unsigned int count)
DESCRIPTION
This function sets the relocation pointer and count within a
section to the supplied values.
*/
/*ARGSUSED*/
void
bfd_set_reloc (ignore_abfd, asect, location, count)
bfd *ignore_abfd;
sec_ptr asect;
arelent **location;
unsigned int count;
{
asect->orelocation = location;
asect->reloc_count = count;
}
void
bfd_assert(file, line)
char *file;
int line;
{
fprintf(stderr, "bfd assertion fail %s:%d\n",file,line);
}
/*
FUNCTION
bfd_set_start_address
DESCRIPTION
Marks the entry point of an output BFD.
RETURNS
Returns <<true>> on success, <<false>> otherwise.
SYNOPSIS
boolean bfd_set_start_address(bfd *, bfd_vma);
*/
boolean
bfd_set_start_address(abfd, vma)
bfd *abfd;
bfd_vma vma;
{
abfd->start_address = vma;
return true;
}
/*
FUNCTION
The bfd_get_mtime function
SYNOPSIS
long bfd_get_mtime(bfd *);
DESCRIPTION
Return file modification time (as read from file system, or
from archive header for archive members).
*/
long
bfd_get_mtime (abfd)
bfd *abfd;
{
FILE *fp;
struct stat buf;
if (abfd->mtime_set)
return abfd->mtime;
fp = bfd_cache_lookup (abfd);
if (0 != fstat (fileno (fp), &buf))
return 0;
abfd->mtime = buf.st_mtime; /* Save value in case anyone wants it */
return buf.st_mtime;
}
/*
FUNCTION
The bfd_get_size function
SYNOPSIS
long bfd_get_size(bfd *);
DESCRIPTION
Return file size (as read from file system) for the file
associated with a bfd.
Note that the initial motivation for, and use of, this routine is not
so we can get the exact size of the object the bfd applies to, since
that might not be generally possible (archive members for example?).
Although it would be ideal if someone could eventually modify
it so that such results were guaranteed.
Instead, we want to ask questions like "is this NNN byte sized
object I'm about to try read from file offset YYY reasonable?"
As as example of where we might want to do this, some object formats
use string tables for which the first sizeof(long) bytes of the table
contain the size of the table itself, including the size bytes.
If an application tries to read what it thinks is one of these
string tables, without some way to validate the size, and for
some reason the size is wrong (byte swapping error, wrong location
for the string table, etc), the only clue is likely to be a read
error when it tries to read the table, or a "virtual memory
exhausted" error when it tries to allocated 15 bazillon bytes
of space for the 15 bazillon byte table it is about to read.
This function at least allows us to answer the quesion, "is the
size reasonable?".
*/
long
bfd_get_size (abfd)
bfd *abfd;
{
FILE *fp;
struct stat buf;
fp = bfd_cache_lookup (abfd);
if (0 != fstat (fileno (fp), &buf))
return 0;
return buf.st_size;
}
/*
FUNCTION
The bfd_get_gp_size function
SYNOPSIS
int bfd_get_gp_size(bfd *);
DESCRIPTION
Get the maximum size of objects to be optimized using the GP
register under MIPS ECOFF. This is typically set by the -G
argument to the compiler, assembler or linker.
*/
int
bfd_get_gp_size (abfd)
bfd *abfd;
{
if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
return ecoff_data (abfd)->gp_size;
return 0;
}
/*
FUNCTION
The bfd_set_gp_size function
SYNOPSIS
void bfd_set_gp_size(bfd *, int);
DESCRIPTION
Set the maximum size of objects to be optimized using the GP
register under ECOFF or MIPS ELF. This is typically set by
the -G argument to the compiler, assembler or linker.
*/
void
bfd_set_gp_size (abfd, i)
bfd *abfd;
int i;
{
if (abfd->xvec->flavour == bfd_target_ecoff_flavour)
ecoff_data (abfd)->gp_size = i;
else if (abfd->xvec->flavour == bfd_target_elf_flavour)
elf_gp_size (abfd) = i;
}
/*
FUNCTION
bfd_scan_vma
DESCRIPTION
Converts, like strtoul, a numerical expression as a
string into a bfd_vma integer, and returns that integer.
(Though without as many bells and whistles as strtoul.)
The expression is assumed to be unsigned (i.e. positive).
If given a base, it is used as the base for conversion.
A base of 0 causes the function to interpret the string
in hex if a leading "0x" or "0X" is found, otherwise
in octal if a leading zero is found, otherwise in decimal.
Overflow is not detected.
SYNOPSIS
bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base);
*/
bfd_vma
DEFUN(bfd_scan_vma,(string, end, base),
CONST char *string AND
CONST char **end AND
int base)
{
bfd_vma value;
int digit;
/* Let the host do it if possible. */
if (sizeof(bfd_vma) <= sizeof(unsigned long))
return (bfd_vma) strtoul (string, 0, base);
/* A negative base makes no sense, and we only need to go as high as hex. */
if ((base < 0) || (base > 16))
return (bfd_vma) 0;
if (base == 0)
{
if (string[0] == '0')
{
if ((string[1] == 'x') || (string[1] == 'X'))
base = 16;
/* XXX should we also allow "0b" or "0B" to set base to 2? */
else
base = 8;
}
else
base = 10;
}
if ((base == 16) &&
(string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X')))
string += 2;
/* XXX should we also skip over "0b" or "0B" if base is 2? */
/* Speed could be improved with a table like hex_value[] in gas. */
#define HEX_VALUE(c) \
(isxdigit(c) ? \
(isdigit(c) ? \
(c - '0') : \
(10 + c - (islower(c) ? 'a' : 'A'))) : \
42)
for (value = 0; (digit = HEX_VALUE(*string)) < base; string++)
{
value = value * base + digit;
}
if (end)
*end = string;
return value;
}
/*
FUNCTION
stuff
DESCRIPTION
stuff which should be documented
.#define bfd_sizeof_headers(abfd, reloc) \
. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
.
.#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
. BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
.
. {* Do these three do anything useful at all, for any back end? *}
.#define bfd_debug_info_start(abfd) \
. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
.
.#define bfd_debug_info_end(abfd) \
. BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
.
.#define bfd_debug_info_accumulate(abfd, section) \
. BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
.
.
.#define bfd_stat_arch_elt(abfd, stat) \
. BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
.
.#define bfd_set_arch_mach(abfd, arch, mach)\
. BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
.
.#define bfd_get_relocated_section_contents(abfd, seclet, data, relocateable) \
. BFD_SEND (abfd, _bfd_get_relocated_section_contents, (abfd, seclet, data, relocateable))
.
.#define bfd_relax_section(abfd, section, symbols) \
. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, symbols))
.
.#define bfd_seclet_link(abfd, data, relocateable) \
. BFD_SEND (abfd, _bfd_seclet_link, (abfd, data, relocateable))
*/

1803
gnu/usr.bin/gdb/bfd/bfd.h Normal file

File diff suppressed because it is too large Load diff

311
gnu/usr.bin/gdb/bfd/cache.c Normal file
View file

@ -0,0 +1,311 @@
/* BFD library -- caching of file descriptors.
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
File Caching
The file caching mechanism is embedded within BFD and allows
the application to open as many BFDs as it wants without
regard to the underlying operating system's file descriptor
limit (often as low as 20 open files). The module in
<<cache.c>> maintains a least recently used list of
<<BFD_CACHE_MAX_OPEN>> files, and exports the name
<<bfd_cache_lookup>> which runs around and makes sure that
the required BFD is open. If not, then it chooses a file to
close, closes it and opens the one wanted, returning its file
handle.
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/*
INTERNAL_FUNCTION
BFD_CACHE_MAX_OPEN macro
DESCRIPTION
The maximum number of files which the cache will keep open at
one time.
.#define BFD_CACHE_MAX_OPEN 10
*/
static boolean
bfd_cache_delete PARAMS ((bfd *));
/* Number of bfds on the chain. All such bfds have their file open;
if it closed, they get snipd()d from the chain. */
static int open_files;
static bfd *cache_sentinel; /* Chain of BFDs with active fds we've
opened */
/*
INTERNAL_FUNCTION
bfd_last_cache
SYNOPSIS
extern bfd *bfd_last_cache;
DESCRIPTION
Zero, or a pointer to the topmost BFD on the chain. This is
used by the <<bfd_cache_lookup>> macro in @file{libbfd.h} to
determine when it can avoid a function call.
*/
bfd *bfd_last_cache;
/*
* INTERNAL_FUNCTION
* bfd_cache_lookup
*
* DESCRIPTION
* Checks to see if the required BFD is the same as the last one
* looked up. If so then it can use the iostream in the BFD with
* impunity, since it can't have changed since the last lookup,
* otherwise it has to perform the complicated lookup function
*
* .#define bfd_cache_lookup(x) \
* . ((x)==bfd_last_cache? \
* . (FILE*)(bfd_last_cache->iostream): \
* . bfd_cache_lookup_worker(x))
*
*
*/
static void
DEFUN_VOID(close_one)
{
bfd *kill = cache_sentinel;
if (kill == 0) /* Nothing in the cache */
return ;
/* We can only close files that want to play this game. */
while (!kill->cacheable) {
kill = kill->lru_prev;
if (kill == cache_sentinel) /* Nobody wants to play */
return ;
}
kill->where = ftell((FILE *)(kill->iostream));
(void) bfd_cache_delete(kill);
}
/* Cuts the BFD abfd out of the chain in the cache */
static void
DEFUN(snip,(abfd),
bfd *abfd)
{
abfd->lru_prev->lru_next = abfd->lru_next;
abfd->lru_next->lru_prev = abfd->lru_prev;
if (cache_sentinel == abfd) cache_sentinel = (bfd *)NULL;
}
static boolean
DEFUN(bfd_cache_delete,(abfd),
bfd *abfd)
{
boolean ret;
if (fclose ((FILE *)(abfd->iostream)) == 0)
ret = true;
else
{
ret = false;
bfd_error = system_call_error;
}
snip (abfd);
abfd->iostream = NULL;
open_files--;
bfd_last_cache = 0;
return ret;
}
static bfd *
DEFUN(insert,(x,y),
bfd *x AND
bfd *y)
{
if (y) {
x->lru_next = y;
x->lru_prev = y->lru_prev;
y->lru_prev->lru_next = x;
y->lru_prev = x;
}
else {
x->lru_prev = x;
x->lru_next = x;
}
return x;
}
/* Initialize a BFD by putting it on the cache LRU. */
void
DEFUN(bfd_cache_init,(abfd),
bfd *abfd)
{
if (open_files >= BFD_CACHE_MAX_OPEN)
close_one ();
cache_sentinel = insert(abfd, cache_sentinel);
++open_files;
}
/*
INTERNAL_FUNCTION
bfd_cache_close
DESCRIPTION
Remove the BFD from the cache. If the attached file is open,
then close it too.
SYNOPSIS
boolean bfd_cache_close (bfd *);
RETURNS
<<false>> is returned if closing the file fails, <<true>> is
returned if all is well.
*/
boolean
DEFUN(bfd_cache_close,(abfd),
bfd *abfd)
{
/* If this file is open then remove from the chain */
if (abfd->iostream)
{
return bfd_cache_delete(abfd);
}
else
{
return true;
}
}
/*
INTERNAL_FUNCTION
bfd_open_file
DESCRIPTION
Call the OS to open a file for this BFD. Returns the FILE *
(possibly null) that results from this operation. Sets up the
BFD so that future accesses know the file is open. If the FILE
* returned is null, then there is won't have been put in the
cache, so it won't have to be removed from it.
SYNOPSIS
FILE* bfd_open_file(bfd *);
*/
FILE *
DEFUN(bfd_open_file, (abfd),
bfd *abfd)
{
abfd->cacheable = true; /* Allow it to be closed later. */
if(open_files >= BFD_CACHE_MAX_OPEN) {
close_one();
}
switch (abfd->direction) {
case read_direction:
case no_direction:
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_RB);
break;
case both_direction:
case write_direction:
if (abfd->opened_once == true) {
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_RUB);
if (!abfd->iostream) {
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_WUB);
}
} else {
/*open for creat */
abfd->iostream = (char *) fopen(abfd->filename, FOPEN_WB);
abfd->opened_once = true;
}
break;
}
if (abfd->iostream) {
bfd_cache_init (abfd);
}
return (FILE *)(abfd->iostream);
}
/*
INTERNAL_FUNCTION
bfd_cache_lookup_worker
DESCRIPTION
Called when the macro <<bfd_cache_lookup>> fails to find a
quick answer. Finds a file descriptor for this BFD. If
necessary, it open it. If there are already more than
BFD_CACHE_MAX_OPEN files open, it trys to close one first, to
avoid running out of file descriptors.
SYNOPSIS
FILE *bfd_cache_lookup_worker(bfd *);
*/
FILE *
DEFUN(bfd_cache_lookup_worker,(abfd),
bfd *abfd)
{
if (abfd->my_archive)
{
abfd = abfd->my_archive;
}
/* Is this file already open .. if so then quick exit */
if (abfd->iostream)
{
if (abfd != cache_sentinel) {
/* Place onto head of lru chain */
snip (abfd);
cache_sentinel = insert(abfd, cache_sentinel);
}
}
/* This is a BFD without a stream -
so it must have been closed or never opened.
find an empty cache entry and use it. */
else
{
if (open_files >= BFD_CACHE_MAX_OPEN)
{
close_one();
}
BFD_ASSERT(bfd_open_file (abfd) != (FILE *)NULL) ;
fseek((FILE *)(abfd->iostream), abfd->where, false);
}
bfd_last_cache = abfd;
return (FILE *)(abfd->iostream);
}

File diff suppressed because it is too large Load diff

106
gnu/usr.bin/gdb/bfd/core.c Normal file
View file

@ -0,0 +1,106 @@
/* Core file generic interface routines for BFD.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
Core files
DESCRIPTION
Buff output this facinating topic
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/*
FUNCTION
bfd_core_file_failing_command
SYNOPSIS
CONST char *bfd_core_file_failing_command(bfd *);
DESCRIPTION
Returns a read-only string explaining what program was running
when it failed and produced the core file being read
*/
CONST char *
DEFUN(bfd_core_file_failing_command,(abfd),
bfd *abfd)
{
if (abfd->format != bfd_core) {
bfd_error = invalid_operation;
return NULL;
}
return BFD_SEND (abfd, _core_file_failing_command, (abfd));
}
/*
FUNCTION
bfd_core_file_failing_signal
SYNOPSIS
int bfd_core_file_failing_signal(bfd *);
DESCRIPTION
Returns the signal number which caused the core dump which
generated the file the BFD is attached to.
*/
int
bfd_core_file_failing_signal (abfd)
bfd *abfd;
{
if (abfd->format != bfd_core) {
bfd_error = invalid_operation;
return 0;
}
return BFD_SEND (abfd, _core_file_failing_signal, (abfd));
}
/*
FUNCTION
core_file_matches_executable_p
SYNOPSIS
boolean core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
DESCRIPTION
Returns <<true>> if the core file attached to @var{core_bfd}
was generated by a run of the executable file attached to
@var{exec_bfd}, or else <<false>>.
*/
boolean
core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd, *exec_bfd;
{
if ((core_bfd->format != bfd_core) || (exec_bfd->format != bfd_object)) {
bfd_error = wrong_format;
return false;
}
return BFD_SEND (core_bfd, _core_file_matches_executable_p,
(core_bfd, exec_bfd));
}

View file

@ -0,0 +1,43 @@
/* BFD support for the Intel 386 architecture.
Copyright 1992 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
static bfd_arch_info_type arch_info_struct =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_i386,
0, /* only 1 machine */
"i386",
"i386",
3,
true, /* the one and only */
bfd_default_compatible,
bfd_default_scan ,
0,
};
void DEFUN_VOID(bfd_i386_arch)
{
bfd_arch_linkin(&arch_info_struct);
}

148
gnu/usr.bin/gdb/bfd/ctor.c Normal file
View file

@ -0,0 +1,148 @@
/* BFD library support routines for constructors
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support. With some help from
Judy Chamberlain too.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
Constructors
Classes in C++ have `constructors' and `destructors'. These
are functions which are called automatically by the language
whenever data of a class is created or destroyed. Class data
which is static data may also be have a type which requires
`construction', the contructor must be called before the data
can be referenced, so the contructor must be called before the
program begins.
The common solution to this problem is for the compiler to
call a magic function as the first statement <<main>>.
This magic function, (often called <<__main>>) runs around
calling the constructors for all the things needing it.
With COFF the compile has a bargain with the linker et al.
All constructors are given strange names, for example
<<__GLOBAL__$I$foo>> might be the label of a contructor for
the class @var{foo}. The solution on unfortunate systems
(most system V machines) is to perform a partial link on all
the <<.o>> files, do an <<nm>> on the result, run <<awk>> or some
such over the result looking for strange <<__GLOBAL__$>>
symbols, generate a C program from this, compile it and link
with the partially linked input. This process is usually
called <<collect>>.
Some versions of <<a.out>> use something called the
<<set_vector>> mechanism. The constructor symbols are output
from the compiler with a special stab code saying that they
are constructors, and the linker can deal with them directly.
BFD allows applications (ie the linker) to deal with
constructor information independently of their external
implimentation by providing a set of entry points for the
indiviual object back ends to call which maintains a database
of the contructor information. The application can
interrogate the database to find out what it wants. The
construction data essential for the linker to be able to
perform its job are:
o asymbol -
The asymbol of the contructor entry point contains all the
information necessary to call the function.
o table id -
The type of symbol, i.e., is it a constructor, a destructor or
something else someone dreamed up to make our lives difficult.
This module takes this information and then builds extra
sections attached to the bfds which own the entry points. It
creates these sections as if they were tables of pointers to
the entry points, and builds relocation entries to go with
them so that the tables can be relocated along with the data
they reference.
These sections are marked with a special bit
(<<SEC_CONSTRUCTOR>>) which the linker notices and do with
what it wants.
*/
#include <bfd.h>
#include <sysdep.h>
#include <libbfd.h>
/*
INTERNAL_FUNCTION
bfd_constructor_entry
SYNOPSIS
void bfd_constructor_entry(bfd *abfd,
asymbol **symbol_ptr_ptr,
CONST char*type);
DESCRIPTION
This function is called with an a symbol describing the
function to be called, an string which descibes the xtor type,
e.g., something like "CTOR" or "DTOR" would be fine. And the bfd
which owns the function. Its duty is to create a section
called "CTOR" or "DTOR" or whatever if the bfd doesn't already
have one, and grow a relocation table for the entry points as
they accumulate.
*/
void DEFUN(bfd_constructor_entry,(abfd, symbol_ptr_ptr, type),
bfd *abfd AND
asymbol **symbol_ptr_ptr AND
CONST char *type)
{
/* Look up the section we're using to store the table in */
asection *rel_section = bfd_get_section_by_name (abfd, type);
if (rel_section == (asection *)NULL) {
rel_section = bfd_make_section (abfd, type);
rel_section->flags = SEC_CONSTRUCTOR;
rel_section->alignment_power = 2;
}
/* Create a relocation into the section which references the entry
point */
{
arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd,
sizeof(arelent_chain));
/* reloc->relent.section = (asection *)NULL;*/
reloc->relent.addend = 0;
reloc->relent.sym_ptr_ptr = symbol_ptr_ptr;
reloc->next = rel_section->constructor_chain;
rel_section->constructor_chain = reloc;
reloc->relent.address = rel_section->_cooked_size;
/* ask the cpu which howto to use */
reloc->relent.howto = bfd_reloc_type_lookup(abfd, BFD_RELOC_CTOR);
rel_section->_cooked_size += sizeof(int *);
rel_section->reloc_count++;
}
}

3994
gnu/usr.bin/gdb/bfd/ecoff.c Normal file

File diff suppressed because it is too large Load diff

248
gnu/usr.bin/gdb/bfd/elf.c Normal file
View file

@ -0,0 +1,248 @@
/* ELF executable support for BFD.
Copyright 1993 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
ELF backends
BFD support for ELF formats is being worked on.
Currently, the best supported back ends are for sparc and i386
(running svr4 or Solaris 2).
Documentation of the internals of the support code still needs
to be written. The code is changing quickly enough that we
haven't bothered yet.
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#define ARCH_SIZE 0
#include "libelf.h"
/* Standard ELF hash function. Do not change this function; you will
cause invalid hash tables to be generated. (Well, you would if this
were being used yet.) */
unsigned long
DEFUN (bfd_elf_hash, (name),
CONST unsigned char *name)
{
unsigned long h = 0;
unsigned long g;
int ch;
while ((ch = *name++) != '\0')
{
h = (h << 4) + ch;
if ((g = (h & 0xf0000000)) != 0)
{
h ^= g >> 24;
h &= ~g;
}
}
return h;
}
/* Read a specified number of bytes at a specified offset in an ELF
file, into a newly allocated buffer, and return a pointer to the
buffer. */
static char *
DEFUN (elf_read, (abfd, offset, size),
bfd * abfd AND
long offset AND
int size)
{
char *buf;
if ((buf = bfd_alloc (abfd, size)) == NULL)
{
bfd_error = no_memory;
return NULL;
}
if (bfd_seek (abfd, offset, SEEK_SET) == -1)
{
bfd_error = system_call_error;
return NULL;
}
if (bfd_read ((PTR) buf, size, 1, abfd) != size)
{
bfd_error = system_call_error;
return NULL;
}
return buf;
}
boolean
DEFUN (elf_mkobject, (abfd), bfd * abfd)
{
/* this just does initialization */
/* coff_mkobject zalloc's space for tdata.coff_obj_data ... */
elf_tdata (abfd) = (struct elf_obj_tdata *)
bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
if (elf_tdata (abfd) == 0)
{
bfd_error = no_memory;
return false;
}
/* since everything is done at close time, do we need any
initialization? */
return true;
}
char *
DEFUN (elf_get_str_section, (abfd, shindex),
bfd * abfd AND
unsigned int shindex)
{
Elf_Internal_Shdr **i_shdrp;
char *shstrtab = NULL;
unsigned int offset;
unsigned int shstrtabsize;
i_shdrp = elf_elfsections (abfd);
if (i_shdrp == 0 || i_shdrp[shindex] == 0)
return 0;
shstrtab = i_shdrp[shindex]->rawdata;
if (shstrtab == NULL)
{
/* No cached one, attempt to read, and cache what we read. */
offset = i_shdrp[shindex]->sh_offset;
shstrtabsize = i_shdrp[shindex]->sh_size;
shstrtab = elf_read (abfd, offset, shstrtabsize);
i_shdrp[shindex]->rawdata = (void *) shstrtab;
}
return shstrtab;
}
char *
DEFUN (elf_string_from_elf_section, (abfd, shindex, strindex),
bfd * abfd AND
unsigned int shindex AND
unsigned int strindex)
{
Elf_Internal_Shdr *hdr;
if (strindex == 0)
return "";
hdr = elf_elfsections (abfd)[shindex];
if (!hdr->rawdata
&& elf_get_str_section (abfd, shindex) == NULL)
return NULL;
return ((char *) hdr->rawdata) + strindex;
}
/*
INTERNAL_FUNCTION
bfd_elf_find_section
SYNOPSIS
struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
DESCRIPTION
Helper functions for GDB to locate the string tables.
Since BFD hides string tables from callers, GDB needs to use an
internal hook to find them. Sun's .stabstr, in particular,
isn't even pointed to by the .stab section, so ordinary
mechanisms wouldn't work to find it, even if we had some.
*/
struct elf_internal_shdr *
DEFUN (bfd_elf_find_section, (abfd, name),
bfd * abfd AND
char *name)
{
Elf_Internal_Shdr **i_shdrp;
char *shstrtab;
unsigned int max;
unsigned int i;
i_shdrp = elf_elfsections (abfd);
if (i_shdrp != NULL)
{
shstrtab = elf_get_str_section (abfd, elf_elfheader (abfd)->e_shstrndx);
if (shstrtab != NULL)
{
max = elf_elfheader (abfd)->e_shnum;
for (i = 1; i < max; i++)
if (!strcmp (&shstrtab[i_shdrp[i]->sh_name], name))
return i_shdrp[i];
}
}
return 0;
}
const struct bfd_elf_arch_map bfd_elf_arch_map[] = {
{ bfd_arch_sparc, EM_SPARC },
{ bfd_arch_i386, EM_386 },
{ bfd_arch_m68k, EM_68K },
{ bfd_arch_m88k, EM_88K },
{ bfd_arch_i860, EM_860 },
{ bfd_arch_mips, EM_MIPS },
{ bfd_arch_hppa, EM_HPPA },
};
const int bfd_elf_arch_map_size = sizeof (bfd_elf_arch_map) / sizeof (bfd_elf_arch_map[0]);
const char *const bfd_elf_section_type_names[] = {
"SHT_NULL", "SHT_PROGBITS", "SHT_SYMTAB", "SHT_STRTAB",
"SHT_RELA", "SHT_HASH", "SHT_DYNAMIC", "SHT_NOTE",
"SHT_NOBITS", "SHT_REL", "SHT_SHLIB", "SHT_DYNSYM",
};
/* ELF relocs are against symbols. If we are producing relocateable
output, and the reloc is against an external symbol, and nothing
has given us any additional addend, the resulting reloc will also
be against the same symbol. In such a case, we don't want to
change anything about the way the reloc is handled, since it will
all be done at final link time. Rather than put special case code
into bfd_perform_relocation, all the reloc types use this howto
function. It just short circuits the reloc if producing
relocateable output against an external symbol. */
bfd_reloc_status_type
bfd_elf_generic_reloc (abfd,
reloc_entry,
symbol,
data,
input_section,
output_bfd)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
{
if (output_bfd != (bfd *) NULL
&& (symbol->flags & BSF_SECTION_SYM) == 0
&& reloc_entry->addend == 0)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
return bfd_reloc_continue;
}

View file

@ -0,0 +1,258 @@
/* Generic BFD support for file formats.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
File Formats
A format is a BFD concept of high level file contents. The
formats supported by BFD are:
o bfd_object
The BFD may contain data, symbols, relocations and debug info.
o bfd_archive
The BFD contains other BFDs and an optional index.
o bfd_core
The BFD contains the result of an executable core dump.
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
extern bfd_target *target_vector[];
extern bfd_target *default_vector[];
/*
FUNCTION
bfd_check_format
SYNOPSIS
boolean bfd_check_format(bfd *abfd, bfd_format format);
DESCRIPTION
This routine is supplied a BFD and a format. It attempts to
verify if the file attached to the BFD is indeed compatible
with the format specified (ie, one of <<bfd_object>>,
<<bfd_archive>> or <<bfd_core>>).
If the BFD has been set to a specific @var{target} before the
call, only the named target and format combination will be
checked. If the target has not been set, or has been set to
<<default>> then all the known target backends will be
interrogated to determine a match. If the default target
matches, it is used. If not, exactly one target must recognize
the file, or an error results.
The function returns <<true>> on success, otherwise <<false>>
with one of the following error codes:
o invalid_operation -
if <<format>> is not one of <<bfd_object>>, <<bfd_archive>> or
<<bfd_core>>.
o system_call_error -
if an error occured during a read - even some file mismatches
can cause system_call_errors
o file_not_recognised -
none of the backends recognised the file format
o file_ambiguously_recognized -
more than one backend recognised the file format.
*/
boolean
DEFUN(bfd_check_format,(abfd, format),
bfd *abfd AND
bfd_format format)
{
bfd_target **target, *save_targ, *right_targ;
int match_count;
if (!bfd_read_p (abfd) ||
((int)(abfd->format) < (int)bfd_unknown) ||
((int)(abfd->format) >= (int)bfd_type_end)) {
bfd_error = invalid_operation;
return false;
}
if (abfd->format != bfd_unknown)
return (abfd->format == format)? true: false;
/* Since the target type was defaulted, check them
all in the hope that one will be uniquely recognized. */
save_targ = abfd->xvec;
match_count = 0;
right_targ = 0;
/* presume the answer is yes */
abfd->format = format;
/* If the target type was explicitly specified, just check that target. */
if (!abfd->target_defaulted) {
bfd_seek (abfd, (file_ptr)0, SEEK_SET); /* rewind! */
right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (right_targ) {
abfd->xvec = right_targ; /* Set the target as returned */
return true; /* File position has moved, BTW */
}
}
for (target = target_vector; *target != NULL; target++) {
bfd_target *temp;
abfd->xvec = *target; /* Change BFD's target temporarily */
bfd_seek (abfd, (file_ptr)0, SEEK_SET);
/* If _bfd_check_format neglects to set bfd_error, assume wrong_format.
We didn't used to even pay any attention to bfd_error, so I suspect
that some _bfd_check_format might have this problem. */
bfd_error = wrong_format;
temp = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
if (temp) { /* This format checks out as ok! */
right_targ = temp;
match_count++;
/* If this is the default target, accept it, even if other targets
might match. People who want those other targets have to set
the GNUTARGET variable. */
if (temp == default_vector[0])
{
match_count = 1;
break;
}
#ifdef GNU960
/* Big- and little-endian b.out archives look the same, but it doesn't
* matter: there is no difference in their headers, and member file byte
* orders will (I hope) be handled appropriately by bfd. Ditto for big
* and little coff archives. And the 4 coff/b.out object formats are
* unambiguous. So accept the first match we find.
*/
break;
#endif
} else if (bfd_error != wrong_format) {
abfd->xvec = save_targ;
abfd->format = bfd_unknown;
return false;
}
}
if (match_count == 1) {
abfd->xvec = right_targ; /* Change BFD's target permanently */
return true; /* File position has moved, BTW */
}
abfd->xvec = save_targ; /* Restore original target type */
abfd->format = bfd_unknown; /* Restore original format */
bfd_error = ((match_count == 0) ? file_not_recognized :
file_ambiguously_recognized);
return false;
}
/*
FUNCTION
bfd_set_format
SYNOPSIS
boolean bfd_set_format(bfd *, bfd_format);
DESCRIPTION
This function sets the file format of the supplied BFD to the
format requested. If the target set in the BFD does not
support the format requested, the format is illegal or the BFD
is not open for writing than an error occurs.
*/
boolean
DEFUN(bfd_set_format,(abfd, format),
bfd *abfd AND
bfd_format format)
{
if (bfd_read_p (abfd) ||
((int)abfd->format < (int)bfd_unknown) ||
((int)abfd->format >= (int)bfd_type_end)) {
bfd_error = invalid_operation;
return false;
}
if (abfd->format != bfd_unknown)
return (abfd->format == format) ? true:false;
/* presume the answer is yes */
abfd->format = format;
if (!BFD_SEND_FMT (abfd, _bfd_set_format, (abfd))) {
abfd->format = bfd_unknown;
return false;
}
return true;
}
/*
FUNCTION
bfd_format_string
SYNOPSIS
CONST char *bfd_format_string(bfd_format);
DESCRIPTION
This function takes one argument, and enumerated type
(bfd_format) and returns a pointer to a const string
<<invalid>>, <<object>>, <<archive>>, <<core>> or <<unknown>>
depending upon the value of the enumeration.
*/
CONST char *
DEFUN(bfd_format_string,(format),
bfd_format format)
{
if (((int)format <(int) bfd_unknown)
|| ((int)format >=(int) bfd_type_end))
return "invalid";
switch (format) {
case bfd_object:
return "object"; /* linker/assember/compiler output */
case bfd_archive:
return "archive"; /* object archive file */
case bfd_core:
return "core"; /* core dump */
default:
return "unknown";
}
}

View file

@ -0,0 +1,111 @@
/* BFD back-end for i386 a.out binaries under BSD.
Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This data should be correct for the format used under all the various
BSD ports for 386 machines. */
#define BYTES_IN_WORD 4
#define ARCH 32
/* ZMAGIC files never have the header in the text. */
#define N_HEADER_IN_TEXT(x) 0
/* ZMAGIC files start at address 0. This does not apply to QMAGIC. */
#define TEXT_START_ADDR 0
#define PAGE_SIZE 4096
#define SEGMENT_SIZE PAGE_SIZE
#define DEFAULT_ARCH bfd_arch_i386
#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN)
#define MY(OP) CAT(freebsd386_,OP)
#define TARGETNAME "a.out-freebsd-386"
#define N_MAGIC(ex) \
((ex).a_info & 0xffff)
#define N_MACHTYPE(ex) \
( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETMID_NET(ex) : \
((ex).a_info >> 16) & 0x03ff )
#define N_FLAGS(ex) \
( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETFLAG_NET(ex) : \
((ex).a_info >> 26) & 0x3f )
#define N_SET_INFO(ex,mag,mid,flag) \
( (ex).a_info = (((flag) & 0x3f) <<26) | (((mid) & 0x03ff) << 16) | \
((mag) & 0xffff) )
#define N_GETMAGIC_NET(ex) \
(ntohl((ex).a_info) & 0xffff)
#define N_GETMID_NET(ex) \
((ntohl((ex).a_info) >> 16) & 0x03ff)
#define N_GETFLAG_NET(ex) \
((ntohl((ex).a_info) >> 26) & 0x3f)
#define N_SETMAGIC_NET(ex,mag,mid,flag) \
( (ex).a_info = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
(((mag)&0xffff)) ) )
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "libaout.h"
#define N_ALIGN(ex,x) \
(N_MAGIC(ex) == ZMAGIC || N_MAGIC(ex) == QMAGIC || \
N_GETMAGIC_NET(ex) == ZMAGIC || N_GETMAGIC_NET(ex) == QMAGIC ? \
((x) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1) : (x))
/* Valid magic number check. */
#define N_BADMAG(ex) \
(N_MAGIC(ex) != OMAGIC && N_MAGIC(ex) != NMAGIC && \
N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != QMAGIC && \
N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \
N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC)
/* Address of the bottom of the text segment. */
#define N_TXTADDR(ex) \
((N_MAGIC(ex) == OMAGIC || N_MAGIC(ex) == NMAGIC || \
N_MAGIC(ex) == ZMAGIC) ? 0 : PAGE_SIZE)
/* Address of the bottom of the data segment. */
#define N_DATADDR(ex) \
N_ALIGN(ex, N_TXTADDR(ex) + (ex).a_text)
/* Text segment offset. */
#define N_TXTOFF(ex) \
(N_MAGIC(ex) == ZMAGIC ? PAGE_SIZE : (N_MAGIC(ex) == QMAGIC || \
N_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : EXEC_BYTES_SIZE)
/* Data segment offset. */
#define N_DATOFF(ex) \
N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text)
/* Relocation table offset. */
#define N_RELOFF(ex) \
N_ALIGN(ex, N_DATOFF(ex) + (ex).a_data)
/* Symbol table offset. */
#define N_SYMOFF(ex) \
(N_RELOFF(ex) + (ex).a_trsize + (ex).a_drsize)
/* String table offset. */
#define N_STROFF(ex) (N_SYMOFF(ex) + (ex).a_syms)
#define NO_SWAP_MAGIC /* magic number already in correct endian format */
#include "aout-target.h"

View file

@ -0,0 +1,78 @@
/* bfd initialization stuff
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
extern void DEFUN_VOID (bfd_section_init);
static boolean initialized = false;
/*
SECTION
Initialization
This is the initialization section
*/
/*
FUNCTION
bfd_init
SYNOPSIS
void bfd_init(void);
DESCRIPTION
This routine must be called before any other bfd function to
initialize magical internal data structures.
*/
void DEFUN_VOID(bfd_init)
{
if (initialized == false) {
initialized = true;
bfd_arch_init();
}
}
/*
INTERNAL_FUNCTION
bfd_check_init
DESCRIPTION
This routine is called before any other bfd function using
initialized data is used to ensure that the structures have
been initialized. Soon this function will go away, and the bfd
library will assume that bfd_init has been called.
SYNOPSIS
void bfd_check_init(void);
*/
void DEFUN_VOID(bfd_check_init)
{
if (initialized == false) {
bfd_init();
}
}

View file

@ -0,0 +1,393 @@
/* BFD back-end data structures for a.out (and similar) files.
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* We try to encapsulate the differences in the various a.out file
variants in a few routines, and otherwise share large masses of code.
This means we only have to fix bugs in one place, most of the time. */
/* Parameterize the a.out code based on whether it is being built
for a 32-bit architecture or a 64-bit architecture. */
#if ARCH_SIZE==64
#define GET_WORD bfd_h_get_64
#define GET_SWORD bfd_h_get_signed_64
#define PUT_WORD bfd_h_put_64
#ifndef NAME
#define NAME(x,y) CAT3(x,_64_,y)
#endif
#define JNAME(x) CAT(x,_64)
#define BYTES_IN_WORD 8
#else /* ARCH_SIZE == 32 */
#define GET_WORD bfd_h_get_32
#define GET_SWORD bfd_h_get_signed_32
#define PUT_WORD bfd_h_put_32
#ifndef NAME
#define NAME(x,y) CAT3(x,_32_,y)
#endif
#define JNAME(x) CAT(x,_32)
#define BYTES_IN_WORD 4
#endif /* ARCH_SIZE==32 */
/* Declare these types at file level, since they are used in parameter
lists, which have wierd scope. */
struct external_exec;
struct internal_exec;
/* Back-end information for various a.out targets. */
struct aout_backend_data
{
/* Are ZMAGIC files mapped contiguously? If so, the text section may
need more padding, if the segment size (granularity for memory access
control) is larger than the page size. */
unsigned char zmagic_mapped_contiguous;
/* If this flag is set, ZMAGIC/NMAGIC file headers get mapped in with the
text section, which starts immediately after the file header.
If not, the text section starts on the next page. */
unsigned char text_includes_header;
/* If the text section VMA isn't specified, and we need an absolute
address, use this as the default. If we're producing a relocatable
file, zero is always used. */
/* ?? Perhaps a callback would be a better choice? Will this do anything
reasonable for a format that handles multiple CPUs with different
load addresses for each? */
bfd_vma default_text_vma;
/* Callback for setting the page and segment sizes, if they can't be
trivially determined from the architecture. */
boolean (*set_sizes) PARAMS ((bfd *));
/* zmagic files only. For go32, the length of the exec header contributes
to the size of the text section in the file for alignment purposes but
does *not* get counted in the length of the text section. */
unsigned char exec_header_not_counted;
};
#define aout_backend_info(abfd) \
((CONST struct aout_backend_data *)((abfd)->xvec->backend_data))
/* This is the layout in memory of a "struct exec" while we process it.
All 'lengths' are given as a number of bytes.
All 'alignments' are for relinkable files only; an alignment of
'n' indicates the corresponding segment must begin at an
address that is a multiple of (2**n). */
struct internal_exec
{
long a_info; /* Magic number and flags, packed */
bfd_vma a_text; /* length of text, in bytes */
bfd_vma a_data; /* length of data, in bytes */
bfd_vma a_bss; /* length of uninitialized data area in mem */
bfd_vma a_syms; /* length of symbol table data in file */
bfd_vma a_entry; /* start address */
bfd_vma a_trsize; /* length of text's relocation info, in bytes */
bfd_vma a_drsize; /* length of data's relocation info, in bytes */
/* Added for i960 */
bfd_vma a_tload; /* Text runtime load address */
bfd_vma a_dload; /* Data runtime load address */
unsigned char a_talign; /* Alignment of text segment */
unsigned char a_dalign; /* Alignment of data segment */
unsigned char a_balign; /* Alignment of bss segment */
char a_relaxable; /* Enough info for linker relax */
};
/* Magic number is written
< MSB >
3130292827262524232221201918171615141312111009080706050403020100
< FLAGS >< MACHINE TYPE >< MAGIC NUMBER >
*/
/* Magic number for NetBSD is
<MSB >
3130292827262524232221201918171615141312111009080706050403020100
< FLAGS >< >< MAGIC NUMBER >
*/
enum machine_type {
M_UNKNOWN = 0,
M_68010 = 1,
M_68020 = 2,
M_SPARC = 3,
/* skip a bunch so we don't run into any of suns numbers */
M_386 = 100,
M_29K = 101, /* AMD 29000 */
M_386_DYNIX = 102, /* Sequent running dynix */
M_386_NETBSD = 134, /* NetBSD/386 binary */
M_MIPS1 = 151, /* MIPS R2000/R3000 binary */
M_MIPS2 = 152, /* MIPS R4000/R6000 binary */
M_HP200 = 200, /* HP 200 (68010) BSD binary */
M_HP300 = (300 % 256), /* HP 300 (68020+68881) BSD binary */
M_HPUX = (0x20c % 256)/* HP 200/300 HPUX binary */
};
#define N_DYNAMIC(exec) ((exec).a_info & 0x8000000)
#ifndef N_MAGIC
# define N_MAGIC(exec) ((exec).a_info & 0xffff)
#endif
#ifndef N_MACHTYPE
# define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
#endif
#ifndef N_FLAGS
# define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
#endif
#ifndef N_SET_INFO
# define N_SET_INFO(exec, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \
| (((int)(type) & 0xff) << 16) \
| (((flags) & 0xff) << 24))
#endif
#ifndef N_SET_MAGIC
# define N_SET_MAGIC(exec, magic) \
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
#endif
#ifndef N_SET_MACHTYPE
# define N_SET_MACHTYPE(exec, machtype) \
((exec).a_info = \
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
#endif
#ifndef N_SET_FLAGS
# define N_SET_FLAGS(exec, flags) \
((exec).a_info = \
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
#endif
typedef struct aout_symbol {
asymbol symbol;
short desc;
char other;
unsigned char type;
} aout_symbol_type;
/* The `tdata' struct for all a.out-like object file formats.
Various things depend on this struct being around any time an a.out
file is being handled. An example is dbxread.c in GDB. */
struct aoutdata {
struct internal_exec *hdr; /* exec file header */
aout_symbol_type *symbols; /* symtab for input bfd */
/* For ease, we do this */
asection *textsec;
asection *datasec;
asection *bsssec;
/* We remember these offsets so that after check_file_format, we have
no dependencies on the particular format of the exec_hdr. */
file_ptr sym_filepos;
file_ptr str_filepos;
/* Size of a relocation entry in external form */
unsigned reloc_entry_size;
/* Size of a symbol table entry in external form */
unsigned symbol_entry_size;
/* Page size - needed for alignment of demand paged files. */
unsigned long page_size;
/* Segment size - needed for alignment of demand paged files. */
unsigned long segment_size;
unsigned exec_bytes_size;
unsigned vma_adjusted : 1;
/* used when a bfd supports several highly similar formats */
enum {
default_format = 0,
gnu_encap_format } subformat;
enum {
undecided_magic = 0,
z_magic,
o_magic,
n_magic } magic;
};
struct aout_data_struct {
struct aoutdata a;
struct internal_exec e;
};
#define adata(bfd) ((bfd)->tdata.aout_data->a)
#define exec_hdr(bfd) (adata(bfd).hdr)
#define obj_aout_symbols(bfd) (adata(bfd).symbols)
#define obj_textsec(bfd) (adata(bfd).textsec)
#define obj_datasec(bfd) (adata(bfd).datasec)
#define obj_bsssec(bfd) (adata(bfd).bsssec)
#define obj_sym_filepos(bfd) (adata(bfd).sym_filepos)
#define obj_str_filepos(bfd) (adata(bfd).str_filepos)
#define obj_reloc_entry_size(bfd) (adata(bfd).reloc_entry_size)
#define obj_symbol_entry_size(bfd) (adata(bfd).symbol_entry_size)
#define obj_aout_subformat(bfd) (adata(bfd).subformat)
/* We take the address of the first element of an asymbol to ensure that the
macro is only ever applied to an asymbol */
#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
/* Prototype declarations for functions defined in aoutx.h */
boolean
NAME(aout,squirt_out_relocs) PARAMS ((bfd *abfd, asection *section));
bfd_target *
NAME(aout,some_aout_object_p) PARAMS ((bfd *abfd,
struct internal_exec *execp,
bfd_target * (*callback)(bfd *)));
boolean
NAME(aout,mkobject) PARAMS ((bfd *abfd));
enum machine_type
NAME(aout,machine_type) PARAMS ((enum bfd_architecture arch,
unsigned long machine));
boolean
NAME(aout,set_arch_mach) PARAMS ((bfd *abfd, enum bfd_architecture arch,
unsigned long machine));
boolean
NAME(aout,new_section_hook) PARAMS ((bfd *abfd, asection *newsect));
boolean
NAME(aout,set_section_contents) PARAMS ((bfd *abfd, sec_ptr section,
PTR location, file_ptr offset, bfd_size_type count));
asymbol *
NAME(aout,make_empty_symbol) PARAMS ((bfd *abfd));
boolean
NAME(aout,slurp_symbol_table) PARAMS ((bfd *abfd));
void
NAME(aout,write_syms) PARAMS ((bfd *abfd));
void
NAME(aout,reclaim_symbol_table) PARAMS ((bfd *abfd));
unsigned int
NAME(aout,get_symtab_upper_bound) PARAMS ((bfd *abfd));
unsigned int
NAME(aout,get_symtab) PARAMS ((bfd *abfd, asymbol **location));
boolean
NAME(aout,slurp_reloc_table) PARAMS ((bfd *abfd, sec_ptr asect,
asymbol **symbols));
unsigned int
NAME(aout,canonicalize_reloc) PARAMS ((bfd *abfd, sec_ptr section,
arelent **relptr, asymbol **symbols));
unsigned int
NAME(aout,get_reloc_upper_bound) PARAMS ((bfd *abfd, sec_ptr asect));
void
NAME(aout,reclaim_reloc) PARAMS ((bfd *ignore_abfd, sec_ptr ignore));
alent *
NAME(aout,get_lineno) PARAMS ((bfd *ignore_abfd, asymbol *ignore_symbol));
void
NAME(aout,print_symbol) PARAMS ((bfd *ignore_abfd, PTR file,
asymbol *symbol, bfd_print_symbol_type how));
void
NAME(aout,get_symbol_info) PARAMS ((bfd *ignore_abfd,
asymbol *symbol, symbol_info *ret));
boolean
NAME(aout,close_and_cleanup) PARAMS ((bfd *abfd));
boolean
NAME(aout,find_nearest_line) PARAMS ((bfd *abfd, asection *section,
asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
CONST char **functionname_ptr, unsigned int *line_ptr));
int
NAME(aout,sizeof_headers) PARAMS ((bfd *abfd, boolean exec));
boolean
NAME(aout,adjust_sizes_and_vmas) PARAMS ((bfd *abfd,
bfd_size_type *text_size, file_ptr *text_end));
void
NAME(aout,swap_exec_header_in) PARAMS ((bfd *abfd,
struct external_exec *raw_bytes, struct internal_exec *execp));
void
NAME(aout,swap_exec_header_out) PARAMS ((bfd *abfd,
struct internal_exec *execp, struct external_exec *raw_bytes));
/* Prototypes for functions in stab-syms.c. */
CONST char *
aout_stab_name PARAMS ((int code));
/* A.out uses the generic versions of these routines... */
#define aout_32_get_section_contents bfd_generic_get_section_contents
#define aout_32_close_and_cleanup bfd_generic_close_and_cleanup
#define aout_64_get_section_contents bfd_generic_get_section_contents
#define aout_64_close_and_cleanup bfd_generic_close_and_cleanup
#ifndef NO_WRITE_HEADER_KLUDGE
#define NO_WRITE_HEADER_KLUDGE 0
#endif
#ifndef WRITE_HEADERS
#define WRITE_HEADERS(abfd, execp) \
{ \
bfd_size_type text_size; /* dummy vars */ \
file_ptr text_end; \
if (adata(abfd).magic == undecided_magic) \
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
\
execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
execp->a_entry = bfd_get_start_address (abfd); \
\
execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
obj_reloc_entry_size (abfd)); \
execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
obj_reloc_entry_size (abfd)); \
NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
\
bfd_seek (abfd, (file_ptr) 0, SEEK_SET); \
bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd); \
/* Now write out reloc info, followed by syms and strings */ \
\
if (bfd_get_symcount (abfd) != 0) \
{ \
bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET); \
\
NAME(aout,write_syms)(abfd); \
\
bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET); \
\
if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) return false; \
bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET); \
\
if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) return false; \
} \
}
#endif

View file

@ -0,0 +1,850 @@
/* Assorted BFD support routines, only used internally.
Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/*
SECTION
libbfd
DESCRIPTION
This file contains various routines which are used within BFD.
They are not intended for export, but are documented here for
completeness.
*/
boolean
DEFUN(_bfd_dummy_new_section_hook,(ignore, ignore_newsect),
bfd *ignore AND
asection *ignore_newsect)
{
return true;
}
boolean
DEFUN(bfd_false ,(ignore),
bfd *ignore)
{
return false;
}
boolean
DEFUN(bfd_true,(ignore),
bfd *ignore)
{
return true;
}
PTR
DEFUN(bfd_nullvoidptr,(ignore),
bfd *ignore)
{
return (PTR)NULL;
}
int
DEFUN(bfd_0,(ignore),
bfd *ignore)
{
return 0;
}
unsigned int
DEFUN(bfd_0u,(ignore),
bfd *ignore)
{
return 0;
}
void
DEFUN(bfd_void,(ignore),
bfd *ignore)
{
}
boolean
DEFUN(_bfd_dummy_core_file_matches_executable_p,(ignore_core_bfd, ignore_exec_bfd),
bfd *ignore_core_bfd AND
bfd *ignore_exec_bfd)
{
bfd_error = invalid_operation;
return false;
}
/* of course you can't initialize a function to be the same as another, grr */
char *
DEFUN(_bfd_dummy_core_file_failing_command,(ignore_abfd),
bfd *ignore_abfd)
{
return (char *)NULL;
}
int
DEFUN(_bfd_dummy_core_file_failing_signal,(ignore_abfd),
bfd *ignore_abfd)
{
return 0;
}
bfd_target *
DEFUN(_bfd_dummy_target,(ignore_abfd),
bfd *ignore_abfd)
{
return 0;
}
/** zalloc -- allocate and clear storage */
#ifndef zalloc
char *
DEFUN(zalloc,(size),
bfd_size_type size)
{
char *ptr = (char *) malloc ((size_t)size);
if ((ptr != NULL) && (size != 0))
memset(ptr,0, (size_t) size);
return ptr;
}
#endif
/*
INTERNAL_FUNCTION
bfd_xmalloc
SYNOPSIS
PTR bfd_xmalloc( bfd_size_type size);
DESCRIPTION
Like malloc, but exit if no more memory.
*/
/** There is major inconsistency in how running out of memory is handled.
Some routines return a NULL, and set bfd_error to no_memory.
However, obstack routines can't do this ... */
DEFUN(PTR bfd_xmalloc,(size),
bfd_size_type size)
{
static CONST char no_memory_message[] = "Virtual memory exhausted!\n";
PTR ptr;
if (size == 0) size = 1;
ptr = (PTR)malloc((size_t) size);
if (!ptr)
{
write (2, no_memory_message, sizeof(no_memory_message)-1);
exit (-1);
}
return ptr;
}
/*
INTERNAL_FUNCTION
bfd_xmalloc_by_size_t
SYNOPSIS
PTR bfd_xmalloc_by_size_t ( size_t size);
DESCRIPTION
Like malloc, but exit if no more memory.
Uses size_t, so it's suitable for use as obstack_chunk_alloc.
*/
PTR
DEFUN(bfd_xmalloc_by_size_t, (size),
size_t size)
{
return bfd_xmalloc ((bfd_size_type) size);
}
/* Some IO code */
/* Note that archive entries don't have streams; they share their parent's.
This allows someone to play with the iostream behind BFD's back.
Also, note that the origin pointer points to the beginning of a file's
contents (0 for non-archive elements). For archive entries this is the
first octet in the file, NOT the beginning of the archive header. */
static
int DEFUN(real_read,(where, a,b, file),
PTR where AND
int a AND
int b AND
FILE *file)
{
return fread(where, a,b,file);
}
bfd_size_type
DEFUN(bfd_read,(ptr, size, nitems, abfd),
PTR ptr AND
bfd_size_type size AND
bfd_size_type nitems AND
bfd *abfd)
{
int nread;
nread = real_read (ptr, 1, (int)(size*nitems), bfd_cache_lookup(abfd));
#ifdef FILE_OFFSET_IS_CHAR_INDEX
if (nread > 0)
abfd->where += nread;
#endif
return nread;
}
bfd_size_type
DEFUN(bfd_write,(ptr, size, nitems, abfd),
CONST PTR ptr AND
bfd_size_type size AND
bfd_size_type nitems AND
bfd *abfd)
{
int nwrote = fwrite (ptr, 1, (int)(size*nitems), bfd_cache_lookup(abfd));
#ifdef FILE_OFFSET_IS_CHAR_INDEX
if (nwrote > 0)
abfd->where += nwrote;
#endif
return nwrote;
}
/*
INTERNAL_FUNCTION
bfd_write_bigendian_4byte_int
SYNOPSIS
void bfd_write_bigendian_4byte_int(bfd *abfd, int i);
DESCRIPTION
Writes a 4 byte integer to the outputing bfd, in big endian
mode regardless of what else is going on. This is useful in
archives.
*/
void
DEFUN(bfd_write_bigendian_4byte_int,(abfd, i),
bfd *abfd AND
int i)
{
bfd_byte buffer[4];
bfd_putb32(i, buffer);
bfd_write((PTR)buffer, 4, 1, abfd);
}
long
DEFUN(bfd_tell,(abfd),
bfd *abfd)
{
file_ptr ptr;
ptr = ftell (bfd_cache_lookup(abfd));
if (abfd->my_archive)
ptr -= abfd->origin;
abfd->where = ptr;
return ptr;
}
int
DEFUN(bfd_flush,(abfd),
bfd *abfd)
{
return fflush (bfd_cache_lookup(abfd));
}
int
DEFUN(bfd_stat,(abfd, statbuf),
bfd *abfd AND
struct stat *statbuf)
{
return fstat (fileno(bfd_cache_lookup(abfd)), statbuf);
}
int
DEFUN(bfd_seek,(abfd, position, direction),
bfd * CONST abfd AND
CONST file_ptr position AND
CONST int direction)
{
int result;
FILE *f;
file_ptr file_position;
/* For the time being, a BFD may not seek to it's end. The problem
is that we don't easily have a way to recognize the end of an
element in an archive. */
BFD_ASSERT (direction == SEEK_SET || direction == SEEK_CUR);
if (direction == SEEK_CUR && position == 0)
return 0;
#ifdef FILE_OFFSET_IS_CHAR_INDEX
if (abfd->format != bfd_archive && abfd->my_archive == 0)
{
#ifndef NDEBUG
/* Explanation for this code: I'm only about 95+% sure that the above
conditions are sufficient and that all i/o calls are properly
adjusting the `where' field. So this is sort of an `assert'
that the `where' field is correct. If we can go a while without
tripping the abort, we can probably safely disable this code,
so that the real optimizations happen. */
file_ptr where_am_i_now;
where_am_i_now = ftell (bfd_cache_lookup (abfd));
if (abfd->my_archive)
where_am_i_now -= abfd->origin;
if (where_am_i_now != abfd->where)
abort ();
#endif
if (direction == SEEK_SET && position == abfd->where)
return 0;
}
else
{
/* We need something smarter to optimize access to archives.
Currently, anything inside an archive is read via the file
handle for the archive. Which means that a bfd_seek on one
component affects the `current position' in the archive, as
well as in any other component.
It might be sufficient to put a spike through the cache
abstraction, and look to the archive for the file position,
but I think we should try for something cleaner.
In the meantime, no optimization for archives. */
}
#endif
f = bfd_cache_lookup (abfd);
file_position = position;
if (direction == SEEK_SET && abfd->my_archive != NULL)
file_position += abfd->origin;
result = fseek (f, file_position, direction);
if (result != 0)
/* Force redetermination of `where' field. */
bfd_tell (abfd);
else
{
#ifdef FILE_OFFSET_IS_CHAR_INDEX
/* Adjust `where' field. */
if (direction == SEEK_SET)
abfd->where = position;
else
abfd->where += position;
#endif
}
return result;
}
/** Make a string table */
/*>bfd.h<
Add string to table pointed to by table, at location starting with free_ptr.
resizes the table if necessary (if it's NULL, creates it, ignoring
table_length). Updates free_ptr, table, table_length */
boolean
DEFUN(bfd_add_to_string_table,(table, new_string, table_length, free_ptr),
char **table AND
char *new_string AND
unsigned int *table_length AND
char **free_ptr)
{
size_t string_length = strlen (new_string) + 1; /* include null here */
char *base = *table;
size_t space_length = *table_length;
unsigned int offset = (base ? *free_ptr - base : 0);
if (base == NULL) {
/* Avoid a useless regrow if we can (but of course we still
take it next time */
space_length = (string_length < DEFAULT_STRING_SPACE_SIZE ?
DEFAULT_STRING_SPACE_SIZE : string_length+1);
base = zalloc ((bfd_size_type) space_length);
if (base == NULL) {
bfd_error = no_memory;
return false;
}
}
if ((size_t)(offset + string_length) >= space_length) {
/* Make sure we will have enough space */
while ((size_t)(offset + string_length) >= space_length)
space_length += space_length/2; /* grow by 50% */
base = (char *) realloc (base, space_length);
if (base == NULL) {
bfd_error = no_memory;
return false;
}
}
memcpy (base + offset, new_string, string_length);
*table = base;
*table_length = space_length;
*free_ptr = base + offset + string_length;
return true;
}
/** The do-it-yourself (byte) sex-change kit */
/* The middle letter e.g. get<b>short indicates Big or Little endian
target machine. It doesn't matter what the byte order of the host
machine is; these routines work for either. */
/* FIXME: Should these take a count argument?
Answer (gnu@cygnus.com): No, but perhaps they should be inline
functions in swap.h #ifdef __GNUC__.
Gprof them later and find out. */
/*
FUNCTION
bfd_put_size
FUNCTION
bfd_get_size
DESCRIPTION
These macros as used for reading and writing raw data in
sections; each access (except for bytes) is vectored through
the target format of the BFD and mangled accordingly. The
mangling performs any necessary endian translations and
removes alignment restrictions. Note that types accepted and
returned by these macros are identical so they can be swapped
around in macros--for example libaout.h defines GET_WORD to
either bfd_get_32 or bfd_get_64.
In the put routines, val must be a bfd_vma. If we are on a
system without prototypes, the caller is responsible for making
sure that is true, with a cast if necessary. We don't cast
them in the macro definitions because that would prevent lint
or gcc -Wall from detecting sins such as passing a pointer.
To detect calling these with less than a bfd_vma, use gcc
-Wconversion on a host with 64 bit bfd_vma's.
.
.{* Byte swapping macros for user section data. *}
.
.#define bfd_put_8(abfd, val, ptr) \
. (*((unsigned char *)(ptr)) = (unsigned char)val)
.#define bfd_put_signed_8 \
. bfd_put_8
.#define bfd_get_8(abfd, ptr) \
. (*(unsigned char *)(ptr))
.#define bfd_get_signed_8(abfd, ptr) \
. ((*(unsigned char *)(ptr) ^ 0x80) - 0x80)
.
.#define bfd_put_16(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
.#define bfd_put_signed_16 \
. bfd_put_16
.#define bfd_get_16(abfd, ptr) \
. BFD_SEND(abfd, bfd_getx16, (ptr))
.#define bfd_get_signed_16(abfd, ptr) \
. BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
.
.#define bfd_put_32(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
.#define bfd_put_signed_32 \
. bfd_put_32
.#define bfd_get_32(abfd, ptr) \
. BFD_SEND(abfd, bfd_getx32, (ptr))
.#define bfd_get_signed_32(abfd, ptr) \
. BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
.
.#define bfd_put_64(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
.#define bfd_put_signed_64 \
. bfd_put_64
.#define bfd_get_64(abfd, ptr) \
. BFD_SEND(abfd, bfd_getx64, (ptr))
.#define bfd_get_signed_64(abfd, ptr) \
. BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
.
*/
/*
FUNCTION
bfd_h_put_size
FUNCTION
bfd_h_get_size
DESCRIPTION
These macros have the same function as their <<bfd_get_x>>
bretherin, except that they are used for removing information
for the header records of object files. Believe it or not,
some object files keep their header records in big endian
order, and their data in little endian order.
.
.{* Byte swapping macros for file header data. *}
.
.#define bfd_h_put_8(abfd, val, ptr) \
. bfd_put_8 (abfd, val, ptr)
.#define bfd_h_put_signed_8(abfd, val, ptr) \
. bfd_put_8 (abfd, val, ptr)
.#define bfd_h_get_8(abfd, ptr) \
. bfd_get_8 (abfd, ptr)
.#define bfd_h_get_signed_8(abfd, ptr) \
. bfd_get_signed_8 (abfd, ptr)
.
.#define bfd_h_put_16(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
.#define bfd_h_put_signed_16 \
. bfd_h_put_16
.#define bfd_h_get_16(abfd, ptr) \
. BFD_SEND(abfd, bfd_h_getx16,(ptr))
.#define bfd_h_get_signed_16(abfd, ptr) \
. BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))
.
.#define bfd_h_put_32(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
.#define bfd_h_put_signed_32 \
. bfd_h_put_32
.#define bfd_h_get_32(abfd, ptr) \
. BFD_SEND(abfd, bfd_h_getx32,(ptr))
.#define bfd_h_get_signed_32(abfd, ptr) \
. BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))
.
.#define bfd_h_put_64(abfd, val, ptr) \
. BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
.#define bfd_h_put_signed_64 \
. bfd_h_put_64
.#define bfd_h_get_64(abfd, ptr) \
. BFD_SEND(abfd, bfd_h_getx64,(ptr))
.#define bfd_h_get_signed_64(abfd, ptr) \
. BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
.
*/
/* Sign extension to bfd_signed_vma. */
#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
#define EIGHT_GAZILLION (((HOST_64_BIT)0x80000000) << 32)
#define COERCE64(x) \
(((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
bfd_vma
DEFUN(bfd_getb16,(addr),
register bfd_byte *addr)
{
return (addr[0] << 8) | addr[1];
}
bfd_vma
DEFUN(bfd_getl16,(addr),
register bfd_byte *addr)
{
return (addr[1] << 8) | addr[0];
}
bfd_signed_vma
DEFUN(bfd_getb_signed_16,(addr),
register bfd_byte *addr)
{
return COERCE16((addr[0] << 8) | addr[1]);
}
bfd_signed_vma
DEFUN(bfd_getl_signed_16,(addr),
register bfd_byte *addr)
{
return COERCE16((addr[1] << 8) | addr[0]);
}
void
DEFUN(bfd_putb16,(data, addr),
bfd_vma data AND
register bfd_byte *addr)
{
addr[0] = (bfd_byte)(data >> 8);
addr[1] = (bfd_byte )data;
}
void
DEFUN(bfd_putl16,(data, addr),
bfd_vma data AND
register bfd_byte *addr)
{
addr[0] = (bfd_byte )data;
addr[1] = (bfd_byte)(data >> 8);
}
bfd_vma
bfd_getb32 (addr)
register bfd_byte *addr;
{
return (((((bfd_vma)addr[0] << 8) | addr[1]) << 8)
| addr[2]) << 8 | addr[3];
}
bfd_vma
bfd_getl32 (addr)
register bfd_byte *addr;
{
return (((((bfd_vma)addr[3] << 8) | addr[2]) << 8)
| addr[1]) << 8 | addr[0];
}
bfd_signed_vma
bfd_getb_signed_32 (addr)
register bfd_byte *addr;
{
return COERCE32((((((bfd_vma)addr[0] << 8) | addr[1]) << 8)
| addr[2]) << 8 | addr[3]);
}
bfd_signed_vma
bfd_getl_signed_32 (addr)
register bfd_byte *addr;
{
return COERCE32((((((bfd_vma)addr[3] << 8) | addr[2]) << 8)
| addr[1]) << 8 | addr[0]);
}
bfd_vma
DEFUN(bfd_getb64,(addr),
register bfd_byte *addr)
{
#ifdef BFD64
bfd_vma low, high;
high= ((((((((addr[0]) << 8) |
addr[1]) << 8) |
addr[2]) << 8) |
addr[3]) );
low = (((((((((bfd_vma)addr[4]) << 8) |
addr[5]) << 8) |
addr[6]) << 8) |
addr[7]));
return high << 32 | low;
#else
BFD_FAIL();
return 0;
#endif
}
bfd_vma
DEFUN(bfd_getl64,(addr),
register bfd_byte *addr)
{
#ifdef BFD64
bfd_vma low, high;
high= (((((((addr[7] << 8) |
addr[6]) << 8) |
addr[5]) << 8) |
addr[4]));
low = ((((((((bfd_vma)addr[3] << 8) |
addr[2]) << 8) |
addr[1]) << 8) |
addr[0]) );
return high << 32 | low;
#else
BFD_FAIL();
return 0;
#endif
}
bfd_signed_vma
DEFUN(bfd_getb_signed_64,(addr),
register bfd_byte *addr)
{
#ifdef BFD64
bfd_vma low, high;
high= ((((((((addr[0]) << 8) |
addr[1]) << 8) |
addr[2]) << 8) |
addr[3]) );
low = (((((((((bfd_vma)addr[4]) << 8) |
addr[5]) << 8) |
addr[6]) << 8) |
addr[7]));
return COERCE64(high << 32 | low);
#else
BFD_FAIL();
return 0;
#endif
}
bfd_signed_vma
DEFUN(bfd_getl_signed_64,(addr),
register bfd_byte *addr)
{
#ifdef BFD64
bfd_vma low, high;
high= (((((((addr[7] << 8) |
addr[6]) << 8) |
addr[5]) << 8) |
addr[4]));
low = ((((((((bfd_vma)addr[3] << 8) |
addr[2]) << 8) |
addr[1]) << 8) |
addr[0]) );
return COERCE64(high << 32 | low);
#else
BFD_FAIL();
return 0;
#endif
}
void
DEFUN(bfd_putb32,(data, addr),
bfd_vma data AND
register bfd_byte *addr)
{
addr[0] = (bfd_byte)(data >> 24);
addr[1] = (bfd_byte)(data >> 16);
addr[2] = (bfd_byte)(data >> 8);
addr[3] = (bfd_byte)data;
}
void
DEFUN(bfd_putl32,(data, addr),
bfd_vma data AND
register bfd_byte *addr)
{
addr[0] = (bfd_byte)data;
addr[1] = (bfd_byte)(data >> 8);
addr[2] = (bfd_byte)(data >> 16);
addr[3] = (bfd_byte)(data >> 24);
}
void
DEFUN(bfd_putb64,(data, addr),
bfd_vma data AND
register bfd_byte *addr)
{
#ifdef BFD64
addr[0] = (bfd_byte)(data >> (7*8));
addr[1] = (bfd_byte)(data >> (6*8));
addr[2] = (bfd_byte)(data >> (5*8));
addr[3] = (bfd_byte)(data >> (4*8));
addr[4] = (bfd_byte)(data >> (3*8));
addr[5] = (bfd_byte)(data >> (2*8));
addr[6] = (bfd_byte)(data >> (1*8));
addr[7] = (bfd_byte)(data >> (0*8));
#else
BFD_FAIL();
#endif
}
void
DEFUN(bfd_putl64,(data, addr),
bfd_vma data AND
register bfd_byte *addr)
{
#ifdef BFD64
addr[7] = (bfd_byte)(data >> (7*8));
addr[6] = (bfd_byte)(data >> (6*8));
addr[5] = (bfd_byte)(data >> (5*8));
addr[4] = (bfd_byte)(data >> (4*8));
addr[3] = (bfd_byte)(data >> (3*8));
addr[2] = (bfd_byte)(data >> (2*8));
addr[1] = (bfd_byte)(data >> (1*8));
addr[0] = (bfd_byte)(data >> (0*8));
#else
BFD_FAIL();
#endif
}
/* Default implementation */
boolean
DEFUN(bfd_generic_get_section_contents, (abfd, section, location, offset, count),
bfd *abfd AND
sec_ptr section AND
PTR location AND
file_ptr offset AND
bfd_size_type count)
{
if (count == 0)
return true;
if ((bfd_size_type)(offset+count) > section->_raw_size
|| bfd_seek(abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
|| bfd_read(location, (bfd_size_type)1, count, abfd) != count)
return (false); /* on error */
return (true);
}
/* This generic function can only be used in implementations where creating
NEW sections is disallowed. It is useful in patching existing sections
in read-write files, though. See other set_section_contents functions
to see why it doesn't work for new sections. */
boolean
DEFUN(bfd_generic_set_section_contents, (abfd, section, location, offset, count),
bfd *abfd AND
sec_ptr section AND
PTR location AND
file_ptr offset AND
bfd_size_type count)
{
if (count == 0)
return true;
if ((bfd_size_type)(offset+count) > bfd_get_section_size_after_reloc(section)
|| bfd_seek(abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
|| bfd_write(location, (bfd_size_type)1, count, abfd) != count)
return (false); /* on error */
return (true);
}
/*
INTERNAL_FUNCTION
bfd_log2
DESCRIPTION
Return the log base 2 of the value supplied, rounded up. eg an
arg of 1025 would return 11.
SYNOPSIS
unsigned int bfd_log2(bfd_vma x);
*/
unsigned
bfd_log2(x)
bfd_vma x;
{
unsigned result = 0;
while ( (bfd_vma)(1<< result) < x)
result++;
return result;
}

View file

@ -0,0 +1,273 @@
/* libbfd.h -- Declarations used by bfd library *implementation*.
(This include file is not for users of the library.)
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Align an address upward to a boundary, expressed as a number of bytes.
E.g. align to an 8-byte boundary with argument of 8. */
#define BFD_ALIGN(this, boundary) \
((( (this) + ((boundary) -1)) & (~((boundary)-1))))
/* If you want to read and write large blocks, you might want to do it
in quanta of this amount */
#define DEFAULT_BUFFERSIZE 8192
/* Set a tdata field. Can't use the other macros for this, since they
do casts, and casting to the left of assignment isn't portable. */
#define set_tdata(bfd, v) ((bfd)->tdata.any = (PTR) (v))
/* tdata for an archive. For an input archive, cache
needs to be free()'d. For an output archive, symdefs do. */
struct artdata {
file_ptr first_file_filepos;
/* Speed up searching the armap */
struct ar_cache *cache;
bfd *archive_head; /* Only interesting in output routines */
carsym *symdefs; /* the symdef entries */
symindex symdef_count; /* how many there are */
char *extended_names; /* clever intel extension */
time_t armap_timestamp; /* Timestamp value written into armap.
This is used for BSD archives to check
that the timestamp is recent enough
for the BSD linker to not complain,
just before we finish writing an
archive. */
file_ptr armap_datepos; /* Position within archive to seek to
rewrite the date field. */
};
#define bfd_ardata(bfd) ((bfd)->tdata.aout_ar_data)
/* Goes in bfd's arelt_data slot */
struct areltdata {
char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
char *filename; /* null-terminated */
};
#define arelt_size(bfd) (((struct areltdata *)((bfd)->arelt_data))->parsed_size)
char *zalloc PARAMS ((bfd_size_type size));
/* These routines allocate and free things on the BFD's obstack. Note
that realloc can never occur in place. */
PTR bfd_alloc PARAMS ((bfd *abfd, size_t size));
PTR bfd_zalloc PARAMS ((bfd *abfd, size_t size));
PTR bfd_realloc PARAMS ((bfd *abfd, PTR orig, size_t new));
void bfd_alloc_grow PARAMS ((bfd *abfd, PTR thing, size_t size));
PTR bfd_alloc_finish PARAMS ((bfd *abfd));
PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t wanted));
#define bfd_release(x,y) (void) obstack_free(&(x->memory),y)
bfd_size_type bfd_read PARAMS ((PTR ptr, bfd_size_type size,
bfd_size_type nitems, bfd *abfd));
bfd_size_type bfd_write PARAMS ((CONST PTR ptr, bfd_size_type size,
bfd_size_type nitems, bfd *abfd));
int bfd_seek PARAMS ((bfd* CONST abfd, CONST file_ptr fp,
CONST int direction));
long bfd_tell PARAMS ((bfd *abfd));
int bfd_flush PARAMS ((bfd *abfd));
int bfd_stat PARAMS ((bfd *abfd, struct stat *));
bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd));
bfd * look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index));
boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd));
struct areltdata * snarf_ar_hdr PARAMS ((bfd *abfd));
bfd_target * bfd_generic_archive_p PARAMS ((bfd *abfd));
boolean bfd_slurp_armap PARAMS ((bfd *abfd));
boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd));
#define bfd_slurp_bsd_armap bfd_slurp_armap
#define bfd_slurp_coff_armap bfd_slurp_armap
boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd));
boolean _bfd_write_archive_contents PARAMS ((bfd *abfd));
bfd * new_bfd PARAMS (());
#define DEFAULT_STRING_SPACE_SIZE 0x2000
boolean bfd_add_to_string_table PARAMS ((char **table, char *new_string,
unsigned int *table_length,
char **free_ptr));
boolean bfd_false PARAMS ((bfd *ignore));
boolean bfd_true PARAMS ((bfd *ignore));
PTR bfd_nullvoidptr PARAMS ((bfd *ignore));
int bfd_0 PARAMS ((bfd *ignore));
unsigned int bfd_0u PARAMS ((bfd *ignore));
void bfd_void PARAMS ((bfd *ignore));
bfd * new_bfd_contained_in PARAMS ((bfd *));
boolean _bfd_dummy_new_section_hook PARAMS ((bfd *ignore, asection *newsect));
char * _bfd_dummy_core_file_failing_command PARAMS ((bfd *abfd));
int _bfd_dummy_core_file_failing_signal PARAMS ((bfd *abfd));
boolean _bfd_dummy_core_file_matches_executable_p PARAMS ((bfd *core_bfd,
bfd *exec_bfd));
bfd_target * _bfd_dummy_target PARAMS ((bfd *abfd));
void bfd_dont_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
char *hdr));
void bfd_bsd_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
char *hdr));
void bfd_gnu_truncate_arname PARAMS ((bfd *abfd, CONST char *filename,
char *hdr));
boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength,
struct orl *map, unsigned int orl_count, int stridx));
boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength,
struct orl *map, unsigned int orl_count, int stridx));
bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive,
bfd *last_file));
int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *));
boolean bfd_generic_get_section_contents PARAMS ((bfd *abfd, sec_ptr section,
PTR location, file_ptr offset,
bfd_size_type count));
boolean bfd_generic_set_section_contents PARAMS ((bfd *abfd, sec_ptr section,
PTR location, file_ptr offset,
bfd_size_type count));
/* Macros to tell if bfds are read or write enabled.
Note that bfds open for read may be scribbled into if the fd passed
to bfd_fdopenr is actually open both for read and write
simultaneously. However an output bfd will never be open for
read. Therefore sometimes you want to check bfd_read_p or
!bfd_read_p, and only sometimes bfd_write_p.
*/
#define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction)
#define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction)
void bfd_assert PARAMS ((char*,int));
#define BFD_ASSERT(x) \
{ if (!(x)) bfd_assert(__FILE__,__LINE__); }
#define BFD_FAIL() \
{ bfd_assert(__FILE__,__LINE__); }
FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
extern bfd *bfd_last_cache;
/* Now Steve, what's the story here? */
#ifdef lint
#define itos(x) "l"
#define stoi(x) 1
#else
#define itos(x) ((char*)(x))
#define stoi(x) ((int)(x))
#endif
/* Generic routine for close_and_cleanup is really just bfd_true. */
#define bfd_generic_close_and_cleanup bfd_true
/* And more follows */
void
bfd_check_init PARAMS ((void));
PTR
bfd_xmalloc PARAMS (( bfd_size_type size));
PTR
bfd_xmalloc_by_size_t PARAMS (( size_t size));
void
bfd_write_bigendian_4byte_int PARAMS ((bfd *abfd, int i));
unsigned int
bfd_log2 PARAMS ((bfd_vma x));
#define BFD_CACHE_MAX_OPEN 10
extern bfd *bfd_last_cache;
#define bfd_cache_lookup(x) \
((x)==bfd_last_cache? \
(FILE*)(bfd_last_cache->iostream): \
bfd_cache_lookup_worker(x))
boolean
bfd_cache_close PARAMS ((bfd *));
FILE*
bfd_open_file PARAMS ((bfd *));
FILE *
bfd_cache_lookup_worker PARAMS ((bfd *));
void
bfd_constructor_entry PARAMS ((bfd *abfd,
asymbol **symbol_ptr_ptr,
CONST char*type));
CONST struct reloc_howto_struct *
bfd_default_reloc_type_lookup
PARAMS ((bfd *abfd AND
bfd_reloc_code_real_type code));
boolean
bfd_generic_relax_section
PARAMS ((bfd *abfd,
asection *section,
asymbol **symbols));
bfd_byte *
bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
struct bfd_seclet *seclet,
bfd_byte *data,
boolean relocateable));
boolean
bfd_generic_seclet_link
PARAMS ((bfd *abfd,
PTR data,
boolean relocateable));
extern bfd_arch_info_type bfd_default_arch_struct;
boolean
bfd_default_set_arch_mach PARAMS ((bfd *abfd,
enum bfd_architecture arch,
unsigned long mach));
void
bfd_arch_init PARAMS ((void));
void
bfd_arch_linkin PARAMS ((bfd_arch_info_type *));
CONST bfd_arch_info_type *
bfd_default_compatible
PARAMS ((CONST bfd_arch_info_type *a,
CONST bfd_arch_info_type *b));
boolean
bfd_default_scan PARAMS ((CONST struct bfd_arch_info *, CONST char *));
struct elf_internal_shdr *
bfd_elf_find_section PARAMS ((bfd *abfd, char *name));

View file

@ -0,0 +1,352 @@
/* BFD COFF object file private structure.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Object file tdata; access macros */
#define coff_data(bfd) ((bfd)->tdata.coff_obj_data)
#define exec_hdr(bfd) (coff_data(bfd)->hdr)
#define obj_symbols(bfd) (coff_data(bfd)->symbols)
#define obj_sym_filepos(bfd) (coff_data(bfd)->sym_filepos)
#define obj_relocbase(bfd) (coff_data(bfd)->relocbase)
#define obj_raw_syments(bfd) (coff_data(bfd)->raw_syments)
#define obj_raw_syment_count(bfd) (coff_data(bfd)->raw_syment_count)
#define obj_convert(bfd) (coff_data(bfd)->conversion_table)
#define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
#if CFILE_STUFF
#define obj_symbol_slew(bfd) (coff_data(bfd)->symbol_index_slew)
#else
#define obj_symbol_slew(bfd) 0
#endif
/* `Tdata' information kept for COFF files. */
typedef struct coff_tdata
{
struct coff_symbol_struct *symbols; /* symtab for input bfd */
unsigned int *conversion_table;
int conv_table_size;
file_ptr sym_filepos;
long symbol_index_slew; /* used during read to mark whether a
C_FILE symbol as been added. */
struct coff_ptr_struct *raw_syments;
struct lineno *raw_linenos;
unsigned int raw_syment_count;
unsigned short flags;
/* These are only valid once writing has begun */
long int relocbase;
/* These members communicate important constants about the symbol table
to GDB's symbol-reading code. These `constants' unfortunately vary
from coff implementation to implementation... */
unsigned local_n_btmask;
unsigned local_n_btshft;
unsigned local_n_tmask;
unsigned local_n_tshift;
unsigned local_symesz;
unsigned local_auxesz;
unsigned local_linesz;
} coff_data_type;
/* We take the address of the first element of a asymbol to ensure that the
* macro is only ever applied to an asymbol. */
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd)))
/* Functions in coffgen.c. */
extern bfd_target *coff_object_p PARAMS ((bfd *));
extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
extern unsigned int coff_get_symtab_upper_bound PARAMS ((bfd *));
extern unsigned int coff_get_symtab PARAMS ((bfd *, asymbol **));
extern int coff_count_linenumbers PARAMS ((bfd *));
extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
extern void coff_renumber_symbols PARAMS ((bfd *));
extern void coff_mangle_symbols PARAMS ((bfd *));
extern void coff_write_symbols PARAMS ((bfd *));
extern void coff_write_linenumbers PARAMS ((bfd *));
extern alent *coff_get_lineno PARAMS ((bfd *, asymbol *));
extern asymbol *coff_section_symbol PARAMS ((bfd *, char *));
extern struct coff_ptr_struct *coff_get_normalized_symtab PARAMS ((bfd *));
extern unsigned int coff_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
extern asymbol *coff_make_empty_symbol PARAMS ((bfd *));
extern void coff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *,
bfd_print_symbol_type how));
extern void coff_get_symbol_info PARAMS ((bfd *, asymbol *,
symbol_info *ret));
extern asymbol *coff_bfd_make_debug_symbol PARAMS ((bfd *, PTR,
unsigned long));
extern boolean coff_find_nearest_line PARAMS ((bfd *,
asection *,
asymbol **,
bfd_vma offset,
CONST char **filename_ptr,
CONST char **functionname_ptr,
unsigned int *line_ptr));
extern int coff_sizeof_headers PARAMS ((bfd *, boolean reloc));
extern boolean bfd_coff_reloc16_relax_section PARAMS ((bfd *,
asection *,
asymbol **));
extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_seclet *, bfd_byte *, boolean relocateable));
extern bfd_vma bfd_coff_reloc16_get_value PARAMS ((arelent *,
struct bfd_seclet *));
/* And more taken from the source .. */
typedef struct coff_ptr_struct
{
/* Remembers the offset from the first symbol in the file for
this symbol. Generated by coff_renumber_symbols. */
unsigned int offset;
/* Should the tag field of this symbol be renumbered.
Created by coff_pointerize_aux. */
char fix_tag;
/* Should the endidx field of this symbol be renumbered.
Created by coff_pointerize_aux. */
char fix_end;
/* The container for the symbol structure as read and translated
from the file. */
union {
union internal_auxent auxent;
struct internal_syment syment;
} u;
} combined_entry_type;
/* Each canonical asymbol really looks like this: */
typedef struct coff_symbol_struct
{
/* The actual symbol which the rest of BFD works with */
asymbol symbol;
/* A pointer to the hidden information for this symbol */
combined_entry_type *native;
/* A pointer to the linenumber information for this symbol */
struct lineno_cache_entry *lineno;
/* Have the line numbers been relocated yet ? */
boolean done_lineno;
} coff_symbol_type;
typedef struct
{
void (*_bfd_coff_swap_aux_in) PARAMS ((
bfd *abfd ,
PTR ext,
int type,
int class ,
PTR in));
void (*_bfd_coff_swap_sym_in) PARAMS ((
bfd *abfd ,
PTR ext,
PTR in));
void (*_bfd_coff_swap_lineno_in) PARAMS ((
bfd *abfd,
PTR ext,
PTR in));
unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
bfd *abfd,
PTR in,
int type,
int class,
PTR ext));
unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
bfd *abfd,
PTR in,
PTR ext));
unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
bfd *abfd,
PTR in,
PTR ext));
unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
bfd *abfd,
PTR src,
PTR dst));
unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
bfd *abfd,
PTR in,
PTR out));
unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
bfd *abfd,
PTR in,
PTR out));
unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
bfd *abfd,
PTR in,
PTR out));
unsigned int _bfd_filhsz;
unsigned int _bfd_aoutsz;
unsigned int _bfd_scnhsz;
unsigned int _bfd_symesz;
unsigned int _bfd_auxesz;
unsigned int _bfd_linesz;
boolean _bfd_coff_long_filenames;
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
bfd *abfd,
PTR ext,
PTR in));
void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
bfd *abfd,
PTR ext,
PTR in));
void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
bfd *abfd,
PTR ext,
PTR in));
boolean (*_bfd_coff_bad_format_hook) PARAMS ((
bfd *abfd,
PTR internal_filehdr));
boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
bfd *abfd,
PTR internal_filehdr));
PTR (*_bfd_coff_mkobject_hook) PARAMS ((
bfd *abfd,
PTR internal_filehdr,
PTR internal_aouthdr));
flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
bfd *abfd,
PTR internal_scnhdr));
asection *(*_bfd_make_section_hook) PARAMS ((
bfd *abfd,
char *name));
void (*_bfd_set_alignment_hook) PARAMS ((
bfd *abfd,
asection *sec,
PTR internal_scnhdr));
boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
bfd *abfd));
boolean (*_bfd_coff_symname_in_debug) PARAMS ((
bfd *abfd,
struct internal_syment *sym));
void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
bfd *abfd,
struct bfd_seclet *seclet,
arelent *reloc,
bfd_byte *data,
unsigned int *src_ptr,
unsigned int *dst_ptr));
int (*_bfd_coff_reloc16_estimate) PARAMS ((
asection *input_section,
asymbol **symbols,
arelent *r,
unsigned int shrink));
} bfd_coff_backend_data;
#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
#define bfd_coff_swap_aux_in(a,e,t,c,i) \
((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,i))
#define bfd_coff_swap_sym_in(a,e,i) \
((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
#define bfd_coff_swap_lineno_in(a,e,i) \
((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
#define bfd_coff_swap_reloc_out(abfd, i, o) \
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
#define bfd_coff_swap_lineno_out(abfd, i, o) \
((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
#define bfd_coff_swap_aux_out(abfd, i, t,c,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_aux_out) (abfd, i,t,c, o))
#define bfd_coff_swap_sym_out(abfd, i,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
#define bfd_coff_swap_filehdr_out(abfd, i,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
#define bfd_coff_bad_format_hook(abfd, filehdr) \
((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr)\
((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr))
#define bfd_coff_make_section_hook(abfd, name)\
((coff_backend_info (abfd)->_bfd_make_section_hook) (abfd, name))
#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
#define bfd_coff_slurp_symbol_table(abfd)\
((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
#define bfd_coff_symname_in_debug(abfd, sym)\
((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
#define bfd_coff_reloc16_extra_cases(abfd, seclet, reloc, data, src_ptr, dst_ptr)\
((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
(abfd, seclet, reloc, data, src_ptr, dst_ptr))
#define bfd_coff_reloc16_estimate(abfd, section, symbols, reloc, shrink)\
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
(section, symbols, reloc, shrink))

View file

@ -0,0 +1,265 @@
/* BFD ECOFF object file private structure.
Copyright (C) 1993 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This is the backend information kept for ECOFF files. This
structure is constant for a particular backend. The first element
is the COFF backend data structure, so that ECOFF targets can use
the generic COFF code. */
#define ecoff_backend(abfd) \
((struct ecoff_backend_data *) (abfd)->xvec->backend_data)
struct ecoff_backend_data
{
/* COFF backend information. This must be the first field. */
bfd_coff_backend_data coff;
/* Supported architecture. */
enum bfd_architecture arch;
/* Symbol table magic number. */
int sym_magic;
/* Initial portion of armap string. */
const char *armap_start;
/* Alignment of debugging information. E.g., 4. */
bfd_size_type debug_align;
/* The page boundary used to align sections in a demand-paged
executable file. E.g., 0x1000. */
bfd_vma round;
/* Bitsize of constructor entries. */
unsigned int constructor_bitsize;
/* Reloc to use for constructor entries. */
CONST struct reloc_howto_struct *constructor_reloc;
/* Sizes of external symbolic information. */
bfd_size_type external_hdr_size;
bfd_size_type external_dnr_size;
bfd_size_type external_pdr_size;
bfd_size_type external_sym_size;
bfd_size_type external_opt_size;
bfd_size_type external_fdr_size;
bfd_size_type external_rfd_size;
bfd_size_type external_ext_size;
/* Functions to swap in external symbolic data. */
void (*swap_hdr_in) PARAMS ((bfd *, PTR, HDRR *));
void (*swap_dnr_in) PARAMS ((bfd *, PTR, DNR *));
void (*swap_pdr_in) PARAMS ((bfd *, PTR, PDR *));
void (*swap_sym_in) PARAMS ((bfd *, PTR, SYMR *));
void (*swap_opt_in) PARAMS ((bfd *, PTR, OPTR *));
void (*swap_fdr_in) PARAMS ((bfd *, PTR, FDR *));
void (*swap_rfd_in) PARAMS ((bfd *, PTR, RFDT *));
void (*swap_ext_in) PARAMS ((bfd *, PTR, EXTR *));
/* Functions to swap out external symbolic data. */
void (*swap_hdr_out) PARAMS ((bfd *, const HDRR *, PTR));
void (*swap_dnr_out) PARAMS ((bfd *, const DNR *, PTR));
void (*swap_pdr_out) PARAMS ((bfd *, const PDR *, PTR));
void (*swap_sym_out) PARAMS ((bfd *, const SYMR *, PTR));
void (*swap_opt_out) PARAMS ((bfd *, const OPTR *, PTR));
void (*swap_fdr_out) PARAMS ((bfd *, const FDR *, PTR));
void (*swap_rfd_out) PARAMS ((bfd *, const RFDT *, PTR));
void (*swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR));
/* It so happens that the auxiliary type information has the same
type and format for all known ECOFF targets. I don't see any
reason that that should change, so at least for now the auxiliary
swapping information is not in this table. */
/* External reloc size. */
bfd_size_type external_reloc_size;
/* Reloc swapping functions. */
void (*swap_reloc_in) PARAMS ((bfd *, PTR, struct internal_reloc *));
void (*swap_reloc_out) PARAMS ((bfd *, const struct internal_reloc *, PTR));
/* Backend reloc tweaking. */
void (*finish_reloc) PARAMS ((bfd *, struct internal_reloc *, arelent *));
};
/* This is the target specific information kept for ECOFF files. */
#define ecoff_data(abfd) ((abfd)->tdata.ecoff_obj_data)
typedef struct ecoff_tdata
{
/* The reloc file position, set by
ecoff_compute_section_file_positions. */
file_ptr reloc_filepos;
/* The symbol table file position, set by ecoff_mkobject_hook. */
file_ptr sym_filepos;
/* The start and end of the text segment. Only valid for an
existing file, not for one we are creating. */
unsigned long text_start;
unsigned long text_end;
/* The cached gp value. This is used when relocating. */
bfd_vma gp;
/* The maximum size of objects to optimize using gp. This is
typically set by the -G option to the compiler, assembler or
linker. */
int gp_size;
/* The register masks. When linking, all the masks found in the
input files are combined into the masks of the output file.
These are not all used for all targets, but that's OK, because
the relevant ones are the only ones swapped in and out. */
unsigned long gprmask;
unsigned long fprmask;
unsigned long cprmask[4];
/* The size of the unswapped ECOFF symbolic information. */
bfd_size_type raw_size;
/* The unswapped ECOFF symbolic information. */
PTR raw_syments;
/* The swapped ECOFF symbolic header. */
HDRR symbolic_header;
/* Pointers to the unswapped symbolic information. */
unsigned char *line;
PTR external_dnr; /* struct dnr_ext */
PTR external_pdr; /* struct pdr_ext */
PTR external_sym; /* struct sym_ext */
PTR external_opt; /* struct opt_ext */
union aux_ext *external_aux;
char *ss;
char *ssext;
PTR external_fdr; /* struct fdr_ext */
PTR external_rfd; /* struct rfd_ext */
PTR external_ext; /* struct ext_ext */
/* The swapped FDR information. */
FDR *fdr;
/* The FDR index. This is set for an input BFD to a link so that
the external symbols can set their FDR index correctly. */
unsigned int ifdbase;
/* The canonical BFD symbols. */
struct ecoff_symbol_struct *canonical_symbols;
} ecoff_data_type;
/* Each canonical asymbol really looks like this. */
typedef struct ecoff_symbol_struct
{
/* The actual symbol which the rest of BFD works with */
asymbol symbol;
/* The fdr for this symbol. */
FDR *fdr;
/* true if this is a local symbol rather than an external one. */
boolean local;
/* A pointer to the unswapped hidden information for this symbol.
This is either a struct sym_ext or a struct ext_ext, depending on
the value of the local field above. */
PTR native;
} ecoff_symbol_type;
/* We take the address of the first element of a asymbol to ensure that the
macro is only ever applied to an asymbol. */
#define ecoffsymbol(asymbol) ((ecoff_symbol_type *) (&((asymbol)->the_bfd)))
/* This is a hack borrowed from coffcode.h; we need to save the index
of an external symbol when we write it out so that can set the
symbol index correctly when we write out the relocs. */
#define ecoff_get_sym_index(symbol) ((unsigned long) (symbol)->udata)
#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata = (PTR) (idx))
/* Make an ECOFF object. */
extern boolean ecoff_mkobject PARAMS ((bfd *));
/* Read in the ECOFF symbolic debugging information. */
extern boolean ecoff_slurp_symbolic_info PARAMS ((bfd *));
/* Generic ECOFF BFD backend vectors. */
extern asymbol *ecoff_make_empty_symbol PARAMS ((bfd *abfd));
extern unsigned int ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd));
extern unsigned int ecoff_get_symtab PARAMS ((bfd *abfd,
asymbol **alocation));
extern void ecoff_get_symbol_info PARAMS ((bfd *abfd,
asymbol *symbol,
symbol_info *ret));
extern void ecoff_print_symbol PARAMS ((bfd *abfd, PTR filep,
asymbol *symbol,
bfd_print_symbol_type how));
extern unsigned int ecoff_canonicalize_reloc PARAMS ((bfd *abfd,
asection *section,
arelent **relptr,
asymbol **symbols));
extern boolean ecoff_find_nearest_line PARAMS ((bfd *abfd,
asection *section,
asymbol **symbols,
bfd_vma offset,
CONST char **filename_ptr,
CONST char **fnname_ptr,
unsigned int *retline_ptr));
extern boolean ecoff_bfd_seclet_link PARAMS ((bfd *abfd, PTR data,
boolean relocateable));
extern boolean ecoff_set_arch_mach PARAMS ((bfd *abfd,
enum bfd_architecture arch,
unsigned long machine));
extern int ecoff_sizeof_headers PARAMS ((bfd *abfd, boolean reloc));
extern boolean ecoff_set_section_contents PARAMS ((bfd *abfd,
asection *section,
PTR location,
file_ptr offset,
bfd_size_type count));
extern boolean ecoff_get_section_contents PARAMS ((bfd *abfd,
asection *section,
PTR location,
file_ptr offset,
bfd_size_type count));
extern boolean ecoff_write_object_contents PARAMS ((bfd *abfd));
extern boolean ecoff_slurp_armap PARAMS ((bfd *abfd));
extern boolean ecoff_write_armap PARAMS ((bfd *abfd, unsigned int elength,
struct orl *map,
unsigned int orl_count,
int stridx));
#define ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table
extern bfd_target *ecoff_archive_p PARAMS ((bfd *abfd));
#define ecoff_get_lineno \
((alent *(*) PARAMS ((bfd *, asymbol *))) bfd_nullvoidptr)
#define ecoff_truncate_arname bfd_dont_truncate_arname
#define ecoff_openr_next_archived_file bfd_generic_openr_next_archived_file
#define ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define ecoff_get_reloc_upper_bound coff_get_reloc_upper_bound
#define ecoff_close_and_cleanup bfd_generic_close_and_cleanup
#define ecoff_bfd_debug_info_start bfd_void
#define ecoff_bfd_debug_info_end bfd_void
#define ecoff_bfd_debug_info_accumulate \
((void (*) PARAMS ((bfd *, struct sec *))) bfd_void)
#define ecoff_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
#define ecoff_bfd_relax_section bfd_generic_relax_section
#define ecoff_bfd_make_debug_symbol \
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
/* Hook functions for the generic COFF section reading code. */
extern PTR ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
extern asection *ecoff_make_section_hook PARAMS ((bfd *abfd, char *name));
extern boolean ecoff_new_section_hook PARAMS ((bfd *abfd,
asection *section));
#define ecoff_set_alignment_hook \
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
extern boolean ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr));
extern long ecoff_sec_to_styp_flags PARAMS ((CONST char *name,
flagword flags));
extern flagword ecoff_styp_to_sec_flags PARAMS ((bfd *abfd, PTR hdr));
extern boolean ecoff_slurp_symbol_table PARAMS ((bfd *abfd));

View file

@ -0,0 +1,249 @@
/* BFD back-end data structures for ELF files.
Copyright (C) 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _LIBELF_H_
#define _LIBELF_H_ 1
#include "elf/common.h"
#include "elf/internal.h"
#include "elf/external.h"
/* If size isn't specified as 64 or 32, NAME macro should fail. */
#ifndef NAME
#if ARCH_SIZE==64
#define NAME(x,y) CAT4(x,64,_,y)
#endif
#if ARCH_SIZE==32
#define NAME(x,y) CAT4(x,32,_,y)
#endif
#endif
#ifndef NAME
#define NAME(x,y) CAT4(x,NOSIZE,_,y)
#endif
#define ElfNAME(X) NAME(Elf,X)
#define elfNAME(X) NAME(elf,X)
typedef struct
{
asymbol symbol;
Elf_Internal_Sym internal_elf_sym;
union
{
unsigned int hppa_arg_reloc;
PTR any;
}
tc_data;
} elf_symbol_type;
struct elf_backend_data
{
int use_rela_p;
int elf_64_p;
enum bfd_architecture arch;
void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
Elf_Internal_Rela *));
void (*elf_info_to_howto_rel) PARAMS ((bfd *, arelent *,
Elf_Internal_Rel *));
bfd_vma maxpagesize;
void (*write_relocs) PARAMS ((bfd *, asection *, PTR));
void (*elf_backend_symbol_processing) PARAMS ((bfd *, asymbol *));
boolean (*elf_backend_symbol_table_processing) PARAMS ((bfd *, elf_symbol_type *, int));
boolean (*elf_backend_section_processing) PARAMS ((bfd *, Elf32_Internal_Shdr *));
boolean (*elf_backend_section_from_shdr) PARAMS ((bfd *, Elf32_Internal_Shdr *, char *));
boolean (*elf_backend_fake_sections) PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
boolean (*elf_backend_section_from_bfd_section) PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *));
};
struct elf_sym_extra
{
int elf_sym_num; /* sym# after locals/globals are reordered */
};
typedef struct elf_sym_extra Elf_Sym_Extra;
struct bfd_elf_arch_map {
enum bfd_architecture bfd_arch;
int elf_arch;
};
extern const struct bfd_elf_arch_map bfd_elf_arch_map[];
extern const int bfd_elf_arch_map_size;
struct bfd_elf_section_data {
Elf_Internal_Shdr this_hdr;
Elf_Internal_Shdr rel_hdr;
int this_idx, rel_idx;
};
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
#define shdr_name(abfd,shdr) (elf_shstrtab (abfd)->tab + (shdr)->sh_name)
#define get_elf_backend_data(abfd) \
((struct elf_backend_data *) (abfd)->xvec->backend_data)
struct strtab
{
char *tab;
int nentries;
int length;
};
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
struct elf_obj_tdata
{
Elf_Internal_Ehdr elf_header[1]; /* Actual data, but ref like ptr */
Elf_Internal_Shdr **elf_sect_ptr;
Elf_Internal_Phdr *phdr;
struct strtab *strtab_ptr;
int num_locals;
int num_globals;
Elf_Internal_Sym *internal_syms;
elf_symbol_type *symbols; /* elf_symbol_type */
Elf_Sym_Extra *sym_extra;
asymbol **section_syms; /* STT_SECTION symbols for each section */
int num_section_syms; /* number of section_syms allocated */
Elf_Internal_Shdr symtab_hdr;
Elf_Internal_Shdr shstrtab_hdr;
Elf_Internal_Shdr strtab_hdr;
int symtab_section, shstrtab_section, strtab_section;
file_ptr next_file_pos;
void *prstatus; /* The raw /proc prstatus structure */
void *prpsinfo; /* The raw /proc prpsinfo structure */
bfd_vma gp; /* The gp value (MIPS only, for now) */
int gp_size; /* The gp size (MIPS only, for now) */
};
#define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
#define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
#define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
#define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
#define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
#define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
#define elf_sym_extra(bfd) (elf_tdata(bfd) -> sym_extra)
#define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
#define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
#define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
#define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
#define obj_symbols(bfd) (elf_tdata(bfd) -> symbols)
#define obj_internal_syms(bfd) (elf_tdata(bfd) -> internal_syms)
#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
extern char * elf_string_from_elf_section PARAMS ((bfd *, unsigned, unsigned));
extern char * elf_get_str_section PARAMS ((bfd *, unsigned));
#define bfd_elf32_mkobject bfd_elf_mkobject
#define bfd_elf64_mkobject bfd_elf_mkobject
#define elf_mkobject bfd_elf_mkobject
extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
arelent *,
asymbol *,
PTR,
asection *,
bfd *));
extern boolean bfd_elf_mkobject PARAMS ((bfd *));
extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
extern boolean bfd_elf32_write_object_contents PARAMS ((bfd *));
extern boolean bfd_elf64_write_object_contents PARAMS ((bfd *));
extern bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
extern bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
extern int bfd_elf32_core_file_failing_signal PARAMS ((bfd *));
extern boolean bfd_elf32_core_file_matches_executable_p PARAMS ((bfd *,
bfd *));
extern boolean bfd_elf32_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
file_ptr,
bfd_size_type));
extern unsigned int bfd_elf32_get_symtab_upper_bound PARAMS ((bfd *));
extern unsigned int bfd_elf32_get_symtab PARAMS ((bfd *, asymbol **));
extern unsigned int bfd_elf32_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
extern unsigned int bfd_elf32_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
arelent **,
asymbol **));
extern asymbol *bfd_elf32_make_empty_symbol PARAMS ((bfd *));
extern void bfd_elf32_print_symbol PARAMS ((bfd *, PTR, asymbol *,
bfd_print_symbol_type));
extern void bfd_elf32_get_symbol_info PARAMS ((bfd *, asymbol *,
symbol_info *));
extern alent *bfd_elf32_get_lineno PARAMS ((bfd *, asymbol *));
extern boolean bfd_elf32_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
unsigned long));
extern boolean bfd_elf32_find_nearest_line PARAMS ((bfd *, asection *,
asymbol **,
bfd_vma, CONST char **,
CONST char **,
unsigned int *));
extern int bfd_elf32_sizeof_headers PARAMS ((bfd *, boolean));
extern void bfd_elf32__write_relocs PARAMS ((bfd *, asection *, PTR));
extern boolean bfd_elf32_new_section_hook PARAMS ((bfd *, asection *));
/* If the target doesn't have reloc handling written yet: */
extern void bfd_elf32_no_info_to_howto PARAMS ((bfd *, arelent *,
Elf32_Internal_Rela *));
extern bfd_target *bfd_elf64_object_p PARAMS ((bfd *));
extern bfd_target *bfd_elf64_core_file_p PARAMS ((bfd *));
extern char *bfd_elf64_core_file_failing_command PARAMS ((bfd *));
extern int bfd_elf64_core_file_failing_signal PARAMS ((bfd *));
extern boolean bfd_elf64_core_file_matches_executable_p PARAMS ((bfd *,
bfd *));
extern boolean bfd_elf64_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
file_ptr,
bfd_size_type));
extern unsigned int bfd_elf64_get_symtab_upper_bound PARAMS ((bfd *));
extern unsigned int bfd_elf64_get_symtab PARAMS ((bfd *, asymbol **));
extern unsigned int bfd_elf64_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
extern unsigned int bfd_elf64_canonicalize_reloc PARAMS ((bfd *, sec_ptr,
arelent **,
asymbol **));
extern asymbol *bfd_elf64_make_empty_symbol PARAMS ((bfd *));
extern void bfd_elf64_print_symbol PARAMS ((bfd *, PTR, asymbol *,
bfd_print_symbol_type));
extern void bfd_elf64_get_symbol_info PARAMS ((bfd *, asymbol *,
symbol_info *));
extern alent *bfd_elf64_get_lineno PARAMS ((bfd *, asymbol *));
extern boolean bfd_elf64_set_arch_mach PARAMS ((bfd *, enum bfd_architecture,
unsigned long));
extern boolean bfd_elf64_find_nearest_line PARAMS ((bfd *, asection *,
asymbol **,
bfd_vma, CONST char **,
CONST char **,
unsigned int *));
extern int bfd_elf64_sizeof_headers PARAMS ((bfd *, boolean));
extern void bfd_elf64__write_relocs PARAMS ((bfd *, asection *, PTR));
extern boolean bfd_elf64_new_section_hook PARAMS ((bfd *, asection *));
/* If the target doesn't have reloc handling written yet: */
extern void bfd_elf64_no_info_to_howto PARAMS ((bfd *, arelent *,
Elf64_Internal_Rela *));
#endif /* _LIBELF_H_ */

View file

@ -0,0 +1,534 @@
/* opncls.c -- open and close a BFD.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "obstack.h"
extern void bfd_cache_init PARAMS ((bfd *));
FILE *bfd_open_file PARAMS ((bfd *));
/* fdopen is a loser -- we should use stdio exclusively. Unfortunately
if we do that we can't use fcntl. */
#define obstack_chunk_alloc bfd_xmalloc_by_size_t
#define obstack_chunk_free free
/* Return a new BFD. All BFD's are allocated through this routine. */
bfd *
new_bfd PARAMS ((void))
{
bfd *nbfd;
nbfd = (bfd *)zalloc (sizeof (bfd));
if (!nbfd)
return 0;
bfd_check_init();
obstack_begin((PTR)&nbfd->memory, 128);
nbfd->arch_info = &bfd_default_arch_struct;
nbfd->direction = no_direction;
nbfd->iostream = NULL;
nbfd->where = 0;
nbfd->sections = (asection *)NULL;
nbfd->format = bfd_unknown;
nbfd->my_archive = (bfd *)NULL;
nbfd->origin = 0;
nbfd->opened_once = false;
nbfd->output_has_begun = false;
nbfd->section_count = 0;
nbfd->usrdata = (PTR)NULL;
nbfd->cacheable = false;
nbfd->flags = NO_FLAGS;
nbfd->mtime_set = false;
return nbfd;
}
/* Allocate a new BFD as a member of archive OBFD. */
bfd *
new_bfd_contained_in (obfd)
bfd *obfd;
{
bfd *nbfd;
nbfd = new_bfd();
nbfd->xvec = obfd->xvec;
nbfd->my_archive = obfd;
nbfd->direction = read_direction;
nbfd->target_defaulted = obfd->target_defaulted;
return nbfd;
}
/*
SECTION
Opening and Closing BFDs
*/
/*
FUNCTION
bfd_openr
SYNOPSIS
bfd *bfd_openr(CONST char *filename, CONST char*target);
DESCRIPTION
This function opens the file supplied (using <<fopen>>) with the target
supplied, it returns a pointer to the created BFD.
If NULL is returned then an error has occured. Possible errors
are <<no_memory>>, <<invalid_target>> or <<system_call>> error.
*/
bfd *
DEFUN(bfd_openr, (filename, target),
CONST char *filename AND
CONST char *target)
{
bfd *nbfd;
bfd_target *target_vec;
nbfd = new_bfd();
if (nbfd == NULL) {
bfd_error = no_memory;
return NULL;
}
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL) {
bfd_error = invalid_target;
return NULL;
}
nbfd->filename = filename;
nbfd->direction = read_direction;
if (bfd_open_file (nbfd) == NULL) {
bfd_error = system_call_error; /* File didn't exist, or some such */
bfd_release(nbfd,0);
return NULL;
}
return nbfd;
}
/* Don't try to `optimize' this function:
o - We lock using stack space so that interrupting the locking
won't cause a storage leak.
o - We open the file stream last, since we don't want to have to
close it if anything goes wrong. Closing the stream means closing
the file descriptor too, even though we didn't open it.
*/
/*
FUNCTION
bfd_fdopenr
SYNOPSIS
bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd);
DESCRIPTION
bfd_fdopenr is to bfd_fopenr much like fdopen is to fopen.
It opens a BFD on a file already described by the @var{fd}
supplied.
When the file is later bfd_closed, the file descriptor will be closed.
If the caller desires that this file descriptor be cached by BFD
(opened as needed, closed as needed to free descriptors for
other opens), with the supplied @var{fd} used as an initial
file descriptor (but subject to closure at any time), set
bfd->cacheable nonzero in the returned BFD. The default is to
assume no cacheing; the file descriptor will remain open until
bfd_close, and will not be affected by BFD operations on other
files.
Possible errors are no_memory, invalid_target and system_call
error.
*/
bfd *
DEFUN(bfd_fdopenr,(filename, target, fd),
CONST char *filename AND
CONST char *target AND
int fd)
{
bfd *nbfd;
bfd_target *target_vec;
int fdflags;
bfd_error = system_call_error;
#ifdef NO_FCNTL
fdflags = O_RDWR; /* Assume full access */
#else
fdflags = fcntl (fd, F_GETFL, NULL);
#endif
if (fdflags == -1) return NULL;
nbfd = new_bfd();
if (nbfd == NULL) {
bfd_error = no_memory;
return NULL;
}
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL) {
bfd_error = invalid_target;
return NULL;
}
#if defined(VMS) || defined(__GO32__)
nbfd->iostream = (char *)fopen(filename, FOPEN_RB);
#else
/* (O_ACCMODE) parens are to avoid Ultrix header file bug */
switch (fdflags & (O_ACCMODE)) {
case O_RDONLY: nbfd->iostream = (char *) fdopen (fd, FOPEN_RB); break;
case O_WRONLY: nbfd->iostream = (char *) fdopen (fd, FOPEN_RUB); break;
case O_RDWR: nbfd->iostream = (char *) fdopen (fd, FOPEN_RUB); break;
default: abort ();
}
#endif
if (nbfd->iostream == NULL) {
(void) obstack_free (&nbfd->memory, (PTR)0);
return NULL;
}
/* OK, put everything where it belongs */
nbfd->filename = filename;
/* As a special case we allow a FD open for read/write to
be written through, although doing so requires that we end
the previous clause with a preposition. */
/* (O_ACCMODE) parens are to avoid Ultrix header file bug */
switch (fdflags & (O_ACCMODE)) {
case O_RDONLY: nbfd->direction = read_direction; break;
case O_WRONLY: nbfd->direction = write_direction; break;
case O_RDWR: nbfd->direction = both_direction; break;
default: abort ();
}
bfd_cache_init (nbfd);
return nbfd;
}
/** bfd_openw -- open for writing.
Returns a pointer to a freshly-allocated BFD on success, or NULL.
See comment by bfd_fdopenr before you try to modify this function. */
/*
FUNCTION
bfd_openw
SYNOPSIS
bfd *bfd_openw(CONST char *filename, CONST char *target);
DESCRIPTION
Creates a BFD, associated with file @var{filename}, using the
file format @var{target}, and returns a pointer to it.
Possible errors are system_call_error, no_memory,
invalid_target.
*/
bfd *
DEFUN(bfd_openw,(filename, target),
CONST char *filename AND
CONST char *target)
{
bfd *nbfd;
bfd_target *target_vec;
bfd_error = system_call_error;
/* nbfd has to point to head of malloc'ed block so that bfd_close may
reclaim it correctly. */
nbfd = new_bfd();
if (nbfd == NULL) {
bfd_error = no_memory;
return NULL;
}
target_vec = bfd_find_target (target, nbfd);
if (target_vec == NULL) return NULL;
nbfd->filename = filename;
nbfd->direction = write_direction;
if (bfd_open_file (nbfd) == NULL) {
bfd_error = system_call_error; /* File not writeable, etc */
(void) obstack_free (&nbfd->memory, (PTR)0);
return NULL;
}
return nbfd;
}
/*
FUNCTION
bfd_close
SYNOPSIS
boolean bfd_close(bfd *);
DESCRIPTION
This function closes a BFD. If the BFD was open for writing,
then pending operations are completed and the file written out
and closed. If the created file is executable, then
<<chmod>> is called to mark it as such.
All memory attached to the BFD's obstacks is released.
The file descriptor associated with the BFD is closed (even
if it was passed in to BFD by bfd_fdopenr).
RETURNS
<<true>> is returned if all is ok, otherwise <<false>>.
*/
boolean
DEFUN(bfd_close,(abfd),
bfd *abfd)
{
boolean ret;
if (!bfd_read_p(abfd))
if (BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)) != true)
return false;
if (BFD_SEND (abfd, _close_and_cleanup, (abfd)) != true) return false;
ret = bfd_cache_close(abfd);
/* If the file was open for writing and is now executable,
make it so */
if (ret == true
&& abfd->direction == write_direction
&& abfd->flags & EXEC_P) {
struct stat buf;
stat(abfd->filename, &buf);
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0010 /* Execute by group. */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0001 /* Execute by others. */
#endif
chmod(abfd->filename, 0777 & (buf.st_mode | S_IXUSR | S_IXGRP | S_IXOTH));
}
(void) obstack_free (&abfd->memory, (PTR)0);
(void) free(abfd);
return ret;
}
/*
FUNCTION
bfd_close_all_done
SYNOPSIS
boolean bfd_close_all_done(bfd *);
DESCRIPTION
This function closes a BFD. It differs from <<bfd_close>>
since it does not complete any pending operations. This
routine would be used if the application had just used BFD for
swapping and didn't want to use any of the writing code.
If the created file is executable, then <<chmod>> is called
to mark it as such.
All memory attached to the BFD's obstacks is released.
RETURNS
<<true>> is returned if all is ok, otherwise <<false>>.
*/
boolean
DEFUN(bfd_close_all_done,(abfd),
bfd *abfd)
{
boolean ret;
ret = bfd_cache_close(abfd);
/* If the file was open for writing and is now executable,
make it so */
if (ret == true
&& abfd->direction == write_direction
&& abfd->flags & EXEC_P) {
struct stat buf;
stat(abfd->filename, &buf);
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
#ifndef S_IXGRP
#define S_IXGRP 0010 /* Execute by group. */
#endif
#ifndef S_IXOTH
#define S_IXOTH 0001 /* Execute by others. */
#endif
chmod(abfd->filename, 0x777 &(buf.st_mode | S_IXUSR | S_IXGRP | S_IXOTH));
}
(void) obstack_free (&abfd->memory, (PTR)0);
(void) free(abfd);
return ret;
}
/*
FUNCTION
bfd_alloc_size
SYNOPSIS
bfd_size_type bfd_alloc_size(bfd *abfd);
DESCRIPTION
Return the number of bytes in the obstacks connected to the
supplied BFD.
*/
bfd_size_type
DEFUN(bfd_alloc_size,(abfd),
bfd *abfd)
{
struct _obstack_chunk *chunk = abfd->memory.chunk;
size_t size = 0;
while (chunk) {
size += chunk->limit - &(chunk->contents[0]);
chunk = chunk->prev;
}
return size;
}
/*
FUNCTION
bfd_create
SYNOPSIS
bfd *bfd_create(CONST char *filename, bfd *templ);
DESCRIPTION
This routine creates a new BFD in the manner of
<<bfd_openw>>, but without opening a file. The new BFD
takes the target from the target used by @var{template}. The
format is always set to <<bfd_object>>.
*/
bfd *
DEFUN(bfd_create,(filename, templ),
CONST char *filename AND
bfd *templ)
{
bfd *nbfd = new_bfd();
if (nbfd == (bfd *)NULL) {
bfd_error = no_memory;
return (bfd *)NULL;
}
nbfd->filename = filename;
if(templ) {
nbfd->xvec = templ->xvec;
}
nbfd->direction = no_direction;
bfd_set_format(nbfd, bfd_object);
return nbfd;
}
/*
INTERNAL_FUNCTION
bfd_alloc_by_size_t
SYNOPSIS
PTR bfd_alloc_by_size_t(bfd *abfd, size_t wanted);
DESCRIPTION
This function allocates a block of memory in the obstack
attatched to <<abfd>> and returns a pointer to it.
*/
PTR
DEFUN(bfd_alloc_by_size_t,(abfd, size),
bfd *abfd AND
size_t size)
{
PTR res = obstack_alloc(&(abfd->memory), size);
return res;
}
DEFUN(void bfd_alloc_grow,(abfd, ptr, size),
bfd *abfd AND
PTR ptr AND
size_t size)
{
(void) obstack_grow(&(abfd->memory), ptr, size);
}
DEFUN(PTR bfd_alloc_finish,(abfd),
bfd *abfd)
{
return obstack_finish(&(abfd->memory));
}
DEFUN(PTR bfd_alloc, (abfd, size),
bfd *abfd AND
size_t size)
{
return bfd_alloc_by_size_t(abfd, (size_t)size);
}
DEFUN(PTR bfd_zalloc,(abfd, size),
bfd *abfd AND
size_t size)
{
PTR res;
res = bfd_alloc(abfd, size);
memset(res, 0, (size_t)size);
return res;
}
DEFUN(PTR bfd_realloc,(abfd, old, size),
bfd *abfd AND
PTR old AND
size_t size)
{
PTR res = bfd_alloc(abfd, size);
memcpy(res, old, (size_t)size);
return res;
}

1225
gnu/usr.bin/gdb/bfd/reloc.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,185 @@
/* seclet.c
Copyright (C) 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This module is part of BFD */
/* The intention is that one day, all the code which uses sections
will change and use seclets instead - maybe seglet would have been
a better name..
Anyway, a seclet contains enough info to be able to describe an
area of output memory in one go.
The only description so far catered for is that of the
<<bfd_indirect_seclet>>, which is a select which points to a
<<section>> and the <<asymbols>> associated with the section, so
that relocation can be done when needed.
One day there will be more types - they will at least migrate from
the linker's data structures - also there could be extra stuff,
like a bss seclet, which descibes a lump of memory as containing
zeros compactly, without the horrible SEC_* flag cruft.
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "seclet.h"
#include "coff/internal.h"
/* Create a new seclet and attach it to a section. */
bfd_seclet_type *
DEFUN(bfd_new_seclet,(abfd, section),
bfd *abfd AND
asection *section)
{
bfd_seclet_type *n = (bfd_seclet_type *)bfd_alloc(abfd, sizeof(bfd_seclet_type));
if (section->seclets_tail != (bfd_seclet_type *)NULL) {
section->seclets_tail->next = n;
}
else
{
section->seclets_head = n;
}
section->seclets_tail = n;
return n;
}
/* Given an indirect seclet which points to an input section, relocate
the contents of the seclet and put the data in its final
destination. */
static boolean
DEFUN(rel,(abfd, seclet, output_section, data, relocateable),
bfd *abfd AND
bfd_seclet_type *seclet AND
asection *output_section AND
PTR data AND
boolean relocateable)
{
if ((output_section->flags & SEC_HAS_CONTENTS) != 0
&& seclet->size)
{
data = (PTR) bfd_get_relocated_section_contents(abfd, seclet, data,
relocateable);
if(bfd_set_section_contents(abfd,
output_section,
data,
seclet->offset,
seclet->size) == false)
{
abort();
}
}
return true;
}
/* Put the contents of a seclet in its final destination. */
static boolean
DEFUN(seclet_dump_seclet,(abfd, seclet, section, data, relocateable),
bfd *abfd AND
bfd_seclet_type *seclet AND
asection *section AND
PTR data AND
boolean relocateable)
{
switch (seclet->type)
{
case bfd_indirect_seclet:
/* The contents of this section come from another one somewhere
else */
return rel(abfd, seclet, section, data, relocateable);
case bfd_fill_seclet:
/* Fill in the section with us */
{
char *d = bfd_xmalloc(seclet->size);
unsigned int i;
for (i =0; i < seclet->size; i+=2) {
d[i] = seclet->u.fill.value >> 8;
}
for (i = 1; i < seclet->size; i+=2) {
d[i] = seclet->u.fill.value ;
}
/* Don't bother to fill in empty sections */
if (!(bfd_get_section_flags(abfd, section) & SEC_HAS_CONTENTS))
{
return true;
}
return bfd_set_section_contents(abfd, section, d, seclet->offset,
seclet->size);
}
default:
abort();
}
return true;
}
/*
INTERNAL_FUNCTION
bfd_generic_seclet_link
SYNOPSIS
boolean bfd_generic_seclet_link
(bfd *abfd,
PTR data,
boolean relocateable);
DESCRIPTION
The generic seclet linking routine. The caller should have
set up seclets for all the output sections. The DATA argument
should point to a memory area large enough to hold the largest
section. This function looks through the seclets and moves
the contents into the output sections. If RELOCATEABLE is
true, the orelocation fields of the output sections must
already be initialized.
*/
boolean
DEFUN(bfd_generic_seclet_link,(abfd, data, relocateable),
bfd *abfd AND
PTR data AND
boolean relocateable)
{
asection *o = abfd->sections;
while (o != (asection *)NULL)
{
bfd_seclet_type *p = o->seclets_head;
while (p != (bfd_seclet_type *)NULL)
{
if (seclet_dump_seclet(abfd, p, o, data, relocateable) == false)
return false;
p = p ->next;
}
o = o->next;
}
return true;
}

View file

@ -0,0 +1,55 @@
/* Definitions of little sections (seclets) for BFD.
Copyright 1992 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _SECLET_H
#define _SECLET_H
enum bfd_seclet_enum
{
bfd_indirect_seclet,
bfd_fill_seclet
};
struct bfd_seclet
{
struct bfd_seclet *next;
enum bfd_seclet_enum type;
unsigned int offset;
unsigned int size;
union
{
struct
{
asection *section;
asymbol **symbols;
} indirect;
struct {
int value;
} fill;
}
u;
};
typedef struct bfd_seclet bfd_seclet_type;
bfd_seclet_type *
bfd_new_seclet PARAMS ((bfd *, asection *));
#endif

View file

@ -0,0 +1,899 @@
/* Object file "section" support for the BFD library.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
Sections
Sections are supported in BFD in <<section.c>>.
The raw data contained within a BFD is maintained through the
section abstraction. A single BFD may have any number of
sections, and keeps hold of them by pointing to the first,
each one points to the next in the list.
@menu
@* Section Input::
@* Section Output::
@* typedef asection::
@* section prototypes::
@end menu
INODE
Section Input, Section Output, Sections, Sections
SUBSECTION
Section Input
When a BFD is opened for reading, the section structures are
created and attached to the BFD.
Each section has a name which describes the section in the
outside world - for example, <<a.out>> would contain at least
three sections, called <<.text>>, <<.data>> and <<.bss>>.
Names need not be unique; for example a COFF file may have several
sections named .data.
Sometimes a BFD will contain more than the 'natural' number of
sections. A back end may attach other sections containing
constructor data, or an application may add a section (using
bfd_make_section) to the sections attached to an already open
BFD. For example, the linker creates a supernumary section
<<COMMON>> for each input file's BFD to hold information about
common storage.
The raw data is not necessarily read in at the same time as
the section descriptor is created. Some targets may leave the
data in place until a <<bfd_get_section_contents>> call is
made. Other back ends may read in all the data at once - For
example; an S-record file has to be read once to determine the
size of the data. An IEEE-695 file doesn't contain raw data in
sections, but data and relocation expressions intermixed, so
the data area has to be parsed to get out the data and
relocations.
INODE
Section Output, typedef asection, Section Input, Sections
SUBSECTION
Section Output
To write a new object style BFD, the various sections to be
written have to be created. They are attached to the BFD in
the same way as input sections, data is written to the
sections using <<bfd_set_section_contents>>.
Any program that creates or combines sections (e.g., the assembler
and linker) must use the fields <<output_section>> and
<<output_offset>> to indicate the file sections to which each
section must be written. (If the section is being created from
scratch, <<output_section>> should probably point to the section
itself, and <<output_offset>> should probably be zero.)
The data to be written comes from input sections attached to
the output sections. The output section structure can be
considered a filter for the input section, the output section
determines the vma of the output data and the name, but the
input section determines the offset into the output section of
the data to be written.
E.g., to create a section "O", starting at 0x100, 0x123 long,
containing two subsections, "A" at offset 0x0 (ie at vma
0x100) and "B" at offset 0x20 (ie at vma 0x120) the structures
would look like:
| section name "A"
| output_offset 0x00
| size 0x20
| output_section -----------> section name "O"
| | vma 0x100
| section name "B" | size 0x123
| output_offset 0x20 |
| size 0x103 |
| output_section --------|
SUBSECTION
Seglets
The data within a section is stored in a <<seglet>>. These
are much like the fixups in <<gas>>. The seglet abstraction
allows the a section to grow and shrink within itself.
A seglet knows how big it is, and which is the next seglet and
where the raw data for it is, and also points to a list of
relocations which apply to it.
The seglet is used by the linker to perform relaxing on final
code. The application creates code which is as big as
necessary to make it work without relaxing, and the user can
select whether to relax. Sometimes relaxing takes a lot of
time. The linker runs around the relocations to see if any
are attached to data which can be shrunk, if so it does it on
a seglet by seglet basis.
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/*
DOCDD
INODE
typedef asection, section prototypes, Section Output, Sections
SUBSECTION
typedef asection
The shape of a section struct:
CODE_FRAGMENT
.
.typedef struct sec
.{
. {* The name of the section, the name isn't a copy, the pointer is
. the same as that passed to bfd_make_section. *}
.
. CONST char *name;
.
. {* Which section is it 0.nth *}
.
. int index;
.
. {* The next section in the list belonging to the BFD, or NULL. *}
.
. struct sec *next;
.
. {* The field flags contains attributes of the section. Some of
. flags are read in from the object file, and some are
. synthesized from other information. *}
.
. flagword flags;
.
.#define SEC_NO_FLAGS 0x000
.
. {* Tells the OS to allocate space for this section when loaded.
. This would clear for a section containing debug information
. only. *}
.#define SEC_ALLOC 0x001
.
. {* Tells the OS to load the section from the file when loading.
. This would be clear for a .bss section *}
.#define SEC_LOAD 0x002
.
. {* The section contains data still to be relocated, so there will
. be some relocation information too. *}
.#define SEC_RELOC 0x004
.
.#if 0 {* Obsolete ? *}
.#define SEC_BALIGN 0x008
.#endif
.
. {* A signal to the OS that the section contains read only
. data. *}
.#define SEC_READONLY 0x010
.
. {* The section contains code only. *}
.#define SEC_CODE 0x020
.
. {* The section contains data only. *}
.#define SEC_DATA 0x040
.
. {* The section will reside in ROM. *}
.#define SEC_ROM 0x080
.
. {* The section contains constructor information. This section
. type is used by the linker to create lists of constructors and
. destructors used by <<g++>>. When a back end sees a symbol
. which should be used in a constructor list, it creates a new
. section for the type of name (eg <<__CTOR_LIST__>>), attaches
. the symbol to it and builds a relocation. To build the lists
. of constructors, all the linker has to do is catenate all the
. sections called <<__CTOR_LIST__>> and relocte the data
. contained within - exactly the operations it would peform on
. standard data. *}
.#define SEC_CONSTRUCTOR 0x100
.
. {* The section is a constuctor, and should be placed at the
. end of the text, data, or bss section(?). *}
.#define SEC_CONSTRUCTOR_TEXT 0x1100
.#define SEC_CONSTRUCTOR_DATA 0x2100
.#define SEC_CONSTRUCTOR_BSS 0x3100
.
. {* The section has contents - a data section could be
. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>, a debug section could be
. <<SEC_HAS_CONTENTS>> *}
.#define SEC_HAS_CONTENTS 0x200
.
. {* An instruction to the linker not to output sections
. containing this flag even if they have information which
. would normally be written. *}
.#define SEC_NEVER_LOAD 0x400
.
. {* The section is a shared library section. The linker must leave
. these completely alone, as the vma and size are used when
. the executable is loaded. *}
.#define SEC_SHARED_LIBRARY 0x800
.
. {* The section is a common section (symbols may be defined
. multiple times, the value of a symbol is the amount of
. space it requires, and the largest symbol value is the one
. used). Most targets have exactly one of these (which we
. translate to bfd_com_section), but ECOFF has two. *}
.#define SEC_IS_COMMON 0x8000
.
. {* The section contains only debugging information. For
. example, this is set for ELF .debug and .stab sections.
. strip tests this flag to see if a section can be
. discarded. *}
.#define SEC_DEBUGGING 0x10000
.
. {* End of section flags. *}
.
. {* The virtual memory address of the section - where it will be
. at run time. The symbols are relocated against this. The
. user_set_vma flag is maintained by bfd; if it's not set, the
. backend can assign addresses (for example, in <<a.out>>, where
. the default address for <<.data>> is dependent on the specific
. target and various flags). *}
.
. bfd_vma vma;
. boolean user_set_vma;
.
. {* The load address of the section - where it would be in a
. rom image, really only used for writing section header
. information. *}
.
. bfd_vma lma;
.
. {* The size of the section in bytes, as it will be output.
. contains a value even if the section has no contents (eg, the
. size of <<.bss>>). This will be filled in after relocation *}
.
. bfd_size_type _cooked_size;
.
. {* The size on disk of the section in bytes originally. Normally this
. value is the same as the size, but if some relaxing has
. been done, then this value will be bigger. *}
.
. bfd_size_type _raw_size;
.
. {* If this section is going to be output, then this value is the
. offset into the output section of the first byte in the input
. section. Eg, if this was going to start at the 100th byte in
. the output section, this value would be 100. *}
.
. bfd_vma output_offset;
.
. {* The output section through which to map on output. *}
.
. struct sec *output_section;
.
. {* The alignment requirement of the section, as an exponent - eg
. 3 aligns to 2^3 (or 8) *}
.
. unsigned int alignment_power;
.
. {* If an input section, a pointer to a vector of relocation
. records for the data in this section. *}
.
. struct reloc_cache_entry *relocation;
.
. {* If an output section, a pointer to a vector of pointers to
. relocation records for the data in this section. *}
.
. struct reloc_cache_entry **orelocation;
.
. {* The number of relocation records in one of the above *}
.
. unsigned reloc_count;
.
. {* Information below is back end specific - and not always used
. or updated. *}
.
. {* File position of section data *}
.
. file_ptr filepos;
.
. {* File position of relocation info *}
.
. file_ptr rel_filepos;
.
. {* File position of line data *}
.
. file_ptr line_filepos;
.
. {* Pointer to data for applications *}
.
. PTR userdata;
.
. struct lang_output_section *otheruserdata;
.
. {* Attached line number information *}
.
. alent *lineno;
.
. {* Number of line number records *}
.
. unsigned int lineno_count;
.
. {* When a section is being output, this value changes as more
. linenumbers are written out *}
.
. file_ptr moving_line_filepos;
.
. {* what the section number is in the target world *}
.
. int target_index;
.
. PTR used_by_bfd;
.
. {* If this is a constructor section then here is a list of the
. relocations created to relocate items within it. *}
.
. struct relent_chain *constructor_chain;
.
. {* The BFD which owns the section. *}
.
. bfd *owner;
.
. boolean reloc_done;
. {* A symbol which points at this section only *}
. struct symbol_cache_entry *symbol;
. struct symbol_cache_entry **symbol_ptr_ptr;
.
. struct bfd_seclet *seclets_head;
. struct bfd_seclet *seclets_tail;
.} asection ;
.
.
. {* These sections are global, and are managed by BFD. The application
. and target back end are not permitted to change the values in
. these sections. *}
.#define BFD_ABS_SECTION_NAME "*ABS*"
.#define BFD_UND_SECTION_NAME "*UND*"
.#define BFD_COM_SECTION_NAME "*COM*"
.#define BFD_IND_SECTION_NAME "*IND*"
.
. {* the absolute section *}
.extern asection bfd_abs_section;
. {* Pointer to the undefined section *}
.extern asection bfd_und_section;
. {* Pointer to the common section *}
.extern asection bfd_com_section;
. {* Pointer to the indirect section *}
.extern asection bfd_ind_section;
.
.extern struct symbol_cache_entry *bfd_abs_symbol;
.extern struct symbol_cache_entry *bfd_com_symbol;
.extern struct symbol_cache_entry *bfd_und_symbol;
.extern struct symbol_cache_entry *bfd_ind_symbol;
.#define bfd_get_section_size_before_reloc(section) \
. (section->reloc_done ? (abort(),1): (section)->_raw_size)
.#define bfd_get_section_size_after_reloc(section) \
. ((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
*/
/* These symbols are global, not specific to any BFD. Therefore, anything
that tries to change them is broken, and should be repaired. */
static CONST asymbol global_syms[] = {
/* the_bfd, name, value, attr, section [, udata] */
{ 0, BFD_COM_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_com_section },
{ 0, BFD_UND_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_und_section },
{ 0, BFD_ABS_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_abs_section },
{ 0, BFD_IND_SECTION_NAME, 0, BSF_SECTION_SYM, &bfd_ind_section },
};
#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
asymbol *SYM = (asymbol *) &global_syms[IDX]; \
asection SEC = { NAME, 0, 0, FLAGS, 0, 0, (boolean) 0, 0, 0, 0, &SEC,\
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (boolean) 0, \
(asymbol *) &global_syms[IDX], &SYM, }
STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, BFD_COM_SECTION_NAME, 0);
STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1);
STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
#undef STD_SECTION
/*
DOCDD
INODE
section prototypes, , typedef asection, Sections
SUBSECTION
section prototypes
These are the functions exported by the section handling part of
<<libbfd>.
*/
/*
FUNCTION
bfd_get_section_by_name
SYNOPSIS
asection *bfd_get_section_by_name(bfd *abfd, CONST char *name);
DESCRIPTION
Runs through the provided @var{abfd} and returns the one of the
<<asection>>s who's name matches that provided, otherwise NULL.
@xref{Sections}, for more information.
This should only be used in special cases; the normal way to process
all sections of a given name is to use bfd_map_over_sections and
strcmp on the name (or better yet, base it on the section flags
or something else) for each section.
*/
asection *
DEFUN(bfd_get_section_by_name,(abfd, name),
bfd *abfd AND
CONST char *name)
{
asection *sect;
for (sect = abfd->sections; sect != NULL; sect = sect->next)
if (!strcmp (sect->name, name)) return sect;
return NULL;
}
/*
FUNCTION
bfd_make_section_old_way
SYNOPSIS
asection *bfd_make_section_old_way(bfd *, CONST char *name);
DESCRIPTION
This function creates a new empty section called @var{name}
and attaches it to the end of the chain of sections for the
BFD supplied. An attempt to create a section with a name which
is already in use, returns its pointer without changing the
section chain.
It has the funny name since this is the way it used to be
before is was rewritten...
Possible errors are:
o invalid_operation -
If output has already started for this BFD.
o no_memory -
If obstack alloc fails.
*/
asection *
DEFUN(bfd_make_section_old_way,(abfd, name),
bfd *abfd AND
CONST char * name)
{
asection *sec = bfd_get_section_by_name(abfd, name);
if (sec == (asection *)NULL)
{
sec = bfd_make_section(abfd, name);
}
return sec;
}
/*
FUNCTION
bfd_make_section_anyway
SYNOPSIS
asection *bfd_make_section_anyway(bfd *, CONST char *name);
DESCRIPTION
Create a new empty section called @var{name} and attach it to the end of
the chain of sections for @var{abfd}. Create a new section even if there
is already a section with that name.
Returns NULL and sets bfd_error on error; possible errors are:
o invalid_operation - If output has already started for @var{abfd}.
o no_memory - If obstack alloc fails.
*/
sec_ptr
bfd_make_section_anyway (abfd, name)
bfd *abfd;
CONST char *name;
{
asection *newsect;
asection **prev = &abfd->sections;
asection * sect = abfd->sections;
if (abfd->output_has_begun)
{
bfd_error = invalid_operation;
return NULL;
}
while (sect) {
prev = &sect->next;
sect = sect->next;
}
newsect = (asection *) bfd_zalloc(abfd, sizeof (asection));
if (newsect == NULL) {
bfd_error = no_memory;
return NULL;
}
newsect->name = name;
newsect->index = abfd->section_count++;
newsect->flags = SEC_NO_FLAGS;
newsect->userdata = 0;
newsect->next = (asection *)NULL;
newsect->relocation = (arelent *)NULL;
newsect->reloc_count = 0;
newsect->line_filepos =0;
newsect->owner = abfd;
/* Create a symbol whos only job is to point to this section. This is
useful for things like relocs which are relative to the base of a
section. */
newsect->symbol = bfd_make_empty_symbol(abfd);
newsect->symbol->name = name;
newsect->symbol->value = 0;
newsect->symbol->section = newsect;
newsect->symbol->flags = BSF_SECTION_SYM;
newsect->symbol_ptr_ptr = &newsect->symbol;
if (BFD_SEND (abfd, _new_section_hook, (abfd, newsect)) != true) {
free (newsect);
return NULL;
}
*prev = newsect;
return newsect;
}
/*
FUNCTION
bfd_make_section
SYNOPSIS
asection *bfd_make_section(bfd *, CONST char *name);
DESCRIPTION
Like bfd_make_section_anyway, but return NULL (without setting
bfd_error) without changing the section chain if there is already a
section named @var{name}. If there is an error, return NULL and set
bfd_error.
*/
sec_ptr
DEFUN(bfd_make_section,(abfd, name),
bfd *abfd AND
CONST char * name)
{
asection * sect = abfd->sections;
if (strcmp(name, BFD_ABS_SECTION_NAME) == 0)
{
return &bfd_abs_section;
}
if (strcmp(name, BFD_COM_SECTION_NAME) == 0)
{
return &bfd_com_section;
}
if (strcmp(name, BFD_UND_SECTION_NAME) == 0)
{
return &bfd_und_section;
}
if (strcmp(name, BFD_IND_SECTION_NAME) == 0)
{
return &bfd_ind_section;
}
while (sect) {
if (!strcmp(sect->name, name)) return NULL;
sect = sect->next;
}
/* The name is not already used; go ahead and make a new section. */
return bfd_make_section_anyway (abfd, name);
}
/*
FUNCTION
bfd_set_section_flags
SYNOPSIS
boolean bfd_set_section_flags(bfd *, asection *, flagword);
DESCRIPTION
Attempts to set the attributes of the section named in the BFD
supplied to the value. Returns true on success, false on
error. Possible error returns are:
o invalid operation -
The section cannot have one or more of the attributes
requested. For example, a .bss section in <<a.out>> may not
have the <<SEC_HAS_CONTENTS>> field set.
*/
boolean
DEFUN(bfd_set_section_flags,(abfd, section, flags),
bfd *abfd AND
sec_ptr section AND
flagword flags)
{
#if 0
/* If you try to copy a text section from an input file (where it
has the SEC_CODE flag set) to an output file, this loses big if
the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE
set - which it doesn't, at least not for a.out. FIXME */
if ((flags & bfd_applicable_section_flags (abfd)) != flags) {
bfd_error = invalid_operation;
return false;
}
#endif
section->flags = flags;
return true;
}
/*
FUNCTION
bfd_map_over_sections
SYNOPSIS
void bfd_map_over_sections(bfd *abfd,
void (*func)(bfd *abfd,
asection *sect,
PTR obj),
PTR obj);
DESCRIPTION
Calls the provided function @var{func} for each section
attached to the BFD @var{abfd}, passing @var{obj} as an
argument. The function will be called as if by
| func(abfd, the_section, obj);
This is the prefered method for iterating over sections, an
alternative would be to use a loop:
| section *p;
| for (p = abfd->sections; p != NULL; p = p->next)
| func(abfd, p, ...)
*/
/*VARARGS2*/
void
DEFUN(bfd_map_over_sections,(abfd, operation, user_storage),
bfd *abfd AND
void (*operation) PARAMS ((bfd *abfd, asection *sect, PTR obj)) AND
PTR user_storage)
{
asection *sect;
int i = 0;
for (sect = abfd->sections; sect != NULL; i++, sect = sect->next)
(*operation) (abfd, sect, user_storage);
if (i != abfd->section_count) /* Debugging */
abort();
}
/*
FUNCTION
bfd_set_section_size
SYNOPSIS
boolean bfd_set_section_size(bfd *, asection *, bfd_size_type val);
DESCRIPTION
Sets @var{section} to the size @var{val}. If the operation is
ok, then <<true>> is returned, else <<false>>.
Possible error returns:
o invalid_operation -
Writing has started to the BFD, so setting the size is invalid
*/
boolean
DEFUN(bfd_set_section_size,(abfd, ptr, val),
bfd *abfd AND
sec_ptr ptr AND
bfd_size_type val)
{
/* Once you've started writing to any section you cannot create or change
the size of any others. */
if (abfd->output_has_begun) {
bfd_error = invalid_operation;
return false;
}
ptr->_cooked_size = val;
ptr->_raw_size = val;
return true;
}
/*
FUNCTION
bfd_set_section_contents
SYNOPSIS
boolean bfd_set_section_contents
(bfd *abfd,
asection *section,
PTR data,
file_ptr offset,
bfd_size_type count);
DESCRIPTION
Sets the contents of the section @var{section} in BFD
@var{abfd} to the data starting in memory at @var{data}. The
data is written to the output section starting at offset
@var{offset} for @var{count} bytes.
Normally <<true>> is returned, else <<false>>. Possible error
returns are:
o no_contents -
The output section does not have the <<SEC_HAS_CONTENTS>>
attribute, so nothing can be written to it.
o and some more too
This routine is front end to the back end function
<<_bfd_set_section_contents>>.
*/
#define bfd_get_section_size_now(abfd,sec) \
(sec->reloc_done \
? bfd_get_section_size_after_reloc (sec) \
: bfd_get_section_size_before_reloc (sec))
boolean
DEFUN(bfd_set_section_contents,(abfd, section, location, offset, count),
bfd *abfd AND
sec_ptr section AND
PTR location AND
file_ptr offset AND
bfd_size_type count)
{
bfd_size_type sz;
if (!bfd_get_section_flags(abfd, section) & SEC_HAS_CONTENTS)
{
bfd_error = no_contents;
return(false);
}
if (offset < 0)
{
bad_val:
bfd_error = bad_value;
return false;
}
sz = bfd_get_section_size_now (abfd, section);
if (offset > sz
|| count > sz
|| offset + count > sz)
goto bad_val;
switch (abfd->direction)
{
case read_direction:
case no_direction:
bfd_error = invalid_operation;
return false;
case write_direction:
break;
case both_direction:
/* File is opened for update. `output_has_begun' some time ago when
the file was created. Do not recompute sections sizes or alignments
in _bfd_set_section_content. */
abfd->output_has_begun = true;
break;
}
if (BFD_SEND (abfd, _bfd_set_section_contents,
(abfd, section, location, offset, count)))
{
abfd->output_has_begun = true;
return true;
}
return false;
}
/*
FUNCTION
bfd_get_section_contents
SYNOPSIS
boolean bfd_get_section_contents
(bfd *abfd, asection *section, PTR location,
file_ptr offset, bfd_size_type count);
DESCRIPTION
This function reads data from @var{section} in BFD @var{abfd}
into memory starting at @var{location}. The data is read at an
offset of @var{offset} from the start of the input section,
and is read for @var{count} bytes.
If the contents of a constuctor with the <<SEC_CONSTUCTOR>>
flag set are requested, then the @var{location} is filled with
zeroes. If no errors occur, <<true>> is returned, else
<<false>>.
*/
boolean
DEFUN(bfd_get_section_contents,(abfd, section, location, offset, count),
bfd *abfd AND
sec_ptr section AND
PTR location AND
file_ptr offset AND
bfd_size_type count)
{
bfd_size_type sz;
if (section->flags & SEC_CONSTRUCTOR)
{
memset(location, 0, (unsigned)count);
return true;
}
if (offset < 0)
{
bad_val:
bfd_error = bad_value;
return false;
}
sz = bfd_get_section_size_now (abfd, section);
if (offset > sz
|| count > sz
|| offset + count > sz)
goto bad_val;
if (count == 0)
/* Don't bother. */
return true;
return BFD_SEND (abfd, _bfd_get_section_contents,
(abfd, section, location, offset, count));
}

1001
gnu/usr.bin/gdb/bfd/srec.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,59 @@
/* Table of stab names for the BFD library.
Copyright (C) 1990-1991 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#define ARCH_SIZE 32 /* Value doesn't matter. */
#include "libaout.h"
#include "aout/aout64.h"
/* Create a table of debugging stab-codes and corresponding names. */
#define __define_name(CODE, STRING) {(int)CODE, STRING},
#define __define_stab(NAME, CODE, STRING) __define_name(CODE, STRING)
CONST struct {short code; char string[10];} aout_stab_names[]
= {
#include "aout/stab.def"
/* These are not really stab symbols, but it is
convenient to have them here for the sake of nm.
For completeness, we could also add N_TEXT etc, but those
are never needed, since nm treats those specially. */
__define_name (N_SETA, "SETA") /* Absolute set element symbol */
__define_name (N_SETT, "SETT") /* Text set element symbol */
__define_name (N_SETD, "SETD") /* Data set element symbol */
__define_name (N_SETB, "SETB") /* Bss set element symbol */
__define_name (N_SETV, "SETV") /* Pointer to set vector in data area. */
__define_name (N_INDR, "INDR")
__define_name (N_WARNING, "WARNING")
};
#undef __define_stab
#undef GNU_EXTRA_STABS
CONST char *
DEFUN(aout_stab_name,(code),
int code)
{
register int i = sizeof(aout_stab_names) / sizeof(aout_stab_names[0]);
while (--i >= 0)
if (aout_stab_names[i].code == code)
return aout_stab_names[i].string;
return 0;
}

527
gnu/usr.bin/gdb/bfd/syms.c Normal file
View file

@ -0,0 +1,527 @@
/* Generic symbol-table support for the BFD library.
Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/*
SECTION
Symbols
BFD trys to maintain as much symbol information as it can when
it moves information from file to file. BFD passes information
to applications though the <<asymbol>> structure. When the
application requests the symbol table, BFD reads the table in
the native form and translates parts of it into the internal
format. To maintain more than the infomation passed to
applications some targets keep some information `behind the
scenes', in a structure only the particular back end knows
about. For example, the coff back end keeps the original
symbol table structure as well as the canonical structure when
a BFD is read in. On output, the coff back end can reconstruct
the output symbol table so that no information is lost, even
information unique to coff which BFD doesn't know or
understand. If a coff symbol table was read, but was written
through an a.out back end, all the coff specific information
would be lost. The symbol table of a BFD
is not necessarily read in until a canonicalize request is
made. Then the BFD back end fills in a table provided by the
application with pointers to the canonical information. To
output symbols, the application provides BFD with a table of
pointers to pointers to <<asymbol>>s. This allows applications
like the linker to output a symbol as read, since the `behind
the scenes' information will be still available.
@menu
@* Reading Symbols::
@* Writing Symbols::
@* typedef asymbol::
@* symbol handling functions::
@end menu
INODE
Reading Symbols, Writing Symbols, Symbols, Symbols
SUBSECTION
Reading Symbols
There are two stages to reading a symbol table from a BFD;
allocating storage, and the actual reading process. This is an
excerpt from an appliction which reads the symbol table:
| unsigned int storage_needed;
| asymbol **symbol_table;
| unsigned int number_of_symbols;
| unsigned int i;
|
| storage_needed = get_symtab_upper_bound (abfd);
|
| if (storage_needed == 0) {
| return ;
| }
| symbol_table = (asymbol **) bfd_xmalloc (storage_needed);
| ...
| number_of_symbols =
| bfd_canonicalize_symtab (abfd, symbol_table);
|
| for (i = 0; i < number_of_symbols; i++) {
| process_symbol (symbol_table[i]);
| }
All storage for the symbols themselves is in an obstack
connected to the BFD, and is freed when the BFD is closed.
INODE
Writing Symbols, typedef asymbol, Reading Symbols, Symbols
SUBSECTION
Writing Symbols
Writing of a symbol table is automatic when a BFD open for
writing is closed. The application attaches a vector of
pointers to pointers to symbols to the BFD being written, and
fills in the symbol count. The close and cleanup code reads
through the table provided and performs all the necessary
operations. The outputing code must always be provided with an
'owned' symbol; one which has come from another BFD, or one
which has been created using <<bfd_make_empty_symbol>>. An
example showing the creation of a symbol table with only one element:
| #include "bfd.h"
| main()
| {
| bfd *abfd;
| asymbol *ptrs[2];
| asymbol *new;
|
| abfd = bfd_openw("foo","a.out-sunos-big");
| bfd_set_format(abfd, bfd_object);
| new = bfd_make_empty_symbol(abfd);
| new->name = "dummy_symbol";
| new->section = bfd_make_section_old_way(abfd, ".text");
| new->flags = BSF_GLOBAL;
| new->value = 0x12345;
|
| ptrs[0] = new;
| ptrs[1] = (asymbol *)0;
|
| bfd_set_symtab(abfd, ptrs, 1);
| bfd_close(abfd);
| }
|
| ./makesym
| nm foo
| 00012345 A dummy_symbol
Many formats cannot represent arbitary symbol information; for
instance the <<a.out>> object format does not allow an
arbitary number of sections. A symbol pointing to a section
which is not one of <<.text>>, <<.data>> or <<.bss>> cannot
be described.
*/
/*
DOCDD
INODE
typedef asymbol, symbol handling functions, Writing Symbols, Symbols
*/
/*
SUBSECTION
typedef asymbol
An <<asymbol>> has the form:
*/
/*
CODE_FRAGMENT
.
.typedef struct symbol_cache_entry
.{
. {* A pointer to the BFD which owns the symbol. This information
. is necessary so that a back end can work out what additional
. information (invisible to the application writer) is carried
. with the symbol.
.
. This field is *almost* redundant, since you can use section->owner
. instead, except that some symbols point to the global sections
. bfd_{abs,com,und}_section. This could be fixed by making
. these globals be per-bfd (or per-target-flavor). FIXME. *}
.
. struct _bfd *the_bfd; {* Use bfd_asymbol_bfd(sym) to access this field. *}
.
. {* The text of the symbol. The name is left alone, and not copied - the
. application may not alter it. *}
. CONST char *name;
.
. {* The value of the symbol. This really should be a union of a
. numeric value with a pointer, since some flags indicate that
. a pointer to another symbol is stored here. *}
. symvalue value;
.
. {* Attributes of a symbol: *}
.
.#define BSF_NO_FLAGS 0x00
.
. {* The symbol has local scope; <<static>> in <<C>>. The value
. is the offset into the section of the data. *}
.#define BSF_LOCAL 0x01
.
. {* The symbol has global scope; initialized data in <<C>>. The
. value is the offset into the section of the data. *}
.#define BSF_GLOBAL 0x02
.
. {* The symbol has global scope, and is exported. The value is
. the offset into the section of the data. *}
.#define BSF_EXPORT BSF_GLOBAL {* no real difference *}
.
. {* A normal C symbol would be one of:
. <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
. <<BSF_GLOBAL>> *}
.
. {* The symbol is a debugging record. The value has an arbitary
. meaning. *}
.#define BSF_DEBUGGING 0x08
.
. {* The symbol denotes a function entry point. Used in ELF,
. perhaps others someday. *}
.#define BSF_FUNCTION 0x10
.
. {* Used by the linker. *}
.#define BSF_KEEP 0x20
.#define BSF_KEEP_G 0x40
.
. {* A weak global symbol, overridable without warnings by
. a regular global symbol of the same name. *}
.#define BSF_WEAK 0x80
.
. {* This symbol was created to point to a section, e.g. ELF's
. STT_SECTION symbols. *}
.#define BSF_SECTION_SYM 0x100
.
. {* The symbol used to be a common symbol, but now it is
. allocated. *}
.#define BSF_OLD_COMMON 0x200
.
. {* The default value for common data. *}
.#define BFD_FORT_COMM_DEFAULT_VALUE 0
.
. {* In some files the type of a symbol sometimes alters its
. location in an output file - ie in coff a <<ISFCN>> symbol
. which is also <<C_EXT>> symbol appears where it was
. declared and not at the end of a section. This bit is set
. by the target BFD part to convey this information. *}
.
.#define BSF_NOT_AT_END 0x400
.
. {* Signal that the symbol is the label of constructor section. *}
.#define BSF_CONSTRUCTOR 0x800
.
. {* Signal that the symbol is a warning symbol. If the symbol
. is a warning symbol, then the value field (I know this is
. tacky) will point to the asymbol which when referenced will
. cause the warning. *}
.#define BSF_WARNING 0x1000
.
. {* Signal that the symbol is indirect. The value of the symbol
. is a pointer to an undefined asymbol which contains the
. name to use instead. *}
.#define BSF_INDIRECT 0x2000
.
. {* BSF_FILE marks symbols that contain a file name. This is used
. for ELF STT_FILE symbols. *}
.#define BSF_FILE 0x4000
.
. flagword flags;
.
. {* A pointer to the section to which this symbol is
. relative. This will always be non NULL, there are special
. sections for undefined and absolute symbols *}
. struct sec *section;
.
. {* Back end special data. This is being phased out in favour
. of making this a union. *}
. PTR udata;
.
.} asymbol;
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "aout/stab_gnu.h"
/*
DOCDD
INODE
symbol handling functions, , typedef asymbol, Symbols
SUBSECTION
Symbol Handling Functions
*/
/*
FUNCTION
get_symtab_upper_bound
DESCRIPTION
Returns the number of bytes required in a vector of pointers
to <<asymbols>> for all the symbols in the supplied BFD,
including a terminal NULL pointer. If there are no symbols in
the BFD, then 0 is returned.
.#define get_symtab_upper_bound(abfd) \
. BFD_SEND (abfd, _get_symtab_upper_bound, (abfd))
*/
/*
FUNCTION
bfd_canonicalize_symtab
DESCRIPTION
Supplied a BFD and a pointer to an uninitialized vector of
pointers. This reads in the symbols from the BFD, and fills in
the table with pointers to the symbols, and a trailing NULL.
The routine returns the actual number of symbol pointers not
including the NULL.
.#define bfd_canonicalize_symtab(abfd, location) \
. BFD_SEND (abfd, _bfd_canonicalize_symtab,\
. (abfd, location))
*/
/*
FUNCTION
bfd_set_symtab
DESCRIPTION
Provided a table of pointers to symbols and a count, writes to
the output BFD the symbols when closed.
SYNOPSIS
boolean bfd_set_symtab (bfd *, asymbol **, unsigned int );
*/
boolean
bfd_set_symtab (abfd, location, symcount)
bfd *abfd;
asymbol **location;
unsigned int symcount;
{
if ((abfd->format != bfd_object) || (bfd_read_p (abfd))) {
bfd_error = invalid_operation;
return false;
}
bfd_get_outsymbols (abfd) = location;
bfd_get_symcount (abfd) = symcount;
return true;
}
/*
FUNCTION
bfd_print_symbol_vandf
DESCRIPTION
Prints the value and flags of the symbol supplied to the stream file.
SYNOPSIS
void bfd_print_symbol_vandf(PTR file, asymbol *symbol);
*/
void
DEFUN(bfd_print_symbol_vandf,(file, symbol),
PTR file AND
asymbol *symbol)
{
flagword type = symbol->flags;
if (symbol->section != (asection *)NULL)
{
fprintf_vma(file, symbol->value+symbol->section->vma);
}
else
{
fprintf_vma(file, symbol->value);
}
fprintf(file," %c%c%c%c%c%c%c",
(type & BSF_LOCAL) ? 'l':' ',
(type & BSF_GLOBAL) ? 'g' : ' ',
(type & BSF_WEAK) ? 'w' : ' ',
(type & BSF_CONSTRUCTOR) ? 'C' : ' ',
(type & BSF_WARNING) ? 'W' : ' ',
(type & BSF_INDIRECT) ? 'I' : ' ',
(type & BSF_DEBUGGING) ? 'd' :' ');
}
/*
FUNCTION
bfd_make_empty_symbol
DESCRIPTION
This function creates a new <<asymbol>> structure for the BFD,
and returns a pointer to it.
This routine is necessary, since each back end has private
information surrounding the <<asymbol>>. Building your own
<<asymbol>> and pointing to it will not create the private
information, and will cause problems later on.
.#define bfd_make_empty_symbol(abfd) \
. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
*/
/*
FUNCTION
bfd_make_debug_symbol
DESCRIPTION
This function creates a new <<asymbol>> structure for the BFD,
to be used as a debugging symbol. Further details of its use have
yet to be worked out.
.#define bfd_make_debug_symbol(abfd,ptr,size) \
. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
*/
struct section_to_type
{
CONST char *section;
char type;
};
/* Map COFF section names to POSIX/BSD single-character symbol types.
This table is probably incomplete. It is sorted for convenience of
adding entries. Since it is so short, a linear search is used. */
static CONST struct section_to_type stt[] = {
{"*DEBUG*", 'N'},
{".bss", 'b'},
{".data", 'd'},
{".sbss", 's'}, /* Small BSS (uninitialized data) */
{".scommon", 'c'}, /* Small common */
{".sdata", 'g'}, /* Small initialized data */
{".text", 't'},
{0, 0}
};
/* Return the single-character symbol type corresponding to
COFF section S, or '?' for an unknown COFF section. */
static char
coff_section_type (s)
char *s;
{
CONST struct section_to_type *t;
for (t = &stt[0]; t->section; t++)
if (!strcmp (s, t->section))
return t->type;
return '?';
}
#ifndef islower
#define islower(c) ((c) >= 'a' && (c) <= 'z')
#endif
#ifndef toupper
#define toupper(c) (islower(c) ? ((c) & ~0x20) : (c))
#endif
/*
FUNCTION
bfd_decode_symclass
DESCRIPTION
Return a character corresponding to the symbol
class of symbol, or '?' for an unknown class.
SYNOPSIS
int bfd_decode_symclass(asymbol *symbol);
*/
int
DEFUN(bfd_decode_symclass,(symbol),
asymbol *symbol)
{
char c;
if (bfd_is_com_section (symbol->section))
return 'C';
if (symbol->section == &bfd_und_section)
return 'U';
if (symbol->section == &bfd_ind_section)
return 'I';
if (!(symbol->flags & (BSF_GLOBAL|BSF_LOCAL)))
return '?';
if (symbol->section == &bfd_abs_section)
c = 'a';
else if (symbol->section)
c = coff_section_type (symbol->section->name);
else
return '?';
if (symbol->flags & BSF_GLOBAL)
c = toupper (c);
return c;
/* We don't have to handle these cases just yet, but we will soon:
N_SETV: 'v';
N_SETA: 'l';
N_SETT: 'x';
N_SETD: 'z';
N_SETB: 's';
N_INDR: 'i';
*/
}
/*
FUNCTION
bfd_symbol_info
DESCRIPTION
Fill in the basic info about symbol that nm needs.
Additional info may be added by the back-ends after
calling this function.
SYNOPSIS
void bfd_symbol_info(asymbol *symbol, symbol_info *ret);
*/
void
DEFUN(bfd_symbol_info,(symbol, ret),
asymbol *symbol AND
symbol_info *ret)
{
ret->type = bfd_decode_symclass (symbol);
if (ret->type != 'U')
ret->value = symbol->value+symbol->section->vma;
else
ret->value = 0;
ret->name = symbol->name;
}
void
bfd_symbol_is_absolute()
{
abort();
}

View file

@ -0,0 +1,46 @@
#ifndef hosts_i386bsd_H
/* Intel 386 running any BSD Unix */
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <string.h>
#include <sys/file.h>
#include <machine/param.h>
#include <machine/vmparam.h>
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
#endif
#define SEEK_SET 0
#define SEEK_CUR 1
#define HOST_PAGE_SIZE NBPG
#define HOST_MACHINE_ARCH bfd_arch_i386
#define HOST_TEXT_START_ADDR USRTEXT
/* Jolitz suggested defining HOST_STACK_END_ADDR to
(u.u_kproc.kp_eproc.e_vm.vm_maxsaddr + MAXSSIZ), which should work on
both BSDI and 386BSD, but that is believed not to work for BSD 4.4. */
#ifdef __bsdi__
/* This seems to be the right thing for BSDI. */
#define HOST_STACK_END_ADDR USRSTACK
#define HOST_DATA_START_ADDR ((bfd_vma)u.u_kproc.kp_eproc.e_vm.vm_daddr)
#else
/* This seems to be the right thing for 386BSD release 0.1. */
#define HOST_STACK_END_ADDR (USRSTACK - MAXSSIZ)
#endif
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
((core_bfd)->tdata.trad_core_data->u.u_sig)
#define u_comm u_kproc.kp_proc.p_comm
#include "fopen-same.h"
#define hosts_i386bsd_H
#endif

View file

@ -0,0 +1,635 @@
/* Generic target-file-type support for the BFD library.
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
/*
SECTION
Targets
DESCRIPTION
Each port of BFD to a different machine requries the creation
of a target back end. All the back end provides to the root
part of BFD is a structure containing pointers to functions
which perform certain low level operations on files. BFD
translates the applications's requests through a pointer into
calls to the back end routines.
When a file is opened with <<bfd_openr>>, its format and
target are unknown. BFD uses various mechanisms to determine
how to interpret the file. The operations performed are:
o First a BFD is created by calling the internal routine
<<new_bfd>>, then <<bfd_find_target>> is called with the
target string supplied to <<bfd_openr>> and the new BFD pointer.
o If a null target string was provided to <<bfd_find_target>>,
it looks up the environment variable <<GNUTARGET>> and uses
that as the target string.
o If the target string is still NULL, or the target string is
<<default>>, then the first item in the target vector is used
as the target type, and <<target_defaulted>> is set to
cause <<bfd_check_format>> to loop through all the targets.
@xref{bfd_target}. @xref{Formats}.
o Otherwise, the elements in the target vector are inspected
one by one, until a match on target name is found. When found,
that is used.
o Otherwise the error <<invalid_target>> is returned to
<<bfd_openr>>.
o <<bfd_openr>> attempts to open the file using
<<bfd_open_file>>, and returns the BFD.
Once the BFD has been opened and the target selected, the file
format may be determined. This is done by calling
<<bfd_check_format>> on the BFD with a suggested format.
If <<target_defaulted>> has been set, each possible target
type is tried to see if it recognizes the specified format. The
routine returns <<true>> when the application guesses right.
@menu
@* bfd_target::
@end menu
*/
/*
INODE
bfd_target, , Targets, Targets
DOCDD
SUBSECTION
bfd_target
DESCRIPTION
This structure contains everything that BFD knows about a
target. It includes things like its byte order, name, what
routines to call to do various operations, etc.
Every BFD points to a target structure with its <<xvec>>
member.
These macros are used to dispatch to functions through the
bfd_target vector. They are used in a number of macros further
down in @file{bfd.h}, and are also used when calling various
routines by hand inside the BFD implementation. The "arglist"
argument must be parenthesized; it contains all the arguments
to the called function.
They make the documentation (more) unpleasant to read, so if
someone wants to fix this and not break the above, please do.
.#define BFD_SEND(bfd, message, arglist) \
. ((*((bfd)->xvec->message)) arglist)
For operations which index on the BFD format
.#define BFD_SEND_FMT(bfd, message, arglist) \
. (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
This is the struct which defines the type of BFD this is. The
<<xvec>> member of the struct <<bfd>> itself points here. Each
module that implements access to a different target under BFD,
defines one of these.
FIXME, these names should be rationalised with the names of
the entry points which call them. Too bad we can't have one
macro to define them both!
.typedef struct bfd_target
.{
Identifies the kind of target, eg SunOS4, Ultrix, etc.
. char *name;
The "flavour" of a back end is a general indication about the contents
of a file.
. enum target_flavour {
. bfd_target_unknown_flavour,
. bfd_target_aout_flavour,
. bfd_target_coff_flavour,
. bfd_target_ecoff_flavour,
. bfd_target_elf_flavour,
. bfd_target_ieee_flavour,
. bfd_target_nlm_flavour,
. bfd_target_oasys_flavour,
. bfd_target_tekhex_flavour,
. bfd_target_srec_flavour,
. bfd_target_hppa_flavour} flavour;
The order of bytes within the data area of a file.
. boolean byteorder_big_p;
The order of bytes within the header parts of a file.
. boolean header_byteorder_big_p;
This is a mask of all the flags which an executable may have set -
from the set <<NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.
. flagword object_flags;
This is a mask of all the flags which a section may have set - from
the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.
. flagword section_flags;
The character normally found at the front of a symbol
(if any), perhaps _.
. char symbol_leading_char;
The pad character for filenames within an archive header.
. char ar_pad_char;
The maximum number of characters in an archive header.
. unsigned short ar_max_namelen;
The minimum alignment restriction for any section.
. unsigned int align_power_min;
Entries for byte swapping for data. These are different to the other
entry points, since they don't take BFD as first arg. Certain other handlers
could do the same.
. bfd_vma (*bfd_getx64) PARAMS ((bfd_byte *));
. bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((bfd_byte *));
. void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
. bfd_vma (*bfd_getx32) PARAMS ((bfd_byte *));
. bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((bfd_byte *));
. void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
. bfd_vma (*bfd_getx16) PARAMS ((bfd_byte *));
. bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((bfd_byte *));
. void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
Byte swapping for the headers
. bfd_vma (*bfd_h_getx64) PARAMS ((bfd_byte *));
. bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((bfd_byte *));
. void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
. bfd_vma (*bfd_h_getx32) PARAMS ((bfd_byte *));
. bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((bfd_byte *));
. void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
. bfd_vma (*bfd_h_getx16) PARAMS ((bfd_byte *));
. bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((bfd_byte *));
. void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
Format dependent routines: these are vectors of entry points
within the target vector structure, one for each format to check.
Check the format of a file being read. Return bfd_target * or zero.
. struct bfd_target * (*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
Set the format of a file being written.
. boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
Write cached information into a file being written, at bfd_close.
. boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
The following functions are defined in <<JUMP_TABLE>>. The idea is
that the back end writer of <<foo>> names all the routines
<<foo_>>@var{entry_point}, <<JUMP_TABLE>> will built the entries
in this structure in the right order.
Core file entry points
. char * (*_core_file_failing_command) PARAMS ((bfd *));
. int (*_core_file_failing_signal) PARAMS ((bfd *));
. boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
Archive entry points
. boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
. boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
. void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
. boolean (*write_armap) PARAMS ((bfd *arch,
. unsigned int elength,
. struct orl *map,
. unsigned int orl_count,
. int stridx));
Standard stuff.
. boolean (*_close_and_cleanup) PARAMS ((bfd *));
. boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
. file_ptr, bfd_size_type));
. boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
. file_ptr, bfd_size_type));
. boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
Symbols and relocations
. unsigned int (*_get_symtab_upper_bound) PARAMS ((bfd *));
. unsigned int (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
. struct symbol_cache_entry **));
. unsigned int (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
. unsigned int (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
. struct symbol_cache_entry **));
. struct symbol_cache_entry *
. (*_bfd_make_empty_symbol) PARAMS ((bfd *));
. void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
. struct symbol_cache_entry *,
. bfd_print_symbol_type));
.#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
. void (*_bfd_get_symbol_info) PARAMS ((bfd *,
. struct symbol_cache_entry *,
. symbol_info *));
.#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
. alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
.
. boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
. unsigned long));
.
. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
.
. boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
. struct sec *section, struct symbol_cache_entry **symbols,
. bfd_vma offset, CONST char **file, CONST char **func,
. unsigned int *line));
.
. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
.
. int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
.
. void (*_bfd_debug_info_start) PARAMS ((bfd *));
. void (*_bfd_debug_info_end) PARAMS ((bfd *));
. void (*_bfd_debug_info_accumulate) PARAMS ((bfd *, struct sec *));
.
. bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
. struct bfd_seclet *, bfd_byte *data,
. boolean relocateable));
.
. boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
. struct symbol_cache_entry **));
.
. boolean (*_bfd_seclet_link) PARAMS ((bfd *, PTR data,
. boolean relocateable));
. {* See documentation on reloc types. *}
. CONST struct reloc_howto_struct *
. (*reloc_type_lookup) PARAMS ((bfd *abfd,
. bfd_reloc_code_real_type code));
.
. {* Back-door to allow format-aware applications to create debug symbols
. while using BFD for everything else. Currently used by the assembler
. when creating COFF files. *}
. asymbol * (*_bfd_make_debug_symbol) PARAMS ((
. bfd *abfd,
. void *ptr,
. unsigned long size));
Data for use by back-end routines, which isn't generic enough to belong
in this structure.
. PTR backend_data;
.} bfd_target;
*/
/* All known xvecs (even those that don't compile on all systems).
Alphabetized for easy reference.
They are listed a second time below, since
we can't intermix extern's and initializers. */
extern bfd_target a29kcoff_big_vec;
extern bfd_target a_out_adobe_vec;
extern bfd_target aout_mips_big_vec;
extern bfd_target aout_mips_little_vec;
extern bfd_target apollocoff_vec;
extern bfd_target b_out_vec_big_host;
extern bfd_target b_out_vec_little_host;
extern bfd_target bfd_elf32_big_generic_vec;
extern bfd_target bfd_elf32_bigmips_vec;
extern bfd_target bfd_elf32_hppa_vec;
extern bfd_target bfd_elf32_i386_vec;
extern bfd_target bfd_elf32_i860_vec;
extern bfd_target bfd_elf32_little_generic_vec;
extern bfd_target bfd_elf32_littlemips_vec;
extern bfd_target bfd_elf32_m68k_vec;
extern bfd_target bfd_elf32_m88k_vec;
extern bfd_target bfd_elf32_sparc_vec;
extern bfd_target bfd_elf64_big_generic_vec;
extern bfd_target bfd_elf64_little_generic_vec;
extern bfd_target demo_64_vec;
extern bfd_target ecoff_big_vec;
extern bfd_target ecoff_little_vec;
extern bfd_target ecoffalpha_little_vec;
extern bfd_target h8300coff_vec;
extern bfd_target h8500coff_vec;
extern bfd_target host_aout_vec;
extern bfd_target hp300bsd_vec;
extern bfd_target hp300hpux_vec;
extern bfd_target hppa_vec;
extern bfd_target i386aout_vec;
extern bfd_target i386bsd_vec;
extern bfd_target netbsd386_vec;
extern bfd_target freebsd386_vec;
extern bfd_target i386coff_vec;
extern bfd_target i386linux_vec;
extern bfd_target i386lynx_aout_vec;
extern bfd_target i386lynx_coff_vec;
extern bfd_target icoff_big_vec;
extern bfd_target icoff_little_vec;
extern bfd_target ieee_vec;
extern bfd_target m68kcoff_vec;
extern bfd_target m68kcoffun_vec;
extern bfd_target m68klynx_aout_vec;
extern bfd_target m68klynx_coff_vec;
extern bfd_target m88kbcs_vec;
extern bfd_target newsos3_vec;
extern bfd_target nlm32_big_generic_vec;
extern bfd_target nlm32_i386_vec;
extern bfd_target nlm32_little_generic_vec;
extern bfd_target nlm64_big_generic_vec;
extern bfd_target nlm64_little_generic_vec;
extern bfd_target oasys_vec;
extern bfd_target rs6000coff_vec;
extern bfd_target shcoff_vec;
extern bfd_target sunos_big_vec;
extern bfd_target tekhex_vec;
extern bfd_target we32kcoff_vec;
extern bfd_target z8kcoff_vec;
/* srec is always included. */
extern bfd_target srec_vec;
extern bfd_target symbolsrec_vec;
/* All of the xvecs for core files. */
extern bfd_target aix386_core_vec;
extern bfd_target hpux_core_vec;
extern bfd_target osf_core_vec;
extern bfd_target sco_core_vec;
extern bfd_target trad_core_vec;
bfd_target *target_vector[] = {
#ifdef SELECT_VECS
SELECT_VECS,
#else /* not SELECT_VECS */
#ifdef DEFAULT_VECTOR
&DEFAULT_VECTOR,
#endif
/* This list is alphabetized to make it easy to compare
with other vector lists -- the decls above and
the case statement in configure.in.
Vectors that don't compile on all systems, or aren't finished,
should have an entry here with #if 0 around it, to show that
it wasn't omitted by mistake. */
&a29kcoff_big_vec,
&a_out_adobe_vec,
#if 0 /* No one seems to use this. */
&aout_mips_big_vec,
#endif
&aout_mips_little_vec,
&b_out_vec_big_host,
&b_out_vec_little_host,
#if 0 /* No one seems to use this. */
&bfd_elf32_big_generic_vec,
&bfd_elf32_bigmips_vec,
#endif
#if 0
&bfd_elf32_hppa_vec,
#endif
&bfd_elf32_i386_vec,
&bfd_elf32_i860_vec,
#if 0 /* No one seems to use this. */
&bfd_elf32_little_generic_vec,
&bfd_elf32_littlemips_vec,
#endif
&bfd_elf32_m68k_vec,
&bfd_elf32_m88k_vec,
&bfd_elf32_sparc_vec,
#ifdef BFD64 /* No one seems to use this. */
&bfd_elf64_big_generic_vec,
&bfd_elf64_little_generic_vec,
#endif
#ifdef BFD64
&demo_64_vec, /* Only compiled if host has long-long support */
#endif
&ecoff_big_vec,
&ecoff_little_vec,
#if 0
&ecoffalpha_little_vec,
#endif
&h8300coff_vec,
&h8500coff_vec,
#if 0
&host_aout_vec,
#endif
#if 0 /* Clashes with sunos_big_vec magic no. */
&hp300bsd_vec,
#endif
&hp300hpux_vec,
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD)
&hppa_vec,
#endif
&i386aout_vec,
&i386bsd_vec,
&netbsd386_vec,
&freebsd386_vec,
&i386coff_vec,
#if 0
&i386linux_vec,
#endif
&i386lynx_aout_vec,
&i386lynx_coff_vec,
&icoff_big_vec,
&icoff_little_vec,
&ieee_vec,
&m68kcoff_vec,
&m68kcoffun_vec,
&m68klynx_aout_vec,
&m68klynx_coff_vec,
&m88kbcs_vec,
&newsos3_vec,
#if 0 /* No one seems to use this. */
&nlm32_big_generic_vec,
#endif
&nlm32_i386_vec,
#if 0 /* No one seems to use this. */
&nlm32_little_generic_vec,
#endif
#ifdef BFD64
&nlm64_big_generic_vec,
&nlm64_little_generic_vec,
#endif
#if 0
/* We have no oasys tools anymore, so we can't test any of this
anymore. If you want to test the stuff yourself, go ahead...
steve@cygnus.com
Worse, since there is no magic number for archives, there
can be annoying target mis-matches. */
&oasys_vec,
#endif
&rs6000coff_vec,
&shcoff_vec,
&sunos_big_vec,
#if 0
&tekhex_vec,
#endif
&we32kcoff_vec,
&z8kcoff_vec,
#endif /* not SELECT_VECS */
/* Always support S-records, for convenience. */
&srec_vec,
&symbolsrec_vec,
/* Add any required traditional-core-file-handler. */
#ifdef AIX386_CORE
&aix386_core_vec,
#endif
#ifdef HPUX_CORE
&hpux_core_vec,
#endif
#ifdef OSF_CORE
&osf_core_vec,
#endif
#ifdef SCO_CORE
&sco_core_vec,
#endif
#ifdef TRAD_CORE
&trad_core_vec,
#endif
NULL /* end of list marker */
};
/* default_vector[0] contains either the address of the default vector,
if there is one, or zero if there isn't. */
bfd_target *default_vector[] = {
#ifdef DEFAULT_VECTOR
&DEFAULT_VECTOR,
#endif
NULL
};
/*
FUNCTION
bfd_find_target
DESCRIPTION
Returns a pointer to the transfer vector for the object target
named target_name. If target_name is NULL, chooses the one in
the environment variable GNUTARGET; if that is null or not
defined thenthe first entry in the target list is chosen.
Passing in the string "default" or setting the environment
variable to "default" will cause the first entry in the target
list to be returned, and "target_defaulted" will be set in the
BFD. This causes <<bfd_check_format>> to loop over all the
targets to find the one that matches the file being read.
SYNOPSIS
bfd_target *bfd_find_target(CONST char *, bfd *);
*/
bfd_target *
DEFUN(bfd_find_target,(target_name, abfd),
CONST char *target_name AND
bfd *abfd)
{
bfd_target **target;
extern char *getenv ();
CONST char *targname = (target_name ? target_name :
(CONST char *) getenv ("GNUTARGET"));
/* This is safe; the vector cannot be null */
if (targname == NULL || !strcmp (targname, "default")) {
abfd->target_defaulted = true;
return abfd->xvec = target_vector[0];
}
abfd->target_defaulted = false;
for (target = &target_vector[0]; *target != NULL; target++) {
if (!strcmp (targname, (*target)->name))
return abfd->xvec = *target;
}
bfd_error = invalid_target;
return NULL;
}
/*
FUNCTION
bfd_target_list
DESCRIPTION
This function returns a freshly malloced NULL-terminated
vector of the names of all the valid BFD targets. Do not
modify the names
SYNOPSIS
CONST char **bfd_target_list(void);
*/
CONST char **
DEFUN_VOID(bfd_target_list)
{
int vec_length= 0;
#ifdef NATIVE_HPPAHPUX_COMPILER
/* The native compiler on the HP9000/700 has a bug which causes it
to loop endlessly when compiling this file. This avoids it. */
volatile
#endif
bfd_target **target;
CONST char **name_list, **name_ptr;
for (target = &target_vector[0]; *target != NULL; target++)
vec_length++;
name_ptr =
name_list = (CONST char **) zalloc ((vec_length + 1) * sizeof (char **));
if (name_list == NULL) {
bfd_error = no_memory;
return NULL;
}
for (target = &target_vector[0]; *target != NULL; target++)
*(name_ptr++) = (*target)->name;
return name_list;
}

View file

@ -0,0 +1,384 @@
/* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* To use this file on a particular host, configure the host with these
parameters in the config/h-HOST file:
HDEFINES=-DTRAD_CORE
HDEPFILES=trad-core.o
*/
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "libaout.h" /* BFD a.out internal data structures */
#include <stdio.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/dir.h>
#include <signal.h>
#include <sys/user.h> /* After a.out.h */
#if 0
/* file.h is included by std-host.h. So we better not try to include it
twice; on some systems (dpx2) it is not protected against multiple
inclusion. I have checked that all the hosts which use this file
include sys/file.h in the hosts file. */
#include <sys/file.h>
#endif
#include <errno.h>
struct trad_core_struct
{
asection *data_section;
asection *stack_section;
asection *reg_section;
struct user u;
} *rawptr;
#define core_upage(bfd) (&((bfd)->tdata.trad_core_data->u))
#define core_datasec(bfd) ((bfd)->tdata.trad_core_data->data_section)
#define core_stacksec(bfd) ((bfd)->tdata.trad_core_data->stack_section)
#define core_regsec(bfd) ((bfd)->tdata.trad_core_data->reg_section)
/* forward declarations */
bfd_target * trad_unix_core_file_p PARAMS ((bfd *abfd));
char * trad_unix_core_file_failing_command PARAMS ((bfd *abfd));
int trad_unix_core_file_failing_signal PARAMS ((bfd *abfd));
boolean trad_unix_core_file_matches_executable_p
PARAMS ((bfd *core_bfd, bfd *exec_bfd));
/* Handle 4.2-style (and perhaps also sysV-style) core dump file. */
/* ARGSUSED */
bfd_target *
trad_unix_core_file_p (abfd)
bfd *abfd;
{
int val;
struct user u;
#ifdef TRAD_CORE_USER_OFFSET
/* If defined, this macro is the file position of the user struct. */
if (bfd_seek (abfd, TRAD_CORE_USER_OFFSET, SEEK_SET) == 0)
return 0;
#endif
val = bfd_read ((void *)&u, 1, sizeof u, abfd);
if (val != sizeof u)
{
/* Too small to be a core file */
bfd_error = wrong_format;
return 0;
}
/* Sanity check perhaps??? */
if (u.u_dsize > 0x1000000) /* Remember, it's in pages... */
{
bfd_error = wrong_format;
return 0;
}
if (u.u_ssize > 0x1000000)
{
bfd_error = wrong_format;
return 0;
}
/* Check that the size claimed is no greater than the file size. */
{
FILE *stream = bfd_cache_lookup (abfd);
struct stat statbuf;
if (stream == NULL)
return 0;
if (fstat (fileno (stream), &statbuf) < 0)
{
bfd_error = system_call_error;
return 0;
}
if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) > statbuf.st_size)
{
bfd_error = file_truncated;
return 0;
}
if (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
#ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED
/* Some systems write the file too big. */
+ TRAD_CORE_EXTRA_SIZE_ALLOWED
#endif
< statbuf.st_size)
{
/* The file is too big. Maybe it's not a core file
or we otherwise have bad values for u_dsize and u_ssize). */
bfd_error = wrong_format;
return 0;
}
}
/* OK, we believe you. You're a core file (sure, sure). */
/* Allocate both the upage and the struct core_data at once, so
a single free() will free them both. */
rawptr = (struct trad_core_struct *)
bfd_zalloc (abfd, sizeof (struct trad_core_struct));
if (rawptr == NULL) {
bfd_error = no_memory;
return 0;
}
abfd->tdata.trad_core_data = rawptr;
rawptr->u = u; /*Copy the uarea into the tdata part of the bfd */
/* Create the sections. This is raunchy, but bfd_close wants to free
them separately. */
core_stacksec(abfd) = (asection *) zalloc (sizeof (asection));
if (core_stacksec (abfd) == NULL) {
loser:
bfd_error = no_memory;
free ((void *)rawptr);
return 0;
}
core_datasec (abfd) = (asection *) zalloc (sizeof (asection));
if (core_datasec (abfd) == NULL) {
loser1:
free ((void *)core_stacksec (abfd));
goto loser;
}
core_regsec (abfd) = (asection *) zalloc (sizeof (asection));
if (core_regsec (abfd) == NULL) {
free ((void *)core_datasec (abfd));
goto loser1;
}
core_stacksec (abfd)->name = ".stack";
core_datasec (abfd)->name = ".data";
core_regsec (abfd)->name = ".reg";
core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
core_regsec (abfd)->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
core_datasec (abfd)->_raw_size = NBPG * u.u_dsize;
core_stacksec (abfd)->_raw_size = NBPG * u.u_ssize;
core_regsec (abfd)->_raw_size = NBPG * UPAGES; /* Larger than sizeof struct u */
/* What a hack... we'd like to steal it from the exec file,
since the upage does not seem to provide it. FIXME. */
#ifdef HOST_DATA_START_ADDR
core_datasec (abfd)->vma = HOST_DATA_START_ADDR;
#else
core_datasec (abfd)->vma = HOST_TEXT_START_ADDR + (NBPG * u.u_tsize);
#endif
/* a hack, but it works for FreeBSD !! */
#include <vm/vm_param.h>
/* this should really be in <vm/vm_param.h>, but somebody forgot it */
#ifndef vm_page_size
#define vm_page_size 4096
#endif
#define HOST_STACK_START_ADDR trunc_page(u.u_kproc.kp_eproc.e_vm.vm_maxsaddr \
+ MAXSSIZ - ctob(u.u_ssize))
#ifdef HOST_STACK_START_ADDR
core_stacksec (abfd)->vma = HOST_STACK_START_ADDR;
#else
core_stacksec (abfd)->vma = HOST_STACK_END_ADDR - (NBPG * u.u_ssize);
#endif
/* This is tricky. As the "register section", we give them the entire
upage and stack. u.u_ar0 points to where "register 0" is stored.
There are two tricks with this, though. One is that the rest of the
registers might be at positive or negative (or both) displacements
from *u_ar0. The other is that u_ar0 is sometimes an absolute address
in kernel memory, and on other systems it is an offset from the beginning
of the `struct user'.
As a practical matter, we don't know where the registers actually are,
so we have to pass the whole area to GDB. We encode the value of u_ar0
by setting the .regs section up so that its virtual memory address
0 is at the place pointed to by u_ar0 (by setting the vma of the start
of the section to -u_ar0). GDB uses this info to locate the regs,
using minor trickery to get around the offset-or-absolute-addr problem. */
core_regsec (abfd)->vma = 0 - (int) u.u_ar0;
core_datasec (abfd)->filepos = NBPG * UPAGES;
#ifdef TRAD_CORE_STACK_FILEPOS
core_stacksec (abfd)->filepos = TRAD_CORE_STACK_FILEPOS;
#else
core_stacksec (abfd)->filepos = (NBPG * UPAGES) + NBPG * u.u_dsize;
#endif
core_regsec (abfd)->filepos = 0; /* Register segment is the upage */
/* Align to word at least */
core_stacksec (abfd)->alignment_power = 2;
core_datasec (abfd)->alignment_power = 2;
core_regsec (abfd)->alignment_power = 2;
abfd->sections = core_stacksec (abfd);
core_stacksec (abfd)->next = core_datasec (abfd);
core_datasec (abfd)->next = core_regsec (abfd);
abfd->section_count = 3;
return abfd->xvec;
}
char *
trad_unix_core_file_failing_command (abfd)
bfd *abfd;
{
#ifndef NO_CORE_COMMAND
char *com = abfd->tdata.trad_core_data->u.u_comm;
if (*com)
return com;
else
#endif
return 0;
}
/* ARGSUSED */
int
trad_unix_core_file_failing_signal (ignore_abfd)
bfd *ignore_abfd;
{
#ifdef TRAD_UNIX_CORE_FILE_FAILING_SIGNAL
return TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(ignore_abfd);
#else
return -1; /* FIXME, where is it? */
#endif
}
/* ARGSUSED */
boolean
trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd, *exec_bfd;
{
return true; /* FIXME, We have no way of telling at this point */
}
/* No archive file support via this BFD */
#define trad_unix_openr_next_archived_file bfd_generic_openr_next_archived_file
#define trad_unix_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define trad_unix_slurp_armap bfd_false
#define trad_unix_slurp_extended_name_table bfd_true
#define trad_unix_write_armap (boolean (*) PARAMS \
((bfd *arch, unsigned int elength, struct orl *map, \
unsigned int orl_count, int stridx))) bfd_false
#define trad_unix_truncate_arname bfd_dont_truncate_arname
#define aout_32_openr_next_archived_file bfd_generic_openr_next_archived_file
#define trad_unix_close_and_cleanup bfd_generic_close_and_cleanup
#define trad_unix_set_section_contents (boolean (*) PARAMS \
((bfd *abfd, asection *section, PTR data, file_ptr offset, \
bfd_size_type count))) bfd_false
#define trad_unix_get_section_contents bfd_generic_get_section_contents
#define trad_unix_new_section_hook (boolean (*) PARAMS \
((bfd *, sec_ptr))) bfd_true
#define trad_unix_get_symtab_upper_bound bfd_0u
#define trad_unix_get_symtab (unsigned int (*) PARAMS \
((bfd *, struct symbol_cache_entry **))) bfd_0u
#define trad_unix_get_reloc_upper_bound (unsigned int (*) PARAMS \
((bfd *, sec_ptr))) bfd_0u
#define trad_unix_canonicalize_reloc (unsigned int (*) PARAMS \
((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
#define trad_unix_make_empty_symbol (struct symbol_cache_entry * \
(*) PARAMS ((bfd *))) bfd_false
#define trad_unix_print_symbol (void (*) PARAMS \
((bfd *, PTR, struct symbol_cache_entry *, \
bfd_print_symbol_type))) bfd_false
#define trad_unix_get_symbol_info (void (*) PARAMS \
((bfd *, struct symbol_cache_entry *, \
symbol_info *))) bfd_false
#define trad_unix_get_lineno (alent * (*) PARAMS \
((bfd *, struct symbol_cache_entry *))) bfd_nullvoidptr
#define trad_unix_set_arch_mach (boolean (*) PARAMS \
((bfd *, enum bfd_architecture, unsigned long))) bfd_false
#define trad_unix_find_nearest_line (boolean (*) PARAMS \
((bfd *abfd, struct sec *section, \
struct symbol_cache_entry **symbols,bfd_vma offset, \
CONST char **file, CONST char **func, unsigned int *line))) bfd_false
#define trad_unix_sizeof_headers (int (*) PARAMS \
((bfd *, boolean))) bfd_0
#define trad_unix_bfd_debug_info_start bfd_void
#define trad_unix_bfd_debug_info_end bfd_void
#define trad_unix_bfd_debug_info_accumulate (void (*) PARAMS \
((bfd *, struct sec *))) bfd_void
#define trad_unix_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
#define trad_unix_bfd_relax_section bfd_generic_relax_section
#define trad_unix_bfd_seclet_link \
((boolean (*) PARAMS ((bfd *, PTR, boolean))) bfd_false)
#define trad_unix_bfd_reloc_type_lookup \
((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
#define trad_unix_bfd_make_debug_symbol \
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
/* If somebody calls any byte-swapping routines, shoot them. */
void
swap_abort()
{
abort(); /* This way doesn't require any declaration for ANSI to fuck up */
}
#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
bfd_target trad_core_vec =
{
"trad-core",
bfd_target_unknown_flavour,
true, /* target byte order */
true, /* target headers byte order */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
0, /* symbol prefix */
' ', /* ar_pad_char */
16, /* ar_max_namelen */
3, /* minimum alignment power */
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
{ /* bfd_check_format */
_bfd_dummy_target, /* unknown format */
_bfd_dummy_target, /* object file */
_bfd_dummy_target, /* archive */
trad_unix_core_file_p /* a core file */
},
{ /* bfd_set_format */
bfd_false, bfd_false,
bfd_false, bfd_false
},
{ /* bfd_write_contents */
bfd_false, bfd_false,
bfd_false, bfd_false
},
JUMP_TABLE(trad_unix),
(PTR) 0 /* backend_data */
};

View file

@ -0,0 +1,783 @@
Tue Oct 19 14:21:18 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo (Sourc Path): index entries for $cwd, $pdir
* a4rc.sed: update to work with Andreas Vogel papersize params
* refcard.tex: use Andreas Vogel simplifications of papersize
params; remove useless version info; update copyright date.
Tue Oct 19 10:46:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.texinfo (Symbols): Add class NAME to doc for ptype.
Tue Oct 12 09:11:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.texinfo (Files): Say what address the load command loads it at.
* stabs.texinfo (Common Blocks): Minor cleanups.
* stabs.texinfo: Update ld stabs in elf relocation to reflect the fact
that Sun has backed away from the linker kludge and thus the relevant
issue is changes to the SunPRO tools, not the Solaris linker.
* stabs.texinfo (Traditional Integer Types): Clean up description
of octal bounds a little bit. Document extra leading zeroes.
Thu Oct 7 16:15:37 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.texinfo (Signaling): Update for symbolic symbol names
and add a section explaining the difference between the GDB
signal command and the shell kill utility.
Wed Oct 6 13:23:01 1993 Tom Lord (lord@rtl.cygnus.com)
* libgdb.texinfo: added `@' to braces that were unescaped.
Mon Oct 4 10:42:18 1993 Tom Lord (lord@rtl.cygnus.com)
* libgdb.texinfo: new file. Spec for the gdb library.
Sun Oct 3 15:26:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Include Files): Fix typo (start -> end).
Thu Sep 30 18:24:56 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo, remote.texi: assorted small improvements, mostly
from Melissa at FSF's editing pass.
Thu Sep 30 11:54:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.texinfo: Remove stuff about ar and 14 character filenames.
I believe this was fixed by the 13 Sep 89 change to print_frame_info.
Also, modern versions of ar like BSD 4.4 or SVR4 don't have this bug.
Wed Sep 22 21:22:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* remote.texi (Bootstrapping): Discuss 386 call gates.
Sat Sep 18 17:10:44 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)
* stabs.texinfo (Based Variables): New node.
Thu Sep 16 17:48:55 1993 Jim Kingdon (kingdon@cirdan.cygnus.com)
* stabs.texinfo (Negative Type Numbers): Re-write discussions of
names, sizes, and formats to suggest how not to lose.
Sat Sep 11 09:35:11 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)
* stabs.texinfo (Methods): Fix typo.
Fri Sep 10 06:34:20 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* gdb.texinfo: Fix a few typos.
Wed Sep 8 09:11:52 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.texinfo: Clarify how well it works with Fortran.
* stabs.texinfo (Stabs In ELF, Statics, ELF Transformations):
More on relocating stabs in ELF files.
Tue Sep 7 13:45:02 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Stabs In ELF): Talk about N_FUN value.
Mon Sep 6 19:23:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Local Variable Parameters): Talk about nameless
parameters on VAX.
Fri Sep 3 17:06:08 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo: @up/@down -> @raisesections/@lowersections
Fri Sep 3 12:04:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: Make info author notice match the TeX author notice.
Tue Aug 31 13:21:06 1993 David J. Mackenzie (djm@thepub.cygnus.com)
* stabs.texinfo: Initial-caps all words in node names and
non-trivial words in section names.
Mon Aug 30 11:13:16 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: Many minor cleanups.
* stabs.texinfo: Remove @deffn except from Expanded Reference node.
Sat Aug 28 12:08:09 1993 David J. MacKenzie (djm@edison.eng.umd.edu)
* stabs.texinfo: Remove full description of big example.
It's not really helpful; just use pieces of it where appropriate.
Add more Texinfo formatting directives (@samp, etc.).
Use @deffn to define stab types.
Eliminate some wordiness. Break up some nodes.
Add an (alphabetized) index of symbol types.
Use consistent capitalization style in node and section names.
Thu Aug 26 06:36:31 1993 Fred Fish (fnf@deneb.cygnus.com)
* gdb.texinfo: Change typo "Two two" to "The two".
Sun Aug 22 12:15:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (XCOFF-differences): Remove references to
non-existent types N_DECL and N_RPSYM.
* stabs.texinfo (String Field): Say that type attributes bug is
fixed in GDB 4.10, since it is.
* stabs.texinfo: Clean up djm cleanups, and more cleanups of my own.
Sat Aug 21 04:32:28 1993 David MacKenzie (djm@cygnus.com)
* stabs.texinfo: Formatting cleanups.
Fri Aug 20 20:49:53 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: When explaining the n_type of a stab, standardize
how we do it ('#' as a comment indicator, "36 is N_FUN" as text,
no tabs, use @r).
(Global Variables): Clean up.
Tue Aug 17 15:57:27 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Stack Variables): Re-write.
Mon Aug 16 21:20:08 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Stabs-in-elf): Talk about getting the start
addresses of a source file. Also revise formatting.
Change "object module" or "object file" to "source file".
Various: Miscellaneous cleanups.
Thu Aug 12 15:11:51 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: Point to mangling info in gcc's gpcompare.texi.
Tue Aug 10 16:57:49 1993 Stan Shebs (shebs@rtl.cygnus.com)
* gdbint.texinfo: Removed many nonsensical machine-collected
host and target conditionals, described some of the remainder.
Tue Aug 10 13:28:30 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdbint.texinfo (Getting Started): Use @itemize, not @table.
* gdbint.texinfo (Top): Add name to @top line, and re-write the
paragraph which follows.
* gdbint.texinfo (Host): Use @code not @samp for Makefile
variables. Looks better and avoids overful hbox.
Fri Jul 30 18:26:21 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Procedures): Improve stuff on nested functions.
Thu Jul 29 15:10:58 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* remote.texi: (MIPS Remote) clearer doc for set/show timeout,
retransmit-timeout
Thu Jul 29 13:16:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdbint.texinfo: Update statement about `some ancient Unix
systems, like Ultrix 4.0' to Ultrix 4.2.
Wed Jul 28 15:26:53 1993 Roland H. Pesch (pesch@el_bosque.cygnus.com)
* h8-cfg.texi, all-cfg.texi: new flag GDBSERVER
* Makefile.in: depend on remote.texi rather than gdbinv-s.texi
* remote.texi: (Server) New node on gdbserver. (Remote Serial,
ST2000 Remote, MIPS Remote): mention `host:port' syntax for TCP.
* remote.texi: new name for former gdbinv-s.texi
* gdb.texinfo: use remote.texi rather than gdbinv-s.texi
Wed Jul 28 08:26:24 1993 Ian Lance Taylor (ian@cygnus.com)
* gdbinv-s.texi: Documented timeout and retransmit-timeout
variables for MIPS remote debugging protocol.
Mon Jul 26 13:00:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Negative Type Numbers): FORTRAN LOGICAL fix.
Tue Jul 20 16:30:41 1993 Jim Kingdon (kingdon@deneb.cygnus.com)
* Makefile.in (refcard.dvi): Use srcdir where necessary.
Mon Jul 19 12:02:50 1993 Roland H. Pesch (pesch@cygnus.com)
* gdb.texinfo: repair conditional bugs in text markup
Fri Jul 16 18:57:50 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo, all-cfg.texi, h8-cfg.texi: introduce MOD2 switch
to select Modula-2 material.
Thu Jul 15 13:15:01 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: Cleanups regarding statics.
* gdbinv-s.texi (Bootstrapping): Document exceptionHandler.
(Debug Session): Mention exceptionHandler. Add xref to Bootstrapping.
Mon Jul 12 13:37:02 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: N_MAIN is sometimes used for C.
Fri Jul 9 09:47:02 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* gdbint.texinfo (Host, Target Conditionals): Remove TM_FILE_OVERRIDE.
Tue Jul 6 12:41:28 1993 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo (Target Conditionals): Remove NO_TYPEDEFS,
removed from the code by Kingdon.
Tue Jul 6 12:24:34 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.texinfo (Break Commands): Remove stuff about flushing terminal
input when evaluating breakpoint conditions; the bug has been fixed.
* gdb.texinfo (Continuing and Stepping): Argument to "continue"
sets the ignore count to N-1, not to N.
Thu Jul 1 14:57:42 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* refcard.tex (\hoffset): correct longstanding error to match
intended offset; avoids cutting off edge on some printers
Wed Jun 30 18:23:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Parameters): Say that order of stabs is significant.
Fri Jun 25 21:34:52 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Common Blocks): Say what Sun FORTRAN does.
Fri Jun 25 16:15:10 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* Makefile.in: (REFEDITS) new var to control whether PS or CM
fonts and whether US or A4 paper for GDB refcard; (refcard.dvi)
collect sed edits if any, apply to refcard before formatting;
(refcard.ps) stop implying PS fonts if PS output requested;
(lrefcard.ps) delete extra target for variant PS fonts
* refcard.tex: parametrize papersize dependent info, collect
in easily replaced spot
* a4rc.sed: new file, edits to refcard for A4 paper
Fri Jun 25 14:21:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Negative Type Numbers): Type -16 is 4 bytes.
Wed Jun 23 15:02:50 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Negative Type Numbers): Minor character cleanups.
Tue Jun 22 16:31:52 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: Express disapproval of 'D' symbol descriptor
politely rather than rudely.
Fri Jun 18 19:42:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: Document common blocks.
Fri Jun 18 12:12:57 1993 Fred Fish (fnf@cygnus.com)
* stabs.texinfo: Add some basic info about stabs-in-elf.
Fri Jun 18 13:57:09 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Top): Minor cleanup.
Mon Jun 14 16:16:51 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com)
* Makefile.in (install-info): remove parentdir support
Tue Jun 15 18:11:39 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo (Copying): delete this node and references to it;
RMS says this manual need not carry GPL. (passim): Improvements
from last round at FSF, largely due to Ian Taylor review, and
minor formatting improvements.
* gdbinv-s.texi (passim): Improvements from last round at FSF,
largely due to Ian Taylor review. (Debug Session): minor edits to
new text.
Sun Jun 13 12:52:39 1993 Jim Kingdon (kingdon@cygnus.com)
* Makefile.in (realclean): Remove info and dvi files too.
Sat Jun 12 16:09:22 1993 Jim Kingdon (kingdon@cygnus.com)
* {all,h8}-config.texi: Rename to *-cfg.texi for 14 char filenames.
* Makefile.in: Change accordingly. gdb-config.texi -> gdb-cfg.texi.
* gdb.texinfo: Change accordingly.
* stabs.texinfo: Clean up N_{L,R}BRAC. Discuss what addresses of
N_{L,R}BRAC,N_SLINE are relative to.
Fri Jun 11 15:15:55 1993 Jim Kingdon (kingdon@cygnus.com)
* Makefile.in (GDBvn.texi): Update atomically.
Wed Jun 9 10:58:16 1993 Jim Kingdon (kingdon@cygnus.com)
* gdbinv-s.texi (Debug Session): Document exceptionHook.
Tue Jun 8 13:42:04 1993 Jim Kingdon (kingdon@cygnus.com)
* gdb.texinfo (Print Settings): Move all stuff relating to symbolic
addresses together. Also motivate the set print symbol-filename
command and suggest other solutions.
Tue Jun 1 22:46:43 1993 Fred Fish (fnf@cygnus.com)
* gdb.texinfo (set print elements): Note that the number of
elements is set to unlimited by "set print elements 0".
Mon May 31 08:06:55 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo (Builtin Type Descriptors): Try to clarify what
NF_LDOUBLE means.
(Stab Types): Include Solaris stab types.
(Procedures): Document Solaris extensions.
Thu May 27 06:20:42 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* gdb.texinfo: Add `set print symbol-filename' doc.
Wed May 26 00:26:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Arrays): Talk about type definition vs. type
information.
* stabs.texinfo (Builtin Type Descriptors): Talk about omitting
the trailing semicolon.
Tue May 25 14:49:42 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Line Numbers, Source Files): Re-write these two nodes
and merge in other parts of the document addressing these subjects.
gdbint.texinfo (XCOFF): Remove info which is now in stabs.texinfo.
* stabs.texinfo (Subranges, Arrays): Try to explain about the semicolon
at the end of a range type.
* stabs.texinfo (Subranges): "A offset" and "T offset" are not
AIX extensions.
Mon May 24 09:00:33 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Stabs Format): Misc fixes.
Sat May 22 10:40:56 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Constants): Allow an `e' constant to be non-enum.
(Traditional builtin types): Document convex convention for long long.
(Negative builtin types): Discuss type names, and misc fixes.
Fri May 21 11:20:31 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Builtin Type Descriptors): Document the floating
point types used with @samp{R} type descriptor.
(Symbol Descriptors): Describe how to handle conflict between
different meanings of @samp{P} symbol descriptor.
Thu May 20 13:35:10 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo: Remove node Quick Reference and put its children
directly under the main menu.
* stabs.texinfo: Many more changes to bring it into line with
AIX documentation and reality. I think it now has all the
information from the AIX documentation, except that I burned
out when I got to variant records (Pascal and Modula-2) and
all the COBOL types. Oh well, we can add them later when we're
worrying more about those languages.
* stabs.texinfo (Automatic variables): Talk about what it means
to omit the symbol descriptor.
Tue May 18 17:59:18 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* stabs.texinfo (Parameters): Add "(sometimes)" when describing
gcc2 behavior with promoted args.
Fri May 14 21:35:29 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo: include readline appendices in info version of manual
Fri May 7 11:56:18 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdbinv-s.texi (Remote Serial): describe new ^C behavior in
target remote.
* gdb.texinfo (Machine Code): more index entries for disassemble
Fri May 7 10:12:30 1993 Fred Fish (fnf@cygnus.com)
* Clarify the intended use of the gdb-testers and gdb-patches
mailing lists, and shrink gzip comment.
Thu May 6 16:39:50 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo (Shell Commands): do not mention SHELL env var in
DOSHOST configuration of manual.
* gdb.texinfo (MIPS Stack): new node.
* all-config.texi (MIPS) new switch.
* gdbinv-s.texi (Nindy Options) Remove two instances of future
tense; (MIPS Remote) new node.
* gdb.texinfo (passim) rephrases to work around makeinfo @value
bug; (Environment) less passive, other small cleanups in text about
.cshrc/.bashrc; (Invoking GDB) new MIPS Remote menu entry;
(Remote) new MIPS Remote menu entry.
Thu Apr 29 09:36:25 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo: Many changes to include information from the
AIX documentation.
* gdb.texinfo (Environment): Mention pitfall with .cshrc.
Tue Apr 27 14:02:57 1993 Jim Kingdon (kingdon@cygnus.com)
* gdbint.texinfo (new node Debugging GDB, elsewhere):
Move a bunch of information from ../README.
(Getting Started): New node.
Fri Apr 23 17:21:13 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdbinv-s.texi, gdb.texinfo: include Hitachi SH target
* gdb.texinfo: advance manual revision dates to present
* gdbinv-s.texi, gdb.texinfo, all-config.texi, h8-config.texi:
stop using silly Roman numerals in @set variable names
Fri Apr 23 07:30:01 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo (Parameters): Keep trying to get this right.
Wed Apr 21 15:18:47 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo (Parameters): More on "local parameters".
Mon Apr 19 08:00:51 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo (Parameters): Re-do "local parameters" section.
Sun Apr 18 09:47:45 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo (Symbol descriptors): Re-do using @table and @xref.
(Parameters): Rewrite.
(xcoff-differences, Sun-differences): Minor changes.
Thu Apr 15 02:35:24 1993 John Gilmore (gnu@cacophony.cygnus.com)
* stabs.texinfo: Minor cleanup.
Wed Apr 14 17:31:00 1993 Jim Kingdon (kingdon@cygnus.com)
* gdbint.texinfo: Minor xcoff stuff.
Wed Apr 7 14:11:07 1993 Fred Fish (fnf@cygnus.com)
* gdbint.texinfo: Update for new config directory structure.
Add info about internal type data structures.
Mon Apr 5 09:06:30 1993 Ian Lance Taylor (ian@cygnus.com)
* Makefile.in (SFILES_INCLUDED): gdb-config.texi is no longer in
$(srcdir).
(gdb-config.texi): Depend on file in $(srcdir).
Fri Apr 2 16:55:13 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo: Fixes about N_SO.
Fri Mar 26 18:00:35 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo: include list of nonstandard init file names
* *-config.texi: new switch GENERIC for text that applies *only*
to (usual) multiple-target version of manual
* gdb.texinfo, gdbinv-s.texi: Update conditional markup to correct
h8 config
* gdb.texinfo: depend on latest fixed makeinfo, use conditionals
in menus (rather than conditionally selected multiple alternative
menus).
* Makefile.in: define and use DOC_CONFIG var to select
configuration for GDB user manual.
* gdb-config.texi: delete from repository, generate from Makefile.
* all-config.texi: normal `generic' configuration file, formerly
stored as gdb-config.texi
Wed Mar 24 14:03:19 1993 david d `zoo' zuhn (zoo at poseidon.cygnus.com)
* Makefile.in: add dvi target to build all .dvi files
Tue Mar 23 16:03:24 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo, gdvinv-s.texinfo: formatting improvements.
Fri Mar 19 21:46:50 1993 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Doc NO_MMALLOC and NO_MMALLOC_CHECK as
host conditionals.
* stabs.texinfo: More array fixes inspired by Jim's.
Fri Mar 19 10:23:34 1993 Jim Kingdon (kingdon@cygnus.com)
* stabs.texinfo: Fixes re arrays and continuations.
* gdbint.texinfo: Add XCOFF node.
Mon Mar 8 15:52:18 1993 John Gilmore (gnu@cygnus.com)
* gdb.texinfo: Add `set print max-symbolic-offset' doc.
Sun Feb 21 17:09:38 1993 Per Bothner (bothner@rtl.cygnus.com)
* stabs.texinfo: Fix for array types to mention lower bounds.
Thu Feb 18 01:19:49 1993 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Update PTRACE_ARG3_TYPE doc, pull PT_*.
Wed Feb 17 08:15:24 1993 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Remove SET_STACK_LIMIT_HUGE from target defines.
Thu Feb 11 10:38:40 1993 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Fix thinko (NM_FILE => NAT_FILE). Found
by Michael Ben-Gershon <mybg@CS.HUJI.AC.IL>.
Wed Feb 10 23:59:19 1993 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Eliminate IBM6000_HOST, document IBM6000_TARGET.
Tue Feb 9 18:26:21 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo, gdbinv-s.texi: misc updates
Sat Feb 6 10:25:47 1993 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Brief documentation for longjmp support,
from an email msg by Stu.
Fri Feb 5 14:10:15 1993 John Gilmore (gnu@cygnus.com)
* stabs.texinfo: Fix description of floating point "range"
types (which really define basic types). Reported by Jim Meehan,
<meehan@src.dec.com>.
* gdbint.texinfo: Remove COFF_NO_LONG_FILE_NAMES define, now gone.
Thu Feb 4 13:56:46 1993 Ian Lance Taylor (ian@cygnus.com)
* gdbint.texinfo: Slightly expand section on supporting a new
object file format.
Thu Feb 4 01:49:04 1993 John Gilmore (gnu@cygnus.com)
* Makefile.in (refcard.ps, lrefcard.ps): Remove psref.tex
intermediate file.
Tue Feb 2 12:18:06 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo, gdbinv-s.texi: miscellaneous stylistic cleanups
Mon Feb 1 15:35:47 1993 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdbinv-s.texi: z8000 simulator target name is just "sim"
* gdbinv-s.texi: Mention that Z8000 simulator can simulate Z8001
as well as Z8002.
Sat Nov 28 06:51:35 1992 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Add sections on clean design and on how to send
in changes.
Mon Nov 9 23:57:02 1992 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Add how to declare the result of make_cleanup.
Mon Oct 26 11:09:47 1992 John Gilmore (gnu@cygnus.com)
* gdb.texinfo: Fix typo, reported by Karl Berry.
Fri Oct 23 00:41:21 1992 John Gilmore (gnu@cygnus.com)
* gdb.texinfo: Add opcodes dir to GDB distribution description.
Sat Oct 10 18:04:58 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com)
* gdbint.texinfo: fixed a stray email address (needs @@),
added @table @code to node "Native Conditionals"
Tue Sep 22 00:34:15 1992 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Describe coding style of GDB.
Mon Sep 21 19:32:16 1992 John Gilmore (gnu@cygnus.com)
* stabs.texinfo: Minor wording changes.
Tue Sep 15 02:57:09 1992 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Improve release doc slightly.
Fri Sep 11 01:34:25 1992 John Gilmore (gnu@sphagnum.cygnus.com)
* gdbint.texinfo: Improve doc of GDB config macros.
Wed Sep 9 16:52:06 1992 John Gilmore (gnu@cygnus.com)
* stabs.texinfo: Remove Bothner's changes for C++ nested types.
These will be reinserted when examined.
Mon Aug 24 01:17:55 1992 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Make a start at documenting all the #if macros
in GDB. At least list them all, and start separating them into
host-specific and target-specific.
Tue Aug 18 15:59:13 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdbinv-s.m4.in: refrain from using @cartouche for just a few
examples (not consistent w others).
gdb.texinfo: issue disclaimer paragraph on cmdline options only
for generic vn of doc
Tue Aug 18 14:53:27 1992 Ian Lance Taylor (ian@cygnus.com)
* Makefile.in: always create installation directories.
Tue Aug 18 14:11:50 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo: in h8 config, do not describe searching commands.
Mon Aug 17 18:07:59 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo, none.m4, h8.m4, gdbinv-s.m4.in: improve H8/300
conditionals; introduce a few generic switches that may be
useful for other cross-dev or dos-hosted configs.
* gdb.texinfo: fix typo in "info reg" description
Sun Aug 16 01:16:18 1992 John Gilmore (gnu@cygnus.com)
* stabs.texinfo: Minor updates from running TeX over it.
* Makefile.in (stabs.dvi, stabs.ps): Add.
Sat Aug 15 20:52:24 1992 Per Bothner (bothner@rtl.cygnus.com)
* stabs.texinfo: Stabs documentation, written by Julia Menapace.
First pass at converting it to texinfo.
Sat Aug 15 03:14:59 1992 John Gilmore (gnu@cygnus.com)
* gdb.texinfo, refcard.tex: Document mult args on `info reg'.
* Makefile.in (refcard.ps, lrefcard.ps): Add missing $(srdir).
Fri Aug 14 21:08:47 1992 John Gilmore (gnu@cygnus.com)
* gdbint.texinfo: Add section on partial symbol tables.
Sat Jun 20 16:31:10 1992 John Gilmore (gnu at cygnus.com)
* gdb.texinfo: document `set remotedebug' and `set
rstack_high_address'.
Thu May 14 17:09:48 1992 Roland H. Pesch (pesch@fowanton.cygnus.com)
* gdb.texinfo: slight expansion of new text on reading info files
* gdbinv-s.m4.in: correct and expand info on cross-debugging
H8/300 from DOS.
Tue May 12 12:22:47 1992 John Gilmore (gnu at cygnus.com)
* gdb.texinfo: `info user' => `show user'. Noticed by David Taylor.
Mon May 11 19:06:27 1992 John Gilmore (gnu at cygnus.com)
* gdb.texinfo: Say how to read the `info' files.
Tue May 5 12:11:38 1992 K. Richard Pixley (rich@cygnus.com)
* Makefile.in: gm4 -> m4.
Fri Apr 10 17:50:43 1992 John Gilmore (gnu at rtl.cygnus.com)
* gdb.texinfo: Update for GDB-4.5. Move `Formatting
Documentation' ahead of `Installing GDB' to match README.
Update shared library doc, -readnow and -mapped, and directory
structure (add glob and mmalloc). Update configure doc.
Tue Mar 24 23:28:38 1992 K. Richard Pixley (rich@cygnus.com)
* Makefile.in: remove $(srcdir) from gdb.info rule.
Sat Mar 7 18:44:50 1992 K. Richard Pixley (rich@rtl.cygnus.com)
* Makefile.in: commented out gdb-all.texinfo rule. This is
temporary.
Wed Feb 26 18:04:40 1992 K. Richard Pixley (rich@cygnus.com)
* Makefile.in, configure.in: removed traces of namesubdir,
-subdirs, $(subdir), $(unsubdir), some rcs triggers. Forced
copyrights to '92, changed some from Cygnus to FSF.
Fri Dec 13 09:47:31 1991 John Gilmore (gnu at cygnus.com)
* gdb.texinfo: Improve how we ask for bug reports.
Tue Dec 10 04:07:21 1991 K. Richard Pixley (rich at rtl.cygnus.com)
* Makefile.in: infodir belongs in datadir.
Fri Dec 6 23:57:34 1991 K. Richard Pixley (rich at rtl.cygnus.com)
* Makefile.in: remove spaces following hyphens, bsd make can't
cope. install using INSTALL_DATA. added clean-info. added
standards.text support.
Thu Dec 5 22:46:12 1991 K. Richard Pixley (rich at rtl.cygnus.com)
* Makefile.in: idestdir and ddestdir go away. Added copyrights
and shift gpl to v2. Added ChangeLog if it didn't exist. docdir
and mandir now keyed off datadir by default.
Local Variables:
mode: indented-text
left-margin: 8
fill-column: 74
version-control: never
End:

View file

@ -0,0 +1,340 @@
# This file was generated automatically by configure. Do not edit.
VPATH = .
links =
host_alias = i386-unknown-freebsd
host_cpu = i386
host_vendor = unknown
host_os = freebsd
host_canonical = i386-unknown-freebsd
target_alias = i386-unknown-freebsd
target_cpu = i386
target_vendor = unknown
target_os = freebsd
target_canonical = i386-unknown-freebsd
##Copyright (C) 1991, 1992 Free Software Foundation, Inc.
# Makefile for GDB documentation.
# This file is part of GDB.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
srcdir = .
prefix = /usr/gnu
infodir = $(prefix)/info
SHELL = /bin/sh
INSTALL = install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)
# main GDB source directory
gdbdir = $(srcdir)/..
# where to find texinfo; GDB dist should include a recent one
TEXIDIR=${gdbdir}/../texinfo
# where to find makeinfo, preferably one designed for texinfo-2
MAKEINFO=makeinfo
# where to find texi2roff, ditto
TEXI2ROFF=texi2roff
# Where is the source dir for the READLINE library doc?
# Traditionally readline is in .. or .
READLINE_DIR = ${gdbdir}/../readline/doc
SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$$TEXINPUTS
# There may be alternate predefined collections of switches to configure
# the GDB manual. Normally this is not done in synch with the software
# config system, since this choice tends to be independent; most people
# want a doc config of `all' for a generic manual, regardless of sw config.
DOC_CONFIG = all
# This list of sed edits will edit the GDB reference card
# for what fonts and what papersize to use.
# By default (NO edits applied), the refcard uses:
# - Computer Modern (CM) fonts
# - US letter paper (8.5x11in)
# List some of the following files for alternative fonts and paper:
# a4rc.sed use A4 paper (297 x 210 mm)
# psrc.sed use PostScript fonts (Karl Berry short TeX names)
# lpsrc.sed use PostScript fonts (full PostScript names in TeX)
# e.g. for A4, Postscript: REFEDITS = a4rc.sed psrc.sed
# for A4, CM fonts: REFEDITS = a4rc.sed
# for US, PS fonts: REFEDITS = psrc.sed
# for default:
REFEDITS =
# Don Knuth's TeX formatter
TEX = tex
# auxiliary program for sorting Texinfo indices
TEXINDEX = texindex
# Main GDB manual's source files
SFILES_INCLUDED = gdb-cfg.texi $(srcdir)/remote.texi
SFILES_LOCAL = $(srcdir)/gdb.texinfo GDBvn.texi $(SFILES_INCLUDED)
SFILES_DOC = $(SFILES_LOCAL) \
$(READLINE_DIR)/rluser.texinfo $(READLINE_DIR)/inc-hist.texi
#### Host, target, and site specific Makefile fragments come in here.
###
all install:
info: gdb.info gdbint.info stabs.info
dvi: gdb.dvi refcard.dvi gdbint.dvi
all-doc: gdb.info gdb.dvi refcard.dvi gdb-internals gdbint.dvi
install-info: info
for i in *.info* ; do \
$(INSTALL_DATA) $$i $(infodir)/$$i ; \
done
STAGESTUFF = *.info* gdb-all.texi GDBvn.texi
# Copy the object files from a particular stage into a subdirectory.
stage1: force
-mkdir stage1
-mv $(STAGESTUFF) stage1
stage2: force
-mkdir stage2
-mv $(STAGESTUFF) stage2
stage3: force
-mkdir stage3
-mv $(STAGESTUFF) stage3
against=stage2
comparison: force
for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
de-stage1: force
-(cd stage1 ; mv -f * ..)
-rmdir stage1
de-stage2: force
-(cd stage2 ; mv -f * ..)
-rmdir stage2
de-stage3: force
-(cd stage3 ; mv -f * ..)
-rmdir stage3
clean-info:
rm -f gdb.info* gdbint.info* stabs.info*
clean-dvi:
rm -f gdb.dvi refcard.dvi gdbint.dvi stabs.dvi sedref.dvi
mostlyclean: clean-info clean-dvi
rm -f gdb.?? gdb.??? gdb.mm gdb.ms gdb.me
rm -f links2roff
rm -f refcard.ps lrefcard.ps refcard.log sedref.* *~
rm -f gdbint.?? gdbint.??? stabs.?? stabs.???
clean: mostlyclean
rm -f GDBvn.texi rluser.texinfo inc-hist.texi
distclean: clean
rm -f Makefile config.status
realclean: distclean clean-dvi clean-info
# GDB QUICK REFERENCE (dvi output)
refcard.dvi : refcard.tex $(REFEDITS)
if [ -z "$(REFEDITS)" ]; then \
cp $(srcdir)/refcard.tex sedref.tex ; \
else \
echo > tmp.sed ; \
for f in "$(REFEDITS)" ; do \
cat $(srcdir)/$$f >>tmp.sed ; done ; \
sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex ; \
fi
$(SET_TEXINPUTS) $(TEX) sedref.tex
mv sedref.dvi refcard.dvi
rm -f sedref.log sedref.tex tmp.sed
refcard.ps : refcard.dvi
dvips -t landscape refcard.dvi -o
# File to record current GDB version number (copied from main dir Makefile.in)
GDBvn.texi : ${gdbdir}/Makefile.in
echo "@set GDBVN `sed <$(srcdir)/../Makefile.in -n 's/VERSION = //p'`" > ./GDBvn.new
mv GDBvn.new GDBvn.texi
# Updated atomically
.PRECIOUS: GDBvn.texi
# Choose configuration for GDB manual (normally `all'; normally not tied into
# `configure' script because most users prefer generic version of manual,
# not one for their binary config---which may not be specifically
# defined anyways).
gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
# GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
# If your texinfo or makeinfo don't support these, get a new texinfo release
#
# The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
# Note that we can *generate* GDBvn.texi, but since we distribute one in the
# source directory for the benefit of people who *don't* use this makefile,
# VPATH will often tell make not to bother building it, because the one
# in the srcdir is up to date. (if not, then make should build one here).
# GDB MANUAL: TeX dvi file
gdb.dvi: ${SFILES_DOC}
if [ ! -f ./GDBvn.texi ]; then \
ln -s $(srcdir)/GDBvn.texi . || \
ln $(srcdir)/GDBvn.texi . || \
cp $(srcdir)/GDBvn.texi . ; else true; fi
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
$(TEXINDEX) gdb.??
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
rm -f gdb.?? gdb.log gdb.aux gdb.toc gdb.??s
# GDB MANUAL: info file
# We're using texinfo2, and older makeinfo's may not be able to
# cope with all the markup.
gdb.info: ${SFILES_DOC}
$(MAKEINFO) -I ${READLINE_DIR} -I $(srcdir) -o ./gdb.info gdb.texinfo
# GDB MANUAL: roff translations
# Try to use a recent texi2roff. v2 was put on prep in jan91.
# If you want an index, see texi2roff doc for postprocessing
# and add -i to texi2roff invocations below.
# Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
# corresponding -e lines when later texi2roff's are current)
# + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
# + @c's deleted explicitly because texi2roff sees texinfo commands in them
# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
# + @alphaenumerate is ridiculously new, turned into @enumerate
# texi2roff doesn't have a notion of include dirs, so we have to fake
# it out for gdb manual's include files---but only if not configured
# in main sourcedir.
links2roff: $(SFILES_INCLUDED)
if [ ! -f gdb.texinfo ]; then \
ln -s $(SFILES_INCLUDED) . || \
ln $(SFILES_INCLUDED) . || \
cp $(SFILES_INCLUDED) . ; \
fi
touch links2roff
# "Readline" appendices. Get them also due to lack of includes,
# regardless of whether or not configuring in main sourcedir.
# @ftable removed due to bug in texi2roff-2; if your texi2roff
# is newer, try just ln or cp
rluser.texinfo: ${READLINE_DIR}/rluser.texinfo
sed -e 's/^@ftable/@table/g' \
-e 's/^@end ftable/@end table/g' \
${READLINE_DIR}/rluser.texinfo > ./rluser.texinfo
inc-hist.texi: ${READLINE_DIR}/inc-hist.texi
ln -s ${READLINE_DIR}/inc-hist.texi . || \
ln ${READLINE_DIR}/inc-hist.texi . || \
cp ${READLINE_DIR}/inc-hist.texi .
# gdb manual suitable for [gtn]roff -me
gdb.me: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
sed -e '/\\input texinfo/d' \
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
-e '/^@ifinfo/,/^@end ifinfo/d' \
-e '/^@c /d' \
-e 's/{.*,,/{/' \
-e 's/@ / /g' \
-e 's/^@alphaenumerate/@enumerate/g' \
-e 's/^@end alphaenumerate/@end enumerate/g' \
$(srcdir)/gdb.texinfo | \
$(TEXI2ROFF) -me | \
sed -e 's/---/\\(em/g' \
>gdb.me
# gdb manual suitable for [gtn]roff -ms
gdb.ms: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
sed -e '/\\input texinfo/d' \
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
-e '/^@ifinfo/,/^@end ifinfo/d' \
-e '/^@c /d' \
-e 's/{.*,,/{/' \
-e 's/@ / /g' \
-e 's/^@alphaenumerate/@enumerate/g' \
-e 's/^@end alphaenumerate/@end enumerate/g' \
$(srcdir)/gdb.texinfo | \
$(TEXI2ROFF) -ms | \
sed -e 's/---/\\(em/g' \
>gdb.ms
# gdb manual suitable for [tn]roff -mm
# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
# try leaving them in
gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
sed -e '/\\input texinfo/d' \
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
-e '/^@ifinfo/,/^@end ifinfo/d' \
-e '/^@c /d' \
-e 's/{.*,,/{/' \
-e '/@noindent/d' \
-e 's/@ / /g' \
-e 's/^@alphaenumerate/@enumerate/g' \
-e 's/^@end alphaenumerate/@end enumerate/g' \
$(srcdir)/gdb.texinfo | \
$(TEXI2ROFF) -mm | \
sed -e 's/---/\\(em/g' \
>gdb.mm
# GDB INTERNALS MANUAL: TeX dvi file
gdbint.dvi : gdbint.texinfo
$(SET_TEXINPUTS) $(TEX) gdbint.texinfo
$(TEXINDEX) gdbint.??
$(SET_TEXINPUTS) $(TEX) gdbint.texinfo
rm -f gdbint.?? gdbint.aux gdbint.cps gdbint.fns gdbint.kys \
gdbint.log gdbint.pgs gdbint.toc gdbint.tps gdbint.vrs
# GDB INTERNALS MANUAL: info file
gdb-internals: gdbint.info
gdbint.info: gdbint.texinfo
$(MAKEINFO) -o gdbint.info $(srcdir)/gdbint.texinfo
stabs.info: stabs.texinfo
$(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo
# STABS DOCUMENTATION: TeX dvi file
stabs.dvi : stabs.texinfo
$(SET_TEXINPUTS) $(TEX) stabs.texinfo
$(TEXINDEX) stabs.??
$(SET_TEXINPUTS) $(TEX) stabs.texinfo
rm -f stabs.?? stabs.aux stabs.cps stabs.fns stabs.kys \
stabs.log stabs.pgs stabs.toc stabs.tps stabs.vrs
stabs.ps: stabs.dvi
dvips -o stabs.ps stabs
force:
Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
$(SHELL) ./config.status

View file

@ -0,0 +1,327 @@
##Copyright (C) 1991, 1992 Free Software Foundation, Inc.
# Makefile for GDB documentation.
# This file is part of GDB.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
srcdir = .
prefix = /usr/local
infodir = $(prefix)/info
SHELL = /bin/sh
INSTALL = install -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)
# main GDB source directory
gdbdir = $(srcdir)/..
# where to find texinfo; GDB dist should include a recent one
TEXIDIR=${gdbdir}/../texinfo
# where to find makeinfo, preferably one designed for texinfo-2
MAKEINFO=makeinfo
# where to find texi2roff, ditto
TEXI2ROFF=texi2roff
# Where is the source dir for the READLINE library doc?
# Traditionally readline is in .. or .
READLINE_DIR = ${gdbdir}/../readline/doc
SET_TEXINPUTS = TEXINPUTS=${TEXIDIR}:.:$(srcdir):$(READLINE_DIR):$$TEXINPUTS
# There may be alternate predefined collections of switches to configure
# the GDB manual. Normally this is not done in synch with the software
# config system, since this choice tends to be independent; most people
# want a doc config of `all' for a generic manual, regardless of sw config.
DOC_CONFIG = all
# This list of sed edits will edit the GDB reference card
# for what fonts and what papersize to use.
# By default (NO edits applied), the refcard uses:
# - Computer Modern (CM) fonts
# - US letter paper (8.5x11in)
# List some of the following files for alternative fonts and paper:
# a4rc.sed use A4 paper (297 x 210 mm)
# psrc.sed use PostScript fonts (Karl Berry short TeX names)
# lpsrc.sed use PostScript fonts (full PostScript names in TeX)
# e.g. for A4, Postscript: REFEDITS = a4rc.sed psrc.sed
# for A4, CM fonts: REFEDITS = a4rc.sed
# for US, PS fonts: REFEDITS = psrc.sed
# for default:
REFEDITS =
# Don Knuth's TeX formatter
TEX = tex
# auxiliary program for sorting Texinfo indices
TEXINDEX = texindex
# Main GDB manual's source files
SFILES_INCLUDED = gdb-cfg.texi $(srcdir)/remote.texi
SFILES_LOCAL = $(srcdir)/gdb.texinfo GDBvn.texi $(SFILES_INCLUDED)
SFILES_DOC = $(SFILES_LOCAL) \
$(READLINE_DIR)/rluser.texinfo $(READLINE_DIR)/inc-hist.texi
#### Host, target, and site specific Makefile fragments come in here.
###
all install:
info: gdb.info gdbint.info stabs.info
dvi: gdb.dvi refcard.dvi gdbint.dvi
all-doc: gdb.info gdb.dvi refcard.dvi gdb-internals gdbint.dvi
install-info: info
for i in *.info* ; do \
$(INSTALL_DATA) $$i $(infodir)/$$i ; \
done
STAGESTUFF = *.info* gdb-all.texi GDBvn.texi
# Copy the object files from a particular stage into a subdirectory.
stage1: force
-mkdir stage1
-mv $(STAGESTUFF) stage1
stage2: force
-mkdir stage2
-mv $(STAGESTUFF) stage2
stage3: force
-mkdir stage3
-mv $(STAGESTUFF) stage3
against=stage2
comparison: force
for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
de-stage1: force
-(cd stage1 ; mv -f * ..)
-rmdir stage1
de-stage2: force
-(cd stage2 ; mv -f * ..)
-rmdir stage2
de-stage3: force
-(cd stage3 ; mv -f * ..)
-rmdir stage3
clean-info:
rm -f gdb.info* gdbint.info* stabs.info*
clean-dvi:
rm -f gdb.dvi refcard.dvi gdbint.dvi stabs.dvi sedref.dvi
mostlyclean: clean-info clean-dvi
rm -f gdb.?? gdb.??? gdb.mm gdb.ms gdb.me
rm -f links2roff
rm -f refcard.ps lrefcard.ps refcard.log sedref.* *~
rm -f gdbint.?? gdbint.??? stabs.?? stabs.???
clean: mostlyclean
rm -f GDBvn.texi rluser.texinfo inc-hist.texi
distclean: clean
rm -f Makefile config.status
realclean: distclean clean-dvi clean-info
# GDB QUICK REFERENCE (dvi output)
refcard.dvi : refcard.tex $(REFEDITS)
if [ -z "$(REFEDITS)" ]; then \
cp $(srcdir)/refcard.tex sedref.tex ; \
else \
echo > tmp.sed ; \
for f in "$(REFEDITS)" ; do \
cat $(srcdir)/$$f >>tmp.sed ; done ; \
sed -f tmp.sed $(srcdir)/refcard.tex >sedref.tex ; \
fi
$(SET_TEXINPUTS) $(TEX) sedref.tex
mv sedref.dvi refcard.dvi
rm -f sedref.log sedref.tex tmp.sed
refcard.ps : refcard.dvi
dvips -t landscape refcard.dvi -o
# File to record current GDB version number (copied from main dir Makefile.in)
GDBvn.texi : ${gdbdir}/Makefile.in
echo "@set GDBVN `sed <$(srcdir)/../Makefile.in -n 's/VERSION = //p'`" > ./GDBvn.new
mv GDBvn.new GDBvn.texi
# Updated atomically
.PRECIOUS: GDBvn.texi
# Choose configuration for GDB manual (normally `all'; normally not tied into
# `configure' script because most users prefer generic version of manual,
# not one for their binary config---which may not be specifically
# defined anyways).
gdb-cfg.texi: ${srcdir}/${DOC_CONFIG}-cfg.texi
ln -s ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
ln ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi || \
cp ${srcdir}/${DOC_CONFIG}-cfg.texi gdb-cfg.texi
# GDB MANUAL: texinfo source, using @set/@clear/@value/@ifset/@ifclear
# If your texinfo or makeinfo don't support these, get a new texinfo release
#
# The nonsense with GDBvn.texi gets this to run with both Sun and GNU make.
# Note that we can *generate* GDBvn.texi, but since we distribute one in the
# source directory for the benefit of people who *don't* use this makefile,
# VPATH will often tell make not to bother building it, because the one
# in the srcdir is up to date. (if not, then make should build one here).
# GDB MANUAL: TeX dvi file
gdb.dvi: ${SFILES_DOC}
if [ ! -f ./GDBvn.texi ]; then \
ln -s $(srcdir)/GDBvn.texi . || \
ln $(srcdir)/GDBvn.texi . || \
cp $(srcdir)/GDBvn.texi . ; else true; fi
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
$(TEXINDEX) gdb.??
$(SET_TEXINPUTS) $(TEX) gdb.texinfo
rm -f gdb.?? gdb.log gdb.aux gdb.toc gdb.??s
# GDB MANUAL: info file
# We're using texinfo2, and older makeinfo's may not be able to
# cope with all the markup.
gdb.info: ${SFILES_DOC}
$(MAKEINFO) -I ${READLINE_DIR} -I $(srcdir) -o ./gdb.info gdb.texinfo
# GDB MANUAL: roff translations
# Try to use a recent texi2roff. v2 was put on prep in jan91.
# If you want an index, see texi2roff doc for postprocessing
# and add -i to texi2roff invocations below.
# Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete
# corresponding -e lines when later texi2roff's are current)
# + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs.
# + @c's deleted explicitly because texi2roff sees texinfo commands in them
# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank
# + @alphaenumerate is ridiculously new, turned into @enumerate
# texi2roff doesn't have a notion of include dirs, so we have to fake
# it out for gdb manual's include files---but only if not configured
# in main sourcedir.
links2roff: $(SFILES_INCLUDED)
if [ ! -f gdb.texinfo ]; then \
ln -s $(SFILES_INCLUDED) . || \
ln $(SFILES_INCLUDED) . || \
cp $(SFILES_INCLUDED) . ; \
fi
touch links2roff
# "Readline" appendices. Get them also due to lack of includes,
# regardless of whether or not configuring in main sourcedir.
# @ftable removed due to bug in texi2roff-2; if your texi2roff
# is newer, try just ln or cp
rluser.texinfo: ${READLINE_DIR}/rluser.texinfo
sed -e 's/^@ftable/@table/g' \
-e 's/^@end ftable/@end table/g' \
${READLINE_DIR}/rluser.texinfo > ./rluser.texinfo
inc-hist.texi: ${READLINE_DIR}/inc-hist.texi
ln -s ${READLINE_DIR}/inc-hist.texi . || \
ln ${READLINE_DIR}/inc-hist.texi . || \
cp ${READLINE_DIR}/inc-hist.texi .
# gdb manual suitable for [gtn]roff -me
gdb.me: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
sed -e '/\\input texinfo/d' \
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
-e '/^@ifinfo/,/^@end ifinfo/d' \
-e '/^@c /d' \
-e 's/{.*,,/{/' \
-e 's/@ / /g' \
-e 's/^@alphaenumerate/@enumerate/g' \
-e 's/^@end alphaenumerate/@end enumerate/g' \
$(srcdir)/gdb.texinfo | \
$(TEXI2ROFF) -me | \
sed -e 's/---/\\(em/g' \
>gdb.me
# gdb manual suitable for [gtn]roff -ms
gdb.ms: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
sed -e '/\\input texinfo/d' \
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
-e '/^@ifinfo/,/^@end ifinfo/d' \
-e '/^@c /d' \
-e 's/{.*,,/{/' \
-e 's/@ / /g' \
-e 's/^@alphaenumerate/@enumerate/g' \
-e 's/^@end alphaenumerate/@end enumerate/g' \
$(srcdir)/gdb.texinfo | \
$(TEXI2ROFF) -ms | \
sed -e 's/---/\\(em/g' \
>gdb.ms
# gdb manual suitable for [tn]roff -mm
# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer,
# try leaving them in
gdb.mm: $(SFILES_LOCAL) links2roff rluser.texinfo inc-hist.texi
sed -e '/\\input texinfo/d' \
-e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \
-e '/^@ifinfo/,/^@end ifinfo/d' \
-e '/^@c /d' \
-e 's/{.*,,/{/' \
-e '/@noindent/d' \
-e 's/@ / /g' \
-e 's/^@alphaenumerate/@enumerate/g' \
-e 's/^@end alphaenumerate/@end enumerate/g' \
$(srcdir)/gdb.texinfo | \
$(TEXI2ROFF) -mm | \
sed -e 's/---/\\(em/g' \
>gdb.mm
# GDB INTERNALS MANUAL: TeX dvi file
gdbint.dvi : gdbint.texinfo
$(SET_TEXINPUTS) $(TEX) gdbint.texinfo
$(TEXINDEX) gdbint.??
$(SET_TEXINPUTS) $(TEX) gdbint.texinfo
rm -f gdbint.?? gdbint.aux gdbint.cps gdbint.fns gdbint.kys \
gdbint.log gdbint.pgs gdbint.toc gdbint.tps gdbint.vrs
# GDB INTERNALS MANUAL: info file
gdb-internals: gdbint.info
gdbint.info: gdbint.texinfo
$(MAKEINFO) -o gdbint.info $(srcdir)/gdbint.texinfo
stabs.info: stabs.texinfo
$(MAKEINFO) -o stabs.info $(srcdir)/stabs.texinfo
# STABS DOCUMENTATION: TeX dvi file
stabs.dvi : stabs.texinfo
$(SET_TEXINPUTS) $(TEX) stabs.texinfo
$(TEXINDEX) stabs.??
$(SET_TEXINPUTS) $(TEX) stabs.texinfo
rm -f stabs.?? stabs.aux stabs.cps stabs.fns stabs.kys \
stabs.log stabs.pgs stabs.toc stabs.tps stabs.vrs
stabs.ps: stabs.dvi
dvips -o stabs.ps stabs
force:
Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
$(SHELL) ./config.status

View file

@ -0,0 +1,11 @@
/--- Papersize params:/,/--- end papersize params/c\
%------- Papersize params:\
%% A4 paper (297x210mm)\
%%\
\\totalwidth=297mm % total width of paper\
\\totalheight=210mm % total height of paper\
\\hmargin=5mm % horizontal margin width\
\\vmargin=10mm % vertical margin width\
\\secskip=.6pc % space between refcard secs\
\\lskip=1pt % extra skip between \\sec entries\
%------- end papersize params

View file

@ -0,0 +1,117 @@
@c GDB MANUAL configuration file.
@c Copyright (c) 1993 Free Software Foundation, Inc.
@c
@c NOTE: While the GDB manual is configurable (by changing these
@c switches), its configuration is ***NOT*** automatically tied in to
@c source configuration---because the authors expect that, save in
@c unusual cases, the most inclusive form of the manual is appropriate
@c no matter how the program itself is configured.
@c
@c The only automatically-varying variable is the GDB version number,
@c which the Makefile rewrites based on the VERSION variable from
@c `../Makefile.in'.
@c
@c GDB version number is recorded in the variable GDBVN
@include GDBvn.texi
@c
@c ----------------------------------------------------------------------
@c PLATFORM FLAGS:
@set GENERIC
@c
@c Hitachi H8/300 target:
@set H8
@c Hitachi H8/300 target ONLY:
@clear H8EXCLUSIVE
@c
@c remote MIPS target:
@set MIPS
@c
@c SPARC target:
@set SPARC
@c
@c AMD 29000 target:
@set AMD29K
@c
@c Intel 960 target:
@set I960
@c
@c Tandem ST2000 (phone switch) target:
@set ST2000
@c
@c Zilog 8000 target:
@set Z8K
@c
@c Lucid "Energize" environment:
@clear LUCID
@c
@c Wind River Systems VxWorks environment:
@set VXWORKS
@c
@c ----------------------------------------------------------------------
@c DOC FEATURE FLAGS:
@c
@c Include change-from-old?
@set NOVEL
@c
@c Bare-board target?
@clear BARETARGET
@c
@c Restrict languages discussed to C?
@c This is backward. As time permits, change this to language-specific
@c switches for what to include.
@clear CONLY
@c Discuss Fortran?
@set FORTRAN
@c
@c Discuss Modula 2?
@set MOD2
@c
@c Specifically for host machine running DOS?
@clear DOSHOST
@c
@c Talk about CPU simulator targets?
@set SIMS
@c
@c Is manual stand-alone, or part of an agglomeration, with overall GPL?
@clear AGGLOMERATION
@c
@c Remote serial line settings of interest?
@set SERIAL
@c
@c Discuss features requiring Posix or similar OS environment?
@set POSIX
@c
@c Discuss remote serial debugging stub?
@set REMOTESTUB
@c
@c Discuss gdbserver?
@set GDBSERVER
@c
@c Refrain from discussing how to configure sw and format doc?
@clear PRECONFIGURED
@c
@c Refrain from referring to unfree publications?
@set FSFDOC
@c
@c ----------------------------------------------------------------------
@c STRINGS:
@c
@c Name of GDB program. Used also for (gdb) prompt string.
@set GDBP gdb
@c
@c Name of GDB product. Used in running text.
@set GDBN GDB
@c
@c Name of GDB initialization file.
@set GDBINIT .gdbinit
@c
@c Name of host. Should not be used in generic configs, but generic
@c value may catch some flubs.
@set HOST machine specific
@c
@c Name of GCC product
@set NGCC GCC
@c
@c Name of GCC program
@set GCC gcc

View file

@ -0,0 +1,5 @@
#!/bin/sh
# This file was generated automatically by configure. Do not edit.
# This directory was configured as follows:
../../configure --host=i386-unknown-freebsd --target=i386-unknown-freebsd -norecursion
#

View file

@ -0,0 +1,7 @@
srcname="GDB doc"
srctrigger=gdb.texinfo
# per-host:
# per-target:
files=""
links=""

View file

@ -0,0 +1,117 @@
@c GDB MANUAL configuration file.
@c Copyright (c) 1993 Free Software Foundation, Inc.
@c
@c NOTE: While the GDB manual is configurable (by changing these
@c switches), its configuration is ***NOT*** automatically tied in to
@c source configuration---because the authors expect that, save in
@c unusual cases, the most inclusive form of the manual is appropriate
@c no matter how the program itself is configured.
@c
@c The only automatically-varying variable is the GDB version number,
@c which the Makefile rewrites based on the VERSION variable from
@c `../Makefile.in'.
@c
@c GDB version number is recorded in the variable GDBVN
@include GDBvn.texi
@c
@c ----------------------------------------------------------------------
@c PLATFORM FLAGS:
@set GENERIC
@c
@c Hitachi H8/300 target:
@set H8
@c Hitachi H8/300 target ONLY:
@clear H8EXCLUSIVE
@c
@c remote MIPS target:
@set MIPS
@c
@c SPARC target:
@set SPARC
@c
@c AMD 29000 target:
@set AMD29K
@c
@c Intel 960 target:
@set I960
@c
@c Tandem ST2000 (phone switch) target:
@set ST2000
@c
@c Zilog 8000 target:
@set Z8K
@c
@c Lucid "Energize" environment:
@clear LUCID
@c
@c Wind River Systems VxWorks environment:
@set VXWORKS
@c
@c ----------------------------------------------------------------------
@c DOC FEATURE FLAGS:
@c
@c Include change-from-old?
@set NOVEL
@c
@c Bare-board target?
@clear BARETARGET
@c
@c Restrict languages discussed to C?
@c This is backward. As time permits, change this to language-specific
@c switches for what to include.
@clear CONLY
@c Discuss Fortran?
@set FORTRAN
@c
@c Discuss Modula 2?
@set MOD2
@c
@c Specifically for host machine running DOS?
@clear DOSHOST
@c
@c Talk about CPU simulator targets?
@set SIMS
@c
@c Is manual stand-alone, or part of an agglomeration, with overall GPL?
@clear AGGLOMERATION
@c
@c Remote serial line settings of interest?
@set SERIAL
@c
@c Discuss features requiring Posix or similar OS environment?
@set POSIX
@c
@c Discuss remote serial debugging stub?
@set REMOTESTUB
@c
@c Discuss gdbserver?
@set GDBSERVER
@c
@c Refrain from discussing how to configure sw and format doc?
@clear PRECONFIGURED
@c
@c Refrain from referring to unfree publications?
@set FSFDOC
@c
@c ----------------------------------------------------------------------
@c STRINGS:
@c
@c Name of GDB program. Used also for (gdb) prompt string.
@set GDBP gdb
@c
@c Name of GDB product. Used in running text.
@set GDBN GDB
@c
@c Name of GDB initialization file.
@set GDBINIT .gdbinit
@c
@c Name of host. Should not be used in generic configs, but generic
@c value may catch some flubs.
@set HOST machine specific
@c
@c Name of GCC product
@set NGCC GCC
@c
@c Name of GCC program
@set GCC gcc

View file

@ -0,0 +1,213 @@
This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
file gdb.texinfo.
START-INFO-DIR-ENTRY
* Gdb:: The GNU debugger.
END-INFO-DIR-ENTRY
This file documents the GNU debugger GDB.
This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
Source-Level Debugger' for GDB Version 4.11.
Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the entire resulting derived work is distributed under the terms
of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions.

Indirect:
gdb.info-1: 992
gdb.info-2: 50863
gdb.info-3: 98423
gdb.info-4: 145674
gdb.info-5: 194815
gdb.info-6: 244253
gdb.info-7: 290141
gdb.info-8: 335234

Tag Table:
(Indirect)
Node: Top992
Node: Summary2561
Node: Free Software3754
Node: Contributors4492
Node: New Features8199
Node: Sample Session12215
Node: Invocation19094
Node: Invoking GDB19559
Node: File Options21298
Node: Mode Options24476
Node: Quitting GDB26641
Node: Shell Commands27359
Node: Commands28106
Node: Command Syntax28739
Node: Completion30598
Node: Help34666
Node: Running38442
Node: Compilation39426
Node: Starting41224
Node: Arguments44411
Node: Environment45412
Node: Working Directory48518
Node: Input/Output49258
Node: Attach50863
Node: Kill Process53122
Node: Process Information54097
Node: Stopping55350
Node: Breakpoints56423
Node: Set Breaks58622
Node: Set Watchpoints65221
Node: Exception Handling66051
Node: Delete Breaks68610
Node: Disabling70238
Node: Conditions72881
Node: Break Commands77378
Node: Breakpoint Menus80225
Node: Error in Breakpoints81935
Node: Continuing and Stepping82839
Node: Signals89318
Node: Stack92940
Node: Frames94414
Node: Backtrace96691
Node: Selection98423
Node: Frame Info100917
Node: MIPS Stack102984
Node: Source103857
Node: List104806
Node: Search108286
Node: Source Path109085
Node: Machine Code111763
Node: Data114236
Node: Expressions116111
Node: Variables117793
Node: Arrays120314
Node: Output Formats122397
Node: Memory124456
Node: Auto Display128727
Node: Print Settings132474
Node: Value History140630
Node: Convenience Vars143017
Node: Registers145674
Node: Floating Point Hardware150276
Node: Languages150781
Node: Setting151949
Node: Manually152483
Node: Automatically153663
Node: Show154980
Node: Checks155888
Node: Type Checking157244
Node: Range Checking159924
Node: Support162265
Node: C163185
Node: C Operators164016
Node: C Constants168071
Node: Cplus expressions169974
Node: C Defaults172597
Node: C Checks173215
Node: Debugging C173926
Node: Debugging C plus plus174404
Node: Modula-2176416
Node: M2 Operators177308
Node: Built-In Func/Proc180308
Node: M2 Constants183051
Node: M2 Defaults184640
Node: Deviations185239
Node: M2 Checks186330
Node: M2 Scope187130
Node: GDB/M2188142
Node: Symbols189081
Node: Altering194815
Node: Assignment195797
Node: Jumping197907
Node: Signaling199914
Node: Returning201034
Node: Calling202226
Node: Patching202700
Node: GDB Files203782
Node: Files204247
Node: Symbol Errors214466
Node: Targets218064
Node: Active Targets218954
Node: Target Commands220530
Node: Remote223904
Node: Remote Serial225315
Node: Stub Contents227768
Node: Bootstrapping229877
Node: Debug Session233057
Node: Protocol236218
Node: Server239069
Node: i960-Nindy Remote242748
Node: Nindy Startup243568
Node: Nindy Options244253
Node: Nindy Reset245867
Node: UDI29K Remote246251
Node: EB29K Remote247172
Node: Comms (EB29K)248006
Node: gdb-EB29K251189
Node: Remote Log252555
Node: ST2000 Remote253030
Node: VxWorks Remote254499
Node: VxWorks Connection256224
Node: VxWorks Download257150
Node: VxWorks Attach258886
Node: Hitachi Remote259281
Node: MIPS Remote260790
Node: Simulator262861
Node: Controlling GDB264351
Node: Prompt264962
Node: Editing265571
Node: History266338
Node: Screen Size269024
Node: Numbers270420
Node: Messages/Warnings271538
Node: Sequences274587
Node: Define275147
Node: Hooks277144
Node: Command Files278547
Node: Output280302
Node: Emacs282714
Node: GDB Bugs288669
Node: Bug Criteria289387
Node: Bug Reporting290141
Node: Command Line Editing297342
Node: Introduction and Notation297763
Node: Readline Interaction298780
Node: Readline Bare Essentials299914
Node: Readline Movement Commands301417
Node: Readline Killing Commands302303
Node: Readline Arguments303941
Node: Readline Init File304887
Node: Readline Init Syntax305708
Node: Commands For Moving309640
Node: Commands For History310260
Node: Commands For Text311330
Node: Commands For Killing313046
Node: Numeric Arguments314168
Node: Commands For Completion314606
Node: Miscellaneous Commands315325
Node: Readline Vi Mode316077
Node: Using History Interactively316784
Node: History Interaction317141
Node: Event Designators318189
Node: Word Designators318828
Node: Modifiers319724
Node: Renamed Commands320469
Node: Formatting Documentation322131
Node: Installing GDB325465
Node: Separate Objdir328945
Node: Config Names331490
Node: configure Options332918
Node: Index335234

End Tag Table

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,657 @@
This is Info file ./gdb.info, produced by Makeinfo-1.52 from the input
file gdb.texinfo.
START-INFO-DIR-ENTRY
* Gdb:: The GNU debugger.
END-INFO-DIR-ENTRY
This file documents the GNU debugger GDB.
This is Edition 4.09, August 1993, of `Debugging with GDB: the GNU
Source-Level Debugger' for GDB Version 4.11.
Copyright (C) 1988, '89, '90, '91, '92, '93 Free Software
Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the entire resulting derived work is distributed under the terms
of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions.

File: gdb.info, Node: Index, Prev: Installing GDB, Up: Top
Index
*****
* Menu:
* #: Command Syntax.
* $bpnum: Set Breaks.
* $cdir: Source Path.
* $cwd: Source Path.
* $_: Convenience Vars.
* $__: Convenience Vars.
* .: M2 Scope.
* .esgdbinit: Command Files.
* .os68gdbinit: Command Files.
* .vxgdbinit: Command Files.
* /proc: Process Information.
* 386: Remote Serial.
* 680x0: Remote Serial.
* @: Arrays.
* # in Modula-2: GDB/M2.
* $$: Value History.
* $_ and info breakpoints: Set Breaks.
* $_ and info line: Machine Code.
* $_, $__, and value history: Memory.
* $: Value History.
* breakpoint subroutine, remote: Stub Contents.
* heuristic-fence-post (MIPS): MIPS Stack.
* remotedebug, MIPS protocol: MIPS Remote.
* retransmit-timeout, MIPS protocol: MIPS Remote.
* timeout, MIPS protocol: MIPS Remote.
* vi style command editing: Readline Vi Mode.
* .gdbinit: Command Files.
* COFF versus C++: Cplus expressions.
* ECOFF and C++: Cplus expressions.
* ELF/DWARF and C++: Cplus expressions.
* ELF/stabs and C++: Cplus expressions.
* XCOFF and C++: Cplus expressions.
* GDB bugs, reporting: Bug Reporting.
* {TYPE}: Expressions.
* a.out and C++: Cplus expressions.
* abbreviation: Command Syntax.
* active targets: Active Targets.
* add-symbol-file: Files.
* add-syms: Renamed Commands.
* AMD 29K register stack: Registers.
* AMD EB29K: Target Commands.
* AMD29K via UDI: UDI29K Remote.
* arguments (to your program): Arguments.
* artificial array: Arrays.
* assembly instructions: Machine Code.
* assignment: Assignment.
* attach: Attach.
* attach: Attach.
* automatic display: Auto Display.
* b: Set Breaks.
* backtrace: Backtrace.
* break: Set Breaks.
* break in overloaded functions: Debugging C plus plus.
* breakpoint commands: Break Commands.
* breakpoint conditions: Conditions.
* breakpoint numbers: Breakpoints.
* breakpoint on memory address: Breakpoints.
* breakpoint on variable modification: Breakpoints.
* breakpoints: Breakpoints.
* bt: Backtrace.
* bug criteria: Bug Criteria.
* bug reports: Bug Reporting.
* bugs in GDB: GDB Bugs.
* c: Continuing and Stepping.
* C and C++: C.
* C and C++ checks: C Checks.
* C and C++ constants: C Operators.
* C and C++ defaults: C Defaults.
* C and C++ operators: C.
* C++: C.
* C++ and object formats: Cplus expressions.
* C++ exception handling: Debugging C plus plus.
* C++ scope resolution: Variables.
* C++ support, not in COFF: Cplus expressions.
* C++ symbol decoding style: Print Settings.
* C++ symbol display: Debugging C plus plus.
* call: Calling.
* call overloaded functions: Cplus expressions.
* call stack: Stack.
* calling functions: Calling.
* calling make: Shell Commands.
* casts, to view memory: Expressions.
* catch: Exception Handling.
* catch exceptions: Frame Info.
* cd: Working Directory.
* cdir: Source Path.
* checks, range: Type Checking.
* checks, type: Checks.
* checksum, for GDB remote: Protocol.
* clear: Delete Breaks.
* clearing breakpoints, watchpoints: Delete Breaks.
* colon, doubled as scope operator: M2 Scope.
* colon-colon: M2 Scope.
* colon-colon: Variables.
* command files: Hooks.
* command files: Command Files.
* command line editing: Editing.
* commands: Break Commands.
* commands for C++: Debugging C plus plus.
* commands to STDBUG (ST2000): ST2000 Remote.
* comment: Command Syntax.
* compilation directory: Source Path.
* completion: Completion.
* completion of quoted strings: Completion.
* condition: Conditions.
* conditional breakpoints: Conditions.
* configuring GDB: Installing GDB.
* confirmation: Messages/Warnings.
* connect (to STDBUG): ST2000 Remote.
* continue: Continuing and Stepping.
* continuing: Continuing and Stepping.
* controlling terminal: Input/Output.
* convenience variables: Convenience Vars.
* core: Files.
* core dump file: Files.
* core-file: Files.
* CPU simulator: Simulator.
* crash of debugger: Bug Criteria.
* current directory: Source Path.
* cwd: Source Path.
* d: Delete Breaks.
* debugger crash: Bug Criteria.
* debugging optimized code: Compilation.
* debugging stub, example: Protocol.
* debugging target: Targets.
* define: Define.
* delete: Delete Breaks.
* delete breakpoints: Delete Breaks.
* delete display: Auto Display.
* delete environment: Renamed Commands.
* deleting breakpoints, watchpoints: Delete Breaks.
* detach: Attach.
* device: Hitachi Remote.
* directories for source files: Source Path.
* directory: Source Path.
* directory, compilation: Source Path.
* directory, current: Source Path.
* dis: Disabling.
* disable: Disabling.
* disable breakpoints: Disabling.
* disable display: Auto Display.
* disabled breakpoints: Disabling.
* disassemble: Machine Code.
* display: Auto Display.
* display of expressions: Auto Display.
* do: Selection.
* document: Define.
* documentation: Formatting Documentation.
* down: Selection.
* down-silently: Selection.
* download to H8/300 or H8/500: Files.
* download to Hitachi SH: Files.
* download to Nindy-960: Files.
* download to VxWorks: VxWorks Download.
* dynamic linking: Files.
* eb.log: Remote Log.
* EB29K board: EB29K Remote.
* EBMON: Comms (EB29K).
* echo: Output.
* editing: Editing.
* editing-mode: Readline Init Syntax.
* emacs: Emacs.
* enable: Disabling.
* enable breakpoints: Disabling.
* enable display: Auto Display.
* enabled breakpoints: Disabling.
* end: Break Commands.
* entering numbers: Numbers.
* environment (of your program): Environment.
* error on valid input: Bug Criteria.
* event designators: Event Designators.
* examining data: Data.
* examining memory: Memory.
* exception handlers: Exception Handling.
* exception handlers: Frame Info.
* exceptionHandler: Bootstrapping.
* exec-file: Files.
* executable file: Files.
* exiting GDB: Quitting GDB.
* expansion: History Interaction.
* expressions: Expressions.
* expressions in C or C++: C.
* expressions in C++: Cplus expressions.
* expressions in Modula-2: Modula-2.
* f: Selection.
* fatal signal: Bug Criteria.
* fatal signals: Signals.
* fg: Continuing and Stepping.
* file: Files.
* finish: Continuing and Stepping.
* flinching: Messages/Warnings.
* floating point: Floating Point Hardware.
* floating point registers: Registers.
* floating point, MIPS remote: MIPS Remote.
* flush_i_cache: Bootstrapping.
* foo: Symbol Errors.
* format options: Print Settings.
* formatted output: Output Formats.
* Fortran: Summary.
* forward-search: Search.
* frame: Selection.
* frame: Frames.
* frame number: Frames.
* frame pointer: Frames.
* frameless execution: Frames.
* g++: C.
* GDB reference card: Formatting Documentation.
* gdbserver: Server.
* getDebugChar: Bootstrapping.
* GNU C++: C.
* h: Help.
* H8/300 or H8/500 download: Files.
* H8/300 or H8/500 simulator: Simulator.
* handle: Signals.
* handle_exception: Stub Contents.
* handling signals: Signals.
* help: Help.
* help target: Target Commands.
* help user-defined: Define.
* history expansion: History.
* history file: History.
* history number: Value History.
* history save: History.
* history size: History.
* history substitution: History.
* Hitachi SH download: Files.
* Hitachi SH simulator: Simulator.
* horizontal-scroll-mode: Readline Init Syntax.
* i: Help.
* i/o: Input/Output.
* i386-stub.c: Remote Serial.
* i960: i960-Nindy Remote.
* ignore: Conditions.
* ignore count (of breakpoint): Conditions.
* INCLUDE_RDB: VxWorks Remote.
* info: Help.
* info address: Symbols.
* info all-registers: Registers.
* info args: Frame Info.
* info breakpoints: Set Breaks.
* info catch: Frame Info.
* info convenience: Renamed Commands.
* info copying: Renamed Commands.
* info directories: Renamed Commands.
* info display: Auto Display.
* info editing: Renamed Commands.
* info f: Frame Info.
* info files: Files.
* info float: Floating Point Hardware.
* info frame: Frame Info.
* info frame: Show.
* info functions: Symbols.
* info history: Renamed Commands.
* info line: Machine Code.
* info locals: Frame Info.
* info proc: Process Information.
* info proc id: Process Information.
* info proc mappings: Process Information.
* info proc status: Process Information.
* info proc times: Process Information.
* info program: Stopping.
* info registers: Registers.
* info s: Backtrace.
* info set: Help.
* info share: Files.
* info sharedlibrary: Files.
* info signals: Signals.
* info source: Symbols.
* info source: Show.
* info sources: Symbols.
* info stack: Backtrace.
* info target: Files.
* info targets: Renamed Commands.
* info terminal: Input/Output.
* info types: Symbols.
* info values: Renamed Commands.
* info variables: Symbols.
* info version: Renamed Commands.
* info warranty: Renamed Commands.
* info watchpoints: Set Watchpoints.
* inheritance: Debugging C plus plus.
* init file: Command Files.
* init file name: Command Files.
* initial frame: Frames.
* innermost frame: Frames.
* inspect: Data.
* installation: Installing GDB.
* instructions, assembly: Machine Code.
* Intel: Remote Serial.
* interaction, readline: Readline Interaction.
* internal GDB breakpoints: Set Breaks.
* interrupt: Quitting GDB.
* interrupting remote programs: Debug Session.
* invalid input: Bug Criteria.
* jump: Jumping.
* kill: Kill Process.
* l: List.
* languages: Languages.
* latest breakpoint: Set Breaks.
* leaving GDB: Quitting GDB.
* linespec: List.
* list: List.
* listing machine instructions: Machine Code.
* load: Files.
* log file for EB29K: Remote Log.
* m68k-stub.c: Remote Serial.
* machine instructions: Machine Code.
* maint info breakpoints: Set Breaks.
* maint print psymbols: Symbols.
* maint print symbols: Symbols.
* make: Shell Commands.
* mapped: Files.
* mark-modified-lines: Readline Init Syntax.
* member functions: Cplus expressions.
* memory tracing: Breakpoints.
* memory, viewing as typed object: Expressions.
* memory-mapped symbol file: Files.
* memset: Bootstrapping.
* MIPS boards: MIPS Remote.
* MIPS remote floating point: MIPS Remote.
* MIPS stack: MIPS Stack.
* Modula-2: Modula-2.
* Modula-2 built-ins: M2 Operators.
* Modula-2 checks: M2 Checks.
* Modula-2 constants: Built-In Func/Proc.
* Modula-2 defaults: M2 Defaults.
* Modula-2 operators: M2 Operators.
* Modula-2, deviations from: Deviations.
* Motorola 680x0: Remote Serial.
* multiple targets: Active Targets.
* n: Continuing and Stepping.
* names of symbols: Symbols.
* namespace in C++: Cplus expressions.
* negative breakpoint numbers: Set Breaks.
* next: Continuing and Stepping.
* nexti: Continuing and Stepping.
* ni: Continuing and Stepping.
* Nindy: i960-Nindy Remote.
* number representation: Numbers.
* numbers for breakpoints: Breakpoints.
* object formats and C++: Cplus expressions.
* online documentation: Help.
* optimized code, debugging: Compilation.
* outermost frame: Frames.
* output: Output.
* output formats: Output Formats.
* overloading: Breakpoint Menus.
* overloading in C++: Debugging C plus plus.
* packets, reporting on stdout: Protocol.
* partial symbol dump: Symbols.
* patching binaries: Patching.
* path: Environment.
* pauses in output: Screen Size.
* pipes: Starting.
* prefer-visible-bell: Readline Init Syntax.
* print: Data.
* print settings: Print Settings.
* printf: Output.
* printing data: Data.
* process image: Process Information.
* prompt: Prompt.
* protocol, GDB remote serial: Protocol.
* ptype: Symbols.
* putDebugChar: Bootstrapping.
* pwd: Working Directory.
* q: Quitting GDB.
* quit: Quitting GDB.
* quotes in commands: Completion.
* quoting names: Symbols.
* raise exceptions: Exception Handling.
* range checking: Type Checking.
* rbreak: Set Breaks.
* reading symbols immediately: Files.
* readline: Editing.
* readnow: Files.
* redirection: Input/Output.
* reference card: Formatting Documentation.
* reference declarations: Cplus expressions.
* register stack, AMD29K: Registers.
* registers: Registers.
* regular expression: Set Breaks.
* reloading symbols: Messages/Warnings.
* remote connection without stubs: Server.
* remote debugging: Remote.
* remote programs, interrupting: Debug Session.
* remote serial debugging summary: Debug Session.
* remote serial debugging, overview: Remote Serial.
* remote serial protocol: Protocol.
* remote serial stub: Stub Contents.
* remote serial stub list: Remote Serial.
* remote serial stub, initialization: Stub Contents.
* remote serial stub, main routine: Stub Contents.
* remote stub, example: Protocol.
* remote stub, support routines: Bootstrapping.
* repeating commands: Command Syntax.
* reporting bugs in GDB: GDB Bugs.
* reset: Nindy Reset.
* response time, MIPS debugging: MIPS Stack.
* resuming execution: Continuing and Stepping.
* RET: Command Syntax.
* return: Returning.
* returning from a function: Returning.
* reverse-search: Search.
* run: Starting.
* running: Starting.
* running 29K programs: EB29K Remote.
* running VxWorks tasks: VxWorks Attach.
* s: Continuing and Stepping.
* saving symbol table: Files.
* scope: M2 Scope.
* search: Search.
* searching: Search.
* selected frame: Stack.
* serial connections, debugging: Protocol.
* serial device, Hitachi micros: Hitachi Remote.
* serial line speed, Hitachi micros: Hitachi Remote.
* serial line, target remote: Debug Session.
* serial protocol, GDB remote: Protocol.
* set addressprint: Renamed Commands.
* set args: Arguments.
* set array-max: Renamed Commands.
* set arrayprint: Renamed Commands.
* set asm-demangle: Renamed Commands.
* set caution: Renamed Commands.
* set check: Range Checking.
* set check: Type Checking.
* set check range: Range Checking.
* set check type: Type Checking.
* set complaints: Messages/Warnings.
* set confirm: Messages/Warnings.
* set demangle: Renamed Commands.
* set demangle-style: Print Settings.
* set editing: Editing.
* set environment: Environment.
* set height: Screen Size.
* set history expansion: History.
* set history filename: History.
* set history save: History.
* set history size: History.
* set history write: Renamed Commands.
* set language: Manually.
* set listsize: List.
* set mipsfpu off: MIPS Remote.
* set prettyprint: Renamed Commands.
* set print address: Print Settings.
* set print array: Print Settings.
* set print asm-demangle: Print Settings.
* set print demangle: Print Settings.
* set print elements: Print Settings.
* set print max-symbolic-offset: Print Settings.
* set print object: Print Settings.
* set print pretty: Print Settings.
* set print sevenbit-strings: Print Settings.
* set print symbol-filename: Print Settings.
* set print union: Print Settings.
* set print vtbl: Print Settings.
* set prompt: Prompt.
* set radix: Numbers.
* set remotedebug: Protocol.
* set retransmit-timeout: MIPS Remote.
* set rstack_high_address: Registers.
* set screen-height: Renamed Commands.
* set screen-width: Renamed Commands.
* set sevenbit-strings: Renamed Commands.
* set symbol-reloading: Messages/Warnings.
* set timeout: MIPS Remote.
* set unionprint: Renamed Commands.
* set variable: Assignment.
* set verbose: Messages/Warnings.
* set vtblprint: Renamed Commands.
* set width: Screen Size.
* set write: Patching.
* setting variables: Assignment.
* setting watchpoints: Set Watchpoints.
* set_debug_traps: Stub Contents.
* share: Files.
* shared libraries: Files.
* sharedlibrary: Files.
* shell: Shell Commands.
* shell escape: Shell Commands.
* show: Help.
* show addressprint: Renamed Commands.
* show args: Arguments.
* show array-max: Renamed Commands.
* show arrayprint: Renamed Commands.
* show asm-demangle: Renamed Commands.
* show caution: Renamed Commands.
* show check range: Range Checking.
* show check type: Type Checking.
* show commands: History.
* show complaints: Messages/Warnings.
* show confirm: Messages/Warnings.
* show convenience: Convenience Vars.
* show copying: Help.
* show demangle: Renamed Commands.
* show demangle-style: Print Settings.
* show directories: Source Path.
* show editing: Editing.
* show environment: Environment.
* show height: Screen Size.
* show history: History.
* show history write: Renamed Commands.
* show language: Show.
* show listsize: List.
* show paths: Environment.
* show prettyprint: Renamed Commands.
* show print address: Print Settings.
* show print array: Print Settings.
* show print asm-demangle: Print Settings.
* show print demangle: Print Settings.
* show print elements: Print Settings.
* show print max-symbolic-offset: Print Settings.
* show print object: Print Settings.
* show print pretty: Print Settings.
* show print sevenbit-strings: Print Settings.
* show print symbol-filename: Print Settings.
* show print union: Print Settings.
* show print vtbl: Print Settings.
* show prompt: Prompt.
* show radix: Numbers.
* show remotedebug: Protocol.
* show retransmit-timeout: MIPS Remote.
* show rstack_high_address: Registers.
* show screen-height: Renamed Commands.
* show screen-width: Renamed Commands.
* show sevenbit-strings: Renamed Commands.
* show timeout: MIPS Remote.
* show unionprint: Renamed Commands.
* show user: Define.
* show values: Value History.
* show verbose: Messages/Warnings.
* show version: Help.
* show vtblprint: Renamed Commands.
* show warranty: Help.
* show width: Screen Size.
* show write: Patching.
* si: Continuing and Stepping.
* signal: Signaling.
* signals: Signals.
* silent: Break Commands.
* sim: Simulator.
* simulator: Simulator.
* simulator, H8/300 or H8/500: Simulator.
* simulator, Hitachi SH: Simulator.
* simulator, Z8000: Simulator.
* size of screen: Screen Size.
* source: Command Files.
* source path: Source Path.
* sparc-stub.c: Remote Serial.
* speed: Hitachi Remote.
* st2000 CMD: ST2000 Remote.
* ST2000 auxiliary commands: ST2000 Remote.
* stack frame: Frames.
* stack on MIPS: MIPS Stack.
* stacking targets: Active Targets.
* starting: Starting.
* STDBUG commands (ST2000): ST2000 Remote.
* step: Continuing and Stepping.
* stepi: Continuing and Stepping.
* stepping: Continuing and Stepping.
* stub example, remote debugging: Protocol.
* stupid questions: Messages/Warnings.
* symbol decoding style, C++: Print Settings.
* symbol dump: Symbols.
* symbol names: Symbols.
* symbol overloading: Breakpoint Menus.
* symbol table: Files.
* symbol-file: Files.
* symbols, reading immediately: Files.
* target: Targets.
* target amd-eb: Target Commands.
* target core: Target Commands.
* target exec: Target Commands.
* target hms: Target Commands.
* target mips PORT: MIPS Remote.
* target nindy: Target Commands.
* target remote: Target Commands.
* target sim: Target Commands.
* target sim: Simulator.
* target st2000: Target Commands.
* target udi: Target Commands.
* target vxworks: Target Commands.
* tbreak: Set Breaks.
* TCP port, target remote: Debug Session.
* terminal: Input/Output.
* this: Cplus expressions.
* toggle-editing-mode: Readline Vi Mode.
* tty: Input/Output.
* type casting memory: Expressions.
* type checking: Checks.
* type conversions in C++: Cplus expressions.
* u: Continuing and Stepping.
* udi: UDI29K Remote.
* UDI: UDI29K Remote.
* undisplay: Auto Display.
* unset: Renamed Commands.
* unset environment: Environment.
* until: Continuing and Stepping.
* up: Selection.
* up-silently: Selection.
* user-defined command: Define.
* value history: Value History.
* variable name conflict: Variables.
* variable values, wrong: Variables.
* variables, setting: Assignment.
* version number: Help.
* VxWorks: VxWorks Remote.
* watch: Set Watchpoints.
* watchpoints: Breakpoints.
* whatis: Symbols.
* where: Backtrace.
* word completion: Completion.
* working directory: Source Path.
* working directory (of your program): Working Directory.
* working language: Languages.
* writing into corefiles: Patching.
* writing into executables: Patching.
* wrong values: Variables.
* x: Memory.
* Z8000 simulator: Simulator.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,47 @@
@c GDB version number is recorded in the variable GDBVN
@include GDBvn.texi
@c
@set AGGLOMERATION
@clear AMD29K
@set BARETARGET
@clear CONLY
@set DOSHOST
@clear FORTRAN
@clear FSFDOC
@clear GDBSERVER
@clear GENERIC
@set H8
@set H8EXCLUSIVE
@clear HAVE-FLOAT
@clear I960
@clear MOD2
@clear NOVEL
@clear POSIX
@set PRECONFIGURED
@clear REMOTESTUB
@set SIMS
@clear SERIAL
@clear SPARC
@clear ST2000
@clear VXWORKS
@clear Z8K
@c ----------------------------------------------------------------------
@c STRINGS:
@c
@c Name of GDB program. Used also for (gdb) prompt string.
@set GDBP gdb
@c
@c Name of GDB product. Used in running text.
@set GDBN GDB
@c
@c Name of GDB initialization file.
@set GDBINIT .gdbinit
@c
@c Name of target.
@set TARGET Hitachi Microprocessors
@c
@c Name of GCC product
@set NGCC GCC
@c
@c Name of GCC program
@set GCC gcc

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
/font defs: ---/,/end font defs ---/c\
%-------------------- PostScript (long names) font defs: -----------------\
\\font\\bbf=Times-Bold at 10pt\
\\font\\vbbf=Times-Bold at 12pt\
\\font\\smrm=Times-Roman at 6pt\
\\font\\brm=Times-Roman at 10pt\
\\font\\rm=Times-Roman at 8pt\
\\font\\it=Times-Italic at 8pt\
\\font\\tt=Courier at 8pt\
% Used only for \copyright, replacing plain TeX macro.\
\\font\\sym=Symbol at 7pt\
\\def\\copyright{{\\sym\\char'323}}\
%-------------------- end font defs ---------------------------------

View file

@ -0,0 +1,13 @@
/font defs: ---/,/end font defs ---/c\
%-------------------- PostScript (K Berry names) font defs: --------------\
\\font\\bbf=ptmb at 10pt\
\\font\\vbbf=ptmb at 12pt\
\\font\\smrm=ptmr at 6pt\
\\font\\brm=ptmr at 10pt\
\\font\\rm=ptmr at 8pt\
\\font\\it=ptmri at 8pt\
\\font\\tt=pcrr at 8pt\
% Used only for \copyright, replacing plain TeX macro.\
\\font\\sym=psyr at 7pt\
\\def\\copyright{{\\sym\\char'323}}\
%-------------------- end font defs ---------------------------------

View file

@ -0,0 +1,798 @@
%!PS-Adobe-2.0
%%Creator: dvips 5.47 Copyright 1986-91 Radical Eye Software
%%Title: refcard.dvi
%%Pages: 2 1
%%BoundingBox: 0 0 612 792
%%EndComments
%%BeginProcSet: tex.pro
/TeXDict 200 dict def TeXDict begin /N /def load def /B{bind def}N /S /exch
load def /X{S N}B /TR /translate load N /isls false N /vsize 10 N /@rigin{
isls{[0 1 -1 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale
Resolution VResolution vsize neg mul TR matrix currentmatrix dup dup 4 get
round 4 exch put dup dup 5 get round 5 exch put setmatrix}N /@letter{/vsize 10
N}B /@landscape{/isls true N /vsize -1 N}B /@a4{/vsize 10.6929133858 N}B /@a3{
/vsize 15.5531 N}B /@ledger{/vsize 16 N}B /@legal{/vsize 13 N}B /@manualfeed{
statusdict /manualfeed true put}B /@copies{/#copies X}B /FMat[1 0 0 -1 0 0]N
/FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{/nn 8 dict N nn begin
/FontType 3 N /FontMatrix fntrx N /FontBBox FBB N string /base X array
/BitMaps X /BuildChar{CharBuilder}N /Encoding IE N end dup{/foo setfont}2
array copy cvx N load 0 nn put /ctr 0 N[}B /df{/sf 1 N /fntrx FMat N df-tail}
B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0]N df-tail}B /E{pop nn dup definefont
setfont}B /ch-width{ch-data dup length 5 sub get}B /ch-height{ch-data dup
length 4 sub get}B /ch-xoff{128 ch-data dup length 3 sub get sub}B /ch-yoff{
ch-data dup length 2 sub get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B
/ch-image{ch-data dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0
N /rw 0 N /rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S
dup /base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx 0
ch-xoff ch-yoff ch-height sub ch-xoff ch-width add ch-yoff setcachedevice
ch-width ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-yoff .1 add]{ch-image}
imagemask restore}B /D{/cc X dup type /stringtype ne{]}if nn /base get cc ctr
put nn /BitMaps get S ctr S sf 1 ne{dup dup length 1 sub dup 2 index S get sf
div put}if put /ctr ctr 1 add N}B /I{cc 1 add D}B /bop{userdict /bop-hook
known{bop-hook}if /SI save N @rigin 0 0 moveto}N /eop{clear SI restore
showpage userdict /eop-hook known{eop-hook}if}N /@start{userdict /start-hook
known{start-hook}if /VResolution X /Resolution X 1000 div /DVImag X /IE 256
array N 0 1 255{IE S 1 string dup 0 3 index put cvn put}for}N /p /show load N
/RMat[1 0 0 -1 0 0]N /BDot 260 string N /rulex 0 N /ruley 0 N /v{/ruley X
/rulex X V}B /V statusdict begin /product where{pop product dup length 7 ge{0
7 getinterval(Display)eq}{pop false}ifelse}{false}ifelse end{{gsave TR -.1 -.1
TR 1 1 scale rulex ruley false RMat{BDot}imagemask grestore}}{{gsave TR -.1
-.1 TR rulex ruley scale 1 1 false RMat{BDot}imagemask grestore}}ifelse B /a{
moveto}B /delta 0 N /tail{dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{
S p tail}B /c{-4 M}B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B
/j{3 M}B /k{4 M}B /w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w
}B /q{p 1 w}B /r{p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p
a}B /bos{/SS save N}B /eos{clear SS restore}B end
%%EndProcSet
TeXDict begin 1000 300 300 @start /Fa 3 104 df<0003FE0000000FFF8000003C01E000
00F000780001C0001C00030000060006000003000C0000018018000000C018000000C030000000
603000000060600000003060000000306000000030C000000018C000000018C000000018C00000
0018C000000018C000000018C000000018C000000018C000000018600000003060000000306000
0000303000000060300000006018000000C018000000C00C000001800600000300030000060001
C0001C0000F0007800003C01E000000FFF80000003FE000025277E9D2A>13
D<003C00E001C00180038003800380038003800380038003800380038003800380038003000700
1C00F0001C00070003000380038003800380038003800380038003800380038003800380018001
C000E0003C0E297D9E15>102 D<F0001C00070003000380038003800380038003800380038003
800380038003800380018001C000E0003C00E001C0018003800380038003800380038003800380
03800380038003800380030007001C00F0000E297D9E15>I E /Fb 1 59
df<60F0F06004047C830C>58 D E /Fc 61 125 df<01F8000604000C0E00180E001800001800
00180000FFFE001806001806001806001806001806001806001806001806001806001806001806
007E1F801114809313>12 D<01FE00060E000C0E00180600180600180600180600FFFE00180600
1806001806001806001806001806001806001806001806001806001806007E1F801114809313>
I<4100E380618020802080208041004100820009097F9311>34 D<020002000F8032406220C210
C270C270E220F2007F003FC00FE002E002704230E230C2308220426022C01F00020002000C187E
9511>36 D<40E06020202040408003097D9309>39 D<01020408103020606040C0C0C0C0C0C0C0
C0C0C040606020301008040201081E7E950D>I<80402010080C04060602030303030303030303
03020606040C0810204080081E7E950D>I<006000006000006000006000006000006000006000
006000006000006000FFFFF0FFFFF0006000006000006000006000006000006000006000006000
00600000600014167E9119>43 D<40E06020202040408003097D8209>I<FFFF080280860B>I<40
E04003037D8209>I<0010003000600060006000C000C000C00180018003000300030006000600
06000C000C000C0018001800300030003000600060006000C000C0000C1D7E9511>I<0F0030C0
606060604020C030C030C030C030C030C030C030C030C03040206060606030C00F000C137E9211
>I<0C001C00EC000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C00FF
C00A137D9211>I<1F0060C06060F070F030603000700070006000C001C0018002000400081010
1020207FE0FFE00C137E9211>I<40E0400000000000000040E040030D7D8C09>58
D<40E0400000000000000040E06020202040408003137D8C09>I<003000003000007800007800
007800009C00009C00011E00010E00010E0002070002070004038007FF800403800801C00801C0
1000E03800E0FE07FC16147F9319>65 D<FFFC001C07001C03801C01C01C01C01C01C01C01C01C
03801C07001FFE001C03801C01C01C00E01C00E01C00E01C00E01C00E01C01C01C0380FFFE0013
147F9317>I<00FC200703600C00E0180060300060700020600020E00000E00000E00000E00000
E00000E000006000207000203000201800400C008007030000FC0013147E9318>I<FFFC001C07
001C01C01C00E01C00601C00701C00301C00381C00381C00381C00381C00381C00381C00301C00
701C00601C00E01C01C01C0380FFFC0015147F9319>I<FFFF801C03801C00801C00801C00401C
00401C08401C08001C18001FF8001C18001C08001C08201C00201C00201C00601C00401C00C01C
01C0FFFFC013147F9316>I<00FC200703600C00E0180060300060700020600020E00000E00000
E00000E00000E00FF8E000E06000E07000E03000E01800E00C00E007036000FC2015147E931A>
71 D<FFC0001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C0000
1C00401C00401C00401C00C01C00801C01801C0380FFFF8012147F9315>76
D<FE000FE01E000F00170017001700170017001700138027001380270011C0470011C0470010E0
870010E0870010E087001071070010710700103A0700103A0700101C0700101C0700381C0700FE
083FE01B147F931E>I<FC01FC1E007017002017802013802011C02010E0201070201070201038
20101C20100E20100F201007201003A01001E01000E01000E0380060FE002016147F9319>I<01
F800070E001C03803801C03000C07000E0600060E00070E00070E00070E00070E00070E0007070
00E07000E03000C03801C01C0380070E0001F80014147E9319>I<FFFC001C07001C03801C01C0
1C01C01C01C01C01C01C01C01C03801C07001FFC001C00001C00001C00001C00001C00001C0000
1C00001C0000FF800012147F9316>I<FFF8001C07001C03801C01C01C01C01C01C01C01C01C03
801C07001FF8001C0E001C07001C03801C03801C03801C03801C03841C03841C01CCFF80F81614
7F9318>82 D<7FFFF0607030407010407010807008807008807008007000007000007000007000
00700000700000700000700000700000700000700000700007FF0015147F9318>84
D<FF81FC1C00701C00201C00201C00201C00201C00201C00201C00201C00201C00201C00201C00
201C00201C00200C00200E004006008003830000FC0016147F9319>I<FF1FF0FC380380303803
80301C03C0201C03C0201E03C0600E04E0400E04E0400704E08007087080070870800388710003
9039000390390001F03E0001E01E0001E01E0000C00C0000C00C0000C00C001E147F9321>87
D<FF00FC3C00301E00200E004007004007808003C10001C10001E20000F6000074000038000038
0000380000380000380000380000380000380001FF0016147F9319>89 D<208041004100820082
008200C300E380410009097A9311>92 D<7F00E1C0E0404060006007E038606060C060C064C064
61E43E380E0D7E8C11>97 D<F00030003000300030003000300033E034103808300C3006300630
0630063006300C3808343023E00F147F9312>I<0FE0187020706020C000C000C000C000C00060
00201018200FC00C0D7F8C0F>I<00780018001800180018001800180F98187820386018C018C0
18C018C018C0186018203810580F9E0F147F9312>I<0F80104020206030C010FFF0C000C000C0
006000201018200FC00C0D7F8C0F>I<03C00CE018E01840180018001800FF0018001800180018
0018001800180018001800180018007F000B1480930A>I<0F3C30E62040606060606060204030
C02F00600060003FE03FF06018C00CC00CC00C601830300FC00F147F8C11>I<F0003000300030
0030003000300033E034303818301830183018301830183018301830183018FC7E0F147F9312>
I<2070200000000000F03030303030303030303030FC06157F9409>I<02070200000000000F03
0303030303030303030303030343E2E67C081B82940A>I<F00030003000300030003000300030
F8306030403080330037003B80318030C0306030703030FC7C0E147F9311>I<F0303030303030
303030303030303030303030FC06147F9309>I<F3E1F0343218381C0C30180C30180C30180C30
180C30180C30180C30180C30180C30180CFC7E3F180D7F8C1B>I<F3E034303818301830183018
301830183018301830183018FC7E0F0D7F8C12>I<0FC0186020106018C00CC00CC00CC00CC00C
6018601838700FC00E0D7F8C11>I<F3E034303808300C30063006300630063006300C38083430
33E030003000300030003000FC000F137F8C12>I<0F88184820386018C018C018C018C018C018
6018203818580F9800180018001800180018007E0F137F8C11>I<F3C034E038E0304030003000
300030003000300030003000FE000B0D7F8C0D>I<3E806180C080C080E0007E003F8003C080C0
80C0C0C0E1809F000A0D7F8C0D>I<10001000100030007000FF80300030003000300030003000
300030803080308011000E0009127F910D>I<F078301830183018301830183018301830183018
303818580F9E0F0D7F8C12>I<F87C301830101820182018200C400C4006800680078003000300
0E0D7F8C11>I<F87CF8707030305820305820188840188C40188C400D04800D06800D06800603
00060300060300150D7F8C18>I<F87C303018600C400C800700030007800CC008E010603030F8
7C0E0D7F8C11>I<F87C301830101820182018200C400C400680068007800300030002000200E6
00E400E80070000E137F8C11>I<FFF0C06080C081C08180030006000C101810383030206060FF
E00C0D7F8C0F>I<FFFFFFFF2001808821>124 D E /Fd 2 94 df<FEFEC0C0C0C0C0C0C0C0C0C0
C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0FEFE07297C9E0C>91
D<FEFE060606060606060606060606060606060606060606060606060606060606060606060606
06FEFE0729809E0C>93 D E /Fe 27 123 df<001F8F000020D9800060990000C0300000C03000
00C0300000C0300007FFFE000180300001806000018060000180600001806000030060000300C0
000300C0000300C0000300C0000600C00006018000060180000601800004010000CCC30000C8C6
000070780000191A819315>11 D<000FF000301800601000600000C00000C00000C00007FFE000
C0600180600180C00180C00180C00180C00181800301900301900301900301A00300E006000006
0000060000C40000C80000700000151A819314>I<FEFC07027D860C>45
D<000080000180000300000300000600000600000C000018000018000030000030000060000060
0000C0000180000180000300000300000600000C00000C00001800001800003000003000006000
00C00000C00000800000111D7E9512>47 D<07C03F8000C00C0001600800016008000120080001
300800023010000218100002181000020C1000040C200004042000040620000402200008034000
080340000801C0000801C00018008000FE00800019147E9319>78 D<07B00C7010703060606060
606060C0C0C0C8C0C841C862D03C700D0D7C8C12>97 D<7C000C00180018001800180030003700
388030C060C060C060C060C0C180C180C1004300660038000A147C9310>I<07800C4010603040
600060006000C000C0004020404021801E000B0D7C8C10>I<007C000C00180018001800180030
07B00C7010703060606060606060C0C0C0C8C0C841C862D03C700E147C9312>I<07800C401020
304060407F8060004000C0004020604021801E000B0D7C8C10>I<001C00660064006000C000C0
00C007F800C001800180018001800180030003000300030003000200060006000600C400C80070
000F1A81930B>I<01D8023804380C3018301830183030603060306010E019C00EC000C000C001
80C180C3007C000D137E8C10>I<3E0006000C000C000C000C00180019E01E3018303830303030
3030306060606460C460C4C0C8C0700E147D9312>I<02060000000000384C4C8C981818303262
62643807147D930B>I<7C0C181818183030303060606060C0D0D0D0D06006147C9309>108
D<30F878590D8C4E0E0C9C0E0C980C0C180C0C180C0C3018183018193018313018316030326030
1C180D7D8C1C>I<30F05B184C189C189818181818183030303230623062606460380F0D7D8C13>
I<03800C6018203030603060306030C060C06040C0608023001E000C0D7C8C12>I<0C78168C13
0426062606060606060C0C0C0C0C080C101A2019C018001800300030003000FC000F137F8C12>
I<31F05A184C109C009800180018003000300030003000600060000D0D7D8C0F>114
D<0700188018C0308038001E001F0003800180C180810082007C000A0D7D8C0E>I<04000C000C
000C001800FF8018001800300030003000300060006100610062006400380009127D910C>I<38
184C184C188C3098301830183030603064306430E411E80E380E0D7D8C12>I<38104C384C108C
10981018101810302030203040304018800F000D0D7D8C10>I<071E09E311C221802180018001
800300030403044308C51078E0100D7F8C10>120 D<38184C184C188C30983018301830306030
60306030E011C00EC000C000802180630046003C000D137D8C11>I<06100F2010E00040008001
0002000C00102020203840478083000C0D7E8C0E>I E /Ff 55 123 df<0100030003000F803F
E073704338C338C338C31073007F003FC00FE003F003384318E318E318E33073603FC00F800300
030001000D1A7E9612>36 D<07001F8019C039C039C039C039BE3B3E3E701C701C701CE03EE06F
E0E7C0E3C4E38E63CE7EFC3C380F147F9312>38 D<070007000700E738FFF87FF01FC01FC07FF0
FFF8E7380700070007000D0E7E9012>42 D<038003800380038003800380FFFEFFFEFFFE038003
8003800380038003800F0F7F9112>I<60F0F878183030E0C00509798312>I<FFF8FFF8FFF80D03
7E8B12>I<60F0F0600404798312>I<0018003800380070007000E000E001C001C001C003800380
070007000E000E001C001C001C003800380070007000E000E000C0000D1A7E9612>I<07C00FE0
1C703838701C701CE00EE00EE00EE00EE00EE00EE00EE01E701C701C38381C700FE007C00F147F
9312>I<0F803FC070E0E070E038E038403800380030007000E000C00180030006000C00183830
387FF87FF80D147E9312>50 D<0FE03FF07838701C201C001C0038007807E007F00038001C000E
000E400EE00EE01C78383FF00FC00F147F9312>I<E000FFFEFFFEE018E038007000E000C001C0
0380038007000700070007000E000E000E000E000E0004000F157F9412>55
D<60F0F06000000000000060F0F060040E798D12>58 D<0038007801F003E00F801F003C00F800
F000F8003C001F000F8003E001F0007800380D117E9212>60 D<FFFEFFFE7FFE0000000000007F
FEFFFEFFFE0F097F8E12>I<4000E000F0007C003E000F8007C001E000F8007800F801E007C00F
803E007C00F000E00040000D137E9312>I<03E007F01E18381C30FC71FE739EE30EE70EE70EE7
0EE70EE30C739C71F830F038001E0E07FE03F80F147F9312>64 D<03E60FFE1C3E381E700E700E
600EE000E000E000E000E000E000600E700E700E381C1C380FF003E00F147F9312>67
D<FFFEFFFE380E380E380E3800380038E038E03FE03FE038E038E03800380E380E380E380EFFFE
FFFE0F147F9312>69 D<FFFEFFFE380E380E380E3800380038E038E03FE03FE038E038E0380038
00380038003800FF00FF000F147F9312>I<FFE0FFE00E000E000E000E000E000E000E000E000E
000E000E000E000E000E000E000E00FFE0FFE00B147D9312>73 D<FC7EFC7E7C7C745C76DC76DC
76DC76DC76DC76DC77DC739C739C701C701C701C701C701CF83EF83E0F147F9312>77
D<FEFEFEFE3E383A383B383B383B383B383B383B3839B839B839B839B839B839B838B838F8FEF8
FEF80F147F9312>I<3FE07FF07070E038E038E038E038E038E038E038E038E038E038E038E038
E038E03870707FF03FE00D147E9312>I<FFE0FFF8383C381C380E380E380E380E381C383C3FF8
3FE0380038003800380038003800FE00FE000F147F9312>I<FF80FFE038F03878383838383838
387838F03FE03FC038E0387038703870387038773877FE3EFE1C10147F9312>82
D<1F303FF070F0E070E070E070E00070007F003FC00FE000F0003800386038E038E030F070FFE0
CF800D147E9312>I<7FFEFFFEE38EE38EE38E0380038003800380038003800380038003800380
0380038003801FF01FF00F147F9312>I<FE3F80FE3F80380E00380E00380E00380E00380E0038
0E00380E00380E00380E00380E00380E00380E00380E00380E001C1C000E380007F00003E00011
14809312>I<3F807FC070E0207000700FF03FF07870E070E070E07070F03FFE1F3E0F0E7E8D12>
97 D<F800F80038003800380038003BE03FF03C38381C380C380E380E380E380E380C381C3C38
3FF01BC00F147F9312>I<07F01FF8383870106000E000E000E000E0006000703838381FF007E0
0D0E7E8D12>I<00F800F8003800380038003807B81FF8387870386038E038E038E038E0386038
707838781FFE0FBE0F147F9312>I<07801FE0387070706038E038FFF8FFF8E000600070383838
1FF007C00D0E7E8D12>I<007E00FF01C70382038003807FFEFFFE038003800380038003800380
03800380038003803FF83FF81014809312>I<0F9E1FFF38E7707070707070707038E03FC03F80
70003FE03FF83FFC701EE00EE00EE00E600C783C1FF00FE010167F8D12>I<F800F80038003800
3800380039E03FF03E383C3838383838383838383838383838383838FE3EFE3E0F147F9312>I<
06000F000F000600000000000000FF00FF000700070007000700070007000700070007000700FF
F0FFF00C157D9412>I<00C001E001E000C00000000000001FE01FE000E000E000E000E000E000
E000E000E000E000E000E000E000E000E000E040C0E1C0FF807E000B1C7E9412>I<F800F80038
003800380038003BFC3BFC38F039E03BC03F803F803FC03DE038E038703838FC7EFC7E0F147F93
12>I<FF00FF000700070007000700070007000700070007000700070007000700070007000700
FFF8FFF80D147E9312>I<F71C00FFBE0079E70079E70071C70071C70071C70071C70071C70071
C70071C70071C700F9E780F8E380110E808D12>I<F9E0FFF03E383C3838383838383838383838
383838383838FE3EFE3E0F0E7F8D12>I<0F803FE038E07070E038E038E038E038E038F0787070
38E03FE00F800D0E7E8D12>I<FBE0FFF03C38381C380C380E380E380E380E380C381C3C383FF0
3BC038003800380038003800FE00FE000F157F8D12>I<079C1FFC387C703C601CE01CE01CE01C
E01C601C703C387C1FFC079C001C001C001C001C001C007F007F10157F8D12>I<FCF8FDFC1F1C
1E081E001C001C001C001C001C001C001C00FFC0FFC00E0E7E8D12>I<1FF03FF06070C070E000
7F003FE00FF000786018E018F030FFE0DFC00D0E7E8D12>I<06000E000E000E007FF8FFF80E00
0E000E000E000E000E000E000E380E380E3807F003C00D127F9112>I<F8F8F8F8383838383838
38383838383838383838383838781FFE0FBE0F0E7F8D12>I<FC7EFC7E38383C781C701C701C70
0EE00EE00EE006C007C007C003800F0E7F8D12>I<FEFEFEFE701C701C301838383BB83FF83FF8
3AB838B81CF01CF01CF00F0E7F8D12>I<7C7C7C7C1CF00EE00FC007C00380078007C00EE01EF0
1C70FC7EFC7E0F0E7F8D12>I<FC7EFC7E3C381C381C701C700E700E600E6006E006E003C003C0
03C0038003800380778077007E003C000F157F8D12>I<3FFC7FFC7038707000E001C003800700
0E001C1C381C701CFFFCFFFC0E0E7F8D12>I E /Fg 35 122 df<00038000000380000007C000
0007C0000007C000000FE000000FE000001FF000001BF000001BF0000031F8000031F8000061FC
000060FC0000E0FE0000C07E0000C07E0001803F0001FFFF0003FFFF8003001F8003001F800600
0FC006000FC00E000FE00C0007E0FFC07FFEFFC07FFE1F1C7E9B24>65 D<FFFFF800FFFFFF000F
C01F800FC00FC00FC007C00FC007E00FC007E00FC007E00FC007E00FC007E00FC007C00FC00F80
0FC03F000FFFFE000FC00F800FC007C00FC007E00FC003E00FC003F00FC003F00FC003F00FC003
F00FC003F00FC007E00FC007E00FC01FC0FFFFFF00FFFFFC001C1C7E9B22>I<001FE02000FFF8
E003F80FE007C003E00F8001E01F0000E03E0000E03E0000607E0000607C000060FC000000FC00
0000FC000000FC000000FC000000FC000000FC000000FC0000007C0000607E0000603E0000603E
0000C01F0000C00F80018007C0030003F80E0000FFFC00001FE0001B1C7D9B22>I<FFFFF800FF
FFFF000FC01FC00FC007E00FC001F00FC001F80FC000F80FC000FC0FC0007C0FC0007C0FC0007E
0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007C0FC0007C0FC000
7C0FC000F80FC000F80FC001F00FC007E00FC01FC0FFFFFF00FFFFF8001F1C7E9B25>I<FFFFFF
00FFFFFF000FC01F000FC007000FC003000FC003800FC003800FC181800FC181800FC181800FC1
80000FC380000FFF80000FFF80000FC380000FC180000FC180000FC180600FC180600FC000E00F
C000C00FC000C00FC001C00FC001C00FC003C00FC00F80FFFFFF80FFFFFF801B1C7E9B1F>I<FF
FFFF00FFFFFF000FC01F000FC007000FC003000FC003800FC003800FC001800FC181800FC18180
0FC180000FC180000FC380000FFF80000FFF80000FC380000FC180000FC180000FC180000FC180
000FC000000FC000000FC000000FC000000FC000000FC00000FFFF0000FFFF0000191C7E9B1E>
I<000FF008007FFE3801FC07F807E001F80F8000781F0000783F0000383E0000387E0000187C00
0018FC000000FC000000FC000000FC000000FC000000FC000000FC007FFFFC007FFF7C0001F87E
0001F83E0001F83F0001F81F0001F80F8001F807E001F801FC07F8007FFE78000FF818201C7D9B
26>I<FFFC3FFFFFFC3FFF0FC003F00FC003F00FC003F00FC003F00FC003F00FC003F00FC003F0
0FC003F00FC003F00FC003F00FFFFFF00FFFFFF00FC003F00FC003F00FC003F00FC003F00FC003
F00FC003F00FC003F00FC003F00FC003F00FC003F00FC003F00FC003F0FFFC3FFFFFFC3FFF201C
7E9B25>I<FFFF00FFFF000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000F
C0000FC0000FC0000FC0000FC0000FC0000FC0030FC0030FC0030FC0070FC0070FC0060FC00E0F
C01E0FC07EFFFFFEFFFFFE181C7E9B1D>76 D<FFE003FFFFE003FF0FF000300FF800300DFC0030
0CFE00300C7E00300C3F00300C1F80300C1FC0300C0FE0300C07F0300C03F0300C01F8300C01FC
300C00FE300C007F300C003F300C001FB00C001FF00C000FF00C0007F00C0003F00C0001F00C00
00F00C0000F0FFC00070FFC00030201C7E9B25>78 D<FFFFF800FFFFFE000FC03F800FC00F800F
C007C00FC007E00FC007E00FC007E00FC007E00FC007E00FC007C00FC007C00FC00F800FC03F00
0FFFFC000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000
000FC000000FC00000FFFC0000FFFC00001B1C7E9B21>80 D<07F8201FFEE03C07E07801E07000
E0F000E0F00060F00060F80000FE0000FFE0007FFE003FFF003FFF800FFFC007FFE0007FE00003
F00001F00000F0C000F0C000F0C000E0E000E0F001C0FC03C0EFFF0083FC00141C7D9B1B>83
D<7FFFFFE07FFFFFE0781F81E0701F80E0601F8060E01F8070C01F8030C01F8030C01F8030C01F
8030001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8000001F800000
1F8000001F8000001F8000001F8000001F8000001F8000001F800007FFFE0007FFFE001C1C7E9B
21>I<FFFC03FFFFFC03FF0FC000300FC000300FC000300FC000300FC000300FC000300FC00030
0FC000300FC000300FC000300FC000300FC000300FC000300FC000300FC000300FC000300FC000
300FC000300FC0003007C0003007C0006003E000E001F001C000FC0780007FFE00000FF800201C
7E9B25>I<FFFC7FFE0FFCFFFC7FFE0FFC0FC007E000C00FC007F000C00FE003F001C007E003F0
018007E007F8018003F007F8030003F007F8030003F80CFC070001F80CFC060001F81CFE060001
FC187E0E0000FC187E0C0000FC387F0C00007E303F1800007E303F1800007F601FB800003F601F
B000003FE01FF000003FC00FF000001FC00FE000001FC00FE000000F8007C000000F8007C00000
0F0003C0000007000380000007000380002E1C7F9B31>87 D<0FF8001C1E003E0F803E07803E07
C01C07C00007C0007FC007E7C01F07C03C07C07C07C0F807C0F807C0F807C0780BC03E13F80FE1
F815127F9117>97 D<FF0000FF00001F00001F00001F00001F00001F00001F00001F00001F0000
1F00001F3F801FE1E01F80701F00781F003C1F003C1F003E1F003E1F003E1F003E1F003E1F003E
1F003C1F003C1F00781F80701EC1E01C3F00171D7F9C1B>I<03FC000E0E001C1F003C1F00781F
00780E00F80000F80000F80000F80000F80000F800007800007801803C01801C03000E0E0003F8
0011127E9115>I<000FF0000FF00001F00001F00001F00001F00001F00001F00001F00001F000
01F001F9F00F07F01C03F03C01F07801F07801F0F801F0F801F0F801F0F801F0F801F0F801F078
01F07801F03C01F01C03F00F0FFE03F9FE171D7E9C1B>I<01FC000F07001C03803C01C07801C0
7801E0F801E0F801E0FFFFE0F80000F80000F800007800007C00603C00601E00C00F038001FC00
13127F9116>I<03F8F00E0F381E0F381C07303C07803C07803C07803C07801C07001E0F000E0E
001BF8001000001800001800001FFF001FFFC00FFFE01FFFF07801F8F00078F00078F000787000
707800F01E03C007FF00151B7F9118>103 D<FF0000FF00001F00001F00001F00001F00001F00
001F00001F00001F00001F00001F0FC01F31E01F40F01F80F81F80F81F00F81F00F81F00F81F00
F81F00F81F00F81F00F81F00F81F00F81F00F81F00F8FFE7FFFFE7FF181D7F9C1B>I<1E003F00
3F003F003F001E00000000000000000000000000FF00FF001F001F001F001F001F001F001F001F
001F001F001F001F001F001F00FFE0FFE00B1E7F9D0E>I<FF0000FF00001F00001F00001F0000
1F00001F00001F00001F00001F00001F00001F0FF81F0FF81F03801F07001F0C001F18001F7000
1FF8001FFC001FBC001F3E001F1F001F0F001F0F801F07C01F03E0FFC7FCFFC7FC161D7F9C19>
107 D<FF00FF001F001F001F001F001F001F001F001F001F001F001F001F001F001F001F001F00
1F001F001F001F001F001F001F001F001F00FFE0FFE00B1D7F9C0E>I<FF0FC07E00FF31E18F00
1F40F207801F80FC07C01F80FC07C01F00F807C01F00F807C01F00F807C01F00F807C01F00F807
C01F00F807C01F00F807C01F00F807C01F00F807C01F00F807C01F00F807C0FFE7FF3FF8FFE7FF
3FF825127F9128>I<FF0FC0FF31E01F40F01F80F81F80F81F00F81F00F81F00F81F00F81F00F8
1F00F81F00F81F00F81F00F81F00F81F00F8FFE7FFFFE7FF18127F911B>I<01FC000F07801C01
C03C01E07800F07800F0F800F8F800F8F800F8F800F8F800F8F800F87800F07800F03C01E01E03
C00F078001FC0015127F9118>I<FF3F80FFE1E01F80F01F00781F007C1F003C1F003E1F003E1F
003E1F003E1F003E1F003E1F003C1F007C1F00781F80F01FC1E01F3F001F00001F00001F00001F
00001F00001F0000FFE000FFE000171A7F911B>I<FE3E00FE47001E8F801E8F801E8F801F0700
1F00001F00001F00001F00001F00001F00001F00001F00001F00001F0000FFF000FFF00011127F
9114>114 D<1FD830786018E018E018F000FF807FE07FF01FF807FC007CC01CC01CE01CE018F8
30CFC00E127E9113>I<0300030003000300070007000F000F003FFCFFFC1F001F001F001F001F
001F001F001F001F001F0C1F0C1F0C1F0C0F08079803F00E1A7F9913>I<FF07F8FF07F81F00F8
1F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F00F81F01F80F01F8
0786FF01F8FF18127F911B>I<FFC7FCFFC7FC1F81800F838007C70003EE0001FC0001F80000F8
00007C0000FE0001DF00039F00070F800607C00C03E0FF07FCFF07FC16127F9119>120
D<FFC1FCFFC1FC1F00601F80E00F80C00FC0C007C18007C18003E30003E30001F70001F60000FE
0000FC0000FC00007800007800003000003000007000706000F86000F8C000F980007300003E00
00161A7F9119>I E /Fh 47 122 df<020408103020604040C0C0C0C0C0C0C0C0404060203010
080402071A7F920C>40 D<8040201018080C0404060606060606060604040C081810204080071A
7E920C>I<40E060202040408003087E8209>44 D<40E04003037E8209>46
D<0C003C00CC000C000C000C000C000C000C000C000C000C000C000C000C00FF8009107E8F0F>
49 D<1F00618040C08060C0600060006000C00180030006000C00102020207FC0FFC00B107F8F
0F>I<1F00218060C060C000C0008001800F00008000400060C060C060804060801F000B107F8F
0F>I<0300030007000F000B001300330023004300C300FFE003000300030003001FE00B107F8F
0F>I<1F00318060C0C040C060C060C06040E021E01E600060004060C0608043003E000B107F8F
0F>57 D<40E040000000000040E060202040408003107E8A09>59 D<03E0000C180010040023C2
004631004C0D00980C80980C80980C80980C80980C804C0C80463C8023C7001000000C038003FC
0011117E9017>64 D<FFF8180C18061803180318031806181C1FFC180618031803180318031806
180EFFF810117F9015>66 D<03F10C0B1807300360014001C000C000C000C000C0004001600130
0218020C0C03F010117E9016>I<FFF800180C001803001801001801801800801800C01800C018
00C01800C01800C01800C0180180180100180300180E00FFF80012117F9017>I<FFFE18061802
180318011821182018601FE01860182018201800180018001800FF0010117F9014>70
D<03F1000C0B00180700300300600100400100C00000C00000C00000C03FC0C003004003006003
003003001803000C070003F90012117E9017>I<FF181818181818181818181818181818FF0811
7F900B>73 D<FF0018001800180018001800180018001800180018021802180218061804181CFF
FC0F117F9013>76 D<F81FC01C07001C020016020013020013020011820010C20010C200106200
103200101200101A00100E00100600380600FE020012117F9016>78 D<FFF0181C180418061806
18061804181C1FF01800180018001800180018001800FF000F117F9014>80
D<FFE000181800180C00180600180600180600180C001818001FE000181800180C00180C00180C
00180C00180C20180420FF03C013117F9016>82 D<1F2060E0006080208020800060003E001F80
00C00060002080208020C040E0C09F000B117E9011>I<7FFF8060C18040C080C0C0C080C04080
C04000C00000C00000C00000C00000C00000C00000C00000C00000C00000C0000FFC0012117F90
16>I<FF1FC0180700180200180200180200180200180200180200180200180200180200180200
1802000802000C040006080001F00012117F9016>I<FC07C03003003003001802001802000C04
000C040006080006080006080003100003100001A00001A00001E00000C00000C00012117F9016
>I<3E006300018001800F8031804180C190C19063903DE00C0B7F8A0F>97
D<F0003000300030003000300037C038603030301830183018301830183030386027800D117F90
11>I<1F8030C06000C000C000C000C000C000604030801F000A0B7F8A0E>I<01E0006000600060
006000600F6030E06060C060C060C060C060C060606030E01F780D117F9011>I<1F00318060C0
C0C0FFC0C000C000C000604030801F000A0B7F8A0E>I<07000D801800180018001800FE001800
180018001800180018001800180018007E00091180900A>I<1EF0331061806180618033003E00
400060003F803FC060E0C060C060C06060C01F000C117F8A0F>I<F00030003000300030003000
33C03C6030603060306030603060306030603060FCF80D117F9011>I<30703000000000F03030
30303030303030FC0612809108>I<F0003000300030003000300031F030C03080330036003F00
3300318031C030C0F9F00C117F9010>107 D<F0303030303030303030303030303030FC061180
9008>I<F3C3C03C2C20383830303030303030303030303030303030303030303030FCFCFC160B
7F8A1A>I<F3C03C6030603060306030603060306030603060FCF80D0B7F8A11>I<1F00318060C0
C060C060C060C060C06060C031801F000B0B7F8A0F>I<F7C03860303030183018301830183018
3030386037803000300030003000FC000D107F8A11>I<F7003980300030003000300030003000
30003000FC00090B7F8A0C>114 D<3E028280783E038181C2BC080B7F8A0C>I<10103030FE3030
303030323232321C070F7F8E0C>I<F1E03060306030603060306030603060306030E00F780D0B
7F8A11>I<F8F0706030403040188018800D000D000D00060006000C0B7F8A10>I<F9F3C060E180
30E10030E1003131001932001A12000E1C000E1C000C0C00040800120B7F8A16>I<F8F0306030
403040188018800D000D000F000600060004000400CC00C80070000C107F8A10>121
D E /Fi 12 86 df<FFFFFF8000FFFFFFE00007F001F80007F000FC0007F0007E0007F0007E00
07F0007F0007F0007F0007F0007F0007F0007F0007F0007F0007F0007E0007F000FE0007F000FC
0007F003F80007FFFFF00007FFFFF00007F001FC0007F0007E0007F0003F0007F0003F8007F000
1F8007F0001FC007F0001FC007F0001FC007F0001FC007F0001FC007F0001FC007F0003F8007F0
003F8007F0007F0007F001FE00FFFFFFF800FFFFFFC00022227EA128>66
D<0003FE0080001FFF818000FF01E38001F8003F8003E0001F8007C0000F800F800007801F8000
07803F000003803F000003807F000001807E000001807E00000180FE00000000FE00000000FE00
000000FE00000000FE00000000FE00000000FE00000000FE000000007E000000007E000001807F
000001803F000001803F000003801F800003000F8000030007C000060003F0000C0001F8003800
00FF00F000001FFFC0000003FE000021227DA128>I<FFFFFF8000FFFFFFF00007F003FC0007F0
007E0007F0003F0007F0001F8007F0000FC007F00007E007F00007E007F00007F007F00003F007
F00003F007F00003F007F00003F807F00003F807F00003F807F00003F807F00003F807F00003F8
07F00003F807F00003F807F00003F807F00003F007F00003F007F00003F007F00007E007F00007
E007F0000FC007F0001F8007F0003F0007F0007E0007F003FC00FFFFFFF000FFFFFF800025227E
A12B>I<FFFFFFFCFFFFFFFC07F000FC07F0003C07F0001C07F0000C07F0000E07F0000E07F000
0607F0180607F0180607F0180607F0180007F0380007F0780007FFF80007FFF80007F0780007F0
380007F0180007F0180007F0180307F0180307F0000307F0000607F0000607F0000607F0000E07
F0000E07F0001E07F0003E07F001FCFFFFFFFCFFFFFFFC20227EA125>I<FFFFFFF8FFFFFFF807
F001F807F0007807F0003807F0001807F0001C07F0001C07F0000C07F0000C07F0180C07F0180C
07F0180007F0180007F0380007F0780007FFF80007FFF80007F0780007F0380007F0180007F018
0007F0180007F0180007F0000007F0000007F0000007F0000007F0000007F0000007F0000007F0
0000FFFFE000FFFFE0001E227EA123>I<0003FE0040001FFFC0C0007F00F1C001F8003FC003F0
000FC007C00007C00FC00003C01F800003C03F000001C03F000001C07F000000C07E000000C07E
000000C0FE00000000FE00000000FE00000000FE00000000FE00000000FE00000000FE00000000
FE000FFFFC7E000FFFFC7F00001FC07F00001FC03F00001FC03F00001FC01F80001FC00FC0001F
C007E0001FC003F0001FC001FC003FC0007F80E7C0001FFFC3C00003FF00C026227DA12C>I<FF
FFE0FFFFE003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003
F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003F80003
F80003F80003F80003F80003F80003F800FFFFE0FFFFE013227FA115>73
D<FFFF803FFCFFFF803FFC07F000038007F000070007F0000E0007F000180007F000300007F000
E00007F001C00007F003800007F007000007F00E000007F018000007F038000007F0FC000007F1
FE000007F3FE000007F77F000007FE7F800007F83F800007F01FC00007F01FE00007F00FE00007
F007F00007F007F80007F003F80007F001FC0007F001FE0007F000FF0007F0007F0007F0007F80
07F0003FC0FFFF83FFFCFFFF83FFFC26227EA12C>75 D<FFF8001FFEFFFC001FFE07FC0000C007
FE0000C006FF0000C0067F8000C0063FC000C0061FE000C0060FE000C0060FF000C00607F800C0
0603FC00C00601FE00C00600FE00C00600FF00C006007F80C006003FC0C006001FE0C006000FF0
C0060007F0C0060007F8C0060003FCC0060001FEC0060000FFC00600007FC00600007FC0060000
3FC00600001FC00600000FC006000007C006000003C006000003C0FFF00001C0FFF00000C02722
7EA12C>78 D<0007FC0000003FFF800000FC07E00003F001F80007E000FC000FC0007E001F8000
3F001F80003F003F00001F803F00001F807F00001FC07E00000FC07E00000FC0FE00000FE0FE00
000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE0FE00000FE07E
00000FC07F00001FC07F00001FC03F00001F803F81F03F801F83F83F000FC70C7E0007E606FC00
03F607F80000FF07E000003FFF80000007FF80200000038020000001C020000001E0E0000001FF
E0000001FFC0000000FFC0000000FFC00000007F800000007F000000001E00232C7DA12A>81
D<FFFFFE0000FFFFFFC00007F007F00007F001F80007F000FC0007F0007E0007F0007F0007F000
7F0007F0007F0007F0007F0007F0007F0007F0007F0007F0007E0007F000FC0007F001F80007F0
07F00007FFFFC00007FFFF800007F00FE00007F007F00007F003F80007F001FC0007F001FC0007
F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0007F001FC0607F000FE06
07F000FF0CFFFF803FF8FFFF800FF027227EA12A>I<FFFF803FFCFFFF803FFC07F000018007F0
00018007F000018007F000018007F000018007F000018007F000018007F000018007F000018007
F000018007F000018007F000018007F000018007F000018007F000018007F000018007F0000180
07F000018007F000018007F000018007F000018007F000018007F000018007F000018003F00003
0003F800030001F800060000FC000E00007E001C00003F80F800000FFFE0000001FF000026227E
A12B>85 D E end
%%EndProlog
%%BeginSetup
%%Feature: *Resolution 300
TeXDict begin @landscape
%%EndSetup
%%Page: 1 1
bop -225 -183 a Fi(GDB)14 b(QUICK)g(REFERENCE)22 b Fh(GDB)14
b(V)n(ersion)h(4)-225 -91 y Fg(Essen)o(tial)c(Commands)-225
-45 y Ff(gdb)i Fe(pr)n(o)n(gr)n(am)f Fd([)p Fe(c)n(or)n(e)p
Fd(])24 b Fc(debug)14 b Fe(pr)n(o)n(gr)n(am)e Fd([)p Fc(using)i(coredump)g
Fe(c)n(or)n(e)p Fd(])-225 9 y Ff(b)f Fd([)p Fe(\014le)p Ff(:)p
Fd(])p Fe(function)68 b Fc(set)13 b(breakp)q(oin)o(t)i(at)e
Fe(function)g Fd([)p Fc(in)h Fe(\014le)p Fd(])-225 63 y Ff(run)f
Fd([)p Fe(ar)n(glist)p Fd(])126 b Fc(start)13 b(y)o(our)h(program)f
Fd([)p Fc(with)h Fe(ar)n(glist)p Fd(])-225 106 y Ff(bt)274
b Fc(bac)o(ktrace:)20 b(displa)o(y)c(program)d(stac)o(k)-225
143 y Ff(p)g Fe(expr)214 b Fc(displa)o(y)15 b(the)f(v)n(alue)h(of)e(an)h
(expression)-225 180 y Ff(c)292 b Fc(con)o(tin)o(ue)14 b(running)h(y)o(our)f
(program)-225 218 y Ff(n)292 b Fc(next)14 b(line,)h(stepping)g(o)o(v)o(er)f
(function)g(calls)-225 255 y Ff(s)292 b Fc(next)14 b(line,)h(stepping)g(in)o
(to)f(function)h(calls)-225 352 y Fg(Starting)c(GDB)-225 398
y Ff(gdb)256 b Fc(start)13 b(GDB,)h(with)g(no)g(debugging)g(\014les)-225
435 y Ff(gdb)f Fe(pr)n(o)n(gr)n(am)121 b Fc(b)q(egin)14 b(debugging)g
Fe(pr)n(o)n(gr)n(am)-225 472 y Ff(gdb)f Fe(pr)n(o)n(gr)n(am)f(c)n(or)n(e)48
b Fc(debug)14 b(coredump)g Fe(c)n(or)n(e)f Fc(pro)q(duced)h(b)o(y)105
510 y Fe(pr)n(o)n(gr)n(am)-225 548 y Ff(gdb)f(--help)135 b
Fc(describ)q(e)14 b(command)g(line)g(options)-225 647 y Fg(Stopping)c(GDB)
-225 692 y Ff(quit)238 b Fc(exit)14 b(GDB;)g(also)g Ff(q)f
Fc(or)g Ff(EOF)g Fc(\(eg)g Ff(C-d)p Fc(\))-225 734 y Ff(INTERRUPT)148
b Fc(\(eg)13 b Ff(C-c)p Fc(\))g(terminate)g(curren)o(t)h(command,)h(or)105
771 y(send)g(to)e(running)i(pro)q(cess)-225 868 y Fg(Getting)c(Help)-225
914 y Ff(help)238 b Fc(list)14 b(classes)g(of)g(commands)-225
951 y Ff(help)e Fe(class)155 b Fc(one-line)14 b(descriptions)h(for)f
(commands)g(in)105 988 y Fe(class)-225 1021 y Ff(help)e Fe(c)n(ommand)83
b Fc(describ)q(e)14 b Fe(c)n(ommand)-225 1119 y Fg(Executing)e(y)o(our)h
(Program)-225 1165 y Ff(run)g Fe(ar)n(glist)150 b Fc(start)13
b(y)o(our)h(program)f(with)i Fe(ar)n(glist)-225 1203 y Ff(run)256
b Fc(start)13 b(y)o(our)h(program)f(with)i(curren)o(t)f(argumen)o(t)105
1240 y(list)-225 1273 y Ff(run)f Fb(:)7 b(:)g(:)12 b Ff(<)p
Fe(inf)h Ff(>)p Fe(outf)32 b Fc(start)13 b(y)o(our)h(program)f(with)i(input,)
g(output)105 1310 y(redirected)-225 1360 y Ff(kill)238 b Fc(kill)15
b(running)g(program)-225 1434 y Ff(tty)e Fe(dev)193 b Fc(use)14
b Fe(dev)f Fc(as)g(stdin)i(and)f(stdout)g(for)g(next)g Ff(run)-225
1472 y(set)f(args)f Fe(ar)n(glist)66 b Fc(sp)q(ecify)15 b Fe(ar)n(glist)d
Fc(for)i(next)g Ff(run)-225 1509 y(set)f(args)171 b Fc(sp)q(ecify)15
b(empt)o(y)f(argumen)o(t)g(list)-225 1546 y Ff(show)e(args)154
b Fc(displa)o(y)15 b(argumen)o(t)f(list)-225 1621 y Ff(show)e(environment)28
b Fc(sho)o(w)13 b(all)i(en)o(vironmen)o(t)g(v)n(ariables)-225
1659 y Ff(show)d(env)h Fe(var)110 b Fc(sho)o(w)13 b(v)n(alue)i(of)f(en)o
(vironmen)o(t)h(v)n(ariable)f Fe(var)-225 1696 y Ff(set)f(env)g
Fe(var)f(string)28 b Fc(set)13 b(en)o(vironmen)o(t)j(v)n(ariable)e
Fe(var)-225 1733 y Ff(unset)e(env)h Fe(var)92 b Fc(remo)o(v)o(e)13
b Fe(var)g Fc(from)h(en)o(vironmen)o(t)-225 1820 y Fg(Shell)d(Commands)-225
1866 y Ff(cd)i Fe(dir)217 b Fc(c)o(hange)13 b(w)o(orking)h(directory)g(to)f
Fe(dir)-225 1903 y Ff(pwd)256 b Fc(Prin)o(t)15 b(w)o(orking)e(directory)-225
1941 y Ff(make)f Fb(:)7 b(:)g(:)176 b Fc(call)14 b(\\)p Ff(make)p
Fc(")-225 1978 y Ff(shell)e Fe(cmd)146 b Fc(execute)13 b(arbitrary)h(shell)h
(command)f(string)-225 2100 y Fd([)f(])h Fh(surround)f(optional)j(argumen)o
(ts)45 b Fb(:)7 b(:)g(:)13 b Fh(sho)o(w)h(one)f(or)h(more)f(argumen)o(ts)-216
2174 y(c)-230 2175 y Fa(\015)p Fh(1991,)h(1992)h(F)n(ree)d(Soft)o(w)o(are)h
(F)n(oundation,)h(Inc.)60 b(P)o(ermissions)15 b(on)f(bac)o(k)p
800 -217 1 9 v 800 2175 V 875 -183 a Fg(Breakp)q(oin)o(ts)d(and)j(W)l(atc)o
(hp)q(oin)o(ts)875 -132 y Ff(break)e Fd([)p Fe(\014le)p Ff(:)p
Fd(])p Fe(line)875 -86 y Ff(b)i Fd([)p Fe(\014le)p Ff(:)p Fd(])p
Fe(line)1185 -132 y Fc(set)g(breakp)q(oin)o(t)g(at)f Fe(line)h
Fc(n)o(um)o(b)q(er)h Fd([)p Fc(in)f Fe(\014le)p Fd(])1185 -94
y Fc(eg:)33 b Ff(break)12 b(main.c:37)875 -32 y(break)g Fd([)p
Fe(\014le)p Ff(:)p Fd(])p Fe(func)57 b Fc(set)14 b(breakp)q(oin)o(t)g(at)f
Fe(func)h Fd([)p Fc(in)g Fe(\014le)p Fd(])875 11 y Ff(break)e(+)p
Fe(o\013set)875 48 y Ff(break)g(-)p Fe(o\013set)1185 11 y Fc(set)i(break)f
(at)h Fe(o\013set)f Fc(lines)i(from)f(curren)o(t)g(stop)875
87 y Ff(break)e(*)p Fe(addr)121 b Fc(set)14 b(breakp)q(oin)o(t)g(at)f
(address)h Fe(addr)875 124 y Ff(break)220 b Fc(set)14 b(breakp)q(oin)o(t)g
(at)f(next)i(instruction)875 161 y Ff(break)d Fb(:)7 b(:)g(:)12
b Ff(if)i Fe(expr)31 b Fc(break)14 b(conditionally)h(on)f(nonzero)f
Fe(expr)875 211 y Ff(cond)g Fe(n)h Fd([)p Fe(expr)p Fd(])103
b Fc(new)13 b(conditional)i(expression)g(on)e(breakp)q(oin)o(t)1206
248 y Fe(n)p Fc(;)h(mak)o(e)g(unconditional)h(if)g(no)e Fe(expr)875
286 y Ff(tbreak)f Fb(:)7 b(:)g(:)140 b Fc(temp)q(orary)13 b(break;)i(disable)
f(when)g(reac)o(hed)875 324 y Ff(rbreak)e Fe(r)n(e)n(gex)115
b Fc(break)14 b(on)f(all)i(functions)g(matc)o(hing)f Fe(r)n(e)n(gex)875
361 y Ff(watch)e Fe(expr)143 b Fc(set)14 b(a)f(w)o(atc)o(hp)q(oin)o(t)h(for)f
(expression)i Fe(expr)875 398 y Ff(catch)d Fe(x)192 b Fc(break)14
b(at)f(C++)i(handler)f(for)g(exception)g Fe(x)875 473 y Ff(info)f(break)135
b Fc(sho)o(w)13 b(de\014ned)i(breakp)q(oin)o(ts)875 511 y Ff(info)e(watch)135
b Fc(sho)o(w)13 b(de\014ned)i(w)o(atc)o(hp)q(oin)o(ts)875 585
y Ff(clear)220 b Fc(delete)14 b(breakp)q(oin)o(ts)g(at)g(next)g(instruction)
875 635 y Ff(clear)e Fd([)p Fe(\014le)p Ff(:)p Fd(])p Fe(fun)73
b Fc(delete)14 b(breakp)q(oin)o(ts)g(at)g(en)o(try)g(to)f Fe(fun)p
Fc(\(\))875 688 y Ff(clear)f Fd([)p Fe(\014le)p Ff(:)p Fd(])p
Fe(line)66 b Fc(delete)14 b(breakp)q(oin)o(ts)g(on)g(source)f(line)875
742 y Ff(delete)f Fd([)p Fe(n)p Fd(])147 b Fc(delete)14 b(breakp)q(oin)o(ts)g
Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])875 823 y Ff(disable)c
Fd([)p Fe(n)p Fd(])130 b Fc(disable)15 b(breakp)q(oin)o(ts)f
Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])875 877 y Ff(enable)d
Fd([)p Fe(n)p Fd(])147 b Fc(enable)14 b(breakp)q(oin)o(ts)g
Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])875 931 y Ff(enable)d(once)g
Fd([)p Fe(n)p Fd(])63 b Fc(enable)14 b(breakp)q(oin)o(ts)g
Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])p Fc(;)1206 969
y(disable)f(again)g(when)f(reac)o(hed)875 1018 y Ff(enable)f(del)h
Fd([)p Fe(n)p Fd(])80 b Fc(enable)14 b(breakp)q(oin)o(ts)g
Fd([)p Fc(or)f(breakp)q(oin)o(t)i Fe(n)p Fd(])p Fc(;)1206 1055
y(delete)e(when)h(reac)o(hed)875 1105 y Ff(ignore)e Fe(n)i(c)n(ount)76
b Fc(ignore)13 b(breakp)q(oin)o(t)i Fe(n)p Fc(,)f Fe(c)n(ount)g
Fc(times)875 1180 y Ff(commands)d Fe(n)946 1217 y Fd([)p Ff(silent)p
Fd(])946 1255 y Fe(c)n(ommand-list)1185 1180 y Fc(execute)i(GDB)h
Fe(c)n(ommand-list)e Fc(ev)o(ery)j(time)1206 1217 y(breakp)q(oin)o(t)f
Fe(n)g Fc(is)g(reac)o(hed.)21 b Fd([)p Ff(silent)1206 1263
y Fc(suppresses)14 b(default)h(displa)o(y)p Fd(])875 1306 y
Ff(end)256 b Fc(end)14 b(of)g Fe(c)n(ommand-list)875 1393 y
Fg(Program)f(Stac)o(k)875 1445 y Ff(backtrace)e Fd([)p Fe(n)p
Fd(])875 1490 y Ff(bt)i Fd([)p Fe(n)p Fd(])1185 1445 y Fc(prin)o(t)i(trace)e
(of)g(all)h(frames)g(in)h(stac)o(k;)f(or)f(of)h Fe(n)1206 1482
y Fc(frames|innermost)g(if)h Fe(n)p Ff(>0)p Fc(,)e(outermost)h(if)1206
1519 y Fe(n)p Ff(<0)875 1563 y(frame)e Fd([)p Fe(n)p Fd(])165
b Fc(select)13 b(frame)h(n)o(um)o(b)q(er)h Fe(n)f Fc(or)f(frame)h(at)g
(address)1206 1600 y Fe(n)p Fc(;)g(if)h(no)e Fe(n)p Fc(,)i(displa)o(y)g
(curren)o(t)f(frame)875 1639 y Ff(up)f Fe(n)242 b Fc(select)13
b(frame)h Fe(n)g Fc(frames)g(up)875 1676 y Ff(down)f Fe(n)206
b Fc(select)13 b(frame)h Fe(n)g Fc(frames)g(do)o(wn)875 1720
y Ff(info)f(frame)f Fd([)p Fe(addr)p Fd(])30 b Fc(describ)q(e)14
b(selected)g(frame,)g(or)f(frame)h(at)f Fe(addr)875 1763 y
Ff(info)g(args)153 b Fc(argumen)o(ts)14 b(of)f(selected)h(frame)875
1800 y Ff(info)f(locals)117 b Fc(lo)q(cal)13 b(v)n(ariables)i(of)e(selected)h
(frame)875 1844 y Ff(info)f(reg)f Fd([)p Fe(rn)p Fd(])p Fb(:)7
b(:)g(:)875 1889 y Ff(info)13 b(all-reg)e Fd([)p Fe(rn)p Fd(])1185
1844 y Fc(register)i(v)n(alues)i Fd([)p Fc(for)e(regs)g Fe(rn)s
Fd(])g Fc(in)h(selected)1206 1881 y(frame;)g Ff(all-reg)d Fc(includes)k
(\015oating)e(p)q(oin)o(t)875 1933 y Ff(info)g(catch)135 b
Fc(exception)14 b(handlers)h(activ)o(e)e(in)i(selected)f(frame)p
1900 -217 V 1900 2175 V 1975 -183 a Fg(Execution)f(Con)o(trol)1975
-138 y Ff(continue)e Fd([)p Fe(c)n(ount)p Fd(])1975 -92 y Ff(c)j
Fd([)p Fe(c)n(ount)p Fd(])2285 -138 y Fc(con)o(tin)o(ue)g(running;)i(if)e
Fe(c)n(ount)g Fc(sp)q(eci\014ed,)g(ignore)2306 -100 y(this)g(breakp)q(oin)o
(t)h(next)f Fe(c)n(ount)g Fc(times)1975 -26 y Ff(step)f Fd([)p
Fe(c)n(ount)p Fd(])1975 20 y Ff(s)h Fd([)p Fe(c)n(ount)p Fd(])2285
-26 y Fc(execute)g(un)o(til)h(another)e(line)i(reac)o(hed;)f(rep)q(eat)2306
12 y Fe(c)n(ount)f Fc(times)i(if)f(sp)q(eci\014ed)1975 74 y
Ff(stepi)e Fd([)p Fe(c)n(ount)p Fd(])1975 120 y Ff(si)h Fd([)p
Fe(c)n(ount)p Fd(])2285 74 y Fc(step)h(b)o(y)h(mac)o(hine)f(instructions)h
(rather)f(than)2306 111 y(source)f(lines)1975 186 y Ff(next)g
Fd([)p Fe(c)n(ount)p Fd(])1975 232 y Ff(n)h Fd([)p Fe(c)n(ount)p
Fd(])2285 186 y Fc(execute)g(next)g(line,)h(including)h(an)o(y)e(function)
2306 223 y(calls)1975 286 y Ff(nexti)e Fd([)p Fe(c)n(ount)p
Fd(])1975 331 y Ff(ni)h Fd([)p Fe(c)n(ount)p Fd(])2285 286
y Fc(next)h(mac)o(hine)h(instruction)g(rather)e(than)2306 323
y(source)g(line)1975 398 y Ff(until)f Fd([)p Fe(lo)n(c)n(ation)p
Fd(])67 b Fc(run)14 b(un)o(til)i(next)e(instruction)h(\(or)e
Fe(lo)n(c)n(ation)p Fc(\))1975 441 y Ff(finish)202 b Fc(run)14
b(un)o(til)i(selected)e(stac)o(k)f(frame)h(returns)1975 484
y Ff(return)e Fd([)p Fe(expr)p Fd(])101 b Fc(p)q(op)14 b(selected)g(stac)o(k)
f(frame)h(without)2306 522 y(executing)g Fd([)p Fc(setting)f(return)i(v)n
(alue)p Fd(])1975 566 y Ff(signal)d Fe(num)125 b Fc(resume)14
b(execution)g(with)g(signal)h Fe(s)f Fc(\(none)f(if)i Ff(0)p
Fc(\))1975 604 y Ff(jump)e Fe(line)1975 641 y Ff(jump)g(*)p
Fe(addr)n(ess)2285 604 y Fc(resume)h(execution)g(at)g(sp)q(eci\014ed)g
Fe(line)f Fc(n)o(um)o(b)q(er)2306 641 y(or)g Fe(addr)n(ess)1975
681 y Ff(set)g(var=)p Fe(expr)106 b Fc(ev)n(aluate)14 b Fe(expr)e
Fc(without)i(displa)o(ying)i(it;)f(use)2306 718 y(for)e(altering)h(program)f
(v)n(ariables)1975 815 y Fg(Displa)o(y)1975 867 y Ff(print)f
Fd([)p Ff(/)p Fe(f)6 b Fd(])13 b([)p Fe(expr)p Fd(])1975 913
y Ff(p)h Fd([)p Ff(/)p Fe(f)5 b Fd(])13 b([)p Fe(expr)p Fd(])2285
867 y Fc(sho)o(w)h(v)n(alue)g(of)g Fe(expr)e Fd([)p Fc(or)h(last)h(v)n(alue)h
Ff($)p Fd(])2306 904 y Fc(according)e(to)g(format)h Fe(f)p
Fc(:)2046 956 y Ff(x)221 b Fc(hexadecimal)2046 993 y Ff(d)g
Fc(signed)14 b(decimal)2046 1030 y Ff(u)221 b Fc(unsigned)15
b(decimal)2046 1068 y Ff(o)221 b Fc(o)q(ctal)2046 1105 y Ff(t)g
Fc(binary)2046 1142 y Ff(a)g Fc(address,)14 b(absolute)g(and)g(relativ)o(e)
2046 1180 y Ff(c)221 b Fc(c)o(haracter)2046 1217 y Ff(f)g Fc(\015oating)13
b(p)q(oin)o(t)1975 1266 y Ff(call)g Fd([)p Ff(/)p Fe(f)5 b
Fd(])13 b Fe(expr)89 b Fc(lik)o(e)15 b Ff(print)d Fc(but)i(do)q(es)g(not)g
(displa)o(y)h Ff(void)1975 1320 y(x)f Fd([)p Ff(/)p Fe(Nuf)5
b Fd(])14 b Fe(expr)98 b Fc(examine)14 b(memory)g(at)g(address)g
Fe(expr)p Fc(;)f(optional)2306 1358 y(format)g(sp)q(ec)h(follo)o(ws)g(slash)
2011 1396 y Fe(N)249 b Fc(coun)o(t)14 b(of)f(ho)o(w)h(man)o(y)h(units)g(to)e
(displa)o(y)2011 1433 y Fe(u)256 b Fc(unit)15 b(size;)f(one)g(of)2356
1471 y Ff(b)f Fc(individual)k(b)o(ytes)2356 1508 y Ff(h)c Fc(halfw)o(ords)h
(\(t)o(w)o(o)f(b)o(ytes\))2356 1545 y Ff(w)g Fc(w)o(ords)h(\(four)g(b)o
(ytes\))2356 1583 y Ff(g)f Fc(gian)o(t)h(w)o(ords)f(\(eigh)o(t)h(b)o(ytes\))
2011 1620 y Fe(f)263 b Fc(prin)o(ting)15 b(format.)21 b(An)o(y)14
b Ff(print)e Fc(format,)i(or)2356 1657 y Ff(s)f Fc(n)o(ull-terminated)j
(string)2356 1695 y Ff(i)d Fc(mac)o(hine)h(instructions)1975
1738 y Ff(disassem)d Fd([)p Fe(addr)p Fd(])62 b Fc(displa)o(y)15
b(memory)g(as)e(mac)o(hine)h(instructions)1975 1840 y Fg(Automatic)e(Displa)o
(y)1975 1891 y Ff(display)g Fd([)p Ff(/)p Fe(f)5 b Fd(])13
b Fe(expr)36 b Fc(sho)o(w)14 b(v)n(alue)g(of)g Fe(expr)e Fc(eac)o(h)i(time)g
(program)2306 1929 y(stops)g Fd([)p Fc(according)e(to)i(format)f
Fe(f)6 b Fd(])1975 1972 y Ff(display)184 b Fc(displa)o(y)15
b(all)g(enabled)f(expressions)h(on)f(list)1975 2014 y Ff(undisplay)d
Fe(n)118 b Fc(remo)o(v)o(e)14 b(n)o(um)o(b)q(er\(s\))h Fe(n)f
Fc(from)g(list)h(of)2306 2051 y(automatically)f(displa)o(y)o(ed)h
(expressions)1975 2091 y Ff(disable)d(disp)g Fe(n)69 b Fc(disable)15
b(displa)o(y)g(for)f(expression\(s\))h(n)o(um)o(b)q(er)g Fe(n)1975
2132 y Ff(enable)d(disp)g Fe(n)87 b Fc(enable)14 b(displa)o(y)h(for)f
(expression\(s\))h(n)o(um)o(b)q(er)g Fe(n)1975 2170 y Ff(info)e(display)99
b Fc(n)o(um)o(b)q(ered)15 b(list)g(of)e(displa)o(y)j(expressions)p
eop
%%Page: 2 2
bop -225 -183 a Fg(Expressions)-225 -138 y Fe(expr)245 b Fc(an)13
b(expression)i(in)g(C,)f(C++,)g(or)g(Mo)q(dula-2)105 -100 y(\(including)i
(function)f(calls\),)f(or:)-225 -60 y Fe(addr)s Ff(@)p Fe(len)176
b Fc(an)13 b(arra)o(y)h(of)f Fe(len)h Fc(elemen)o(ts)h(b)q(eginning)f(at)105
-23 y Fe(addr)-225 10 y(\014le)p Ff(::)p Fe(nm)182 b Fc(a)13
b(v)n(ariable)h(or)g(function)h Fe(nm)e Fc(de\014ned)i(in)f
Fe(\014le)-225 59 y Fa(f)p Fe(typ)n(e)p Fa(g)p Fe(addr)138
b Fc(read)13 b(memory)h(at)g Fe(addr)e Fc(as)h(sp)q(eci\014ed)h
Fe(typ)n(e)-225 105 y Ff($)292 b Fc(most)13 b(recen)o(t)h(displa)o(y)o(ed)i
(v)n(alue)-225 142 y Ff($)p Fe(n)273 b(n)p Fc(th)14 b(displa)o(y)o(ed)i(v)n
(alue)-225 179 y Ff($$)274 b Fc(displa)o(y)o(ed)15 b(v)n(alue)g(previous)g
(to)e($)-225 217 y Ff($$)p Fe(n)255 b(n)p Fc(th)14 b(displa)o(y)o(ed)i(v)n
(alue)e(bac)o(k)g(from)g($)-225 254 y Ff($)p -205 254 11 2
v 292 w Fc(last)g(address)g(examined)g(with)h Ff(x)-225 291
y($)p -205 291 V -193 291 V 292 w Fc(v)n(alue)f(at)g(address)g($)p
357 291 10 2 v -225 329 a Ff($)p Fe(var)243 b Fc(con)o(v)o(enience)14
b(v)n(ariable;)h(assign)f(an)o(y)g(v)n(alue)-225 410 y Ff(show)e(values)g
Fd([)p Fe(n)p Fd(])63 b Fc(sho)o(w)13 b(last)h(10)f(v)n(alues)i
Fd([)p Fc(or)e(surrounding)i($)p Fe(n)p Fd(])-225 453 y Ff(show)d
(convenience)28 b Fc(displa)o(y)15 b(all)f(con)o(v)o(enience)h(v)n(ariables)
-225 550 y Fg(Sym)o(b)q(ol)d(T)l(able)-225 595 y Ff(info)g(address)g
Fe(s)74 b Fc(sho)o(w)13 b(where)h(sym)o(b)q(ol)h Fe(s)f Fc(is)g(stored)-225
645 y Ff(info)e(func)h Fd([)p Fe(r)n(e)n(gex)p Fd(])42 b Fc(sho)o(w)13
b(names,)i(t)o(yp)q(es)f(of)g(de\014ned)g(functions)105 682
y(\(all,)h(or)e(matc)o(hing)h Fe(r)n(e)n(gex)p Fc(\))-225 733
y Ff(info)e(var)h Fd([)p Fe(r)n(e)n(gex)p Fd(])60 b Fc(sho)o(w)13
b(names,)i(t)o(yp)q(es)f(of)g(global)f(v)n(ariables)i(\(all,)105
770 y(or)f(matc)o(hing)g Fe(r)n(e)n(gex)p Fc(\))-225 821 y
Ff(whatis)e Fd([)p Fe(expr)p Fd(])-225 867 y Ff(ptype)g Fd([)p
Fe(expr)p Fd(])85 821 y Fc(sho)o(w)h(data)h(t)o(yp)q(e)g(of)g
Fe(expr)e Fd([)p Fc(or)h Ff($)p Fd(])g Fc(without)105 858 y(ev)n(aluating;)i
Ff(ptype)d Fc(giv)o(es)i(more)g(detail)-225 910 y Ff(ptype)e
Fe(typ)n(e)147 b Fc(describ)q(e)14 b(t)o(yp)q(e,)h(struct,)f(union,)h(or)f
(en)o(um)-225 1008 y Fg(GDB)f(Scripts)-225 1054 y Ff(source)f
Fe(script)104 b Fc(read,)14 b(execute)f(GDB)h(commands)g(from)g(\014le)105
1091 y Fe(script)-225 1147 y Ff(define)e Fe(cmd)-154 1184 y(c)n(ommand-list)
85 1147 y Fc(create)g(new)i(GDB)g(command)g Fe(cmd)p Fc(;)f(execute)105
1184 y(script)i(de\014ned)f(b)o(y)h Fe(c)n(ommand-list)-225
1222 y Ff(end)256 b Fc(end)14 b(of)g Fe(c)n(ommand-list)-225
1260 y Ff(document)d Fe(cmd)-154 1297 y(help-text)85 1260 y
Fc(create)h(online)j(do)q(cumen)o(tation)f(for)f(new)h(GDB)105
1297 y(command)g Fe(cmd)-225 1335 y Ff(end)256 b Fc(end)14
b(of)g Fe(help-text)-225 1432 y Fg(Signals)-225 1478 y Ff(handle)e
Fe(signal)h(act)44 b Fc(sp)q(ecify)15 b(GDB)e(actions)h(for)f
Fe(signal)p Fc(:)-190 1515 y Ff(print)185 b Fc(announce)13
b(signal)-190 1553 y Ff(noprint)149 b Fc(b)q(e)13 b(silen)o(t)i(for)f(signal)
-190 1590 y Ff(stop)203 b Fc(halt)14 b(execution)g(on)g(signal)-190
1627 y Ff(nostop)167 b Fc(do)13 b(not)h(halt)g(execution)-190
1665 y Ff(pass)203 b Fc(allo)o(w)13 b(y)o(our)h(program)f(to)h(handle)g
(signal)-190 1702 y Ff(nopass)167 b Fc(do)13 b(not)h(allo)o(w)g(y)o(our)g
(program)f(to)g(see)h(signal)-225 1739 y Ff(info)e(signals)100
b Fc(sho)o(w)13 b(table)h(of)g(signals,)h(GDB)e(action)h(for)f(eac)o(h)-225
1838 y Fg(Debugging)e(T)l(argets)-225 1884 y Ff(target)h Fe(typ)n(e)g(p)n(ar)
n(am)24 b Fc(connect)13 b(to)g(target)g(mac)o(hine,)i(pro)q(cess,)e(or)h
(\014le)-225 1921 y Ff(help)e(target)118 b Fc(displa)o(y)15
b(a)o(v)n(ailable)g(targets)-225 1958 y Ff(attach)d Fe(p)n(ar)n(am)97
b Fc(connect)13 b(to)g(another)h(pro)q(cess)-225 1996 y Ff(detach)202
b Fc(release)13 b(target)f(from)i(GDB)g(con)o(trol)p 800 -217
1 9 v 800 2175 V 875 -183 a Fg(Con)o(trollin)o(g)d(GDB)875
-138 y Ff(set)i Fe(p)n(ar)n(am)f(value)61 b Fc(set)14 b(one)f(of)h(GDB's)g
(in)o(ternal)h(parameters)875 -100 y Ff(show)e Fe(p)n(ar)n(am)132
b Fc(displa)o(y)15 b(curren)o(t)f(setting)g(of)g(parameter)875
-51 y(P)o(arameters)f(understo)q(o)q(d)h(b)o(y)h Ff(set)e Fc(and)h
Ff(show)p Fc(:)910 -13 y Ff(complaints)d Fe(limit)i Fc(n)o(um)o(b)q(er)i(of)e
(messages)h(on)f(un)o(usual)j(sym)o(b)q(ols)910 28 y Ff(confirm)c
Fe(on/o\013)43 b Fc(enable)14 b(or)f(disable)i(cautionary)f(queries)910
66 y Ff(editing)e Fe(on/o\013)43 b Fc(con)o(trol)13 b Ff(readline)e
Fc(command-line)k(editing)910 103 y Ff(height)d Fe(lpp)110
b Fc(n)o(um)o(b)q(er)15 b(of)e(lines)i(b)q(efore)f(pause)g(in)g(displa)o(y)
910 145 y Ff(language)d Fe(lang)58 b Fc(Language)12 b(for)h(GDB)h
(expressions)h(\()p Ff(auto)p Fc(,)e Ff(c)g Fc(or)1206 182
y Ff(modula-2)p Fc(\))910 222 y Ff(listsize)e Fe(n)101 b Fc(n)o(um)o(b)q(er)
15 b(of)e(lines)i(sho)o(wn)f(b)o(y)h Ff(list)910 259 y(prompt)d
Fe(str)114 b Fc(use)14 b Fe(str)f Fc(as)g(GDB)h(prompt)910
297 y Ff(radix)e Fe(b)n(ase)111 b Fc(o)q(ctal,)13 b(decimal,)i(or)e(hex)i(n)o
(um)o(b)q(er)1206 334 y(represen)o(tation)910 374 y Ff(verbose)d
Fe(on/o\013)43 b Fc(con)o(trol)13 b(messages)g(when)h(loading)g(sym)o(b)q
(ols)910 411 y Ff(width)e Fe(cpl)130 b Fc(n)o(um)o(b)q(er)15
b(of)e(c)o(haracters)g(b)q(efore)h(line)g(folded)910 449 y
Ff(write)e Fe(on/o\013)79 b Fc(Allo)o(w)13 b(or)h(forbid)g(patc)o(hing)h
(binary)m(,)g(core)e(\014les)1206 486 y(\(when)g(reop)q(ened)h(with)g
Ff(exec)f Fc(or)g Ff(core)p Fc(\))910 526 y Ff(history)f Fb(:)7
b(:)g(:)910 563 y Ff(h)14 b Fb(:)7 b(:)g(:)1185 526 y Fc(groups)14
b(with)g(the)g(follo)o(wing)g(options:)910 598 y Ff(h)g(exp)f
Fe(o\013/on)82 b Fc(disable/enable)14 b Ff(readline)d Fc(history)k(expansion)
910 635 y Ff(h)f(file)e Fe(\014lename)33 b Fc(\014le)14 b(for)f(recording)h
(GDB)f(command)h(history)910 672 y Ff(h)g(size)e Fe(size)104
b Fc(n)o(um)o(b)q(er)15 b(of)e(commands)h(k)o(ept)h(in)f(history)h(list)910
710 y Ff(h)f(save)e Fe(o\013/on)65 b Fc(con)o(trol)13 b(use)h(of)g(external)g
(\014le)g(for)f(command)1206 747 y(history)910 803 y Ff(print)f
Fb(:)7 b(:)g(:)910 840 y Ff(p)14 b Fb(:)7 b(:)g(:)1185 803
y Fc(groups)14 b(with)g(the)g(follo)o(wing)g(options:)910 882
y Ff(p)g(address)d Fe(on/o\013)h Fc(prin)o(t)j(memory)f(addresses)g(in)g
(stac)o(ks,)h(v)n(alues)910 923 y Ff(p)f(array)e Fe(o\013/on)47
b Fc(compact)13 b(or)g(attractiv)o(e)g(format)h(for)g(arra)o(ys)910
965 y Ff(p)g(demangl)d Fe(on/o\013)h Fc(source)h(\(demangled\))h(or)g(in)o
(ternal)g(form)g(for)1206 1002 y(C++)g(sym)o(b)q(ols)910 1042
y Ff(p)g(asm-dem)d Fe(on/o\013)h Fc(demangle)i(C++)g(sym)o(b)q(ols)h(in)g
(mac)o(hine-)1206 1079 y(instruction)g(output)910 1118 y Ff(p)f(elements)d
Fe(limit)17 b Fc(n)o(um)o(b)q(er)e(of)e(arra)o(y)h(elemen)o(ts)g(to)g(displa)
o(y)910 1160 y Ff(p)g(object)e Fe(on/o\013)29 b Fc(prin)o(t)15
b(C++)f(deriv)o(ed)h(t)o(yp)q(es)g(for)e(ob)r(jects)910 1201
y Ff(p)h(pretty)e Fe(o\013/on)29 b Fc(struct)14 b(displa)o(y:)23
b(compact)13 b(or)g(inden)o(ted)910 1243 y Ff(p)h(union)e Fe(on/o\013)47
b Fc(displa)o(y)15 b(of)f(union)h(mem)o(b)q(ers)910 1284 y
Ff(p)f(vtbl)e Fe(o\013/on)65 b Fc(displa)o(y)15 b(of)f(C++)h(virtual)f
(function)h(tables)875 1359 y Ff(show)e(commands)81 b Fc(sho)o(w)13
b(last)h(10)f(commands)875 1396 y Ff(show)g(commands)e Fe(n)51
b Fc(sho)o(w)13 b(10)g(commands)h(around)g(n)o(um)o(b)q(er)h
Fe(n)875 1434 y Ff(show)e(commands)e(+)52 b Fc(sho)o(w)13 b(next)i(10)e
(commands)875 1521 y Fg(W)l(orking)g(Files)875 1573 y Ff(file)g
Fd([)p Fe(\014le)p Fd(])156 b Fc(use)14 b Fe(\014le)f Fc(for)h(b)q(oth)g(sym)
o(b)q(ols)h(and)f(executable;)1206 1610 y(with)g(no)g(arg,)f(discard)h(b)q
(oth)875 1659 y Ff(core)f Fd([)p Fe(\014le)p Fd(])156 b Fc(read)13
b Fe(\014le)h Fc(as)f(coredump;)i(or)e(discard)875 1713 y Ff(exec)g
Fd([)p Fe(\014le)p Fd(])156 b Fc(use)14 b Fe(\014le)f Fc(as)h(executable)g
(only;)h(or)e(discard)875 1767 y Ff(symbol)f Fd([)p Fe(\014le)p
Fd(])121 b Fc(use)14 b(sym)o(b)q(ol)h(table)f(from)g Fe(\014le)p
Fc(;)f(or)h(discard)875 1810 y Ff(load)f Fe(\014le)180 b Fc(dynamically)15
b(link)h Fe(\014le)f Fc(and)f(add)g(its)h(sym)o(b)q(ols)875
1848 y Ff(add-sym)c Fe(\014le)j(addr)45 b Fc(read)13 b(additional)i(sym)o(b)q
(ols)g(from)f Fe(\014le)p Fc(,)1206 1885 y(dynamically)h(loaded)f(at)f
Fe(addr)875 1923 y Ff(info)g(files)135 b Fc(displa)o(y)15 b(w)o(orking)f
(\014les)g(and)g(targets)f(in)i(use)875 1961 y Ff(path)e Fe(dirs)167
b Fc(add)14 b Fe(dirs)f Fc(to)g(fron)o(t)h(of)g(path)g(searc)o(hed)f(for)1206
1998 y(executable)g(and)h(sym)o(b)q(ol)h(\014les)875 2037 y
Ff(show)e(path)153 b Fc(displa)o(y)15 b(executable)f(and)g(sym)o(b)q(ol)h
(\014le)f(path)875 2074 y Ff(info)f(share)135 b Fc(list)15
b(names)e(of)h(shared)g(libraries)h(curren)o(tly)1206 2111
y(loaded)p 1900 -217 V 1900 2175 V 1975 -183 a Fg(Source)e(Files)1975
-138 y Ff(dir)g Fe(names)148 b Fc(add)14 b(directory)g Fe(names)f
Fc(to)h(fron)o(t)g(of)f(source)2306 -100 y(path)1975 -62 y
Ff(dir)256 b Fc(clear)13 b(source)h(path)1975 -25 y Ff(show)f(dir)171
b Fc(sho)o(w)14 b(curren)o(t)g(source)f(path)1975 50 y Ff(list)238
b Fc(sho)o(w)14 b(next)g(ten)g(lines)h(of)e(source)1975 87
y Ff(list)g(-)207 b Fc(sho)o(w)14 b(previous)g(ten)g(lines)1975
125 y Ff(list)f Fe(lines)156 b Fc(displa)o(y)15 b(source)f(surrounding)h
Fe(lines)p Fc(,)f(sp)q(eci\014ed)2306 162 y(as:)2011 206 y
Fd([)p Fe(\014le)p Ff(:)p Fd(])p Fe(num)122 b Fc(line)15 b(n)o(um)o(b)q(er)g
Fd([)p Fc(in)f(named)g(\014le)p Fd(])2011 260 y([)p Fe(\014le)p
Ff(:)p Fd(])p Fe(function)63 b Fc(b)q(eginning)15 b(of)e(function)i
Fd([)p Fc(in)f(named)g(\014le)p Fd(])2011 303 y Ff(+)p Fe(o\013)217
b(o\013)14 b Fc(lines)h(after)e(last)h(prin)o(ted)2011 340
y Ff(-)p Fe(o\013)217 b(o\013)14 b Fc(lines)h(previous)f(to)g(last)g(prin)o
(ted)2011 377 y Ff(*)p Fe(addr)n(ess)145 b Fc(line)15 b(con)o(taining)f
Fe(addr)n(ess)1975 415 y Ff(list)f Fe(f)p Ff(,)p Fe(l)187 b
Fc(from)14 b(line)h Fe(f)e Fc(to)g(line)i Fe(l)1975 452 y Ff(info)e(line)f
Fe(num)76 b Fc(sho)o(w)14 b(starting,)g(ending)g(addresses)g(of)2306
489 y(compiled)g(co)q(de)f(for)h(source)f(line)i Fe(num)1975
528 y Ff(info)e(source)117 b Fc(sho)o(w)14 b(name)f(of)h(curren)o(t)g(source)
f(\014le)1975 565 y Ff(info)g(sources)99 b Fc(list)15 b(all)f(source)f
(\014les)h(in)h(use)1975 603 y Ff(forw)e Fe(r)n(e)n(gex)150
b Fc(searc)o(h)13 b(follo)o(wing)h(source)g(lines)h(for)e Fe(r)n(e)n(gex)1975
640 y Ff(rev)g Fe(r)n(e)n(gex)168 b Fc(searc)o(h)13 b(preceding)h(source)g
(lines)h(for)e Fe(r)n(e)n(gex)1975 737 y Fg(GDB)g(under)f(GNU)i(Emacs)1975
782 y Ff(M-x)f(gdb)189 b Fc(run)14 b(GDB)g(under)h(Emacs)1975
820 y Ff(C-h)e(m)225 b Fc(describ)q(e)14 b(GDB)g(mo)q(de)1975
857 y Ff(M-s)256 b Fc(step)14 b(one)f(line)i(\()p Ff(step)p
Fc(\))1975 899 y Ff(M-n)256 b Fc(next)14 b(line)h(\()p Ff(next)p
Fc(\))1975 936 y Ff(M-i)256 b Fc(step)14 b(one)f(instruction)i(\()p
Ff(stepi)p Fc(\))1975 978 y Ff(C-c)e(C-f)189 b Fc(\014nish)15
b(curren)o(t)f(stac)o(k)g(frame)f(\()p Ff(finish)p Fc(\))1975
1015 y Ff(M-c)256 b Fc(con)o(tin)o(ue)14 b(\()p Ff(cont)p Fc(\))1975
1052 y Ff(M-u)256 b Fc(up)14 b Fe(ar)n(g)f Fc(frames)h(\()p
Ff(up)p Fc(\))1975 1094 y Ff(M-d)256 b Fc(do)o(wn)14 b Fe(ar)n(g)f
Fc(frames)h(\()p Ff(down)p Fc(\))1975 1131 y Ff(C-x)f(&)225
b Fc(cop)o(y)14 b(n)o(um)o(b)q(er)h(from)f(p)q(oin)o(t,)h(insert)f(at)f(end)
1975 1169 y Ff(C-x)g(SPC)189 b Fc(\(in)14 b(source)g(\014le\))g(set)f(break)h
(at)g(p)q(oin)o(t)1975 1267 y Fg(GDB)f(License)1975 1313 y
Ff(show)g(copying)99 b Fc(Displa)o(y)15 b(GNU)e(General)g(Public)i(License)
1975 1350 y Ff(show)e(warranty)81 b Fc(There)13 b(is)i(NO)e(W)l(ARRANTY)g
(for)h(GDB.)2306 1387 y(Displa)o(y)h(full)g(no-w)o(arran)o(t)o(y)f(statemen)o
(t.)2024 1622 y Fh(Cop)o(yrigh)o(t)2185 1621 y(c)2171 1622
y Fa(\015)o Fh(1991,)h(1992,)f(1993)h(F)n(ree)d(Soft)o(w)o(are)i(F)n
(oundation,)f(Inc.)2215 1660 y(Roland)i(P)o(esc)o(h)f(\(p)q(esc)o(h@cygn)o
(us.com\))1997 1697 y(The)f(author)h(assumes)f(no)h(resp)q(onsibilit)o(y)j
(for)c(an)o(y)h(errors)g(on)g(this)h(card.)1975 1759 y(This)g(card)e(ma)o(y)g
(b)q(e)g(freely)h(distributed)g(under)f(the)g(terms)g(of)g(the)h(GNU)1975
1797 y(General)h(Public)g(License.)2012 1834 y(Please)f(con)o(tribute)g(to)g
(dev)o(elopmen)o(t)e(of)i(this)h(card)e(b)o(y)h(annotating)h(it.)1975
1896 y(GDB)g(itself)f(is)h(free)e(soft)o(w)o(are;)g(y)o(ou)h(are)g(w)o
(elcome)e(to)i(distribute)h(copies)f(of)1975 1934 y(it)h(under)e(the)g(terms)
g(of)g(the)g(GNU)i(General)g(Public)g(License.)20 b(There)12
b(is)1975 1971 y(absolutely)k(no)d(w)o(arran)o(t)o(y)i(for)e(GDB.)p
eop
%%Trailer
end
userdict /end-hook known{end-hook}if
%%EOF

View file

@ -0,0 +1,646 @@
%%%%%%%%%%%%%%%% gdb-refcard.tex %%%%%%%%%%%%%%%%
%This file is TeX source for a reference card describing GDB, the GNU debugger.
%$Id: refcard.tex,v 1.1.1.1 1993/10/30 21:59:42 jkh Exp $
%Copyright (C) 1991, 1992 Free Software Foundation, Inc.
%Permission is granted to make and distribute verbatim copies of
%this reference provided the copyright notices and permission notices
%are preserved on all copies.
%
%TeX markup is a programming language; accordingly this file is source
%for a program to generate a reference.
%
%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 can find a copy of the GNU General Public License in the GDB
%manual; or write to the Free Software Foundation, Inc.,
%675 Mass Ave, Cambridge, MA 02139, USA.
%
%You can contact the author as: pesch@cygnus.com
%
% Roland Pesch
% Cygnus Support
% 1937 Landings Drive
% Mountain View, CA 94043 USA
%
% +1 415 903 1400
%
%
%
% 22-AUG-1993 Andreas Vogel
%
% Modifications made in order to handle different papersizes correctly.
% You only have to set the total width and height of the paper, the
% horizontal and vertical margin space measured from *paper edge*
% and the interline and interspec spacing.
% In order to support a new papersize, you have to fiddle with the
% latter four dimensions. Just try out a few values.
% All other values will be computed at process time so it should be
% quite easy to support different paper sizes - only four values to
% guess :-)
%
% To find the configuration places, just search for the string
% "CONFIGURATION".
%
% Andreas Vogel (av@ssw.de)
%
%
%
% Uncomment the following `magnification' command if you want to print
% out in a larger font. Caution! You may need larger paper. You had
% best avoid using 3-column output if you try this. See the ``Three
% column format'' section below if you want to print in three column
% format.
%
%\magnification=\magstep 1
%
% NOTE ON INTENTIONAL OMISSIONS: This reference card includes most GDB
% commands, but due to space constraints there are some things I chose
% to omit. In general, not all synonyms for commands are covered, nor
% all variations of a command.
% The GDB-under-Emacs section omits gdb-mode functions without default
% keybindings. GDB startup options are not described.
% set print sevenbit-strings, set symbol-reloading omitted.
% printsyms, printpsyms, omitted since they're for GDB maintenance primarily
% share omitted due to obsolescence
% set check range/type omitted at least til code is in GDB.
%
%-------------------- Three column format -----------------------
%%%% --- To disable three column format, comment out this entire section
% Three-column format for landscape printing
%-------- Papersize defs:
\newdimen\totalwidth \newdimen\totalheight
\newdimen\hmargin \newdimen\vmargin
\newdimen\secskip \newdimen\lskip
\newdimen\barwidth \newdimen\barheight
\newdimen\intersecwidth
%%
%% START CONFIGURATION - PAPERSIZE DEFINITIONS
%------- Papersize params:
%% US letter paper (8.5x11in)
%%
\totalwidth=11in % total width of paper
\totalheight=8.5in % total height of paper
\hmargin=.25in % horizontal margin width
\vmargin=.25in % vertical margin width
\secskip=1pc % space between refcard secs
\lskip=2pt % extra skip between \sec entries
%------- end papersize params
%%
%% change according to personal taste, not papersize dependent
%%
\barwidth=.1pt % width of the cropmark bar
\barheight=2pt % height of the cropmark bar
\intersecwidth=0.5em % width between \itmwid and \dfnwid
%%
%% END CONFIGURATION - PAPERSIZE DEFINITIONS
%%
%%
%% values to be computed - nothing to configure
%%
\newdimen\fullhsize % width of area without margins
\newdimen\itmwid % width of item column
\newdimen\dfnwid % width of definition column
\newdimen\temp % only for temporary use
%%
%% adjust the offsets so the margins are measured *from paper edge*
%%
\hoffset=-1in \advance \hoffset by \hmargin
\voffset=-1in \advance \voffset by \vmargin
%%
%% fullhsize = totalwidth - (2 * hmargin)
%%
\fullhsize=\totalwidth
\temp=\hmargin \multiply \temp by 2 \advance \fullhsize by -\temp
%%
%% hsize = (fullhsize - (4 * hmargin) - (2 * barwidth)) / 3
%%
\hsize=\fullhsize
\temp=\hmargin \multiply \temp by 4 \advance \hsize by -\temp
\temp=\barwidth \multiply \temp by 2 \advance \hsize by -\temp
\divide \hsize by 3
%%
%% vsize = totalheight - (2 * vmargin)
%%
\vsize=\totalheight
\temp=\vmargin \multiply \temp by 2 \advance \vsize by -\temp
%%
%% itmwid = (hsize - intersecwidth) * 1/3
%% dfnwid = (hsize - intersecwidth) * 2/3
%%
\temp=\hsize \advance \temp by -\intersecwidth \divide \temp by 3
\itmwid=\temp
\dfnwid=\hsize \advance \dfnwid by -\itmwid
%-------- end papersize defs
\def\fulline{\hbox to \fullhsize}
\let\lcr=L \newbox\leftcolumn\newbox\centercolumn
\output={\if L\lcr
\global\setbox\leftcolumn=\columnbox \global\let\lcr=C
\else
\if C\lcr
\global\setbox\centercolumn=\columnbox \global\let\lcr=R
\else \tripleformat \global\let\lcr=L
\fi
\fi
% \ifnum\outputpenalty>-20000 \else\dosupereject\fi
}
%%
%% START CONFIGURATION - ALTERNATIVE FOLDING GUIDES
%%
%% For NO printed folding guide,
%% comment out other \def\vdecor's and uncomment:
%\def\vdecor{\hskip\hmargin plus1fil\hskip\barwidth plus1fil\hskip\hmargin plus1fil}
%% For SOLID LINE folding guide,
%% comment out other \def\vdecor's and uncomment:
%\def\vdecor{\hskip\hmargin plus1fil \vrule width \barwidth \hskip\hmargin plus1fil}
%% For SMALL MARKS NEAR TOP AND BOTTOM as folding guide,
%% comment out other \def\vdecor's and uncomment:
\def\vdecor{\hskip\hmargin plus1fil
\vbox to \vsize{\hbox to \barwidth{\vrule height\barheight width\barwidth}\vfill
\hbox to \barwidth{\vrule height\barheight width\barwidth}}%THIS PERCENT SIGN IS ESSENTIAL
\hskip\hmargin plus1fil}
%%
%% END CONFIGURATION - ALTERNATIVES FOR FOLDING GUIDES
%%
\def\tripleformat{\shipout\vbox{\fulline{\box\leftcolumn\vdecor
\box\centercolumn\vdecor
\columnbox}
}
\advancepageno}
\def\columnbox{\leftline{\pagebody}}
\def\bye{\par\vfill
\supereject
\if R\lcr \null\vfill\eject\fi
\end}
%-------------------- end three column format -----------------------
%-------------------- Computer Modern font defs: --------------------
\font\bbf=cmbx10
\font\vbbf=cmbx12
\font\smrm=cmr6
\font\brm=cmr10
\font\rm=cmr7
\font\it=cmti7
\font\tt=cmtt8
%-------------------- end font defs ---------------------------------
%
\hyphenpenalty=5000\tolerance=2000\raggedright\raggedbottom
\normalbaselineskip=9pt\baselineskip=9pt
%
\parindent=0pt
\parskip=0pt
\footline={\vbox to0pt{\hss}}
%
\def\ctl#1{{\tt C-#1}}
\def\opt#1{{\brm[{\rm #1}]}}
\def\xtra#1{\noalign{\smallskip{\tt#1}}}
%
\long\def\sec#1;#2\endsec{\vskip \secskip
\halign{%
%COL 1 (of halign):
\vtop{\hsize=\itmwid\tt
##\par\vskip \lskip }\hfil
%COL 2 (of halign):
&\vtop{\hsize=\dfnwid\hangafter=1\hangindent=\intersecwidth
\rm ##\par\vskip \lskip}\cr
%Tail of \long\def fills in halign body with \sec args:
\noalign{{\bbf #1}\vskip \lskip}
#2
}
}
{\vbbf GDB QUICK REFERENCE}\hfil{\smrm GDB Version 4}\qquad
\sec Essential Commands;
gdb {\it program} \opt{{\it core}}&debug {\it program} \opt{using
coredump {\it core}}\cr
b \opt{\it file\tt:}{\it function}&set breakpoint at {\it function} \opt{in \it file}\cr
run \opt{{\it arglist}}&start your program \opt{with {\it arglist}}\cr
bt& backtrace: display program stack\cr
p {\it expr}&display the value of an expression\cr
c &continue running your program\cr
n &next line, stepping over function calls\cr
s &next line, stepping into function calls\cr
\endsec
\sec Starting GDB;
gdb&start GDB, with no debugging files\cr
gdb {\it program}&begin debugging {\it program}\cr
gdb {\it program core}&debug coredump {\it core} produced by {\it
program}\cr
gdb --help&describe command line options\cr
\endsec
\sec Stopping GDB;
quit&exit GDB; also {\tt q} or {\tt EOF} (eg \ctl{d})\cr
INTERRUPT&(eg \ctl{c}) terminate current command, or send to running process\cr
\endsec
\sec Getting Help;
help&list classes of commands\cr
help {\it class}&one-line descriptions for commands in {\it class}\cr
help {\it command}&describe {\it command}\cr
\endsec
\sec Executing your Program;
run {\it arglist}&start your program with {\it arglist}\cr
run&start your program with current argument list\cr
run $\ldots$ <{\it inf} >{\it outf}&start your program with input, output
redirected\cr
\cr
kill&kill running program\cr
\cr
tty {\it dev}&use {\it dev} as stdin and stdout for next {\tt run}\cr
set args {\it arglist}&specify {\it arglist} for next
{\tt run}\cr
set args&specify empty argument list\cr
show args&display argument list\cr
\cr
show environment&show all environment variables\cr
show env {\it var}&show value of environment variable {\it var}\cr
set env {\it var} {\it string}&set environment variable {\it var}\cr
unset env {\it var}&remove {\it var} from environment\cr
\endsec
\sec Shell Commands;
cd {\it dir}&change working directory to {\it dir}\cr
pwd&Print working directory\cr
make $\ldots$&call ``{\tt make}''\cr
shell {\it cmd}&execute arbitrary shell command string\cr
\endsec
\vfill
\line{\smrm \opt{ } surround optional arguments \hfill $\ldots$ show
one or more arguments}
\vskip\baselineskip
\centerline{\smrm \copyright 1991, 1992 Free Software Foundation, Inc.\qquad Permissions on back}
\eject
\sec Breakpoints and Watchpoints;
break \opt{\it file\tt:}{\it line}\par
b \opt{\it file\tt:}{\it line}&set breakpoint at {\it line} number \opt{in \it file}\par
eg:\quad{\tt break main.c:37}\quad\cr
break \opt{\it file\tt:}{\it func}&set breakpoint at {\it
func} \opt{in \it file}\cr
break +{\it offset}\par
break -{\it offset}&set break at {\it offset} lines from current stop\cr
break *{\it addr}&set breakpoint at address {\it addr}\cr
break&set breakpoint at next instruction\cr
break $\ldots$ if {\it expr}&break conditionally on nonzero {\it expr}\cr
cond {\it n} \opt{\it expr}&new conditional expression on breakpoint
{\it n}; make unconditional if no {\it expr}\cr
tbreak $\ldots$&temporary break; disable when reached\cr
rbreak {\it regex}&break on all functions matching {\it regex}\cr
watch {\it expr}&set a watchpoint for expression {\it expr}\cr
catch {\it x}&break at C++ handler for exception {\it x}\cr
\cr
info break&show defined breakpoints\cr
info watch&show defined watchpoints\cr
\cr
clear&delete breakpoints at next instruction\cr
clear \opt{\it file\tt:}{\it fun}&delete breakpoints at entry to {\it fun}()\cr
clear \opt{\it file\tt:}{\it line}&delete breakpoints on source line \cr
delete \opt{{\it n}}&delete breakpoints
\opt{or breakpoint {\it n}}\cr
\cr
disable \opt{{\it n}}&disable breakpoints
\opt{or breakpoint {\it n}}
\cr
enable \opt{{\it n}}&enable breakpoints
\opt{or breakpoint {\it n}}
\cr
enable once \opt{{\it n}}&enable breakpoints \opt{or breakpoint {\it n}};
disable again when reached
\cr
enable del \opt{{\it n}}&enable breakpoints \opt{or breakpoint {\it n}};
delete when reached
\cr
\cr
ignore {\it n} {\it count}&ignore breakpoint {\it n}, {\it count}
times\cr
\cr
commands {\it n}\par
\qquad \opt{\tt silent}\par
\qquad {\it command-list}&execute GDB {\it command-list} every time breakpoint {\it n} is reached. \opt{{\tt silent} suppresses default
display}\cr
end&end of {\it command-list}\cr
\endsec
\sec Program Stack;
backtrace \opt{\it n}\par
bt \opt{\it n}&print trace of all frames in stack; or of {\it n}
frames---innermost if {\it n}{\tt >0}, outermost if {\it n}{\tt <0}\cr
frame \opt{\it n}&select frame number {\it n} or frame at address {\it
n}; if no {\it n}, display current frame\cr
up {\it n}&select frame {\it n} frames up\cr
down {\it n}&select frame {\it n} frames down\cr
info frame \opt{\it addr}&describe selected frame, or frame at
{\it addr}\cr
info args&arguments of selected frame\cr
info locals&local variables of selected frame\cr
info reg \opt{\it rn}$\ldots$\par
info all-reg \opt{\it rn}&register values \opt{for regs {\it rn\/}} in
selected frame; {\tt all-reg} includes floating point\cr
info catch&exception handlers active in selected frame\cr
\endsec
\vfill\eject
\sec Execution Control;
continue \opt{\it count}\par
c \opt{\it count}&continue running; if {\it count} specified, ignore
this breakpoint next {\it count} times\cr
\cr
step \opt{\it count}\par
s \opt{\it count}&execute until another line reached; repeat {\it count} times if
specified\cr
stepi \opt{\it count}\par
si \opt{\it count}&step by machine instructions rather than source
lines\cr
\cr
next \opt{\it count}\par
n \opt{\it count}&execute next line, including any function calls\cr
nexti \opt{\it count}\par
ni \opt{\it count}&next machine instruction rather than source
line\cr
\cr
until \opt{\it location}&run until next instruction (or {\it
location})\cr
finish&run until selected stack frame returns\cr
return \opt{\it expr}&pop selected stack frame without executing
\opt{setting return value}\cr
signal {\it num}&resume execution with signal {\it s} (none if {\tt 0})\cr
jump {\it line}\par
jump *{\it address}&resume execution at specified {\it line} number or
{\it address}\cr
set var={\it expr}&evaluate {\it expr} without displaying it; use for
altering program variables\cr
\endsec
\sec Display;
print \opt{\tt/{\it f}\/} \opt{\it expr}\par
p \opt{\tt/{\it f}\/} \opt{\it expr}&show value of {\it expr} \opt{or
last value \tt \$} according to format {\it f}:\cr
\qquad x&hexadecimal\cr
\qquad d&signed decimal\cr
\qquad u&unsigned decimal\cr
\qquad o&octal\cr
\qquad t&binary\cr
\qquad a&address, absolute and relative\cr
\qquad c&character\cr
\qquad f&floating point\cr
call \opt{\tt /{\it f}\/} {\it expr}&like {\tt print} but does not display
{\tt void}\cr
x \opt{\tt/{\it Nuf}\/} {\it expr}&examine memory at address {\it expr};
optional format spec follows slash\cr
\quad {\it N}&count of how many units to display\cr
\quad {\it u}&unit size; one of\cr
&{\tt\qquad b}\ individual bytes\cr
&{\tt\qquad h}\ halfwords (two bytes)\cr
&{\tt\qquad w}\ words (four bytes)\cr
&{\tt\qquad g}\ giant words (eight bytes)\cr
\quad {\it f}&printing format. Any {\tt print} format, or\cr
&{\tt\qquad s}\ null-terminated string\cr
&{\tt\qquad i}\ machine instructions\cr
disassem \opt{\it addr}&display memory as machine instructions\cr
\endsec
\sec Automatic Display;
display \opt{\tt/\it f\/} {\it expr}&show value of {\it expr} each time
program stops \opt{according to format {\it f}\/}\cr
display&display all enabled expressions on list\cr
undisplay {\it n}&remove number(s) {\it n} from list of
automatically displayed expressions\cr
disable disp {\it n}&disable display for expression(s) number {\it
n}\cr
enable disp {\it n}&enable display for expression(s) number {\it
n}\cr
info display&numbered list of display expressions\cr
\endsec
\vfill\eject
\sec Expressions;
{\it expr}&an expression in C, C++, or Modula-2 (including function calls), or:\cr
{\it addr\/}@{\it len}&an array of {\it len} elements beginning at {\it
addr}\cr
{\it file}::{\it nm}&a variable or function {\it nm} defined in {\it
file}\cr
$\tt\{${\it type}$\tt\}${\it addr}&read memory at {\it addr} as specified
{\it type}\cr
\$&most recent displayed value\cr
\${\it n}&{\it n}th displayed value\cr
\$\$&displayed value previous to \$\cr
\$\${\it n}&{\it n}th displayed value back from \$\cr
\$\_&last address examined with {\tt x}\cr
\$\_\_&value at address \$\_\cr
\${\it var}&convenience variable; assign any value\cr
\cr
show values \opt{{\it n}}&show last 10 values \opt{or surrounding
\${\it n}}\cr
show convenience&display all convenience variables\cr
\endsec
\sec Symbol Table;
info address {\it s}&show where symbol {\it s} is stored\cr
info func \opt{\it regex}&show names, types of defined functions
(all, or matching {\it regex})\cr
info var \opt{\it regex}&show names, types of global variables (all,
or matching {\it regex})\cr
whatis \opt{\it expr}\par
ptype \opt{\it expr}&show data type of {\it expr} \opt{or \tt \$}
without evaluating; {\tt ptype} gives more detail\cr
ptype {\it type}&describe type, struct, union, or enum\cr
\endsec
\sec GDB Scripts;
source {\it script}&read, execute GDB commands from file {\it
script}\cr
\cr
define {\it cmd}\par
\qquad {\it command-list}&create new GDB command {\it cmd};
execute script defined by {\it command-list}\cr
end&end of {\it command-list}\cr
document {\it cmd}\par
\qquad {\it help-text}&create online documentation
for new GDB command {\it cmd}\cr
end&end of {\it help-text}\cr
\endsec
\sec Signals;
handle {\it signal} {\it act}&specify GDB actions for {\it signal}:\cr
\quad print&announce signal\cr
\quad noprint&be silent for signal\cr
\quad stop&halt execution on signal\cr
\quad nostop&do not halt execution\cr
\quad pass&allow your program to handle signal\cr
\quad nopass&do not allow your program to see signal\cr
info signals&show table of signals, GDB action for each\cr
\endsec
\sec Debugging Targets;
target {\it type} {\it param}&connect to target machine, process, or file\cr
help target&display available targets\cr
attach {\it param}&connect to another process\cr
detach&release target from GDB control\cr
\endsec
\vfill\eject
\sec Controlling GDB;
set {\it param} {\it value}&set one of GDB's internal parameters\cr
show {\it param}&display current setting of parameter\cr
\xtra{\rm Parameters understood by {\tt set} and {\tt show}:}
\quad complaints {\it limit}&number of messages on unusual symbols\cr
\quad confirm {\it on/off}&enable or disable cautionary queries\cr
\quad editing {\it on/off}&control {\tt readline} command-line editing\cr
\quad height {\it lpp}&number of lines before pause in display\cr
\quad language {\it lang}&Language for GDB expressions ({\tt auto}, {\tt c} or
{\tt modula-2})\cr
\quad listsize {\it n}&number of lines shown by {\tt list}\cr
\quad prompt {\it str}&use {\it str} as GDB prompt\cr
\quad radix {\it base}&octal, decimal, or hex number representation\cr
\quad verbose {\it on/off}&control messages when loading
symbols\cr
\quad width {\it cpl}&number of characters before line folded\cr
\quad write {\it on/off}&Allow or forbid patching binary, core files
(when reopened with {\tt exec} or {\tt core})
\cr
\quad history $\ldots$\par
\quad h $\ldots$&groups with the following options:\cr
\quad h exp {\it off/on}&disable/enable {\tt readline} history expansion\cr
\quad h file {\it filename}&file for recording GDB command history\cr
\quad h size {\it size}&number of commands kept in history list\cr
\quad h save {\it off/on}&control use of external file for
command history\cr
\cr
\quad print $\ldots$\par
\quad p $\ldots$&groups with the following options:\cr
\quad p address {\it on/off}&print memory addresses in stacks,
values\cr
\quad p array {\it off/on}&compact or attractive format for
arrays\cr
\quad p demangl {\it on/off}&source (demangled) or internal form for C++
symbols\cr
\quad p asm-dem {\it on/off}&demangle C++ symbols in
machine-instruction output\cr
\quad p elements {\it limit}&number of array elements to display\cr
\quad p object {\it on/off}&print C++ derived types for objects\cr
\quad p pretty {\it off/on}&struct display: compact or indented\cr
\quad p union {\it on/off}&display of union members\cr
\quad p vtbl {\it off/on}&display of C++ virtual function
tables\cr
\cr
show commands&show last 10 commands\cr
show commands {\it n}&show 10 commands around number {\it n}\cr
show commands +&show next 10 commands\cr
\endsec
\sec Working Files;
file \opt{\it file}&use {\it file} for both symbols and executable;
with no arg, discard both\cr
core \opt{\it file}&read {\it file} as coredump; or discard\cr
exec \opt{\it file}&use {\it file} as executable only; or discard\cr
symbol \opt{\it file}&use symbol table from {\it file}; or discard\cr
load {\it file}&dynamically link {\it file\/} and add its symbols\cr
add-sym {\it file} {\it addr}&read additional symbols from {\it file},
dynamically loaded at {\it addr}\cr
info files&display working files and targets in use\cr
path {\it dirs}&add {\it dirs} to front of path searched for
executable and symbol files\cr
show path&display executable and symbol file path\cr
info share&list names of shared libraries currently loaded\cr
\endsec
\vfill\eject
\sec Source Files;
dir {\it names}&add directory {\it names} to front of source path\cr
dir&clear source path\cr
show dir&show current source path\cr
\cr
list&show next ten lines of source\cr
list -&show previous ten lines\cr
list {\it lines}&display source surrounding {\it lines},
specified as:\cr
\quad{\opt{\it file\tt:}\it num}&line number \opt{in named file}\cr
\quad{\opt{\it file\tt:}\it function}&beginning of function \opt{in
named file}\cr
\quad{\tt +\it off}&{\it off} lines after last printed\cr
\quad{\tt -\it off}&{\it off} lines previous to last printed\cr
\quad{\tt*\it address}&line containing {\it address}\cr
list {\it f},{\it l}&from line {\it f} to line {\it l}\cr
info line {\it num}&show starting, ending addresses of compiled code for
source line {\it num}\cr
info source&show name of current source file\cr
info sources&list all source files in use\cr
forw {\it regex}&search following source lines for {\it regex}\cr
rev {\it regex}&search preceding source lines for {\it regex}\cr
\endsec
\sec GDB under GNU Emacs;
M-x gdb&run GDB under Emacs\cr
\ctl{h} m&describe GDB mode\cr
M-s&step one line ({\tt step})\cr
M-n&next line ({\tt next})\cr
M-i&step one instruction ({\tt stepi})\cr
\ctl{c} \ctl{f}&finish current stack frame ({\tt finish})\cr
M-c&continue ({\tt cont})\cr
M-u&up {\it arg} frames ({\tt up})\cr
M-d&down {\it arg} frames ({\tt down})\cr
\ctl{x} \&&copy number from point, insert at end\cr
\ctl{x} SPC&(in source file) set break at point\cr
\endsec
\sec GDB License;
show copying&Display GNU General Public License\cr
show warranty&There is NO WARRANTY for GDB. Display full no-warranty
statement.\cr
\endsec
\vfill
{\smrm\parskip=6pt
\centerline{Copyright \copyright 1991, 1992, 1993 Free Software Foundation, Inc.}
\centerline{Roland Pesch (pesch@cygnus.com)}
\centerline{The author assumes no responsibility for any errors on this card.}
This card may be freely distributed under the terms of the GNU
General Public License.
\centerline{Please contribute to development of this card by
annotating it.}
GDB itself is free software; you are welcome to distribute copies of
it under the terms of the GNU General Public License. There is
absolutely no warranty for GDB.
}
\end

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

339
gnu/usr.bin/gdb/gdb/COPYING Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -0,0 +1,72 @@
PROG = gdb
BINDIR= /usr/bin
SRCS = main.c blockframe.c breakpoint.c findvar.c stack.c thread.c \
source.c values.c eval.c valops.c valarith.c valprint.c printcmd.c \
symtab.c symfile.c symmisc.c infcmd.c infrun.c command.c utils.c \
expprint.c environ.c gdbtypes.c copying.c i386-tdep.c i386-pinsn.c \
freebsd-solib.c ser-unix.c exec.c fork-child.c infptrace.c inftarg.c \
corelow.c coredep.c freebsd-nat.c remote.c dcache.c remote-utils.c \
mem-break.c target.c putenv.c parse.c language.c buildsym.c \
objfiles.c minsyms.c maint.c demangle.c dbxread.c coffread.c \
elfread.c dwarfread.c mipsread.c stabsread.c core.c c-lang.c \
ch-lang.c m2-lang.c complaints.c typeprint.c c-typeprint.c \
ch-typeprint.c m2-typeprint.c c-valprint.c cp-valprint.c ch-valprint.c \
m2-valprint.c nlmread.c serial.c inflow.c regex.c init.c \
c-exp.tab.c ch-exp.tab.c m2-exp.tab.c version.c i386-dis.c dis-buf.c
c-exp.tab.c: $(.CURDIR)/c-exp.y
yacc -d -p c_ $(.CURDIR)/c-exp.y
sed -e '/extern.*malloc/d' -e '/extern.*realloc/d' -e '/extern.*free/d' \
-e '/include.*malloc.h/d' -e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' < y.tab.c > c-exp.new
rm y.tab.c
mv c-exp.new ./c-exp.tab.c
ch-exp.tab.c: $(.CURDIR)/ch-exp.y
yacc -d -p ch_ $(.CURDIR)/ch-exp.y
sed -e '/extern.*malloc/d' -e '/extern.*realloc/d' -e '/extern.*free/d' \
-e '/include.*malloc.h/d' -e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' < y.tab.c > ch-exp.new
rm y.tab.c
mv ch-exp.new ./ch-exp.tab.c
m2-exp.tab.c: $(.CURDIR)/m2-exp.y
yacc -d -p m2_ $(.CURDIR)/m2-exp.y
sed -e '/extern.*malloc/d' -e '/extern.*realloc/d' -e '/extern.*free/d' \
-e '/include.*malloc.h/d' -e 's/malloc/xmalloc/g' \
-e 's/realloc/xrealloc/g' < y.tab.c > m2-exp.new
rm y.tab.c
mv m2-exp.new ./m2-exp.tab.c
CFLAGS+= -I$(.CURDIR)/. -I/usr/include/readline -I$(.CURDIR)/../bfd
CFLAGS+= -DTRAD_CORE
LDADD+= -lreadline -ltermcap
.if exists(${.CURDIR}/../libiberty/obj)
LDADD+= -L${.CURDIR}/../libiberty/obj -liberty
DPADD+= ${.CURDIR}/../libiberty/obj/libiberty.a
.else
LDADD+= -L${.CURDIR}/../libiberty/ -liberty
DPADD+= ${.CURDIR}/../libiberty/libiberty.a
.endif
.if exists(${.CURDIR}/../bfd/obj)
LDADD+= -L${.CURDIR}/../bfd/obj -lbfd
DPADD+= ${.CURDIR}/../bfd/obj/libbfd.a
.else
LDADD+= -L${.CURDIR}/../bfd/ -lbfd
DPADD+= ${.CURDIR}/../bfd/libbfd.a
.endif
.if exists(${.CURDIR}/../mmalloc/obj)
LDADD+= -L${.CURDIR}/../mmalloc/obj -lmmalloc
DPADD+= ${.CURDIR}/../mmalloc/obj/libmmalloc.a
.else
LDADD+= -L${.CURDIR}/../mmalloc/ -lmmalloc
DPADD+= ${.CURDIR}/../mmalloc/libmmalloc.a
.endif
.include <bsd.prog.mk>

View file

@ -0,0 +1,139 @@
/* ANSI and traditional C compatability macros
Copyright 1991, 1992 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ANSI and traditional C compatibility macros
ANSI C is assumed if __STDC__ is #defined.
Macro ANSI C definition Traditional C definition
----- ---- - ---------- ----------- - ----------
PTR `void *' `char *'
LONG_DOUBLE `long double' `double'
VOLATILE `volatile' `'
SIGNED `signed' `'
PTRCONST `void *const' `char *'
CONST is also defined, but is obsolete. Just use const.
DEFUN (name, arglist, args)
Defines function NAME.
ARGLIST lists the arguments, separated by commas and enclosed in
parentheses. ARGLIST becomes the argument list in traditional C.
ARGS list the arguments with their types. It becomes a prototype in
ANSI C, and the type declarations in traditional C. Arguments should
be separated with `AND'. For functions with a variable number of
arguments, the last thing listed should be `DOTS'.
DEFUN_VOID (name)
Defines a function NAME, which takes no arguments.
obsolete -- EXFUN (name, (prototype)) -- obsolete.
Replaced by PARAMS. Do not use; will disappear someday soon.
Was used in external function declarations.
In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in
parentheses). In traditional C it is `NAME()'.
For a function that takes no arguments, PROTOTYPE should be `(void)'.
PARAMS ((args))
We could use the EXFUN macro to handle prototype declarations, but
the name is misleading and the result is ugly. So we just define a
simple macro to handle the parameter lists, as in:
static int foo PARAMS ((int, char));
This produces: `static int foo();' or `static int foo (int, char);'
EXFUN would have done it like this:
static int EXFUN (foo, (int, char));
but the function is not external...and it's hard to visually parse
the function name out of the mess. EXFUN should be considered
obsolete; new code should be written to use PARAMS.
For example:
extern int printf PARAMS ((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 */
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4))
/* All known AIX compilers implement these things (but don't always
define __STDC__). The RISC/OS MIPS compiler defines these things
in SVR4 mode, but does not define __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(void)
#define PROTO(type, name, arglist) type name arglist
#define PARAMS(paramlist) paramlist
#else /* Not ANSI C. */
#define PTR char *
#define PTRCONST PTR
#define LONG_DOUBLE double
#define AND ;
#define NOARGS
#define CONST
#ifndef const /* some systems define it in header files for non-ansi mode */
#define const
#endif
#define VOLATILE
#define SIGNED
#define DOTS
#define EXFUN(name, proto) name()
#define DEFUN(name, arglist, args) name arglist args;
#define DEFUN_VOID(name) name()
#define PROTO(type, name, arglist) type name ()
#define PARAMS(paramlist) ()
#endif /* ANSI C. */
#endif /* ansidecl.h */

View file

@ -0,0 +1,431 @@
/* `a.out' object-file definitions, including extensions to 64-bit fields */
#ifndef __A_OUT_64_H__
#define __A_OUT_64_H__
/* This is the layout on disk of the 32-bit or 64-bit exec header. */
#ifndef external_exec
struct external_exec
{
bfd_byte e_info[4]; /* magic number and stuff */
bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */
bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */
bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */
bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */
bfd_byte e_entry[BYTES_IN_WORD]; /* start address */
bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */
bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */
};
#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7)
/* Magic numbers for a.out files */
#if ARCH_SIZE==64
#define OMAGIC 0x1001 /* Code indicating object file */
#define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */
#define NMAGIC 0x1003 /* Code indicating pure executable. */
/* There is no 64-bit QMAGIC as far as I know. */
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC)
#else
#define OMAGIC 0407 /* ...object file or impure executable. */
#define NMAGIC 0410 /* Code indicating pure executable. */
#define ZMAGIC 0413 /* Code indicating demand-paged executable. */
/* This indicates a demand-paged executable with the header in the text.
As far as I know it is only used by 386BSD and/or BSDI. */
#define QMAGIC 0314
# ifndef N_BADMAG
# define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC \
&& N_MAGIC(x) != QMAGIC)
# endif /* N_BADMAG */
#endif
#endif
#ifdef QMAGIC
#define N_IS_QMAGIC(x) (N_MAGIC (x) == QMAGIC)
#else
#define N_IS_QMAGIC(x) (0)
#endif
/* The difference between PAGE_SIZE and N_SEGSIZE is that PAGE_SIZE is
the the finest granularity at which you can page something, thus it
controls the padding (if any) before the text segment of a ZMAGIC
file. N_SEGSIZE is the resolution at which things can be marked as
read-only versus read/write, so it controls the padding between the
text segment and the data segment (in memory; on disk the padding
between them is PAGE_SIZE). PAGE_SIZE and N_SEGSIZE are the same
for most machines, but different for sun3. */
/* By default, segment size is constant. But some machines override this
to be a function of the a.out header (e.g. machine type). */
#ifndef N_SEGSIZE
#define N_SEGSIZE(x) SEGMENT_SIZE
#endif
/* Virtual memory address of the text section.
This is getting very complicated. A good reason to discard a.out format
for something that specifies these fields explicitly. But til then...
* OMAGIC and NMAGIC files:
(object files: text for "relocatable addr 0" right after the header)
start at 0, offset is EXEC_BYTES_SIZE, size as stated.
* The text address, offset, and size of ZMAGIC files depend
on the entry point of the file:
* entry point below TEXT_START_ADDR:
(hack for SunOS shared libraries)
start at 0, offset is 0, size as stated.
* If N_HEADER_IN_TEXT(x) is true (which defaults to being the
case when the entry point is EXEC_BYTES_SIZE or further into a page):
no padding is needed; text can start after exec header. Sun
considers the text segment of such files to include the exec header;
for BFD's purposes, we don't, which makes more work for us.
start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE,
size as stated minus EXEC_BYTES_SIZE.
* If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when
the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page
aligned)): (padding is needed so that text can start at a page boundary)
start at TEXT_START_ADDR, offset PAGE_SIZE, size as stated.
Specific configurations may want to hardwire N_HEADER_IN_TEXT,
for efficiency or to allow people to play games with the entry point.
In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos,
and as 0 for most other hosts (Sony News, Vax Ultrix, etc).
(Do this in the appropriate bfd target file.)
(The default is a heuristic that will break if people try changing
the entry point, perhaps with the ld -e flag.)
* QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true,
and for which the starting address is PAGE_SIZE (or should this be
SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC).
*/
/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
in the text. */
#ifndef N_HEADER_IN_TEXT
#define N_HEADER_IN_TEXT(x) (((x).a_entry & (PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
#endif
/* Sun shared libraries, not linux. This macro is only relevant for ZMAGIC
files. */
#ifndef N_SHARED_LIB
#define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR)
#endif
#ifndef N_TXTADDR
#define N_TXTADDR(x) \
(/* The address of a QMAGIC file is always one page in, */ \
/* with the header in the text. */ \
N_IS_QMAGIC (x) ? PAGE_SIZE + EXEC_BYTES_SIZE : \
N_MAGIC(x) != ZMAGIC ? 0 : /* object file or NMAGIC */\
N_SHARED_LIB(x) ? 0 : \
N_HEADER_IN_TEXT(x) ? \
TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\
TEXT_START_ADDR /* a page of padding */\
)
#endif
/* Offset in an a.out of the start of the text section. */
#ifndef N_TXTOFF
#define N_TXTOFF(x) \
(/* For {O,N,Q}MAGIC, no padding. */ \
N_MAGIC(x) != ZMAGIC ? EXEC_BYTES_SIZE : \
N_SHARED_LIB(x) ? 0 : \
N_HEADER_IN_TEXT(x) ? \
EXEC_BYTES_SIZE : /* no padding */\
PAGE_SIZE /* a page of padding */\
)
#endif
/* Size of the text section. It's always as stated, except that we
offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF
for ZMAGIC files that nominally include the exec header
as part of the first page of text. (BFD doesn't consider the
exec header to be part of the text segment.) */
#ifndef N_TXTSIZE
#define N_TXTSIZE(x) \
(/* For QMAGIC, we don't consider the header part of the text section. */\
N_IS_QMAGIC (x) ? (x).a_text - EXEC_BYTES_SIZE : \
(N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \
N_HEADER_IN_TEXT(x) ? \
(x).a_text - EXEC_BYTES_SIZE: /* no padding */\
(x).a_text /* a page of padding */\
)
#endif
/* The address of the data segment in virtual memory.
It is the text segment address, plus text segment size, rounded
up to a N_SEGSIZE boundary for pure or pageable files. */
#ifndef N_DATADDR
#define N_DATADDR(x) \
(N_MAGIC(x)==OMAGIC? (N_TXTADDR(x)+N_TXTSIZE(x)) \
: (N_SEGSIZE(x) + ((N_TXTADDR(x)+N_TXTSIZE(x)-1) & ~(N_SEGSIZE(x)-1))))
#endif
/* The address of the BSS segment -- immediately after the data segment. */
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
/* Offsets of the various portions of the file after the text segment. */
/* For {N,Q,Z}MAGIC, there is padding to make the data segment start
on a page boundary. Most of the time the a_text field (and thus
N_TXTSIZE) already contains this padding. But if it doesn't (I
think maybe this happens on BSDI and/or 386BSD), then add it. */
#ifndef N_DATOFF
#define N_DATOFF(x) \
(N_MAGIC(x) == OMAGIC ? N_TXTOFF(x) + N_TXTSIZE(x) : \
PAGE_SIZE + ((N_TXTOFF(x) + N_TXTSIZE(x) - 1) & ~(PAGE_SIZE - 1)))
#endif
#ifndef N_TRELOFF
#define N_TRELOFF(x) ( N_DATOFF(x) + (x).a_data )
#endif
#ifndef N_DRELOFF
#define N_DRELOFF(x) ( N_TRELOFF(x) + (x).a_trsize )
#endif
#ifndef N_SYMOFF
#define N_SYMOFF(x) ( N_DRELOFF(x) + (x).a_drsize )
#endif
#ifndef N_STROFF
#define N_STROFF(x) ( N_SYMOFF(x) + (x).a_syms )
#endif
/* Symbols */
#ifndef external_nlist
struct external_nlist {
bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */
bfd_byte e_type[1]; /* type of symbol */
bfd_byte e_other[1]; /* misc info (usually empty) */
bfd_byte e_desc[2]; /* description field */
bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */
};
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
#endif
struct internal_nlist {
unsigned long n_strx; /* index into string table of name */
unsigned char n_type; /* type of symbol */
unsigned char n_other; /* misc info (usually empty) */
unsigned short n_desc; /* description field */
bfd_vma n_value; /* value of symbol */
};
/* The n_type field is the symbol type, containing: */
#define N_UNDF 0 /* Undefined symbol */
#define N_ABS 2 /* Absolute symbol -- defined at particular addr */
#define N_TEXT 4 /* Text sym -- defined at offset in text seg */
#define N_DATA 6 /* Data sym -- defined at offset in data seg */
#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */
#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */
#define N_FN 0x1f /* File name of .o file */
#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
N_DATA, or N_BSS. When the low-order bit of other types is set,
(e.g. N_WARNING versus N_FN), they are two different types. */
#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */
#define N_TYPE 0x1e
#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */
#define N_INDR 0x0a
/* The following symbols refer to set elements.
All the N_SET[ATDB] symbols with the same name form one set.
Space is allocated for the set in the text section, and each set
elements value is stored into one word of the space.
The first word of the space is the length of the set (number of elements).
The address of the set is made into an N_SETV symbol
whose name is the same as the name of the set.
This symbol acts like a N_DATA global symbol
in that it can satisfy undefined external references. */
/* These appear as input to LD, in a .o file. */
#define N_SETA 0x14 /* Absolute set element symbol */
#define N_SETT 0x16 /* Text set element symbol */
#define N_SETD 0x18 /* Data set element symbol */
#define N_SETB 0x1A /* Bss set element symbol */
/* This is output from LD. */
#define N_SETV 0x1C /* Pointer to set vector in data area. */
/* Warning symbol. The text gives a warning message, the next symbol
in the table will be undefined. When the symbol is referenced, the
message is printed. */
#define N_WARNING 0x1e
/* Relocations
There are two types of relocation flavours for a.out systems,
standard and extended. The standard form is used on systems where the
instruction has room for all the bits of an offset to the operand, whilst
the extended form is used when an address operand has to be split over n
instructions. Eg, on the 68k, each move instruction can reference
the target with a displacement of 16 or 32 bits. On the sparc, move
instructions use an offset of 14 bits, so the offset is stored in
the reloc field, and the data in the section is ignored.
*/
/* This structure describes a single relocation to be performed.
The text-relocation section of the file is a vector of these structures,
all of which apply to the text section.
Likewise, the data-relocation section applies to the data section. */
struct reloc_std_external {
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
bfd_byte r_index[3]; /* symbol table index of symbol */
bfd_byte r_type[1]; /* relocation type */
};
#define RELOC_STD_BITS_PCREL_BIG 0x80
#define RELOC_STD_BITS_PCREL_LITTLE 0x01
#define RELOC_STD_BITS_LENGTH_BIG 0x60
#define RELOC_STD_BITS_LENGTH_SH_BIG 5 /* To shift to units place */
#define RELOC_STD_BITS_LENGTH_LITTLE 0x06
#define RELOC_STD_BITS_LENGTH_SH_LITTLE 1
#define RELOC_STD_BITS_EXTERN_BIG 0x10
#define RELOC_STD_BITS_EXTERN_LITTLE 0x08
#define RELOC_STD_BITS_BASEREL_BIG 0x08
#define RELOC_STD_BITS_BASEREL_LITTLE 0x08
#define RELOC_STD_BITS_JMPTABLE_BIG 0x04
#define RELOC_STD_BITS_JMPTABLE_LITTLE 0x04
#define RELOC_STD_BITS_RELATIVE_BIG 0x02
#define RELOC_STD_BITS_RELATIVE_LITTLE 0x02
#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */
struct reloc_std_internal
{
bfd_vma r_address; /* Address (within segment) to be relocated. */
/* The meaning of r_symbolnum depends on r_extern. */
unsigned int r_symbolnum:24;
/* Nonzero means value is a pc-relative offset
and it should be relocated for changes in its own address
as well as for changes in the symbol or section specified. */
unsigned int r_pcrel:1;
/* Length (as exponent of 2) of the field to be relocated.
Thus, a value of 2 indicates 1<<2 bytes. */
unsigned int r_length:2;
/* 1 => relocate with value of symbol.
r_symbolnum is the index of the symbol
in files the symbol table.
0 => relocate with the address of a segment.
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
(the N_EXT bit may be set also, but signifies nothing). */
unsigned int r_extern:1;
/* The next three bits are for SunOS shared libraries, and seem to
be undocumented. */
unsigned int r_baserel:1; /* Linkage table relative */
unsigned int r_jmptable:1; /* pc-relative to jump table */
unsigned int r_relative:1; /* "relative relocation" */
/* unused */
unsigned int r_pad:1; /* Padding -- set to zero */
};
/* EXTENDED RELOCS */
struct reloc_ext_external {
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */
bfd_byte r_index[3]; /* symbol table index of symbol */
bfd_byte r_type[1]; /* relocation type */
bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */
};
#define RELOC_EXT_BITS_EXTERN_BIG 0x80
#define RELOC_EXT_BITS_EXTERN_LITTLE 0x01
#define RELOC_EXT_BITS_TYPE_BIG 0x1F
#define RELOC_EXT_BITS_TYPE_SH_BIG 0
#define RELOC_EXT_BITS_TYPE_LITTLE 0xF8
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3
/* Bytes per relocation entry */
#define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
enum reloc_type
{
/* simple relocations */
RELOC_8, /* data[0:7] = addend + sv */
RELOC_16, /* data[0:15] = addend + sv */
RELOC_32, /* data[0:31] = addend + sv */
/* pc-rel displacement */
RELOC_DISP8, /* data[0:7] = addend - pc + sv */
RELOC_DISP16, /* data[0:15] = addend - pc + sv */
RELOC_DISP32, /* data[0:31] = addend - pc + sv */
/* Special */
RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */
RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */
RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */
RELOC_22, /* data[0:21] = (addend + sv) */
RELOC_13, /* data[0:12] = (addend + sv) */
RELOC_LO10, /* data[0:9] = (addend + sv) */
RELOC_SFA_BASE,
RELOC_SFA_OFF13,
/* P.I.C. (base-relative) */
RELOC_BASE10, /* Not sure - maybe we can do this the */
RELOC_BASE13, /* right way now */
RELOC_BASE22,
/* for some sort of pc-rel P.I.C. (?) */
RELOC_PC10,
RELOC_PC22,
/* P.I.C. jump table */
RELOC_JMP_TBL,
/* reputedly for shared libraries somehow */
RELOC_SEGOFF16,
RELOC_GLOB_DAT,
RELOC_JMP_SLOT,
RELOC_RELATIVE,
RELOC_11,
RELOC_WDISP2_14,
RELOC_WDISP19,
RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */
RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */
/* 29K relocation types */
RELOC_JUMPTARG,
RELOC_CONST,
RELOC_CONSTH,
/* Q .
What are the other ones,
Since this is a clean slate, can we throw away the ones we dont
understand ? Should we sort the values ? What about using a
microcode format like the 68k ?
*/
NO_RELOC
};
struct reloc_internal {
bfd_vma r_address; /* offset of of data to relocate */
long r_index; /* symbol table index of symbol */
enum reloc_type r_type; /* relocation type */
bfd_vma r_addend; /* datum addend */
};
/* Q.
Should the length of the string table be 4 bytes or 8 bytes ?
Q.
What about archive indexes ?
*/
#endif /* __A_OUT_64_H__ */

View file

@ -0,0 +1,32 @@
/* archive file definition for GNU software */
/* So far this is correct for BSDish archives. Don't forget that
files must begin on an even byte boundary. */
#ifndef __GNU_AR_H__
#define __GNU_AR_H__
#define ARMAG "!<arch>\n" /* For COFF and a.out archives */
#define ARMAGB "!<bout>\n" /* For b.out archives */
#define SARMAG 8
#define ARFMAG "`\n"
/* The ar_date field of the armap (__.SYMDEF) member of an archive
must be greater than the modified date of the entire file, or
BSD-derived linkers complain. We originally write the ar_date with
this offset from the real file's mod-time. After finishing the
file, we rewrite ar_date if it's not still greater than the mod date. */
#define ARMAP_TIME_OFFSET 60
struct ar_hdr {
char ar_name[16]; /* name of this member */
char ar_date[12]; /* file mtime */
char ar_uid[6]; /* owner uid; printed as decimal */
char ar_gid[6]; /* owner gid; printed as decimal */
char ar_mode[8]; /* file mode, printed as octal */
char ar_size[10]; /* file size, printed as decimal */
char ar_fmag[2]; /* should contain ARFMAG */
};
#endif /* __GNU_AR_H__ */

View file

@ -0,0 +1,62 @@
/* ranlib.h -- archive library index member definition for GNU.
Copyright 1990-1991 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* The Symdef member of an archive contains two things:
a table that maps symbol-string offsets to file offsets,
and a symbol-string table. All the symbol names are
run together (each with trailing null) in the symbol-string
table. There is a single longword bytecount on the front
of each of these tables. Thus if we have two symbols,
"foo" and "_bar", that are in archive members at offsets
200 and 900, it would look like this:
16 ; byte count of index table
0 ; offset of "foo" in string table
200 ; offset of foo-module in file
4 ; offset of "bar" in string table
900 ; offset of bar-module in file
9 ; byte count of string table
"foo\0_bar\0" ; string table */
#define RANLIBMAG "__.SYMDEF" /* Archive file name containing index */
#define RANLIBSKEW 3 /* Creation time offset */
/* Format of __.SYMDEF:
First, a longword containing the size of the 'symdef' data that follows.
Second, zero or more 'symdef' structures.
Third, a longword containing the length of symbol name strings.
Fourth, zero or more symbol name strings (each followed by a null). */
struct symdef
{
union
{
unsigned long string_offset; /* In the file */
char *name; /* In memory, sometimes */
} s;
/* this points to the front of the file header (AKA member header --
a struct ar_hdr), not to the front of the file or into the file).
in other words it only tells you which file to read */
unsigned long file_offset;
};
/* Compatability with BSD code */
#define ranlib symdef
#define ran_un s
#define ran_strx string_offset
#define ran_name name
#define ran_off file_offset

View file

@ -0,0 +1,264 @@
/* Table of DBX symbol codes for the GNU system.
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* New stab from Solaris 2. This uses an n_type of 0, which in a.out files
overlaps the N_UNDF used for ordinary symbols. In ELF files, the
debug information is in a different file section, so there is no conflict.
This symbol's n_value gives the size of the string section associated
with this file. The symbol's n_strx (relative to the just-updated
string section start address) gives the name of the source file,
e.g. "foo.c", without any path information. The symbol's n_desc gives
the count of upcoming symbols associated with this file (not including
this one). */
/* __define_stab (N_UNDF, 0x00, "UNDF") */
/* Global variable. Only the name is significant.
To find the address, look in the corresponding external symbol. */
__define_stab (N_GSYM, 0x20, "GSYM")
/* Function name for BSD Fortran. Only the name is significant.
To find the address, look in the corresponding external symbol. */
__define_stab (N_FNAME, 0x22, "FNAME")
/* Function name or text-segment variable for C. Value is its address.
Desc is supposedly starting line number, but GCC doesn't set it
and DBX seems not to miss it. */
__define_stab (N_FUN, 0x24, "FUN")
/* Data-segment variable with internal linkage. Value is its address.
"Static Sym". */
__define_stab (N_STSYM, 0x26, "STSYM")
/* BSS-segment variable with internal linkage. Value is its address. */
__define_stab (N_LCSYM, 0x28, "LCSYM")
/* Name of main routine. Only the name is significant. */
__define_stab (N_MAIN, 0x2a, "MAIN")
/* Solaris2: Read-only data symbols. */
__define_stab (N_ROSYM, 0x2c, "ROSYM")
/* Global symbol in Pascal.
Supposedly the value is its line number; I'm skeptical. */
__define_stab (N_PC, 0x30, "PC")
/* Number of symbols: 0, files,,funcs,lines according to Ultrix V4.0. */
__define_stab (N_NSYMS, 0x32, "NSYMS")
/* "No DST map for sym: name, ,0,type,ignored" according to Ultrix V4.0. */
__define_stab (N_NOMAP, 0x34, "NOMAP")
/* New stab from Solaris 2. Like N_SO, but for the object file. Two in
a row provide the build directory and the relative path of the .o from it.
Solaris2 uses this to avoid putting the stabs info into the linked
executable; this stab goes into the ".stab.index" section, and the debugger
reads the real stabs directly from the .o files instead. */
__define_stab (N_OBJ, 0x38, "OBJ")
/* New stab from Solaris 2. Options for the debugger, related to the
source language for this module. E.g. whether to use ANSI
integral promotions or traditional integral promotions. */
__define_stab (N_OPT, 0x3c, "OPT")
/* Register variable. Value is number of register. */
__define_stab (N_RSYM, 0x40, "RSYM")
/* Modula-2 compilation unit. Can someone say what info it contains? */
__define_stab (N_M2C, 0x42, "M2C")
/* Line number in text segment. Desc is the line number;
value is corresponding address. On Solaris2, the line number is
relative to the start of the current function. */
__define_stab (N_SLINE, 0x44, "SLINE")
/* Similar, for data segment. */
__define_stab (N_DSLINE, 0x46, "DSLINE")
/* Similar, for bss segment. */
__define_stab (N_BSLINE, 0x48, "BSLINE")
/* Sun's source-code browser stabs. ?? Don't know what the fields are.
Supposedly the field is "path to associated .cb file". THIS VALUE
OVERLAPS WITH N_BSLINE! */
__define_stab (N_BROWS, 0x48, "BROWS")
/* GNU Modula-2 definition module dependency. Value is the modification time
of the definition file. Other is non-zero if it is imported with the
GNU M2 keyword %INITIALIZE. Perhaps N_M2C can be used if there
are enough empty fields? */
__define_stab(N_DEFD, 0x4a, "DEFD")
/* New in Solaris2. Function start/body/end line numbers. */
__define_stab(N_FLINE, 0x4C, "FLINE")
/* THE FOLLOWING TWO STAB VALUES CONFLICT. Happily, one is for Modula-2
and one is for C++. Still,... */
/* GNU C++ exception variable. Name is variable name. */
__define_stab (N_EHDECL, 0x50, "EHDECL")
/* Modula2 info "for imc": name,,0,0,0 according to Ultrix V4.0. */
__define_stab (N_MOD2, 0x50, "MOD2")
/* GNU C++ `catch' clause. Value is its address. Desc is nonzero if
this entry is immediately followed by a CAUGHT stab saying what exception
was caught. Multiple CAUGHT stabs means that multiple exceptions
can be caught here. If Desc is 0, it means all exceptions are caught
here. */
__define_stab (N_CATCH, 0x54, "CATCH")
/* Structure or union element. Value is offset in the structure. */
__define_stab (N_SSYM, 0x60, "SSYM")
/* Solaris2: Last stab emitted for module. */
__define_stab (N_ENDM, 0x62, "ENDM")
/* Name of main source file.
Value is starting text address of the compilation.
If multiple N_SO's appear, the first to contain a trailing / is the
compilation directory. The first to not contain a trailing / is the
source file name, relative to the compilation directory. Others (perhaps
resulting from cfront) are ignored.
On Solaris2, value is undefined, but desc is a source-language code. */
__define_stab (N_SO, 0x64, "SO")
/* Automatic variable in the stack. Value is offset from frame pointer.
Also used for type descriptions. */
__define_stab (N_LSYM, 0x80, "LSYM")
/* Beginning of an include file. Only Sun uses this.
In an object file, only the name is significant.
The Sun linker puts data into some of the other fields. */
__define_stab (N_BINCL, 0x82, "BINCL")
/* Name of sub-source file (#include file).
Value is starting text address of the compilation. */
__define_stab (N_SOL, 0x84, "SOL")
/* Parameter variable. Value is offset from argument pointer.
(On most machines the argument pointer is the same as the frame pointer. */
__define_stab (N_PSYM, 0xa0, "PSYM")
/* End of an include file. No name.
This and N_BINCL act as brackets around the file's output.
In an object file, there is no significant data in this entry.
The Sun linker puts data into some of the fields. */
__define_stab (N_EINCL, 0xa2, "EINCL")
/* Alternate entry point. Value is its address. */
__define_stab (N_ENTRY, 0xa4, "ENTRY")
/* Beginning of lexical block.
The desc is the nesting level in lexical blocks.
The value is the address of the start of the text for the block.
The variables declared inside the block *precede* the N_LBRAC symbol.
On Solaris2, the value is relative to the start of the current function. */
__define_stab (N_LBRAC, 0xc0, "LBRAC")
/* Place holder for deleted include file. Replaces a N_BINCL and everything
up to the corresponding N_EINCL. The Sun linker generates these when
it finds multiple identical copies of the symbols from an include file.
This appears only in output from the Sun linker. */
__define_stab (N_EXCL, 0xc2, "EXCL")
/* Modula-2 scope information. Can someone say what info it contains? */
__define_stab (N_SCOPE, 0xc4, "SCOPE")
/* End of a lexical block. Desc matches the N_LBRAC's desc.
The value is the address of the end of the text for the block.
On Solaris2, the value is relative to the start of the current function. */
__define_stab (N_RBRAC, 0xe0, "RBRAC")
/* Begin named common block. Only the name is significant. */
__define_stab (N_BCOMM, 0xe2, "BCOMM")
/* End named common block. Only the name is significant
(and it should match the N_BCOMM). */
__define_stab (N_ECOMM, 0xe4, "ECOMM")
/* Member of a common block; value is offset within the common block.
This should occur within a BCOMM/ECOMM pair. */
__define_stab (N_ECOML, 0xe8, "ECOML")
/* Solaris2: Pascal "with" statement: type,,0,0,offset */
__define_stab (N_WITH, 0xea, "WITH")
/* These STAB's are used on Gould systems for Non-Base register symbols
or something like that. FIXME. I have assigned the values at random
since I don't have a Gould here. Fixups from Gould folk welcome... */
__define_stab (N_NBTEXT, 0xF0, "NBTEXT")
__define_stab (N_NBDATA, 0xF2, "NBDATA")
__define_stab (N_NBBSS, 0xF4, "NBBSS")
__define_stab (N_NBSTS, 0xF6, "NBSTS")
__define_stab (N_NBLCS, 0xF8, "NBLCS")
/* Second symbol entry containing a length-value for the preceding entry.
The value is the length. */
__define_stab (N_LENG, 0xfe, "LENG")
/* The above information, in matrix format.
STAB MATRIX
_________________________________________________
| 00 - 1F are not dbx stab symbols |
| In most cases, the low bit is the EXTernal bit|
| 00 UNDEF | 02 ABS | 04 TEXT | 06 DATA |
| 01 |EXT | 03 |EXT | 05 |EXT | 07 |EXT |
| 08 BSS | 0A INDR | 0C FN_SEQ | 0E |
| 09 |EXT | 0B | 0D | 0F |
| 10 | 12 COMM | 14 SETA | 16 SETT |
| 11 | 13 | 15 | 17 |
| 18 SETD | 1A SETB | 1C SETV | 1E WARNING|
| 19 | 1B | 1D | 1F FN |
|_______________________________________________|
| Debug entries with bit 01 set are unused. |
| 20 GSYM | 22 FNAME | 24 FUN | 26 STSYM |
| 28 LCSYM | 2A MAIN | 2C ROSYM | 2E |
| 30 PC | 32 NSYMS | 34 NOMAP | 36 |
| 38 OBJ | 3A | 3C OPT | 3E |
| 40 RSYM | 42 M2C | 44 SLINE | 46 DSLINE |
| 48 BSLINE*| 4A DEFD | 4C FLINE | 4E |
| 50 EHDECL*| 52 | 54 CATCH | 56 |
| 58 | 5A | 5C | 5E |
| 60 SSYM | 62 ENDM | 64 SO | 66 |
| 68 | 6A | 6C | 6E |
| 70 | 72 | 74 | 76 |
| 78 | 7A | 7C | 7E |
| 80 LSYM | 82 BINCL | 84 SOL | 86 |
| 88 | 8A | 8C | 8E |
| 90 | 92 | 94 | 96 |
| 98 | 9A | 9C | 9E |
| A0 PSYM | A2 EINCL | A4 ENTRY | A6 |
| A8 | AA | AC | AE |
| B0 | B2 | B4 | B6 |
| B8 | BA | BC | BE |
| C0 LBRAC | C2 EXCL | C4 SCOPE | C6 |
| C8 | CA | CC | CE |
| D0 | D2 | D4 | D6 |
| D8 | DA | DC | DE |
| E0 RBRAC | E2 BCOMM | E4 ECOMM | E6 |
| E8 ECOML | EA WITH | EC | EE |
| F0 | F2 | F4 | F6 |
| F8 | FA | FC | FE LENG |
+-----------------------------------------------+
* 50 EHDECL is also MOD2.
* 48 BSLINE is also BROWS.
*/

View file

@ -0,0 +1,36 @@
#ifndef __GNU_STAB__
/* Indicate the GNU stab.h is in use. */
#define __GNU_STAB__
#define __define_stab(NAME, CODE, STRING) NAME=CODE,
enum __stab_debug_code
{
#include "aout/stab.def"
LAST_UNUSED_STAB_CODE
};
#undef __define_stab
/* Definitions of "desc" field for N_SO stabs in Solaris2. */
#define N_SO_AS 1
#define N_SO_C 2
#define N_SO_ANSI_C 3
#define N_SO_CC 4 /* C++ */
#define N_SO_FORTRAN 5
#define N_SO_PASCAL 6
/* Solaris2: Floating point type values in basic types. */
#define NF_NONE 0
#define NF_SINGLE 1 /* IEEE 32-bit */
#define NF_DOUBLE 2 /* IEEE 64-bit */
#define NF_COMPLEX 3 /* Fortran complex */
#define NF_COMPLEX16 4 /* Fortran double complex */
#define NF_COMPLEX32 5 /* Fortran complex*16 */
#define NF_LDOUBLE 6 /* Long double (whatever that is) */
#endif /* __GNU_STAB_ */

View file

@ -0,0 +1,821 @@
/* Get info from stack frames;
convert between frames, blocks, functions and pc values.
Copyright 1986, 1987, 1988, 1989, 1991 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "symtab.h"
#include "bfd.h"
#include "symfile.h"
#include "objfiles.h"
#include "frame.h"
#include "gdbcore.h"
#include "value.h" /* for read_register */
#include "target.h" /* for target_has_stack */
#include "inferior.h" /* for read_pc */
/* Is ADDR inside the startup file? Note that if your machine
has a way to detect the bottom of the stack, there is no need
to call this function from FRAME_CHAIN_VALID; the reason for
doing so is that some machines have no way of detecting bottom
of stack.
A PC of zero is always considered to be the bottom of the stack. */
int
inside_entry_file (addr)
CORE_ADDR addr;
{
if (addr == 0)
return 1;
if (symfile_objfile == 0)
return 0;
#if CALL_DUMMY_LOCATION == AT_ENTRY_POINT
/* Do not stop backtracing if the pc is in the call dummy
at the entry point. */
if (PC_IN_CALL_DUMMY (addr, 0, 0))
return 0;
#endif
return (addr >= symfile_objfile -> ei.entry_file_lowpc &&
addr < symfile_objfile -> ei.entry_file_highpc);
}
/* Test a specified PC value to see if it is in the range of addresses
that correspond to the main() function. See comments above for why
we might want to do this.
Typically called from FRAME_CHAIN_VALID.
A PC of zero is always considered to be the bottom of the stack. */
int
inside_main_func (pc)
CORE_ADDR pc;
{
if (pc == 0)
return 1;
if (symfile_objfile == 0)
return 0;
return (symfile_objfile -> ei.main_func_lowpc <= pc &&
symfile_objfile -> ei.main_func_highpc > pc);
}
/* Test a specified PC value to see if it is in the range of addresses
that correspond to the process entry point function. See comments
in objfiles.h for why we might want to do this.
Typically called from FRAME_CHAIN_VALID.
A PC of zero is always considered to be the bottom of the stack. */
int
inside_entry_func (pc)
CORE_ADDR pc;
{
if (pc == 0)
return 1;
if (symfile_objfile == 0)
return 0;
#if CALL_DUMMY_LOCATION == AT_ENTRY_POINT
/* Do not stop backtracing if the pc is in the call dummy
at the entry point. */
if (PC_IN_CALL_DUMMY (pc, 0, 0))
return 0;
#endif
return (symfile_objfile -> ei.entry_func_lowpc <= pc &&
symfile_objfile -> ei.entry_func_highpc > pc);
}
/* Address of innermost stack frame (contents of FP register) */
static FRAME current_frame;
/*
* Cache for frame addresses already read by gdb. Valid only while
* inferior is stopped. Control variables for the frame cache should
* be local to this module.
*/
struct obstack frame_cache_obstack;
/* Return the innermost (currently executing) stack frame. */
FRAME
get_current_frame ()
{
/* We assume its address is kept in a general register;
param.h says which register. */
return current_frame;
}
void
set_current_frame (frame)
FRAME frame;
{
current_frame = frame;
}
FRAME
create_new_frame (addr, pc)
FRAME_ADDR addr;
CORE_ADDR pc;
{
struct frame_info *fci; /* Same type as FRAME */
char *name;
fci = (struct frame_info *)
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_info));
/* Arbitrary frame */
fci->next = (struct frame_info *) 0;
fci->prev = (struct frame_info *) 0;
fci->frame = addr;
fci->pc = pc;
find_pc_partial_function (pc, &name, (CORE_ADDR *)NULL,(CORE_ADDR *)NULL);
fci->signal_handler_caller = IN_SIGTRAMP (fci->pc, name);
#ifdef INIT_EXTRA_FRAME_INFO
INIT_EXTRA_FRAME_INFO (0, fci);
#endif
return fci;
}
/* Return the frame that called FRAME.
If FRAME is the original frame (it has no caller), return 0. */
FRAME
get_prev_frame (frame)
FRAME frame;
{
/* We're allowed to know that FRAME and "struct frame_info *" are
the same */
return get_prev_frame_info (frame);
}
/* Return the frame that FRAME calls (0 if FRAME is the innermost
frame). */
FRAME
get_next_frame (frame)
FRAME frame;
{
/* We're allowed to know that FRAME and "struct frame_info *" are
the same */
return frame->next;
}
/*
* Flush the entire frame cache.
*/
void
flush_cached_frames ()
{
/* Since we can't really be sure what the first object allocated was */
obstack_free (&frame_cache_obstack, 0);
obstack_init (&frame_cache_obstack);
current_frame = (struct frame_info *) 0; /* Invalidate cache */
}
/* Flush the frame cache, and start a new one if necessary. */
void
reinit_frame_cache ()
{
flush_cached_frames ();
if (target_has_stack)
{
set_current_frame (create_new_frame (read_fp (), read_pc ()));
select_frame (get_current_frame (), 0);
}
else
{
set_current_frame (0);
select_frame ((FRAME) 0, -1);
}
}
/* Return a structure containing various interesting information
about a specified stack frame. */
/* How do I justify including this function? Well, the FRAME
identifier format has gone through several changes recently, and
it's not completely inconceivable that it could happen again. If
it does, have this routine around will help */
struct frame_info *
get_frame_info (frame)
FRAME frame;
{
return frame;
}
/* If a machine allows frameless functions, it should define a macro
FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) in param.h. FI is the struct
frame_info for the frame, and FRAMELESS should be set to nonzero
if it represents a frameless function invocation. */
/* Return nonzero if the function for this frame lacks a prologue. Many
machines can define FRAMELESS_FUNCTION_INVOCATION to just call this
function. */
int
frameless_look_for_prologue (frame)
FRAME frame;
{
CORE_ADDR func_start, after_prologue;
func_start = (get_pc_function_start (frame->pc) +
FUNCTION_START_OFFSET);
if (func_start)
{
after_prologue = func_start;
#ifdef SKIP_PROLOGUE_FRAMELESS_P
/* This is faster, since only care whether there *is* a prologue,
not how long it is. */
SKIP_PROLOGUE_FRAMELESS_P (after_prologue);
#else
SKIP_PROLOGUE (after_prologue);
#endif
return after_prologue == func_start;
}
else
/* If we can't find the start of the function, we don't really
know whether the function is frameless, but we should be able
to get a reasonable (i.e. best we can do under the
circumstances) backtrace by saying that it isn't. */
return 0;
}
/* Default a few macros that people seldom redefine. */
#if !defined (INIT_FRAME_PC)
#define INIT_FRAME_PC(fromleaf, prev) \
prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
#endif
#ifndef FRAME_CHAIN_COMBINE
#define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
#endif
/* Return a structure containing various interesting information
about the frame that called NEXT_FRAME. Returns NULL
if there is no such frame. */
struct frame_info *
get_prev_frame_info (next_frame)
FRAME next_frame;
{
FRAME_ADDR address = 0;
struct frame_info *prev;
int fromleaf = 0;
char *name;
/* If the requested entry is in the cache, return it.
Otherwise, figure out what the address should be for the entry
we're about to add to the cache. */
if (!next_frame)
{
#if 0
/* This screws value_of_variable, which just wants a nice clean
NULL return from block_innermost_frame if there are no frames.
I don't think I've ever seen this message happen otherwise.
And returning NULL here is a perfectly legitimate thing to do. */
if (!current_frame)
{
error ("You haven't set up a process's stack to examine.");
}
#endif
return current_frame;
}
/* If we have the prev one, return it */
if (next_frame->prev)
return next_frame->prev;
/* On some machines it is possible to call a function without
setting up a stack frame for it. On these machines, we
define this macro to take two args; a frameinfo pointer
identifying a frame and a variable to set or clear if it is
or isn't leafless. */
#ifdef FRAMELESS_FUNCTION_INVOCATION
/* Still don't want to worry about this except on the innermost
frame. This macro will set FROMLEAF if NEXT_FRAME is a
frameless function invocation. */
if (!(next_frame->next))
{
FRAMELESS_FUNCTION_INVOCATION (next_frame, fromleaf);
if (fromleaf)
address = next_frame->frame;
}
#endif
if (!fromleaf)
{
/* Two macros defined in tm.h specify the machine-dependent
actions to be performed here.
First, get the frame's chain-pointer.
If that is zero, the frame is the outermost frame or a leaf
called by the outermost frame. This means that if start
calls main without a frame, we'll return 0 (which is fine
anyway).
Nope; there's a problem. This also returns when the current
routine is a leaf of main. This is unacceptable. We move
this to after the ffi test; I'd rather have backtraces from
start go curfluy than have an abort called from main not show
main. */
address = FRAME_CHAIN (next_frame);
if (!FRAME_CHAIN_VALID (address, next_frame))
return 0;
address = FRAME_CHAIN_COMBINE (address, next_frame);
}
if (address == 0)
return 0;
prev = (struct frame_info *)
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_info));
if (next_frame)
next_frame->prev = prev;
prev->next = next_frame;
prev->prev = (struct frame_info *) 0;
prev->frame = address;
prev->signal_handler_caller = 0;
/* This change should not be needed, FIXME! We should
determine whether any targets *need* INIT_FRAME_PC to happen
after INIT_EXTRA_FRAME_INFO and come up with a simple way to
express what goes on here.
INIT_EXTRA_FRAME_INFO is called from two places: create_new_frame
(where the PC is already set up) and here (where it isn't).
INIT_FRAME_PC is only called from here, always after
INIT_EXTRA_FRAME_INFO.
The catch is the MIPS, where INIT_EXTRA_FRAME_INFO requires the PC
value (which hasn't been set yet). Some other machines appear to
require INIT_EXTRA_FRAME_INFO before they can do INIT_FRAME_PC. Phoo.
We shouldn't need INIT_FRAME_PC_FIRST to add more complication to
an already overcomplicated part of GDB. gnu@cygnus.com, 15Sep92.
To answer the question, yes the sparc needs INIT_FRAME_PC after
INIT_EXTRA_FRAME_INFO. Suggested scheme:
SETUP_INNERMOST_FRAME()
Default version is just create_new_frame (read_fp ()),
read_pc ()). Machines with extra frame info would do that (or the
local equivalent) and then set the extra fields.
SETUP_ARBITRARY_FRAME(argc, argv)
Only change here is that create_new_frame would no longer init extra
frame info; SETUP_ARBITRARY_FRAME would have to do that.
INIT_PREV_FRAME(fromleaf, prev)
Replace INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC.
std_frame_pc(fromleaf, prev)
This is the default setting for INIT_PREV_FRAME. It just does what
the default INIT_FRAME_PC does. Some machines will call it from
INIT_PREV_FRAME (either at the beginning, the end, or in the middle).
Some machines won't use it.
kingdon@cygnus.com, 13Apr93. */
#ifdef INIT_FRAME_PC_FIRST
INIT_FRAME_PC_FIRST (fromleaf, prev);
#endif
#ifdef INIT_EXTRA_FRAME_INFO
INIT_EXTRA_FRAME_INFO(fromleaf, prev);
#endif
/* This entry is in the frame queue now, which is good since
FRAME_SAVED_PC may use that queue to figure out it's value
(see tm-sparc.h). We want the pc saved in the inferior frame. */
INIT_FRAME_PC(fromleaf, prev);
find_pc_partial_function (prev->pc, &name,
(CORE_ADDR *)NULL,(CORE_ADDR *)NULL);
if (IN_SIGTRAMP (prev->pc, name))
prev->signal_handler_caller = 1;
return prev;
}
CORE_ADDR
get_frame_pc (frame)
FRAME frame;
{
struct frame_info *fi;
fi = get_frame_info (frame);
return fi->pc;
}
#if defined (FRAME_FIND_SAVED_REGS)
/* Find the addresses in which registers are saved in FRAME. */
void
get_frame_saved_regs (frame_info_addr, saved_regs_addr)
struct frame_info *frame_info_addr;
struct frame_saved_regs *saved_regs_addr;
{
FRAME_FIND_SAVED_REGS (frame_info_addr, *saved_regs_addr);
}
#endif
/* Return the innermost lexical block in execution
in a specified stack frame. The frame address is assumed valid. */
struct block *
get_frame_block (frame)
FRAME frame;
{
struct frame_info *fi;
CORE_ADDR pc;
fi = get_frame_info (frame);
pc = fi->pc;
if (fi->next != 0 && fi->next->signal_handler_caller == 0)
/* We are not in the innermost frame and we were not interrupted
by a signal. We need to subtract one to get the correct block,
in case the call instruction was the last instruction of the block.
If there are any machines on which the saved pc does not point to
after the call insn, we probably want to make fi->pc point after
the call insn anyway. */
--pc;
return block_for_pc (pc);
}
struct block *
get_current_block ()
{
return block_for_pc (read_pc ());
}
CORE_ADDR
get_pc_function_start (pc)
CORE_ADDR pc;
{
register struct block *bl;
register struct symbol *symbol;
register struct minimal_symbol *msymbol;
CORE_ADDR fstart;
if ((bl = block_for_pc (pc)) != NULL &&
(symbol = block_function (bl)) != NULL)
{
bl = SYMBOL_BLOCK_VALUE (symbol);
fstart = BLOCK_START (bl);
}
else if ((msymbol = lookup_minimal_symbol_by_pc (pc)) != NULL)
{
fstart = SYMBOL_VALUE_ADDRESS (msymbol);
}
else
{
fstart = 0;
}
return (fstart);
}
/* Return the symbol for the function executing in frame FRAME. */
struct symbol *
get_frame_function (frame)
FRAME frame;
{
register struct block *bl = get_frame_block (frame);
if (bl == 0)
return 0;
return block_function (bl);
}
/* Return the blockvector immediately containing the innermost lexical block
containing the specified pc value, or 0 if there is none.
PINDEX is a pointer to the index value of the block. If PINDEX
is NULL, we don't pass this information back to the caller. */
struct blockvector *
blockvector_for_pc (pc, pindex)
register CORE_ADDR pc;
int *pindex;
{
register struct block *b;
register int bot, top, half;
register struct symtab *s;
struct blockvector *bl;
/* First search all symtabs for one whose file contains our pc */
s = find_pc_symtab (pc);
if (s == 0)
return 0;
bl = BLOCKVECTOR (s);
b = BLOCKVECTOR_BLOCK (bl, 0);
/* Then search that symtab for the smallest block that wins. */
/* Use binary search to find the last block that starts before PC. */
bot = 0;
top = BLOCKVECTOR_NBLOCKS (bl);
while (top - bot > 1)
{
half = (top - bot + 1) >> 1;
b = BLOCKVECTOR_BLOCK (bl, bot + half);
if (BLOCK_START (b) <= pc)
bot += half;
else
top = bot + half;
}
/* Now search backward for a block that ends after PC. */
while (bot >= 0)
{
b = BLOCKVECTOR_BLOCK (bl, bot);
if (BLOCK_END (b) > pc)
{
if (pindex)
*pindex = bot;
return bl;
}
bot--;
}
return 0;
}
/* Return the innermost lexical block containing the specified pc value,
or 0 if there is none. */
struct block *
block_for_pc (pc)
register CORE_ADDR pc;
{
register struct blockvector *bl;
int index;
bl = blockvector_for_pc (pc, &index);
if (bl)
return BLOCKVECTOR_BLOCK (bl, index);
return 0;
}
/* Return the function containing pc value PC.
Returns 0 if function is not known. */
struct symbol *
find_pc_function (pc)
CORE_ADDR pc;
{
register struct block *b = block_for_pc (pc);
if (b == 0)
return 0;
return block_function (b);
}
/* These variables are used to cache the most recent result
* of find_pc_partial_function. */
static CORE_ADDR cache_pc_function_low = 0;
static CORE_ADDR cache_pc_function_high = 0;
static char *cache_pc_function_name = 0;
/* Clear cache, e.g. when symbol table is discarded. */
void
clear_pc_function_cache()
{
cache_pc_function_low = 0;
cache_pc_function_high = 0;
cache_pc_function_name = (char *)0;
}
/* Finds the "function" (text symbol) that is smaller than PC but
greatest of all of the potential text symbols. Sets *NAME and/or
*ADDRESS conditionally if that pointer is non-null. If ENDADDR is
non-null, then set *ENDADDR to be the end of the function
(exclusive), but passing ENDADDR as non-null means that the
function might cause symbols to be read. This function either
succeeds or fails (not halfway succeeds). If it succeeds, it sets
*NAME, *ADDRESS, and *ENDADDR to real information and returns 1.
If it fails, it sets *NAME, *ADDRESS, and *ENDADDR to zero
and returns 0. */
int
find_pc_partial_function (pc, name, address, endaddr)
CORE_ADDR pc;
char **name;
CORE_ADDR *address;
CORE_ADDR *endaddr;
{
struct partial_symtab *pst;
struct symbol *f;
struct minimal_symbol *msymbol;
struct partial_symbol *psb;
struct obj_section *sec;
if (pc >= cache_pc_function_low && pc < cache_pc_function_high)
goto return_cached_value;
/* If sigtramp is in the u area, it counts as a function (especially
important for step_1). */
#if defined SIGTRAMP_START
if (IN_SIGTRAMP (pc, (char *)NULL))
{
cache_pc_function_low = SIGTRAMP_START;
cache_pc_function_high = SIGTRAMP_END;
cache_pc_function_name = "<sigtramp>";
goto return_cached_value;
}
#endif
msymbol = lookup_minimal_symbol_by_pc (pc);
pst = find_pc_psymtab (pc);
if (pst)
{
/* Need to read the symbols to get a good value for the end address. */
if (endaddr != NULL && !pst->readin)
{
/* Need to get the terminal in case symbol-reading produces
output. */
target_terminal_ours_for_output ();
PSYMTAB_TO_SYMTAB (pst);
}
if (pst->readin)
{
/* Checking whether the msymbol has a larger value is for the
"pathological" case mentioned in print_frame_info. */
f = find_pc_function (pc);
if (f != NULL
&& (msymbol == NULL
|| (BLOCK_START (SYMBOL_BLOCK_VALUE (f))
>= SYMBOL_VALUE_ADDRESS (msymbol))))
{
cache_pc_function_low = BLOCK_START (SYMBOL_BLOCK_VALUE (f));
cache_pc_function_high = BLOCK_END (SYMBOL_BLOCK_VALUE (f));
cache_pc_function_name = SYMBOL_NAME (f);
goto return_cached_value;
}
}
else
{
/* Now that static symbols go in the minimal symbol table, perhaps
we could just ignore the partial symbols. But at least for now
we use the partial or minimal symbol, whichever is larger. */
psb = find_pc_psymbol (pst, pc);
if (psb
&& (msymbol == NULL ||
(SYMBOL_VALUE_ADDRESS (psb)
>= SYMBOL_VALUE_ADDRESS (msymbol))))
{
/* This case isn't being cached currently. */
if (address)
*address = SYMBOL_VALUE_ADDRESS (psb);
if (name)
*name = SYMBOL_NAME (psb);
/* endaddr non-NULL can't happen here. */
return 1;
}
}
}
/* Not in the normal symbol tables, see if the pc is in a known section.
If it's not, then give up. This ensures that anything beyond the end
of the text seg doesn't appear to be part of the last function in the
text segment. */
sec = find_pc_section (pc);
if (!sec)
msymbol = NULL;
/* Must be in the minimal symbol table. */
if (msymbol == NULL)
{
/* No available symbol. */
if (name != NULL)
*name = 0;
if (address != NULL)
*address = 0;
if (endaddr != NULL)
*endaddr = 0;
return 0;
}
/* See if we're in a transfer table for Sun shared libs. */
if (msymbol -> type == mst_text)
cache_pc_function_low = SYMBOL_VALUE_ADDRESS (msymbol);
else
/* It is a transfer table for Sun shared libraries. */
cache_pc_function_low = pc - FUNCTION_START_OFFSET;
cache_pc_function_name = SYMBOL_NAME (msymbol);
/* Use the lesser of the next minimal symbol, or the end of the section, as
the end of the function. */
if (SYMBOL_NAME (msymbol + 1) != NULL
&& SYMBOL_VALUE_ADDRESS (msymbol + 1) < sec->endaddr)
cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + 1);
else
/* We got the start address from the last msymbol in the objfile.
So the end address is the end of the section. */
cache_pc_function_high = sec->endaddr;
return_cached_value:
if (address)
*address = cache_pc_function_low;
if (name)
*name = cache_pc_function_name;
if (endaddr)
*endaddr = cache_pc_function_high;
return 1;
}
/* Return the innermost stack frame executing inside of BLOCK,
or NULL if there is no such frame. If BLOCK is NULL, just return NULL. */
FRAME
block_innermost_frame (block)
struct block *block;
{
struct frame_info *fi;
register FRAME frame;
register CORE_ADDR start;
register CORE_ADDR end;
if (block == NULL)
return NULL;
start = BLOCK_START (block);
end = BLOCK_END (block);
frame = 0;
while (1)
{
frame = get_prev_frame (frame);
if (frame == 0)
return 0;
fi = get_frame_info (frame);
if (fi->pc >= start && fi->pc < end)
return frame;
}
}
#ifdef SIGCONTEXT_PC_OFFSET
/* Get saved user PC for sigtramp from sigcontext for BSD style sigtramp. */
CORE_ADDR
sigtramp_saved_pc (frame)
FRAME frame;
{
CORE_ADDR sigcontext_addr;
char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
int ptrbytes = TARGET_PTR_BIT / TARGET_CHAR_BIT;
int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT;
/* Get sigcontext address, it is the third parameter on the stack. */
if (frame->next)
sigcontext_addr = read_memory_integer (FRAME_ARGS_ADDRESS (frame->next)
+ FRAME_ARGS_SKIP + sigcontext_offs,
ptrbytes);
else
sigcontext_addr = read_memory_integer (read_register (SP_REGNUM)
+ sigcontext_offs,
ptrbytes);
/* Don't cause a memory_error when accessing sigcontext in case the stack
layout has changed or the stack is corrupt. */
target_read_memory (sigcontext_addr + SIGCONTEXT_PC_OFFSET, buf, ptrbytes);
return extract_unsigned_integer (buf, ptrbytes);
}
#endif /* SIGCONTEXT_PC_OFFSET */
void
_initialize_blockframe ()
{
obstack_init (&frame_cache_obstack);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,372 @@
/* Data structures associated with breakpoints in GDB.
Copyright (C) 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (BREAKPOINT_H)
#define BREAKPOINT_H 1
#include "frame.h"
#include "value.h"
/* This is the maximum number of bytes a breakpoint instruction can take.
Feel free to increase it. It's just used in a few places to size
arrays that should be independent of the target architecture. */
#define BREAKPOINT_MAX 16
/* Type of breakpoint. */
/* FIXME In the future, we should fold all other breakpoint-like things into
here. This includes:
* single-step (for machines where we have to simulate single stepping)
(probably, though perhaps it is better for it to look as much as
possible like a single-step to wait_for_inferior). */
enum bptype {
bp_breakpoint, /* Normal breakpoint */
bp_until, /* used by until command */
bp_finish, /* used by finish command */
bp_watchpoint, /* Watchpoint */
bp_longjmp, /* secret breakpoint to find longjmp() */
bp_longjmp_resume, /* secret breakpoint to escape longjmp() */
/* Used by wait_for_inferior for stepping over subroutine calls, for
stepping over signal handlers, and for skipping prologues. */
bp_step_resume,
/* The breakpoint at the end of a call dummy. */
/* FIXME: What if the function we are calling longjmp()s out of the
call, or the user gets out with the "return" command? We currently
have no way of cleaning up the breakpoint in these (obscure) situations.
(Probably can solve this by noticing longjmp, "return", etc., it's
similar to noticing when a watchpoint on a local variable goes out
of scope (with hardware support for watchpoints)). */
bp_call_dummy
};
/* States of enablement of breakpoint. */
enum enable { disabled, enabled};
/* Disposition of breakpoint. Ie: what to do after hitting it. */
enum bpdisp {
delete, /* Delete it */
disable, /* Disable it */
donttouch /* Leave it alone */
};
/* Note that the ->silent field is not currently used by any commands
(though the code is in there if it was to be, and set_raw_breakpoint
does set it to 0). I implemented it because I thought it would be
useful for a hack I had to put in; I'm going to leave it in because
I can see how there might be times when it would indeed be useful */
/* This is for a breakpoint or a watchpoint. */
struct breakpoint
{
struct breakpoint *next;
/* Type of breakpoint. */
enum bptype type;
/* Zero means disabled; remember the info but don't break here. */
enum enable enable;
/* What to do with this breakpoint after we hit it. */
enum bpdisp disposition;
/* Number assigned to distinguish breakpoints. */
int number;
/* Address to break at, or NULL if not a breakpoint. */
CORE_ADDR address;
/* Line number of this address. Only matters if address is
non-NULL. */
int line_number;
/* Source file name of this address. Only matters if address is
non-NULL. */
char *source_file;
/* Non-zero means a silent breakpoint (don't print frame info
if we stop here). */
unsigned char silent;
/* Number of stops at this breakpoint that should
be continued automatically before really stopping. */
int ignore_count;
/* "Real" contents of byte where breakpoint has been inserted.
Valid only when breakpoints are in the program. Under the complete
control of the target insert_breakpoint and remove_breakpoint routines.
No other code should assume anything about the value(s) here. */
char shadow_contents[BREAKPOINT_MAX];
/* Nonzero if this breakpoint is now inserted. Only matters if address
is non-NULL. */
char inserted;
/* Nonzero if this is not the first breakpoint in the list
for the given address. Only matters if address is non-NULL. */
char duplicate;
/* Chain of command lines to execute when this breakpoint is hit. */
struct command_line *commands;
/* Stack depth (address of frame). If nonzero, break only if fp
equals this. */
FRAME_ADDR frame;
/* Conditional. Break only if this expression's value is nonzero. */
struct expression *cond;
/* String we used to set the breakpoint (malloc'd). Only matters if
address is non-NULL. */
char *addr_string;
/* String form of the breakpoint condition (malloc'd), or NULL if there
is no condition. */
char *cond_string;
/* String form of exp (malloc'd), or NULL if none. */
char *exp_string;
/* The expression we are watching, or NULL if not a watchpoint. */
struct expression *exp;
/* The largest block within which it is valid, or NULL if it is
valid anywhere (e.g. consists just of global symbols). */
struct block *exp_valid_block;
/* Value of the watchpoint the last time we checked it. */
value val;
/* Thread number for thread-specific breakpoint, or -1 if don't care */
int thread;
};
/* The following stuff is an abstract data type "bpstat" ("breakpoint status").
This provides the ability to determine whether we have stopped at a
breakpoint, and what we should do about it. */
typedef struct bpstat *bpstat;
/* Interface: */
/* Clear a bpstat so that it says we are not at any breakpoint.
Also free any storage that is part of a bpstat. */
extern void bpstat_clear PARAMS ((bpstat *));
/* Return a copy of a bpstat. Like "bs1 = bs2" but all storage that
is part of the bpstat is copied as well. */
extern bpstat bpstat_copy PARAMS ((bpstat));
/* FIXME: prototypes uses equivalence between FRAME_ADDR and CORE_ADDR */
extern bpstat bpstat_stop_status PARAMS ((CORE_ADDR *, CORE_ADDR, int));
/* This bpstat_what stuff tells wait_for_inferior what to do with a
breakpoint (a challenging task). */
enum bpstat_what_main_action {
/* Perform various other tests; that is, this bpstat does not
say to perform any action (e.g. failed watchpoint and nothing
else). */
BPSTAT_WHAT_KEEP_CHECKING,
/* Rather than distinguish between noisy and silent stops here, it
might be cleaner to have bpstat_print make that decision (also
taking into account stop_print_frame and source_only). But the
implications are a bit scary (interaction with auto-displays, etc.),
so I won't try it. */
/* Stop silently. */
BPSTAT_WHAT_STOP_SILENT,
/* Stop and print. */
BPSTAT_WHAT_STOP_NOISY,
/* Remove breakpoints, single step once, then put them back in and
go back to what we were doing. It's possible that this should be
removed from the main_action and put into a separate field, to more
cleanly handle BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE. */
BPSTAT_WHAT_SINGLE,
/* Set longjmp_resume breakpoint, remove all other breakpoints,
and continue. The "remove all other breakpoints" part is required
if we are also stepping over another breakpoint as well as doing
the longjmp handling. */
BPSTAT_WHAT_SET_LONGJMP_RESUME,
/* Clear longjmp_resume breakpoint, then handle as
BPSTAT_WHAT_KEEP_CHECKING. */
BPSTAT_WHAT_CLEAR_LONGJMP_RESUME,
/* Clear longjmp_resume breakpoint, then handle as BPSTAT_WHAT_SINGLE. */
BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE,
/* This is just used to keep track of how many enums there are. */
BPSTAT_WHAT_LAST
};
struct bpstat_what {
enum bpstat_what_main_action main_action;
/* Did we hit the step resume breakpoint? This is separate from the
main_action to allow for it to be combined with any of the main
actions. */
int step_resume;
/* Did we hit a call dummy breakpoint? This only goes with a main_action
of BPSTAT_WHAT_STOP_SILENT or BPSTAT_WHAT_STOP_NOISY (the concept of
continuing from a call dummy without popping the frame is not a
useful one). */
int call_dummy;
};
/* Tell what to do about this bpstat. */
struct bpstat_what bpstat_what PARAMS ((bpstat));
/* Find the bpstat associated with a breakpoint. NULL otherwise. */
bpstat bpstat_find_breakpoint PARAMS ((bpstat, struct breakpoint *));
/* Nonzero if a signal that we got in wait() was due to circumstances
explained by the BS. */
/* Currently that is true if we have hit a breakpoint, or if there is
a watchpoint enabled. */
#define bpstat_explains_signal(bs) ((bs) != NULL)
/* Nonzero if we should step constantly (e.g. watchpoints on machines
without hardware support). This isn't related to a specific bpstat,
just to things like whether watchpoints are set. */
extern int bpstat_should_step PARAMS ((void));
/* Print a message indicating what happened. Returns nonzero to
say that only the source line should be printed after this (zero
return means print the frame as well as the source line). */
extern int bpstat_print PARAMS ((bpstat));
/* Return the breakpoint number of the first breakpoint we are stopped
at. *BSP upon return is a bpstat which points to the remaining
breakpoints stopped at (but which is not guaranteed to be good for
anything but further calls to bpstat_num).
Return 0 if passed a bpstat which does not indicate any breakpoints. */
extern int bpstat_num PARAMS ((bpstat *));
/* Perform actions associated with having stopped at *BSP. Actually, we just
use this for breakpoint commands. Perhaps other actions will go here
later, but this is executed at a late time (from the command loop). */
extern void bpstat_do_actions PARAMS ((bpstat *));
/* Modify BS so that the actions will not be performed. */
extern void bpstat_clear_actions PARAMS ((bpstat));
/* Implementation: */
struct bpstat
{
/* Linked list because there can be two breakpoints at the
same place, and a bpstat reflects the fact that both have been hit. */
bpstat next;
/* Breakpoint that we are at. */
struct breakpoint *breakpoint_at;
/* Commands left to be done. */
struct command_line *commands;
/* Old value associated with a watchpoint. */
value old_val;
/* Nonzero if this breakpoint tells us to print the frame. */
char print;
/* Nonzero if this breakpoint tells us to stop. */
char stop;
/* Function called by bpstat_print to print stuff associated with
this element of the bpstat chain. Returns 0 or 1 just like
bpstat_print, or -1 if it can't deal with it. */
int (*print_it) PARAMS((bpstat bs));
};
/* Prototypes for breakpoint-related functions. */
#ifdef __STDC__ /* Forward declarations for prototypes */
struct frame_info;
#endif
extern int
breakpoint_here_p PARAMS ((CORE_ADDR));
extern int
breakpoint_thread_match PARAMS ((CORE_ADDR, int));
extern void
until_break_command PARAMS ((char *, int));
extern void
breakpoint_re_set PARAMS ((void));
extern void
clear_momentary_breakpoints PARAMS ((void));
/* FIXME: Prototype uses equivalence of "struct frame_info *" and FRAME */
extern struct breakpoint *
set_momentary_breakpoint PARAMS ((struct symtab_and_line,
struct frame_info *,
enum bptype));
extern void
set_ignore_count PARAMS ((int, int, int));
extern void
set_default_breakpoint PARAMS ((int, CORE_ADDR, struct symtab *, int));
extern void
mark_breakpoints_out PARAMS ((void));
extern void
breakpoint_init_inferior PARAMS ((void));
extern void
delete_breakpoint PARAMS ((struct breakpoint *));
extern void
breakpoint_auto_delete PARAMS ((bpstat));
extern void
breakpoint_clear_ignore_counts PARAMS ((void));
extern void
break_command PARAMS ((char *, int));
extern int
insert_breakpoints PARAMS ((void));
extern int
remove_breakpoints PARAMS ((void));
extern void
enable_longjmp_breakpoint PARAMS ((void));
extern void
disable_longjmp_breakpoint PARAMS ((void));
extern void
set_longjmp_resume_breakpoint PARAMS ((CORE_ADDR, FRAME));
/* The following are for displays, which aren't really breakpoints, but
here is as good a place as any for them. */
extern void
disable_current_display PARAMS ((void));
extern void
do_displays PARAMS ((void));
extern void
disable_display PARAMS ((int));
extern void
clear_displays PARAMS ((void));
#endif /* !defined (BREAKPOINT_H) */

View file

@ -0,0 +1,950 @@
/* Support routines for building symbol tables in GDB's internal format.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This module provides subroutines used for creating and adding to
the symbol table. These routines are called from various symbol-
file-reading routines.
Routines to support specific debugging information formats (stabs,
DWARF, etc) belong somewhere else. */
#include "defs.h"
#include "bfd.h"
#include "obstack.h"
#include "symtab.h"
#include "symfile.h" /* Needed for "struct complaint" */
#include "objfiles.h"
#include "complaints.h"
#include <string.h>
/* Ask buildsym.h to define the vars it normally declares `extern'. */
#define EXTERN /**/
#include "buildsym.h" /* Our own declarations */
#undef EXTERN
static int
compare_line_numbers PARAMS ((const void *, const void *));
static struct blockvector *
make_blockvector PARAMS ((struct objfile *));
/* Initial sizes of data structures. These are realloc'd larger if needed,
and realloc'd down to the size actually used, when completed. */
#define INITIAL_CONTEXT_STACK_SIZE 10
#define INITIAL_LINE_VECTOR_LENGTH 1000
/* Complaints about the symbols we have encountered. */
struct complaint innerblock_complaint =
{"inner block not inside outer block in %s", 0, 0};
struct complaint innerblock_anon_complaint =
{"inner block not inside outer block", 0, 0};
struct complaint blockvector_complaint =
{"block at 0x%lx out of order", 0, 0};
/* maintain the lists of symbols and blocks */
/* Add a symbol to one of the lists of symbols. */
void
add_symbol_to_list (symbol, listhead)
struct symbol *symbol;
struct pending **listhead;
{
register struct pending *link;
/* We keep PENDINGSIZE symbols in each link of the list.
If we don't have a link with room in it, add a new link. */
if (*listhead == NULL || (*listhead)->nsyms == PENDINGSIZE)
{
if (free_pendings)
{
link = free_pendings;
free_pendings = link->next;
}
else
{
link = (struct pending *) xmalloc (sizeof (struct pending));
}
link->next = *listhead;
*listhead = link;
link->nsyms = 0;
}
(*listhead)->symbol[(*listhead)->nsyms++] = symbol;
}
/* Find a symbol named NAME on a LIST. NAME need not be '\0'-terminated;
LENGTH is the length of the name. */
struct symbol *
find_symbol_in_list (list, name, length)
struct pending *list;
char *name;
int length;
{
int j;
char *pp;
while (list != NULL)
{
for (j = list->nsyms; --j >= 0; )
{
pp = SYMBOL_NAME (list->symbol[j]);
if (*pp == *name && strncmp (pp, name, length) == 0 &&
pp[length] == '\0')
{
return (list->symbol[j]);
}
}
list = list->next;
}
return (NULL);
}
/* At end of reading syms, or in case of quit,
really free as many `struct pending's as we can easily find. */
/* ARGSUSED */
void
really_free_pendings (foo)
int foo;
{
struct pending *next, *next1;
#if 0
struct pending_block *bnext, *bnext1;
#endif
for (next = free_pendings; next; next = next1)
{
next1 = next->next;
free ((PTR)next);
}
free_pendings = NULL;
#if 0 /* Now we make the links in the symbol_obstack, so don't free them. */
for (bnext = pending_blocks; bnext; bnext = bnext1)
{
bnext1 = bnext->next;
free ((PTR)bnext);
}
#endif
pending_blocks = NULL;
for (next = file_symbols; next != NULL; next = next1)
{
next1 = next->next;
free ((PTR)next);
}
file_symbols = NULL;
for (next = global_symbols; next != NULL; next = next1)
{
next1 = next->next;
free ((PTR)next);
}
global_symbols = NULL;
}
/* Take one of the lists of symbols and make a block from it.
Keep the order the symbols have in the list (reversed from the input file).
Put the block on the list of pending blocks. */
void
finish_block (symbol, listhead, old_blocks, start, end, objfile)
struct symbol *symbol;
struct pending **listhead;
struct pending_block *old_blocks;
CORE_ADDR start, end;
struct objfile *objfile;
{
register struct pending *next, *next1;
register struct block *block;
register struct pending_block *pblock;
struct pending_block *opblock;
register int i;
register int j;
/* Count the length of the list of symbols. */
for (next = *listhead, i = 0;
next;
i += next->nsyms, next = next->next)
{
/*EMPTY*/;
}
block = (struct block *) obstack_alloc (&objfile -> symbol_obstack,
(sizeof (struct block) + ((i - 1) * sizeof (struct symbol *))));
/* Copy the symbols into the block. */
BLOCK_NSYMS (block) = i;
for (next = *listhead; next; next = next->next)
{
for (j = next->nsyms - 1; j >= 0; j--)
{
BLOCK_SYM (block, --i) = next->symbol[j];
}
}
BLOCK_START (block) = start;
BLOCK_END (block) = end;
/* Superblock filled in when containing block is made */
BLOCK_SUPERBLOCK (block) = NULL;
BLOCK_GCC_COMPILED (block) = processing_gcc_compilation;
/* Put the block in as the value of the symbol that names it. */
if (symbol)
{
SYMBOL_BLOCK_VALUE (symbol) = block;
BLOCK_FUNCTION (block) = symbol;
}
else
{
BLOCK_FUNCTION (block) = NULL;
}
/* Now "free" the links of the list, and empty the list. */
for (next = *listhead; next; next = next1)
{
next1 = next->next;
next->next = free_pendings;
free_pendings = next;
}
*listhead = NULL;
/* Install this block as the superblock
of all blocks made since the start of this scope
that don't have superblocks yet. */
opblock = NULL;
for (pblock = pending_blocks; pblock != old_blocks; pblock = pblock->next)
{
if (BLOCK_SUPERBLOCK (pblock->block) == NULL)
{
#if 1
/* Check to be sure the blocks are nested as we receive them.
If the compiler/assembler/linker work, this just burns a small
amount of time. */
if (BLOCK_START (pblock->block) < BLOCK_START (block) ||
BLOCK_END (pblock->block) > BLOCK_END (block))
{
if (symbol)
{
complain (&innerblock_complaint,
SYMBOL_SOURCE_NAME (symbol));
}
else
{
complain (&innerblock_anon_complaint);
}
BLOCK_START (pblock->block) = BLOCK_START (block);
BLOCK_END (pblock->block) = BLOCK_END (block);
}
#endif
BLOCK_SUPERBLOCK (pblock->block) = block;
}
opblock = pblock;
}
/* Record this block on the list of all blocks in the file.
Put it after opblock, or at the beginning if opblock is 0.
This puts the block in the list after all its subblocks. */
/* Allocate in the symbol_obstack to save time.
It wastes a little space. */
pblock = (struct pending_block *)
obstack_alloc (&objfile -> symbol_obstack,
sizeof (struct pending_block));
pblock->block = block;
if (opblock)
{
pblock->next = opblock->next;
opblock->next = pblock;
}
else
{
pblock->next = pending_blocks;
pending_blocks = pblock;
}
}
static struct blockvector *
make_blockvector (objfile)
struct objfile *objfile;
{
register struct pending_block *next;
register struct blockvector *blockvector;
register int i;
/* Count the length of the list of blocks. */
for (next = pending_blocks, i = 0; next; next = next->next, i++) {;}
blockvector = (struct blockvector *)
obstack_alloc (&objfile -> symbol_obstack,
(sizeof (struct blockvector)
+ (i - 1) * sizeof (struct block *)));
/* Copy the blocks into the blockvector.
This is done in reverse order, which happens to put
the blocks into the proper order (ascending starting address).
finish_block has hair to insert each block into the list
after its subblocks in order to make sure this is true. */
BLOCKVECTOR_NBLOCKS (blockvector) = i;
for (next = pending_blocks; next; next = next->next)
{
BLOCKVECTOR_BLOCK (blockvector, --i) = next->block;
}
#if 0 /* Now we make the links in the obstack, so don't free them. */
/* Now free the links of the list, and empty the list. */
for (next = pending_blocks; next; next = next1)
{
next1 = next->next;
free (next);
}
#endif
pending_blocks = NULL;
#if 1 /* FIXME, shut this off after a while to speed up symbol reading. */
/* Some compilers output blocks in the wrong order, but we depend
on their being in the right order so we can binary search.
Check the order and moan about it. FIXME. */
if (BLOCKVECTOR_NBLOCKS (blockvector) > 1)
{
for (i = 1; i < BLOCKVECTOR_NBLOCKS (blockvector); i++)
{
if (BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i-1))
> BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)))
{
complain (&blockvector_complaint,
(unsigned long) BLOCK_START(BLOCKVECTOR_BLOCK (blockvector, i)));
}
}
}
#endif
return (blockvector);
}
/* Start recording information about source code that came from an included
(or otherwise merged-in) source file with a different name. NAME is
the name of the file (cannot be NULL), DIRNAME is the directory in which
it resides (or NULL if not known). */
void
start_subfile (name, dirname)
char *name;
char *dirname;
{
register struct subfile *subfile;
/* See if this subfile is already known as a subfile of the
current main source file. */
for (subfile = subfiles; subfile; subfile = subfile->next)
{
if (STREQ (subfile->name, name))
{
current_subfile = subfile;
return;
}
}
/* This subfile is not known. Add an entry for it.
Make an entry for this subfile in the list of all subfiles
of the current main source file. */
subfile = (struct subfile *) xmalloc (sizeof (struct subfile));
subfile->next = subfiles;
subfiles = subfile;
current_subfile = subfile;
/* Save its name and compilation directory name */
subfile->name = (name == NULL)? NULL : strdup (name);
subfile->dirname = (dirname == NULL) ? NULL : strdup (dirname);
/* Initialize line-number recording for this subfile. */
subfile->line_vector = NULL;
/* Default the source language to whatever can be deduced from
the filename. If nothing can be deduced (such as for a C/C++
include file with a ".h" extension), then inherit whatever
language the previous subfile had. This kludgery is necessary
because there is no standard way in some object formats to
record the source language. Also, when symtabs are allocated
we try to deduce a language then as well, but it is too late
for us to use that information while reading symbols, since
symtabs aren't allocated until after all the symbols have
been processed for a given source file. */
subfile->language = deduce_language_from_filename (subfile->name);
if (subfile->language == language_unknown &&
subfile->next != NULL)
{
subfile->language = subfile->next->language;
}
/* cfront output is a C program, so in most ways it looks like a C
program. But to demangle we need to set the language to C++. We
can distinguish cfront code by the fact that it has #line
directives which specify a file name ending in .C.
So if the filename of this subfile ends in .C, then change the language
of any pending subfiles from C to C++. We also accept any other C++
suffixes accepted by deduce_language_from_filename (in particular,
some people use .cxx with cfront). */
if (subfile->name)
{
struct subfile *s;
if (deduce_language_from_filename (subfile->name) == language_cplus)
for (s = subfiles; s != NULL; s = s->next)
if (s->language == language_c)
s->language = language_cplus;
}
/* And patch up this file if necessary. */
if (subfile->language == language_c
&& subfile->next != NULL
&& subfile->next->language == language_cplus)
{
subfile->language = language_cplus;
}
}
/* For stabs readers, the first N_SO symbol is assumed to be the source
file name, and the subfile struct is initialized using that assumption.
If another N_SO symbol is later seen, immediately following the first
one, then the first one is assumed to be the directory name and the
second one is really the source file name.
So we have to patch up the subfile struct by moving the old name value to
dirname and remembering the new name. Some sanity checking is performed
to ensure that the state of the subfile struct is reasonable and that the
old name we are assuming to be a directory name actually is (by checking
for a trailing '/'). */
void
patch_subfile_names (subfile, name)
struct subfile *subfile;
char *name;
{
if (subfile != NULL && subfile->dirname == NULL && subfile->name != NULL
&& subfile->name[strlen(subfile->name)-1] == '/')
{
subfile->dirname = subfile->name;
subfile->name = strdup (name);
/* Default the source language to whatever can be deduced from
the filename. If nothing can be deduced (such as for a C/C++
include file with a ".h" extension), then inherit whatever
language the previous subfile had. This kludgery is necessary
because there is no standard way in some object formats to
record the source language. Also, when symtabs are allocated
we try to deduce a language then as well, but it is too late
for us to use that information while reading symbols, since
symtabs aren't allocated until after all the symbols have
been processed for a given source file. */
subfile->language = deduce_language_from_filename (subfile->name);
if (subfile->language == language_unknown &&
subfile->next != NULL)
{
subfile->language = subfile->next->language;
}
}
}
/* Handle the N_BINCL and N_EINCL symbol types
that act like N_SOL for switching source files
(different subfiles, as we call them) within one object file,
but using a stack rather than in an arbitrary order. */
void
push_subfile ()
{
register struct subfile_stack *tem
= (struct subfile_stack *) xmalloc (sizeof (struct subfile_stack));
tem->next = subfile_stack;
subfile_stack = tem;
if (current_subfile == NULL || current_subfile->name == NULL)
{
abort ();
}
tem->name = current_subfile->name;
}
char *
pop_subfile ()
{
register char *name;
register struct subfile_stack *link = subfile_stack;
if (link == NULL)
{
abort ();
}
name = link->name;
subfile_stack = link->next;
free ((PTR)link);
return (name);
}
/* Add a linetable entry for line number LINE and address PC to the line
vector for SUBFILE. */
void
record_line (subfile, line, pc)
register struct subfile *subfile;
int line;
CORE_ADDR pc;
{
struct linetable_entry *e;
/* Ignore the dummy line number in libg.o */
if (line == 0xffff)
{
return;
}
/* Make sure line vector exists and is big enough. */
if (!subfile->line_vector)
{
subfile->line_vector_length = INITIAL_LINE_VECTOR_LENGTH;
subfile->line_vector = (struct linetable *)
xmalloc (sizeof (struct linetable)
+ subfile->line_vector_length * sizeof (struct linetable_entry));
subfile->line_vector->nitems = 0;
}
if (subfile->line_vector->nitems + 1 >= subfile->line_vector_length)
{
subfile->line_vector_length *= 2;
subfile->line_vector = (struct linetable *)
xrealloc ((char *) subfile->line_vector, (sizeof (struct linetable)
+ subfile->line_vector_length * sizeof (struct linetable_entry)));
}
e = subfile->line_vector->item + subfile->line_vector->nitems++;
e->line = line; e->pc = pc;
}
/* Needed in order to sort line tables from IBM xcoff files. Sigh! */
static int
compare_line_numbers (ln1p, ln2p)
const PTR ln1p;
const PTR ln2p;
{
struct linetable_entry *ln1 = (struct linetable_entry *) ln1p;
struct linetable_entry *ln2 = (struct linetable_entry *) ln2p;
/* Note: this code does not assume that CORE_ADDRs can fit in ints.
Please keep it that way. */
if (ln1->pc < ln2->pc)
return -1;
if (ln1->pc > ln2->pc)
return 1;
/* If pc equal, sort by line. I'm not sure whether this is optimum
behavior (see comment at struct linetable in symtab.h). */
return ln1->line - ln2->line;
}
/* Start a new symtab for a new source file.
Called, for example, when a stabs symbol of type N_SO is seen, or when
a DWARF TAG_compile_unit DIE is seen.
It indicates the start of data for one original source file. */
void
start_symtab (name, dirname, start_addr)
char *name;
char *dirname;
CORE_ADDR start_addr;
{
last_source_file = name;
last_source_start_addr = start_addr;
file_symbols = NULL;
global_symbols = NULL;
within_function = 0;
/* Context stack is initially empty. Allocate first one with room for
10 levels; reuse it forever afterward. */
if (context_stack == NULL)
{
context_stack_size = INITIAL_CONTEXT_STACK_SIZE;
context_stack = (struct context_stack *)
xmalloc (context_stack_size * sizeof (struct context_stack));
}
context_stack_depth = 0;
/* Initialize the list of sub source files with one entry
for this file (the top-level source file). */
subfiles = NULL;
current_subfile = NULL;
start_subfile (name, dirname);
}
/* Finish the symbol definitions for one main source file,
close off all the lexical contexts for that file
(creating struct block's for them), then make the struct symtab
for that file and put it in the list of all such.
END_ADDR is the address of the end of the file's text.
SECTION is the section number (in objfile->section_offsets) of
the blockvector and linetable.
Note that it is possible for end_symtab() to return NULL. In particular,
for the DWARF case at least, it will return NULL when it finds a
compilation unit that has exactly one DIE, a TAG_compile_unit DIE. This
can happen when we link in an object file that was compiled from an empty
source file. Returning NULL is probably not the correct thing to do,
because then gdb will never know about this empty file (FIXME). */
struct symtab *
end_symtab (end_addr, sort_pending, sort_linevec, objfile, section)
CORE_ADDR end_addr;
int sort_pending;
int sort_linevec;
struct objfile *objfile;
int section;
{
register struct symtab *symtab = NULL;
register struct blockvector *blockvector;
register struct subfile *subfile;
register struct context_stack *cstk;
struct subfile *nextsub;
/* Finish the lexical context of the last function in the file;
pop the context stack. */
if (context_stack_depth > 0)
{
context_stack_depth--;
cstk = &context_stack[context_stack_depth];
/* Make a block for the local symbols within. */
finish_block (cstk->name, &local_symbols, cstk->old_blocks,
cstk->start_addr, end_addr, objfile);
if (context_stack_depth > 0)
{
/* This is said to happen with SCO. The old coffread.c code
simply emptied the context stack, so we do the same. FIXME:
Find out why it is happening. This is not believed to happen
in most cases (even for coffread.c); it used to be an abort(). */
static struct complaint msg =
{"Context stack not empty in end_symtab", 0, 0};
complain (&msg);
context_stack_depth = 0;
}
}
/* It is unfortunate that in xcoff, pending blocks might not be ordered
in this stage. Especially, blocks for static functions will show up at
the end. We need to sort them, so tools like `find_pc_function' and
`find_pc_block' can work reliably. */
if (sort_pending && pending_blocks)
{
/* FIXME! Remove this horrid bubble sort and use qsort!!! */
int swapped;
do
{
struct pending_block *pb, *pbnext;
pb = pending_blocks;
pbnext = pb->next;
swapped = 0;
while (pbnext)
{
/* swap blocks if unordered! */
if (BLOCK_START(pb->block) < BLOCK_START(pbnext->block))
{
struct block *tmp = pb->block;
pb->block = pbnext->block;
pbnext->block = tmp;
swapped = 1;
}
pb = pbnext;
pbnext = pbnext->next;
}
} while (swapped);
}
/* Cleanup any undefined types that have been left hanging around
(this needs to be done before the finish_blocks so that
file_symbols is still good).
Both cleanup_undefined_types and finish_global_stabs are stabs
specific, but harmless for other symbol readers, since on gdb
startup or when finished reading stabs, the state is set so these
are no-ops. FIXME: Is this handled right in case of QUIT? Can
we make this cleaner? */
cleanup_undefined_types ();
finish_global_stabs (objfile);
if (pending_blocks == NULL
&& file_symbols == NULL
&& global_symbols == NULL)
{
/* Ignore symtabs that have no functions with real debugging info */
blockvector = NULL;
}
else
{
/* Define the STATIC_BLOCK & GLOBAL_BLOCK, and build the blockvector. */
finish_block (0, &file_symbols, 0, last_source_start_addr, end_addr,
objfile);
finish_block (0, &global_symbols, 0, last_source_start_addr, end_addr,
objfile);
blockvector = make_blockvector (objfile);
}
#ifdef PROCESS_LINENUMBER_HOOK
PROCESS_LINENUMBER_HOOK (); /* Needed for xcoff. */
#endif
/* Now create the symtab objects proper, one for each subfile. */
/* (The main file is the last one on the chain.) */
for (subfile = subfiles; subfile; subfile = nextsub)
{
int linetablesize = 0;
/* If we have blocks of symbols, make a symtab.
Otherwise, just ignore this file and any line number info in it. */
symtab = NULL;
if (blockvector)
{
if (subfile->line_vector)
{
linetablesize = sizeof (struct linetable) +
subfile->line_vector->nitems * sizeof (struct linetable_entry);
#if 0
/* I think this is artifact from before it went on the obstack.
I doubt we'll need the memory between now and when we
free it later in this function. */
/* First, shrink the linetable to make more memory. */
subfile->line_vector = (struct linetable *)
xrealloc ((char *) subfile->line_vector, linetablesize);
#endif
/* If sort_linevec is false, we might want just check to make
sure they are sorted and complain() if not, as a way of
tracking down compilers/symbol readers which don't get
them sorted right. */
if (sort_linevec)
qsort (subfile->line_vector->item,
subfile->line_vector->nitems,
sizeof (struct linetable_entry), compare_line_numbers);
}
/* Now, allocate a symbol table. */
symtab = allocate_symtab (subfile->name, objfile);
/* Fill in its components. */
symtab->blockvector = blockvector;
if (subfile->line_vector)
{
/* Reallocate the line table on the symbol obstack */
symtab->linetable = (struct linetable *)
obstack_alloc (&objfile -> symbol_obstack, linetablesize);
memcpy (symtab->linetable, subfile->line_vector, linetablesize);
}
else
{
symtab->linetable = NULL;
}
symtab->block_line_section = section;
if (subfile->dirname)
{
/* Reallocate the dirname on the symbol obstack */
symtab->dirname = (char *)
obstack_alloc (&objfile -> symbol_obstack,
strlen (subfile -> dirname) + 1);
strcpy (symtab->dirname, subfile->dirname);
}
else
{
symtab->dirname = NULL;
}
symtab->free_code = free_linetable;
symtab->free_ptr = NULL;
/* Use whatever language we have been using for this subfile,
not the one that was deduced in allocate_symtab from the
filename. We already did our own deducing when we created
the subfile, and we may have altered our opinion of what
language it is from things we found in the symbols. */
symtab->language = subfile->language;
/* All symtabs for the main file and the subfiles share a
blockvector, so we need to clear primary for everything but
the main file. */
symtab->primary = 0;
}
if (subfile->name != NULL)
{
free ((PTR) subfile->name);
}
if (subfile->dirname != NULL)
{
free ((PTR) subfile->dirname);
}
if (subfile->line_vector != NULL)
{
free ((PTR) subfile->line_vector);
}
nextsub = subfile->next;
free ((PTR)subfile);
}
/* Set this for the main source file. */
if (symtab)
{
symtab->primary = 1;
}
last_source_file = NULL;
current_subfile = NULL;
return (symtab);
}
/* Push a context block. Args are an identifying nesting level (checkable
when you pop it), and the starting PC address of this context. */
struct context_stack *
push_context (desc, valu)
int desc;
CORE_ADDR valu;
{
register struct context_stack *new;
if (context_stack_depth == context_stack_size)
{
context_stack_size *= 2;
context_stack = (struct context_stack *)
xrealloc ((char *) context_stack,
(context_stack_size * sizeof (struct context_stack)));
}
new = &context_stack[context_stack_depth++];
new->depth = desc;
new->locals = local_symbols;
new->old_blocks = pending_blocks;
new->start_addr = valu;
new->name = NULL;
local_symbols = NULL;
return (new);
}
/* Compute a small integer hash code for the given name. */
int
hashname (name)
char *name;
{
register char *p = name;
register int total = p[0];
register int c;
c = p[1];
total += c << 2;
if (c)
{
c = p[2];
total += c << 4;
if (c)
{
total += p[3] << 6;
}
}
/* Ensure result is positive. */
if (total < 0)
{
total += (1000 << 6);
}
return (total % HASHSIZE);
}
/* Initialize anything that needs initializing when starting to read
a fresh piece of a symbol file, e.g. reading in the stuff corresponding
to a psymtab. */
void
buildsym_init ()
{
free_pendings = NULL;
file_symbols = NULL;
global_symbols = NULL;
pending_blocks = NULL;
}
/* Initialize anything that needs initializing when a completely new
symbol file is specified (not just adding some symbols from another
file, e.g. a shared library). */
void
buildsym_new_init ()
{
buildsym_init ();
}
/* Initializer for this module */
void
_initialize_buildsym ()
{
}

View file

@ -0,0 +1,259 @@
/* Build symbol tables in GDB's internal format.
Copyright (C) 1986-1991 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (BUILDSYM_H)
#define BUILDSYM_H 1
/* This module provides definitions used for creating and adding to
the symbol table. These routines are called from various symbol-
file-reading routines.
They originated in dbxread.c of gdb-4.2, and were split out to
make xcoffread.c more maintainable by sharing code.
Variables declared in this file can be defined by #define-ing
the name EXTERN to null. It is used to declare variables that
are normally extern, but which get defined in a single module
using this technique. */
#ifndef EXTERN
#define EXTERN extern
#endif
#define HASHSIZE 127 /* Size of things hashed via hashname() */
/* Name of source file whose symbol data we are now processing.
This comes from a symbol of type N_SO. */
EXTERN char *last_source_file;
/* Core address of start of text of current source file.
This too comes from the N_SO symbol. */
EXTERN CORE_ADDR last_source_start_addr;
/* The list of sub-source-files within the current individual compilation.
Each file gets its own symtab with its own linetable and associated info,
but they all share one blockvector. */
struct subfile
{
struct subfile *next;
char *name;
char *dirname;
struct linetable *line_vector;
int line_vector_length;
enum language language;
};
EXTERN struct subfile *subfiles;
EXTERN struct subfile *current_subfile;
/* Global variable which, when set, indicates that we are processing a
.o file compiled with gcc */
EXTERN unsigned char processing_gcc_compilation;
/* When set, we are processing a .o file compiled by sun acc. This is
misnamed; it refers to all stabs-in-elf implementations which use
N_UNDF the way Sun does, including Solaris gcc. Hopefully all
stabs-in-elf implementations ever invented will choose to be
compatible. */
EXTERN unsigned char processing_acc_compilation;
/* Count symbols as they are processed, for error messages. */
EXTERN unsigned int symnum;
/* Record the symbols defined for each context in a list.
We don't create a struct block for the context until we
know how long to make it. */
#define PENDINGSIZE 100
struct pending
{
struct pending *next;
int nsyms;
struct symbol *symbol[PENDINGSIZE];
};
/* List of free `struct pending' structures for reuse. */
EXTERN struct pending *free_pendings;
/* Here are the three lists that symbols are put on. */
EXTERN struct pending *file_symbols; /* static at top level, and types */
EXTERN struct pending *global_symbols; /* global functions and variables */
EXTERN struct pending *local_symbols; /* everything local to lexic context */
/* Stack representing unclosed lexical contexts
(that will become blocks, eventually). */
struct context_stack
{
/* Outer locals at the time we entered */
struct pending *locals;
/* Pointer into blocklist as of entry */
struct pending_block *old_blocks;
/* Name of function, if any, defining context*/
struct symbol *name;
/* PC where this context starts */
CORE_ADDR start_addr;
/* Temp slot for exception handling. */
CORE_ADDR end_addr;
/* For error-checking matching push/pop */
int depth;
};
EXTERN struct context_stack *context_stack;
/* Index of first unused entry in context stack. */
EXTERN int context_stack_depth;
/* Currently allocated size of context stack. */
EXTERN int context_stack_size;
/* Macro "function" for popping contexts from the stack. Pushing is done
by a real function, push_context. This returns a pointer to a struct
context_stack. */
#define pop_context() (&context_stack[--context_stack_depth]);
/* Nonzero if within a function (so symbols should be local,
if nothing says specifically). */
EXTERN int within_function;
/* List of blocks already made (lexical contexts already closed).
This is used at the end to make the blockvector. */
struct pending_block
{
struct pending_block *next;
struct block *block;
};
EXTERN struct pending_block *pending_blocks;
struct subfile_stack
{
struct subfile_stack *next;
char *name;
};
EXTERN struct subfile_stack *subfile_stack;
#define next_symbol_text() (*next_symbol_text_func)()
/* Function to invoke get the next symbol. Return the symbol name. */
EXTERN char *(*next_symbol_text_func) PARAMS ((void));
/* Vector of types defined so far, indexed by their type numbers.
Used for both stabs and coff.
(In newer sun systems, dbx uses a pair of numbers in parens,
as in "(SUBFILENUM,NUMWITHINSUBFILE)". Then these numbers must be
translated through the type_translations hash table to get
the index into the type vector.) */
EXTERN struct type **type_vector;
/* Number of elements allocated for type_vector currently. */
EXTERN int type_vector_length;
/* Initial size of type vector. Is realloc'd larger if needed,
and realloc'd down to the size actually used, when completed. */
#define INITIAL_TYPE_VECTOR_LENGTH 160
extern void
add_symbol_to_list PARAMS ((struct symbol *, struct pending **));
extern struct symbol *
find_symbol_in_list PARAMS ((struct pending *, char *, int));
extern void
finish_block PARAMS ((struct symbol *, struct pending **,
struct pending_block *, CORE_ADDR, CORE_ADDR,
struct objfile *));
extern void
really_free_pendings PARAMS ((int foo));
extern void
start_subfile PARAMS ((char *, char *));
extern void
patch_subfile_names PARAMS ((struct subfile *subfile, char *name));
extern void
push_subfile PARAMS ((void));
extern char *
pop_subfile PARAMS ((void));
extern struct symtab *
end_symtab PARAMS ((CORE_ADDR, int, int, struct objfile *, int));
extern void
scan_file_globals PARAMS ((struct objfile *));
extern void
buildsym_new_init PARAMS ((void));
extern void
buildsym_init PARAMS ((void));
extern struct context_stack *
push_context PARAMS ((int, CORE_ADDR));
extern void
record_line PARAMS ((struct subfile *, int, CORE_ADDR));
extern void
start_symtab PARAMS ((char *, char *, CORE_ADDR));
extern int
hashname PARAMS ((char *));
#undef EXTERN
#endif /* defined (BUILDSYM_H) */

File diff suppressed because it is too large Load diff

1601
gnu/usr.bin/gdb/gdb/c-exp.y Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,447 @@
/* C language support routines for GDB, the GNU debugger.
Copyright 1992, 1993 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "parser-defs.h"
#include "language.h"
#include "c-lang.h"
/* Print the character C on STREAM as part of the contents of a literal
string whose delimiter is QUOTER. Note that that format for printing
characters and strings is language specific. */
static void
emit_char (c, stream, quoter)
register int c;
FILE *stream;
int quoter;
{
c &= 0xFF; /* Avoid sign bit follies */
if (PRINT_LITERAL_FORM (c))
{
if (c == '\\' || c == quoter)
{
fputs_filtered ("\\", stream);
}
fprintf_filtered (stream, "%c", c);
}
else
{
switch (c)
{
case '\n':
fputs_filtered ("\\n", stream);
break;
case '\b':
fputs_filtered ("\\b", stream);
break;
case '\t':
fputs_filtered ("\\t", stream);
break;
case '\f':
fputs_filtered ("\\f", stream);
break;
case '\r':
fputs_filtered ("\\r", stream);
break;
case '\033':
fputs_filtered ("\\e", stream);
break;
case '\007':
fputs_filtered ("\\a", stream);
break;
default:
fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
break;
}
}
}
static void
c_printchar (c, stream)
int c;
FILE *stream;
{
fputs_filtered ("'", stream);
emit_char (c, stream, '\'');
fputs_filtered ("'", stream);
}
/* Print the character string STRING, printing at most LENGTH characters.
Printing stops early if the number hits print_max; repeat counts
are printed as appropriate. Print ellipses at the end if we
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES. */
static void
c_printstr (stream, string, length, force_ellipses)
FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
{
register unsigned int i;
unsigned int things_printed = 0;
int in_quotes = 0;
int need_comma = 0;
extern int inspect_it;
extern int repeat_count_threshold;
extern int print_max;
/* If the string was not truncated due to `set print elements', and
the last byte of it is a null, we don't print that, in traditional C
style. */
if ((!force_ellipses) && length > 0 && string[length-1] == '\0')
length--;
if (length == 0)
{
fputs_filtered ("\"\"", stdout);
return;
}
for (i = 0; i < length && things_printed < print_max; ++i)
{
/* Position of the character we are examining
to see whether it is repeated. */
unsigned int rep1;
/* Number of repetitions we have detected so far. */
unsigned int reps;
QUIT;
if (need_comma)
{
fputs_filtered (", ", stream);
need_comma = 0;
}
rep1 = i + 1;
reps = 1;
while (rep1 < length && string[rep1] == string[i])
{
++rep1;
++reps;
}
if (reps > repeat_count_threshold)
{
if (in_quotes)
{
if (inspect_it)
fputs_filtered ("\\\", ", stream);
else
fputs_filtered ("\", ", stream);
in_quotes = 0;
}
c_printchar (string[i], stream);
fprintf_filtered (stream, " <repeats %u times>", reps);
i = rep1 - 1;
things_printed += repeat_count_threshold;
need_comma = 1;
}
else
{
if (!in_quotes)
{
if (inspect_it)
fputs_filtered ("\\\"", stream);
else
fputs_filtered ("\"", stream);
in_quotes = 1;
}
emit_char (string[i], stream, '"');
++things_printed;
}
}
/* Terminate the quotes if necessary. */
if (in_quotes)
{
if (inspect_it)
fputs_filtered ("\\\"", stream);
else
fputs_filtered ("\"", stream);
}
if (force_ellipses || i < length)
fputs_filtered ("...", stream);
}
/* Create a fundamental C type using default reasonable for the current
target machine.
Some object/debugging file formats (DWARF version 1, COFF, etc) do not
define fundamental types such as "int" or "double". Others (stabs or
DWARF version 2, etc) do define fundamental types. For the formats which
don't provide fundamental types, gdb can create such types using this
function.
FIXME: Some compilers distinguish explicitly signed integral types
(signed short, signed int, signed long) from "regular" integral types
(short, int, long) in the debugging information. There is some dis-
agreement as to how useful this feature is. In particular, gcc does
not support this. Also, only some debugging formats allow the
distinction to be passed on to a debugger. For now, we always just
use "short", "int", or "long" as the type name, for both the implicit
and explicitly signed types. This also makes life easier for the
gdb test suite since we don't have to account for the differences
in output depending upon what the compiler and debugging format
support. We will probably have to re-examine the issue when gdb
starts taking it's fundamental type information directly from the
debugging information supplied by the compiler. fnf@cygnus.com */
static struct type *
c_create_fundamental_type (objfile, typeid)
struct objfile *objfile;
int typeid;
{
register struct type *type = NULL;
switch (typeid)
{
default:
/* FIXME: For now, if we are asked to produce a type not in this
language, create the equivalent of a C integer type with the
name "<?type?>". When all the dust settles from the type
reconstruction work, this should probably become an error. */
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "<?type?>", objfile);
warning ("internal error: no C/C++ fundamental type %d", typeid);
break;
case FT_VOID:
type = init_type (TYPE_CODE_VOID,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "void", objfile);
break;
case FT_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
0, "char", objfile);
break;
case FT_SIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED, "signed char", objfile);
break;
case FT_UNSIGNED_CHAR:
type = init_type (TYPE_CODE_INT,
TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
break;
case FT_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
0, "short", objfile);
break;
case FT_SIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED, "short", objfile); /* FIXME-fnf */
break;
case FT_UNSIGNED_SHORT:
type = init_type (TYPE_CODE_INT,
TARGET_SHORT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
break;
case FT_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
0, "int", objfile);
break;
case FT_SIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED, "int", objfile); /* FIXME -fnf */
break;
case FT_UNSIGNED_INTEGER:
type = init_type (TYPE_CODE_INT,
TARGET_INT_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
break;
case FT_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
0, "long", objfile);
break;
case FT_SIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED, "long", objfile); /* FIXME -fnf */
break;
case FT_UNSIGNED_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
break;
case FT_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
0, "long long", objfile);
break;
case FT_SIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_SIGNED, "signed long long", objfile);
break;
case FT_UNSIGNED_LONG_LONG:
type = init_type (TYPE_CODE_INT,
TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
break;
case FT_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
0, "float", objfile);
break;
case FT_DBL_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "double", objfile);
break;
case FT_EXT_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT,
TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
0, "long double", objfile);
break;
}
return (type);
}
/* Table mapping opcodes into strings for printing operators
and precedences of the operators. */
static const struct op_print c_op_print_tab[] =
{
{",", BINOP_COMMA, PREC_COMMA, 0},
{"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
{"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
{"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
{"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
{"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
{"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
{"==", BINOP_EQUAL, PREC_EQUAL, 0},
{"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
{"<=", BINOP_LEQ, PREC_ORDER, 0},
{">=", BINOP_GEQ, PREC_ORDER, 0},
{">", BINOP_GTR, PREC_ORDER, 0},
{"<", BINOP_LESS, PREC_ORDER, 0},
{">>", BINOP_RSH, PREC_SHIFT, 0},
{"<<", BINOP_LSH, PREC_SHIFT, 0},
{"+", BINOP_ADD, PREC_ADD, 0},
{"-", BINOP_SUB, PREC_ADD, 0},
{"*", BINOP_MUL, PREC_MUL, 0},
{"/", BINOP_DIV, PREC_MUL, 0},
{"%", BINOP_REM, PREC_MUL, 0},
{"@", BINOP_REPEAT, PREC_REPEAT, 0},
{"-", UNOP_NEG, PREC_PREFIX, 0},
{"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
{"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
{"*", UNOP_IND, PREC_PREFIX, 0},
{"&", UNOP_ADDR, PREC_PREFIX, 0},
{"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
{"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
{"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
/* C++ */
{"::", BINOP_SCOPE, PREC_PREFIX, 0},
{NULL, 0, 0, 0}
};
struct type ** const (c_builtin_types[]) =
{
&builtin_type_int,
&builtin_type_long,
&builtin_type_short,
&builtin_type_char,
&builtin_type_float,
&builtin_type_double,
&builtin_type_void,
&builtin_type_long_long,
&builtin_type_signed_char,
&builtin_type_unsigned_char,
&builtin_type_unsigned_short,
&builtin_type_unsigned_int,
&builtin_type_unsigned_long,
&builtin_type_unsigned_long_long,
&builtin_type_long_double,
&builtin_type_complex,
&builtin_type_double_complex,
0
};
const struct language_defn c_language_defn = {
"c", /* Language name */
language_c,
c_builtin_types,
range_check_off,
type_check_off,
c_parse,
c_error,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_create_fundamental_type, /* Create fundamental type in this language */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
&BUILTIN_TYPE_LONGEST, /* longest signed integral type */
&BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
&builtin_type_double, /* longest floating point type */ /*FIXME*/
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
{"0x%lx", "0x", "x", ""}, /* Hex format info */
c_op_print_tab, /* expression operators for printing */
LANG_MAGIC
};
const struct language_defn cplus_language_defn = {
"c++", /* Language name */
language_cplus,
c_builtin_types,
range_check_off,
type_check_off,
c_parse,
c_error,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_create_fundamental_type, /* Create fundamental type in this language */
c_print_type, /* Print a type using appropriate syntax */
c_val_print, /* Print a value using appropriate syntax */
&BUILTIN_TYPE_LONGEST, /* longest signed integral type */
&BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
&builtin_type_double, /* longest floating point type */ /*FIXME*/
{"", "", "", ""}, /* Binary format info */
{"0%lo", "0", "o", ""}, /* Octal format info */
{"%ld", "", "d", ""}, /* Decimal format info */
{"0x%lx", "0x", "x", ""}, /* Hex format info */
c_op_print_tab, /* expression operators for printing */
LANG_MAGIC
};
void
_initialize_c_language ()
{
add_language (&c_language_defn);
add_language (&cplus_language_defn);
}

View file

@ -0,0 +1,31 @@
/* C language support definitions for GDB, the GNU debugger.
Copyright 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int
c_parse PARAMS ((void)); /* Defined in c-exp.y */
extern void
c_error PARAMS ((char *)); /* Defined in c-exp.y */
extern void /* Defined in c-typeprint.c */
c_print_type PARAMS ((struct type *, char *, FILE *, int, int));
extern int
c_val_print PARAMS ((struct type *, char *, CORE_ADDR, FILE *, int, int,
int, enum val_prettyprint));

View file

@ -0,0 +1,797 @@
/* Support for printing C and C++ types for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "obstack.h"
#include "bfd.h" /* Binary File Description */
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "value.h"
#include "gdbcore.h"
#include "target.h"
#include "command.h"
#include "gdbcmd.h"
#include "language.h"
#include "demangle.h"
#include "c-lang.h"
#include "typeprint.h"
#include <string.h>
#include <errno.h>
extern int demangle; /* whether to print C++ syms raw or source-form */
static void
c_type_print_args PARAMS ((struct type *, FILE *));
static void
c_type_print_varspec_suffix PARAMS ((struct type *, FILE *, int, int, int));
static void
cp_type_print_derivation_info PARAMS ((FILE *, struct type *));
void
c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
void
c_type_print_base PARAMS ((struct type *, FILE *, int, int));
/* Print a description of a type in the format of a
typedef for the current language.
NEW is the new name for a type TYPE. */
void
c_typedef_print (type, new, stream)
struct type *type;
struct symbol *new;
FILE *stream;
{
switch (current_language->la_language)
{
#ifdef _LANG_c
case language_c:
case language_cplus:
fprintf_filtered(stream, "typedef ");
type_print(type,"",stream,0);
if(TYPE_NAME ((SYMBOL_TYPE (new))) == 0
|| !STREQ (TYPE_NAME ((SYMBOL_TYPE (new))), SYMBOL_NAME (new)))
fprintf_filtered(stream, " %s", SYMBOL_SOURCE_NAME(new));
break;
#endif
#ifdef _LANG_m2
case language_m2:
fprintf_filtered(stream, "TYPE ");
if(!TYPE_NAME(SYMBOL_TYPE(new)) ||
!STREQ (TYPE_NAME(SYMBOL_TYPE(new)), SYMBOL_NAME(new)))
fprintf_filtered(stream, "%s = ", SYMBOL_SOURCE_NAME(new));
else
fprintf_filtered(stream, "<builtin> = ");
type_print(type,"",stream,0);
break;
#endif
#ifdef _LANG_chill
case language_chill:
error ("Missing Chill support in function c_typedef_print."); /*FIXME*/
#endif
default:
error("Language not supported.");
}
fprintf_filtered(stream, ";\n");
}
/* LEVEL is the depth to indent lines by. */
void
c_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
FILE *stream;
int show;
int level;
{
register enum type_code code;
int demangled_args;
c_type_print_base (type, stream, show, level);
code = TYPE_CODE (type);
if ((varstring != NULL && *varstring != '\0')
||
/* Need a space if going to print stars or brackets;
but not if we will print just a type name. */
((show > 0 || TYPE_NAME (type) == 0)
&&
(code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD
|| code == TYPE_CODE_ARRAY
|| code == TYPE_CODE_MEMBER
|| code == TYPE_CODE_REF)))
fputs_filtered (" ", stream);
c_type_print_varspec_prefix (type, stream, show, 0);
fputs_filtered (varstring, stream);
/* For demangled function names, we have the arglist as part of the name,
so don't print an additional pair of ()'s */
demangled_args = varstring[strlen(varstring) - 1] == ')';
c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
}
/* Print the C++ method arguments ARGS to the file STREAM. */
void
cp_type_print_method_args (args, prefix, varstring, staticp, stream)
struct type **args;
char *prefix;
char *varstring;
int staticp;
FILE *stream;
{
int i;
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered (" (", stream);
if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
{
i = !staticp; /* skip the class variable */
while (1)
{
type_print (args[i++], "", stream, 0);
if (!args[i])
{
fprintf_filtered (stream, " ...");
break;
}
else if (args[i]->code != TYPE_CODE_VOID)
{
fprintf_filtered (stream, ", ");
}
else break;
}
}
fprintf_filtered (stream, ")");
}
/* If TYPE is a derived type, then print out derivation information.
Print only the actual base classes of this type, not the base classes
of the base classes. I.E. for the derivation hierarchy:
class A { int a; };
class B : public A {int b; };
class C : public B {int c; };
Print the type of class C as:
class C : public B {
int c;
}
Not as the following (like gdb used to), which is not legal C++ syntax for
derived types and may be confused with the multiple inheritance form:
class C : public B : public A {
int c;
}
In general, gdb should try to print the types as closely as possible to
the form that they appear in the source code. */
static void
cp_type_print_derivation_info (stream, type)
FILE *stream;
struct type *type;
{
char *name;
int i;
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
{
fputs_filtered (i == 0 ? ": " : ", ", stream);
fprintf_filtered (stream, "%s%s ",
BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
BASETYPE_VIA_VIRTUAL(type, i) ? " virtual" : "");
name = type_name_no_tag (TYPE_BASECLASS (type, i));
fprintf_filtered (stream, "%s", name ? name : "(null)");
}
if (i > 0)
{
fputs_filtered (" ", stream);
}
}
/* Print any asterisks or open-parentheses needed before the
variable name (to describe its type).
On outermost call, pass 0 for PASSED_A_PTR.
On outermost call, SHOW > 0 means should ignore
any typename for TYPE and show its details.
SHOW is always zero on recursive calls. */
void
c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
struct type *type;
FILE *stream;
int show;
int passed_a_ptr;
{
char *name;
if (type == 0)
return;
if (TYPE_NAME (type) && show <= 0)
return;
QUIT;
switch (TYPE_CODE (type))
{
case TYPE_CODE_PTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
fprintf_filtered (stream, "*");
break;
case TYPE_CODE_MEMBER:
if (passed_a_ptr)
fprintf_filtered (stream, "(");
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
fprintf_filtered (stream, " ");
name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
if (name)
fputs_filtered (name, stream);
else
c_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
fprintf_filtered (stream, "::");
break;
case TYPE_CODE_METHOD:
if (passed_a_ptr)
fprintf (stream, "(");
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
if (passed_a_ptr)
{
fprintf_filtered (stream, " ");
c_type_print_base (TYPE_DOMAIN_TYPE (type), stream, 0, passed_a_ptr);
fprintf_filtered (stream, "::");
}
break;
case TYPE_CODE_REF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
fprintf_filtered (stream, "&");
break;
case TYPE_CODE_FUNC:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
if (passed_a_ptr)
fprintf_filtered (stream, "(");
break;
case TYPE_CODE_ARRAY:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
if (passed_a_ptr)
fprintf_filtered (stream, "(");
break;
case TYPE_CODE_UNDEF:
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
case TYPE_CODE_VOID:
case TYPE_CODE_ERROR:
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
case TYPE_CODE_BITSTRING:
/* These types need no prefix. They are listed here so that
gcc -Wall will reveal any types that haven't been handled. */
break;
}
}
static void
c_type_print_args (type, stream)
struct type *type;
FILE *stream;
{
int i;
struct type **args;
fprintf_filtered (stream, "(");
args = TYPE_ARG_TYPES (type);
if (args != NULL)
{
if (args[1] == NULL)
{
fprintf_filtered (stream, "...");
}
else
{
for (i = 1;
args[i] != NULL && args[i]->code != TYPE_CODE_VOID;
i++)
{
c_print_type (args[i], "", stream, -1, 0);
if (args[i+1] == NULL)
{
fprintf_filtered (stream, "...");
}
else if (args[i+1]->code != TYPE_CODE_VOID)
{
fprintf_filtered (stream, ",");
wrap_here (" ");
}
}
}
}
fprintf_filtered (stream, ")");
}
/* Print any array sizes, function arguments or close parentheses
needed after the variable name (to describe its type).
Args work like c_type_print_varspec_prefix. */
static void
c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
struct type *type;
FILE *stream;
int show;
int passed_a_ptr;
int demangled_args;
{
if (type == 0)
return;
if (TYPE_NAME (type) && show <= 0)
return;
QUIT;
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
if (passed_a_ptr)
fprintf_filtered (stream, ")");
fprintf_filtered (stream, "[");
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
fprintf_filtered (stream, "%d",
(TYPE_LENGTH (type)
/ TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
fprintf_filtered (stream, "]");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
break;
case TYPE_CODE_MEMBER:
if (passed_a_ptr)
fprintf_filtered (stream, ")");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
break;
case TYPE_CODE_METHOD:
if (passed_a_ptr)
fprintf_filtered (stream, ")");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
if (passed_a_ptr)
{
c_type_print_args (type, stream);
}
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0);
break;
case TYPE_CODE_FUNC:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
passed_a_ptr, 0);
if (passed_a_ptr)
fprintf_filtered (stream, ")");
if (!demangled_args)
fprintf_filtered (stream, "()");
break;
case TYPE_CODE_UNDEF:
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
case TYPE_CODE_ENUM:
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
case TYPE_CODE_VOID:
case TYPE_CODE_ERROR:
case TYPE_CODE_CHAR:
case TYPE_CODE_BOOL:
case TYPE_CODE_SET:
case TYPE_CODE_RANGE:
case TYPE_CODE_STRING:
case TYPE_CODE_BITSTRING:
/* These types do not need a suffix. They are listed so that
gcc -Wall will report types that may not have been considered. */
break;
}
}
/* Print the name of the type (or the ultimate pointer target,
function value or array element), or the description of a
structure or union.
SHOW positive means print details about the type (e.g. enum values),
and print structure elements passing SHOW - 1 for show.
SHOW zero means just print the type name or struct tag if there is one.
If there is no name, print something sensible but concise like
"struct {...}".
SHOW negative means the same things as SHOW zero. The difference is that
zero is used for printing structure elements and -1 is used for the
"whatis" command. But I don't see any need to distinguish.
LEVEL is the number of spaces to indent by.
We increase it for some recursive calls. */
void
c_type_print_base (type, stream, show, level)
struct type *type;
FILE *stream;
int show;
int level;
{
register int i;
register int len;
register int lastval;
char *mangled_name;
char *demangled_name;
enum {s_none, s_public, s_private, s_protected} section_type;
QUIT;
wrap_here (" ");
if (type == NULL)
{
fputs_filtered ("<type unknown>", stream);
return;
}
/* When SHOW is zero or less, and there is a valid type name, then always
just print the type name directly from the type. */
/* If we have "typedef struct foo {. . .} bar;" do we want to print it
as "struct foo" or as "bar"? Pick the latter, because C++ folk tend
to expect things like "class5 *foo" rather than "struct class5 *foo". */
if (show <= 0
&& TYPE_NAME (type) != NULL)
{
fputs_filtered (TYPE_NAME (type), stream);
return;
}
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_PTR:
case TYPE_CODE_MEMBER:
case TYPE_CODE_REF:
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
c_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_STRUCT:
if (HAVE_CPLUS_STRUCT (type))
{
fprintf_filtered (stream, "class ");
}
else
{
fprintf_filtered (stream, "struct ");
}
goto struct_union;
case TYPE_CODE_UNION:
fprintf_filtered (stream, "union ");
struct_union:
if (TYPE_TAG_NAME (type) != NULL)
{
fputs_filtered (TYPE_TAG_NAME (type), stream);
if (show > 0)
fputs_filtered (" ", stream);
}
wrap_here (" ");
if (show <= 0)
{
/* If we just printed a tag name, no need to print anything else. */
if (TYPE_TAG_NAME (type) == NULL)
fprintf_filtered (stream, "{...}");
}
else if (show > 0)
{
check_stub_type (type);
cp_type_print_derivation_info (stream, type);
fprintf_filtered (stream, "{\n");
if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
{
if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
else
fprintfi_filtered (level + 4, stream, "<no data fields>\n");
}
/* Start off with no specific section type, so we can print
one for the first field we find, and use that section type
thereafter until we find another type. */
section_type = s_none;
/* If there is a base class for this type,
do not print the field that it occupies. */
len = TYPE_NFIELDS (type);
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
QUIT;
/* Don't print out virtual function table. */
if ((TYPE_FIELD_NAME (type, i))[5] == CPLUS_MARKER &&
!strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
continue;
/* If this is a C++ class we can print the various C++ section
labels. */
if (HAVE_CPLUS_STRUCT (type))
{
if (TYPE_FIELD_PROTECTED (type, i))
{
if (section_type != s_protected)
{
section_type = s_protected;
fprintfi_filtered (level + 2, stream,
"protected:\n");
}
}
else if (TYPE_FIELD_PRIVATE (type, i))
{
if (section_type != s_private)
{
section_type = s_private;
fprintfi_filtered (level + 2, stream, "private:\n");
}
}
else
{
if (section_type != s_public)
{
section_type = s_public;
fprintfi_filtered (level + 2, stream, "public:\n");
}
}
}
print_spaces_filtered (level + 4, stream);
if (TYPE_FIELD_STATIC (type, i))
{
fprintf_filtered (stream, "static ");
}
c_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4);
if (!TYPE_FIELD_STATIC (type, i)
&& TYPE_FIELD_PACKED (type, i))
{
/* It is a bitfield. This code does not attempt
to look at the bitpos and reconstruct filler,
unnamed fields. This would lead to misleading
results if the compiler does not put out fields
for such things (I don't know what it does). */
fprintf_filtered (stream, " : %d",
TYPE_FIELD_BITSIZE (type, i));
}
fprintf_filtered (stream, ";\n");
}
/* If there are both fields and methods, put a space between. */
len = TYPE_NFN_FIELDS (type);
if (len && section_type != s_none)
fprintf_filtered (stream, "\n");
/* C++: print out the methods */
for (i = 0; i < len; i++)
{
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
char *name = type_name_no_tag (type);
int is_constructor = name && STREQ(method_name, name);
for (j = 0; j < len2; j++)
{
QUIT;
if (TYPE_FN_FIELD_PROTECTED (f, j))
{
if (section_type != s_protected)
{
section_type = s_protected;
fprintfi_filtered (level + 2, stream,
"protected:\n");
}
}
else if (TYPE_FN_FIELD_PRIVATE (f, j))
{
if (section_type != s_private)
{
section_type = s_private;
fprintfi_filtered (level + 2, stream, "private:\n");
}
}
else
{
if (section_type != s_public)
{
section_type = s_public;
fprintfi_filtered (level + 2, stream, "public:\n");
}
}
print_spaces_filtered (level + 4, stream);
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
fprintf_filtered (stream, "virtual ");
else if (TYPE_FN_FIELD_STATIC_P (f, j))
fprintf_filtered (stream, "static ");
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
{
/* Keep GDB from crashing here. */
fprintf (stream, "<undefined type> %s;\n",
TYPE_FN_FIELD_PHYSNAME (f, j));
break;
}
else if (!is_constructor)
{
type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
"", stream, 0);
fputs_filtered (" ", stream);
}
if (TYPE_FN_FIELD_STUB (f, j))
{
/* Build something we can demangle. */
mangled_name = gdb_mangle_name (type, i, j);
demangled_name =
cplus_demangle (mangled_name,
DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
fprintf_filtered (stream, "<badly mangled name %s>",
mangled_name);
else
{
char *demangled_no_class =
strchr (demangled_name, ':');
if (demangled_no_class == NULL)
demangled_no_class = demangled_name;
else
{
if (*++demangled_no_class == ':')
++demangled_no_class;
}
fputs_filtered (demangled_no_class, stream);
free (demangled_name);
}
free (mangled_name);
}
else if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
&& TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1,
"~", method_name, 0, stream);
else
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "",
method_name,
TYPE_FN_FIELD_STATIC_P (f, j),
stream);
fprintf_filtered (stream, ";\n");
}
}
fprintfi_filtered (level, stream, "}");
}
break;
case TYPE_CODE_ENUM:
fprintf_filtered (stream, "enum ");
if (TYPE_TAG_NAME (type) != NULL)
{
fputs_filtered (TYPE_TAG_NAME (type), stream);
if (show > 0)
fputs_filtered (" ", stream);
}
wrap_here (" ");
if (show <= 0)
{
/* If we just printed a tag name, no need to print anything else. */
if (TYPE_TAG_NAME (type) == NULL)
fprintf_filtered (stream, "{...}");
}
else if (show > 0)
{
fprintf_filtered (stream, "{");
len = TYPE_NFIELDS (type);
lastval = 0;
for (i = 0; i < len; i++)
{
QUIT;
if (i) fprintf_filtered (stream, ", ");
wrap_here (" ");
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
if (lastval != TYPE_FIELD_BITPOS (type, i))
{
fprintf_filtered (stream, " = %d", TYPE_FIELD_BITPOS (type, i));
lastval = TYPE_FIELD_BITPOS (type, i);
}
lastval++;
}
fprintf_filtered (stream, "}");
}
break;
case TYPE_CODE_VOID:
fprintf_filtered (stream, "void");
break;
case TYPE_CODE_UNDEF:
fprintf_filtered (stream, "struct <unknown>");
break;
case TYPE_CODE_ERROR:
fprintf_filtered (stream, "<unknown type>");
break;
case TYPE_CODE_RANGE:
/* This should not occur */
fprintf_filtered (stream, "<range type>");
break;
default:
/* Handle types not explicitly handled by the other cases,
such as fundamental types. For these, just print whatever
the type name is, as recorded in the type itself. If there
is no type name, then complain. */
if (TYPE_NAME (type) != NULL)
{
fputs_filtered (TYPE_NAME (type), stream);
}
else
{
/* At least for dump_symtab, it is important that this not be
an error (). */
fprintf_filtered (stream, "<invalid type code %d>",
TYPE_CODE (type));
}
break;
}
}

View file

@ -0,0 +1,416 @@
/* Support for printing C values for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "value.h"
#include "demangle.h"
#include "valprint.h"
#include "language.h"
/* BEGIN-FIXME */
extern int vtblprint; /* Controls printing of vtbl's */
extern int demangle; /* whether to print C++ syms raw or src-form */
extern void
cp_print_class_member PARAMS ((char *, struct type *, FILE *, char *));
extern void
cp_print_class_method PARAMS ((char *, struct type *, FILE *));
extern void
cp_print_value_fields PARAMS ((struct type *, char *, FILE *, int, int,
enum val_prettyprint, struct type **));
extern int
cp_is_vtbl_ptr_type PARAMS ((struct type *));
extern int
cp_is_vtbl_member PARAMS ((struct type *));
/* END-FIXME */
/* BEGIN-FIXME: Hooks into c-typeprint.c */
extern void
c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
extern void
cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
FILE *));
/* END-FIXME */
extern struct obstack dont_print_obstack;
/* Print data of type TYPE located at VALADDR (within GDB), which came from
the inferior at address ADDRESS, onto stdio stream STREAM according to
FORMAT (a letter or 0 for natural format). The data at VALADDR is in
target byte order.
If the data are a string pointer, returns the number of string characters
printed.
If DEREF_REF is nonzero, then dereference references, otherwise just print
them like pointers.
The PRETTY parameter controls prettyprinting. */
int
c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
pretty)
struct type *type;
char *valaddr;
CORE_ADDR address;
FILE *stream;
int format;
int deref_ref;
int recurse;
enum val_prettyprint pretty;
{
register unsigned int i = 0; /* Number of characters printed */
unsigned len;
struct type *elttype;
unsigned eltlen;
LONGEST val;
CORE_ADDR addr;
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
{
elttype = TYPE_TARGET_TYPE (type);
eltlen = TYPE_LENGTH (elttype);
len = TYPE_LENGTH (type) / eltlen;
if (prettyprint_arrays)
{
print_spaces_filtered (2 + 2 * recurse, stream);
}
/* For an array of chars, print with string syntax. */
if (eltlen == 1 && TYPE_CODE (elttype) == TYPE_CODE_INT
&& (format == 0 || format == 's'))
{
LA_PRINT_STRING (stream, valaddr, len, 0);
i = len;
}
else
{
fprintf_filtered (stream, "{");
/* If this is a virtual function table, print the 0th
entry specially, and the rest of the members normally. */
if (cp_is_vtbl_ptr_type (elttype))
{
i = 1;
fprintf_filtered (stream, "%d vtable entries", len - 1);
}
else
{
i = 0;
}
val_print_array_elements (type, valaddr, address, stream,
format, deref_ref, recurse, pretty, i);
fprintf_filtered (stream, "}");
}
break;
}
/* Array of unspecified length: treat like pointer to first elt. */
addr = address;
goto print_unpacked_pointer;
case TYPE_CODE_PTR:
if (format && format != 's')
{
print_scalar_formatted (valaddr, type, format, 0, stream);
break;
}
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
{
cp_print_class_method (valaddr, type, stream);
}
else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_MEMBER)
{
cp_print_class_member (valaddr,
TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type)),
stream, "&");
}
else
{
addr = unpack_pointer (type, valaddr);
print_unpacked_pointer:
elttype = TYPE_TARGET_TYPE (type);
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_address_demangle (addr, stream, demangle);
/* Return value is irrelevant except for string pointers. */
return (0);
}
if (addressprint && format != 's')
{
fprintf_filtered (stream, "0x%lx", (unsigned long)addr);
}
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
if (TYPE_LENGTH (elttype) == 1
&& TYPE_CODE (elttype) == TYPE_CODE_INT
&& (format == 0 || format == 's')
&& addr != 0)
{
i = val_print_string (addr, 0, stream);
}
else if (cp_is_vtbl_member(type))
{
/* print vtbl's nicely */
CORE_ADDR vt_address = unpack_pointer (type, valaddr);
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (vt_address);
if ((msymbol != NULL) &&
(vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
{
fputs_filtered (" <", stream);
fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream);
fputs_filtered (">", stream);
}
if (vtblprint)
{
value vt_val;
struct symbol *wsym = (struct symbol *)NULL;
struct type *wtype;
struct symtab *s;
struct block *block = (struct block *)NULL;
int is_this_fld;
wsym = lookup_symbol (SYMBOL_NAME(msymbol), block,
VAR_NAMESPACE, &is_this_fld, &s);
if (wsym)
{
wtype = SYMBOL_TYPE(wsym);
}
else
{
wtype = TYPE_TARGET_TYPE(type);
}
vt_val = value_at (wtype, vt_address);
val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val),
VALUE_ADDRESS (vt_val), stream, format,
deref_ref, recurse + 1, pretty);
if (pretty)
{
fprintf_filtered (stream, "\n");
print_spaces_filtered (2 + 2 * recurse, stream);
}
}
}
/* Return number of characters printed, plus one for the
terminating null if we have "reached the end". */
return (i + (print_max && i != print_max));
}
break;
case TYPE_CODE_MEMBER:
error ("not implemented: member type in c_val_print");
break;
case TYPE_CODE_REF:
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_MEMBER)
{
cp_print_class_member (valaddr,
TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (type)),
stream, "");
break;
}
if (addressprint)
{
fprintf_filtered (stream, "@0x%lx",
unpack_long (builtin_type_int, valaddr));
if (deref_ref)
fputs_filtered (": ", stream);
}
/* De-reference the reference. */
if (deref_ref)
{
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
{
value deref_val =
value_at
(TYPE_TARGET_TYPE (type),
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr));
val_print (VALUE_TYPE (deref_val),
VALUE_CONTENTS (deref_val),
VALUE_ADDRESS (deref_val), stream, format,
deref_ref, recurse + 1, pretty);
}
else
fputs_filtered ("???", stream);
}
break;
case TYPE_CODE_UNION:
if (recurse && !unionprint)
{
fprintf_filtered (stream, "{...}");
break;
}
/* Fall through. */
case TYPE_CODE_STRUCT:
if (vtblprint && cp_is_vtbl_ptr_type(type))
{
/* Print the unmangled name if desired. */
print_address_demangle(*((int *) (valaddr + /* FIXME bytesex */
TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8)),
stream, demangle);
break;
}
cp_print_value_fields (type, valaddr, stream, format, recurse, pretty,
0);
break;
case TYPE_CODE_ENUM:
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
break;
}
len = TYPE_NFIELDS (type);
val = unpack_long (type, valaddr);
for (i = 0; i < len; i++)
{
QUIT;
if (val == TYPE_FIELD_BITPOS (type, i))
{
break;
}
}
if (i < len)
{
fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
}
else
{
print_longest (stream, 'd', 0, val);
}
break;
case TYPE_CODE_FUNC:
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
break;
}
/* FIXME, we should consider, at least for ANSI C language, eliminating
the distinction made between FUNCs and POINTERs to FUNCs. */
fprintf_filtered (stream, "{");
type_print (type, "", stream, -1);
fprintf_filtered (stream, "} ");
/* Try to print what function it points to, and its address. */
print_address_demangle (address, stream, demangle);
break;
case TYPE_CODE_BOOL:
/* Do something at least vaguely reasonable, for example if the
language is set wrong. */
case TYPE_CODE_INT:
format = format ? format : output_format;
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
}
else
{
val_print_type_code_int (type, valaddr, stream);
/* C and C++ has no single byte int type, char is used instead.
Since we don't know whether the value is really intended to
be used as an integer or a character, print the character
equivalent as well. */
if (TYPE_LENGTH (type) == 1)
{
fputs_filtered (" ", stream);
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr),
stream);
}
}
break;
case TYPE_CODE_CHAR:
format = format ? format : output_format;
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
}
else
{
fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%u" : "%d",
unpack_long (type, valaddr));
fputs_filtered (" ", stream);
LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr), stream);
}
break;
case TYPE_CODE_FLT:
if (format)
{
print_scalar_formatted (valaddr, type, format, 0, stream);
}
else
{
print_floating (valaddr, type, stream);
}
break;
case TYPE_CODE_VOID:
fprintf_filtered (stream, "void");
break;
case TYPE_CODE_ERROR:
fprintf_filtered (stream, "<error type>");
break;
case TYPE_CODE_RANGE:
/* FIXME, we should not ever have to print one of these yet. */
fprintf_filtered (stream, "<range type>");
break;
case TYPE_CODE_UNDEF:
/* This happens (without TYPE_FLAG_STUB set) on systems which don't use
dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
and no complete type for struct foo in that file. */
fprintf_filtered (stream, "<incomplete type>");
break;
default:
error ("Invalid C/C++ type code %d in symbol table.", TYPE_CODE (type));
}
fflush (stream);
return (0);
}

View file

@ -0,0 +1,28 @@
/* Prototypes for GDB commands that are called internally by other functions.
Copyright 1992 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern void
initialize_all_files PARAMS ((void));
extern void
exec_file_command PARAMS ((char *, int));
extern void
core_file_command PARAMS ((char *, int));
extern void
break_command PARAMS ((char *, int));

File diff suppressed because it is too large Load diff

1997
gnu/usr.bin/gdb/gdb/ch-exp.y Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,341 @@
/* Chill language support routines for GDB, the GNU debugger.
Copyright 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "parser-defs.h"
#include "language.h"
#include "ch-lang.h"
/* For now, Chill uses a simple mangling algorithm whereby you simply
discard everything after the occurance of two successive CPLUS_MARKER
characters to derive the demangled form. */
char *
chill_demangle (mangled)
const char *mangled;
{
char *joiner;
char *demangled;
joiner = strchr (mangled, CPLUS_MARKER);
if (joiner != NULL && *(joiner + 1) == CPLUS_MARKER)
{
demangled = savestring (mangled, joiner - mangled);
}
else
{
demangled = NULL;
}
return (demangled);
}
static void
chill_printchar (c, stream)
register int c;
FILE *stream;
{
c &= 0xFF; /* Avoid sign bit follies */
if (PRINT_LITERAL_FORM (c))
{
fprintf_filtered (stream, "'%c'", c);
}
else
{
fprintf_filtered (stream, "C'%.2x'", (unsigned int) c);
}
}
/* Print the character string STRING, printing at most LENGTH characters.
Printing stops early if the number hits print_max; repeat counts
are printed as appropriate. Print ellipses at the end if we
had to stop before printing LENGTH characters, or if FORCE_ELLIPSES.
Note that gdb maintains the length of strings without counting the
terminating null byte, while chill strings are typically written with
an explicit null byte. So we always assume an implied null byte
until gdb is able to maintain non-null terminated strings as well
as null terminated strings (FIXME).
*/
static void
chill_printstr (stream, string, length, force_ellipses)
FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
{
register unsigned int i;
unsigned int things_printed = 0;
int in_literal_form = 0;
int in_control_form = 0;
int need_slashslash = 0;
unsigned int c;
extern int repeat_count_threshold;
extern int print_max;
if (length == 0)
{
chill_printchar ('\0', stream);
return;
}
for (i = 0; i < length && things_printed < print_max; ++i)
{
/* Position of the character we are examining
to see whether it is repeated. */
unsigned int rep1;
/* Number of repetitions we have detected so far. */
unsigned int reps;
QUIT;
if (need_slashslash)
{
fputs_filtered ("//", stream);
need_slashslash = 0;
}
rep1 = i + 1;
reps = 1;
while (rep1 < length && string[rep1] == string[i])
{
++rep1;
++reps;
}
c = string[i];
if (reps > repeat_count_threshold)
{
if (in_control_form || in_literal_form)
{
fputs_filtered ("'//", stream);
in_control_form = in_literal_form = 0;
}
chill_printchar (c, stream);
fprintf_filtered (stream, "<repeats %u times>", reps);
i = rep1 - 1;
things_printed += repeat_count_threshold;
need_slashslash = 1;
}
else
{
if (PRINT_LITERAL_FORM (c))
{
if (!in_literal_form)
{
if (in_control_form)
{
fputs_filtered ("'//", stream);
in_control_form = 0;
}
fputs_filtered ("'", stream);
in_literal_form = 1;
}
fprintf_filtered (stream, "%c", c);
}
else
{
if (!in_control_form)
{
if (in_literal_form)
{
fputs_filtered ("'//", stream);
in_literal_form = 0;
}
fputs_filtered ("c'", stream);
in_control_form = 1;
}
fprintf_filtered (stream, "%.2x", c);
}
++things_printed;
}
}
/* Terminate the quotes if necessary. */
if (in_literal_form || in_control_form)
{
fputs_filtered ("'", stream);
}
if (force_ellipses || (i < length))
{
fputs_filtered ("...", stream);
}
}
static struct type *
chill_create_fundamental_type (objfile, typeid)
struct objfile *objfile;
int typeid;
{
register struct type *type = NULL;
switch (typeid)
{
default:
/* FIXME: For now, if we are asked to produce a type not in this
language, create the equivalent of a C integer type with the
name "<?type?>". When all the dust settles from the type
reconstruction work, this should probably become an error. */
type = init_type (TYPE_CODE_INT, 2, 0, "<?type?>", objfile);
warning ("internal error: no chill fundamental type %d", typeid);
break;
case FT_VOID:
/* FIXME: Currently the GNU Chill compiler emits some DWARF entries for
typedefs, unrelated to anything directly in the code being compiled,
that have some FT_VOID types. Just fake it for now. */
type = init_type (TYPE_CODE_VOID, 0, 0, "<?VOID?>", objfile);
break;
case FT_BOOLEAN:
type = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED, "BOOL", objfile);
break;
case FT_CHAR:
type = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
break;
case FT_SIGNED_CHAR:
type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_SIGNED, "BYTE", objfile);
break;
case FT_UNSIGNED_CHAR:
type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, "UBYTE", objfile);
break;
case FT_SHORT: /* Chill ints are 2 bytes */
type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_SIGNED, "INT", objfile);
break;
case FT_UNSIGNED_SHORT: /* Chill ints are 2 bytes */
type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, "UINT", objfile);
break;
case FT_INTEGER: /* FIXME? */
case FT_SIGNED_INTEGER: /* FIXME? */
case FT_LONG: /* Chill longs are 4 bytes */
case FT_SIGNED_LONG: /* Chill longs are 4 bytes */
type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_SIGNED, "LONG", objfile);
break;
case FT_UNSIGNED_INTEGER: /* FIXME? */
case FT_UNSIGNED_LONG: /* Chill longs are 4 bytes */
type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED, "ULONG", objfile);
break;
case FT_FLOAT:
type = init_type (TYPE_CODE_FLT, 4, 0, "REAL", objfile);
break;
case FT_DBL_PREC_FLOAT:
type = init_type (TYPE_CODE_FLT, 8, 0, "LONG_REAL", objfile);
break;
}
return (type);
}
/* Table of operators and their precedences for printing expressions. */
static const struct op_print chill_op_print_tab[] = {
{"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
{"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
{"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
{"MOD", BINOP_MOD, PREC_MUL, 0},
{"REM", BINOP_REM, PREC_MUL, 0},
{":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
{"=", BINOP_EQUAL, PREC_EQUAL, 0},
{"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
{"<=", BINOP_LEQ, PREC_ORDER, 0},
{">=", BINOP_GEQ, PREC_ORDER, 0},
{">", BINOP_GTR, PREC_ORDER, 0},
{"<", BINOP_LESS, PREC_ORDER, 0},
{"+", BINOP_ADD, PREC_ADD, 0},
{"-", BINOP_SUB, PREC_ADD, 0},
{"*", BINOP_MUL, PREC_MUL, 0},
{"/", BINOP_DIV, PREC_MUL, 0},
{"//", BINOP_CONCAT, PREC_PREFIX, 0}, /* FIXME: precedence? */
{"-", UNOP_NEG, PREC_PREFIX, 0},
{NULL, 0, 0, 0}
};
/* The built-in types of Chill. */
struct type *builtin_type_chill_bool;
struct type *builtin_type_chill_char;
struct type *builtin_type_chill_long;
struct type *builtin_type_chill_ulong;
struct type *builtin_type_chill_real;
struct type ** const (chill_builtin_types[]) =
{
&builtin_type_chill_bool,
&builtin_type_chill_char,
&builtin_type_chill_long,
&builtin_type_chill_ulong,
&builtin_type_chill_real,
0
};
const struct language_defn chill_language_defn = {
"chill",
language_chill,
chill_builtin_types,
range_check_on,
type_check_on,
chill_parse, /* parser */
chill_error, /* parser error function */
chill_printchar, /* print a character constant */
chill_printstr, /* function to print a string constant */
chill_create_fundamental_type,/* Create fundamental type in this language */
chill_print_type, /* Print a type using appropriate syntax */
chill_val_print, /* Print a value using appropriate syntax */
&BUILTIN_TYPE_LONGEST, /* longest signed integral type */
&BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */
&builtin_type_chill_real, /* longest floating point type */
{"", "B'", "", ""}, /* Binary format info */
{"O'%lo", "O'", "o", ""}, /* Octal format info */
{"D'%ld", "D'", "d", ""}, /* Decimal format info */
{"H'%lx", "H'", "x", ""}, /* Hex format info */
chill_op_print_tab, /* expression operators for printing */
LANG_MAGIC
};
/* Initialization for Chill */
void
_initialize_chill_language ()
{
builtin_type_chill_bool =
init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"BOOL", (struct objfile *) NULL);
builtin_type_chill_char =
init_type (TYPE_CODE_CHAR, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"CHAR", (struct objfile *) NULL);
builtin_type_chill_long =
init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
0,
"LONG", (struct objfile *) NULL);
builtin_type_chill_ulong =
init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT,
TYPE_FLAG_UNSIGNED,
"ULONG", (struct objfile *) NULL);
builtin_type_chill_real =
init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
0,
"LONG_REAL", (struct objfile *) NULL);
add_language (&chill_language_defn);
}

View file

@ -0,0 +1,31 @@
/* Chill language support definitions for GDB, the GNU debugger.
Copyright 1992 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int
chill_parse PARAMS ((void)); /* Defined in ch-exp.y */
extern void
chill_error PARAMS ((char *)); /* Defined in ch-exp.y */
extern void /* Defined in ch-typeprint.c */
chill_print_type PARAMS ((struct type *, char *, FILE *, int, int));
extern int
chill_val_print PARAMS ((struct type *, char *, CORE_ADDR, FILE *, int, int,
int, enum val_prettyprint));

View file

@ -0,0 +1,225 @@
/* Support for printing Chill types for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
#include "obstack.h"
#include "bfd.h" /* Binary File Description */
#include "symtab.h"
#include "gdbtypes.h"
#include "expression.h"
#include "value.h"
#include "gdbcore.h"
#include "target.h"
#include "command.h"
#include "gdbcmd.h"
#include "language.h"
#include "demangle.h"
#include "ch-lang.h"
#include <string.h>
#include <errno.h>
static void
chill_type_print_base PARAMS ((struct type *, FILE *, int, int));
void
chill_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
FILE *stream;
int show;
int level;
{
if (varstring != NULL && *varstring != '\0')
{
fputs_filtered (varstring, stream);
fputs_filtered (" ", stream);
}
chill_type_print_base (type, stream, show, level);
}
/* Print the name of the type (or the ultimate pointer target,
function value or array element).
SHOW nonzero means don't print this type as just its name;
show its real definition even if it has a name.
SHOW zero means print just typename or tag if there is one
SHOW negative means abbreviate structure elements.
SHOW is decremented for printing of structure elements.
LEVEL is the depth to indent by.
We increase it for some recursive calls. */
static void
chill_type_print_base (type, stream, show, level)
struct type *type;
FILE *stream;
int show;
int level;
{
char *name;
register int len;
register int i;
struct type *index_type;
struct type *range_type;
LONGEST low_bound;
LONGEST high_bound;
QUIT;
wrap_here (" ");
if (type == NULL)
{
fputs_filtered ("<type unknown>", stream);
return;
}
/* When SHOW is zero or less, and there is a valid type name, then always
just print the type name directly from the type. */
if ((show <= 0) && (TYPE_NAME (type) != NULL))
{
fputs_filtered (TYPE_NAME (type), stream);
return;
}
switch (TYPE_CODE (type))
{
case TYPE_CODE_PTR:
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
{
fprintf_filtered (stream, "PTR");
break;
}
fprintf_filtered (stream, "REF ");
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_ARRAY:
range_type = TYPE_FIELD_TYPE (type, 0);
index_type = TYPE_TARGET_TYPE (range_type);
low_bound = TYPE_FIELD_BITPOS (range_type, 0);
high_bound = TYPE_FIELD_BITPOS (range_type, 1);
fputs_filtered ("ARRAY (", stream);
print_type_scalar (index_type, low_bound, stream);
fputs_filtered (":", stream);
print_type_scalar (index_type, high_bound, stream);
fputs_filtered (") ", stream);
chill_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
break;
case TYPE_CODE_STRING:
range_type = TYPE_FIELD_TYPE (type, 0);
index_type = TYPE_TARGET_TYPE (range_type);
high_bound = TYPE_FIELD_BITPOS (range_type, 1);
fputs_filtered ("CHAR (", stream);
print_type_scalar (index_type, high_bound + 1, stream);
fputs_filtered (")", stream);
break;
case TYPE_CODE_MEMBER:
fprintf_filtered (stream, "MEMBER ");
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_REF:
fprintf_filtered (stream, "/*LOC*/ ");
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_FUNC:
fprintf_filtered (stream, "PROC (?)");
chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
break;
case TYPE_CODE_STRUCT:
fprintf_filtered (stream, "STRUCT ");
if ((name = type_name_no_tag (type)) != NULL)
{
fputs_filtered (name, stream);
fputs_filtered (" ", stream);
wrap_here (" ");
}
if (show < 0)
{
fprintf_filtered (stream, "(...)");
}
else
{
check_stub_type (type);
fprintf_filtered (stream, "(\n");
if ((TYPE_NFIELDS (type) == 0) && (TYPE_NFN_FIELDS (type) == 0))
{
if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
{
fprintfi_filtered (level + 4, stream, "<incomplete type>\n");
}
else
{
fprintfi_filtered (level + 4, stream, "<no data fields>\n");
}
}
else
{
len = TYPE_NFIELDS (type);
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
QUIT;
print_spaces_filtered (level + 4, stream);
chill_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
stream, show - 1, level + 4);
if (i < (len - 1))
{
fputs_filtered (",", stream);
}
fputs_filtered ("\n", stream);
}
}
fprintfi_filtered (level, stream, ")");
}
break;
case TYPE_CODE_VOID:
case TYPE_CODE_UNDEF:
case TYPE_CODE_ERROR:
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
case TYPE_CODE_UNION:
case TYPE_CODE_METHOD:
error ("missing language support in chill_type_print_base");
break;
default:
/* Handle types not explicitly handled by the other cases,
such as fundamental types. For these, just print whatever
the type name is, as recorded in the type itself. If there
is no type name, then complain. */
if (TYPE_NAME (type) != NULL)
{
fputs_filtered (TYPE_NAME (type), stream);
}
else
{
error ("Unrecognized type code (%d) in symbol table.",
TYPE_CODE (type));
}
break;
}
}

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