summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/mips-tdump.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
committerobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
commit0bedf4fb30066e5e1d4342a1d3914dae7d37cba7 (patch)
tree68d8110b41afd0ebbf39167b1a4918eea667a7c5 /contrib/gcc/mips-tdump.c
parentd4db5fb866b7ad5216abd5047774a3973b9901a9 (diff)
downloadFreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.zip
FreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.tar.gz
Virgin import of gcc from EGCS 1.1.2
Diffstat (limited to 'contrib/gcc/mips-tdump.c')
-rw-r--r--contrib/gcc/mips-tdump.c141
1 files changed, 68 insertions, 73 deletions
diff --git a/contrib/gcc/mips-tdump.c b/contrib/gcc/mips-tdump.c
index 36dfd15..558e090 100644
--- a/contrib/gcc/mips-tdump.c
+++ b/contrib/gcc/mips-tdump.c
@@ -1,5 +1,5 @@
/* Read and manage MIPS symbol tables from object modules.
- Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1991, 1994, 1995, 1997 Free Software Foundation, Inc.
Contributed by hartzell@boulder.colorado.edu,
Rewritten by meissner@osf.org.
@@ -20,13 +20,8 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <time.h>
-#include <fcntl.h>
-#include <errno.h>
#include "config.h"
+#include "system.h"
#ifdef index
#undef index
@@ -44,7 +39,7 @@ Boston, MA 02111-1307, USA. */
which does not include mips.h.
These must match the corresponding definitions in gdb/mipsread.c.
- Unfortunately, gcc and gdb do not currently share any directories. */
+ Unfortunately, gcc and gdb do not currently share any directories. */
#define CODE_MASK 0x8F300
#define MIPS_IS_STAB(sym) (((sym)->index & 0xFFF00) == CODE_MASK)
@@ -86,7 +81,7 @@ typedef char *CPTR_T;
#define ptrdiff_t int
-/* Redefinition of of storage classes as an enumeration for better
+/* Redefinition of storage classes as an enumeration for better
debugging. */
#ifndef stStaParam
@@ -308,7 +303,7 @@ read_seek (ptr, size, offset, context)
if (size == 0) /* nothing to read */
return ptr;
- if ((ptr == (PTR_T)0 && (ptr = malloc (size)) == (PTR_T)0)
+ if ((ptr == (PTR_T) 0 && (ptr = malloc (size)) == (PTR_T) 0)
|| (tfile_offset != offset && lseek (tfile_fd, offset, 0) == -1)
|| (read_size = read (tfile_fd, ptr, size)) < 0)
{
@@ -721,7 +716,7 @@ type_to_string (aux_ptr, index, fdp)
int j;
/* Print array bounds reversed (ie, in the order the C
- programmer writes them). C is such a fun language.... */
+ programmer writes them). C is such a fun language.... */
while (i < 5 && qualifiers[i+1].type == tq_Array)
i++;
@@ -833,60 +828,60 @@ print_sym_hdr (sym_ptr)
printf(" %-*s %11s %11s %11s\n", width, "====", "======", "======", "=====\n");
printf(" %-*s %11ld %11ld %11ld [%d]\n", width, "Line numbers",
- (long)sym_ptr->cbLineOffset,
- (long)sym_ptr->cbLine,
- (long)sym_ptr->cbLine,
- (int)sym_ptr->ilineMax);
+ (long) sym_ptr->cbLineOffset,
+ (long) sym_ptr->cbLine,
+ (long) sym_ptr->cbLine,
+ (int) sym_ptr->ilineMax);
printf(" %-*s %11ld %11ld %11ld\n", width, "Dense numbers",
- (long)sym_ptr->cbDnOffset,
- (long)sym_ptr->idnMax,
- (long)(sym_ptr->idnMax * sizeof (DNR)));
+ (long) sym_ptr->cbDnOffset,
+ (long) sym_ptr->idnMax,
+ (long) (sym_ptr->idnMax * sizeof (DNR)));
printf(" %-*s %11ld %11ld %11ld\n", width, "Procedures Tables",
- (long)sym_ptr->cbPdOffset,
- (long)sym_ptr->ipdMax,
- (long)(sym_ptr->ipdMax * sizeof (PDR)));
+ (long) sym_ptr->cbPdOffset,
+ (long) sym_ptr->ipdMax,
+ (long) (sym_ptr->ipdMax * sizeof (PDR)));
printf(" %-*s %11ld %11ld %11ld\n", width, "Local Symbols",
- (long)sym_ptr->cbSymOffset,
- (long)sym_ptr->isymMax,
- (long)(sym_ptr->isymMax * sizeof (SYMR)));
+ (long) sym_ptr->cbSymOffset,
+ (long) sym_ptr->isymMax,
+ (long) (sym_ptr->isymMax * sizeof (SYMR)));
printf(" %-*s %11ld %11ld %11ld\n", width, "Optimization Symbols",
- (long)sym_ptr->cbOptOffset,
- (long)sym_ptr->ioptMax,
- (long)(sym_ptr->ioptMax * sizeof (OPTR)));
+ (long) sym_ptr->cbOptOffset,
+ (long) sym_ptr->ioptMax,
+ (long) (sym_ptr->ioptMax * sizeof (OPTR)));
printf(" %-*s %11ld %11ld %11ld\n", width, "Auxiliary Symbols",
- (long)sym_ptr->cbAuxOffset,
- (long)sym_ptr->iauxMax,
- (long)(sym_ptr->iauxMax * sizeof (AUXU)));
+ (long) sym_ptr->cbAuxOffset,
+ (long) sym_ptr->iauxMax,
+ (long) (sym_ptr->iauxMax * sizeof (AUXU)));
printf(" %-*s %11ld %11ld %11ld\n", width, "Local Strings",
- (long)sym_ptr->cbSsOffset,
- (long)sym_ptr->issMax,
- (long)sym_ptr->issMax);
+ (long) sym_ptr->cbSsOffset,
+ (long) sym_ptr->issMax,
+ (long) sym_ptr->issMax);
printf(" %-*s %11ld %11ld %11ld\n", width, "External Strings",
- (long)sym_ptr->cbSsExtOffset,
- (long)sym_ptr->issExtMax,
- (long)sym_ptr->issExtMax);
+ (long) sym_ptr->cbSsExtOffset,
+ (long) sym_ptr->issExtMax,
+ (long) sym_ptr->issExtMax);
printf(" %-*s %11ld %11ld %11ld\n", width, "File Tables",
- (long)sym_ptr->cbFdOffset,
- (long)sym_ptr->ifdMax,
- (long)(sym_ptr->ifdMax * sizeof (FDR)));
+ (long) sym_ptr->cbFdOffset,
+ (long) sym_ptr->ifdMax,
+ (long) (sym_ptr->ifdMax * sizeof (FDR)));
printf(" %-*s %11ld %11ld %11ld\n", width, "Relative Files",
- (long)sym_ptr->cbRfdOffset,
- (long)sym_ptr->crfd,
- (long)(sym_ptr->crfd * sizeof (ulong)));
+ (long) sym_ptr->cbRfdOffset,
+ (long) sym_ptr->crfd,
+ (long) (sym_ptr->crfd * sizeof (ulong)));
printf(" %-*s %11ld %11ld %11ld\n", width, "External Symbols",
- (long)sym_ptr->cbExtOffset,
- (long)sym_ptr->iextMax,
- (long)(sym_ptr->iextMax * sizeof (EXTR)));
+ (long) sym_ptr->cbExtOffset,
+ (long) sym_ptr->iextMax,
+ (long) (sym_ptr->iextMax * sizeof (EXTR)));
}
@@ -909,7 +904,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
printf ("\n Symbol# %d: \"%s\"\n", number, sym_ptr->iss + strbase);
- if (aux_base != (AUXU *)0 && index != indexNil)
+ if (aux_base != (AUXU *) 0 && index != indexNil)
switch (symbol_type)
{
case st_Nil:
@@ -921,7 +916,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
printf (" End+1 symbol: %ld\n", index);
if (want_scope)
{
- if (free_scope == (scope_t *)0)
+ if (free_scope == (scope_t *) 0)
scope_ptr = (scope_t *) malloc (sizeof (scope_t));
else
{
@@ -942,12 +937,12 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
else
{
used_ptr[index] = 1;
- printf (" First symbol: %ld\n", aux_base[index].isym);
+ printf (" First symbol: %ld\n", (long) aux_base[index].isym);
}
if (want_scope)
{
- if (cur_scope == (scope_t *)0)
+ if (cur_scope == (scope_t *) 0)
printf (" Can't pop end scope\n");
else
{
@@ -967,7 +962,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
{
used_ptr[index] = used_ptr[index+1] = 1;
printf (" End+1 symbol: %-7ld Type: %s\n",
- aux_base[index].isym,
+ (long) aux_base[index].isym,
type_to_string (aux_base, index+1, fdp));
}
else /* global symbol */
@@ -975,7 +970,7 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
if (want_scope)
{
- if (free_scope == (scope_t *)0)
+ if (free_scope == (scope_t *) 0)
scope_ptr = (scope_t *) malloc (sizeof (scope_t));
else
{
@@ -1011,12 +1006,12 @@ print_symbol (sym_ptr, number, strbase, aux_base, ifd, fdp)
if (want_scope)
{
printf (" Scopes: ");
- if (cur_scope == (scope_t *)0)
+ if (cur_scope == (scope_t *) 0)
printf (" none\n");
else
{
for (scope_ptr = cur_scope;
- scope_ptr != (scope_t *)0;
+ scope_ptr != (scope_t *) 0;
scope_ptr = scope_ptr->prev)
{
char *class;
@@ -1220,7 +1215,7 @@ print_file_desc (fdp, number)
(ulong) (fdp->rfdBase * sizeof(ulong) + sym_hdr.cbRfdOffset));
- if (want_scope && cur_scope != (scope_t *)0)
+ if (want_scope && cur_scope != (scope_t *) 0)
printf ("\n Warning scope does not start at 0!\n");
/*
@@ -1238,7 +1233,7 @@ print_file_desc (fdp, number)
-1,
fdp);
- if (want_scope && cur_scope != (scope_t *)0)
+ if (want_scope && cur_scope != (scope_t *) 0)
printf ("\n Warning scope does not end at 0!\n");
/*
@@ -1328,7 +1323,7 @@ print_file_desc (fdp, number)
if (pdi == fdp->cpd + fdp->ipdFirst - 1) /* last procedure */
line_end = ((uchar *)lines) + fdp->cbLine + fdp->cbLineOffset;
- else /* not last proc. */
+ else /* not last proc. */
line_end = (((uchar *)lines) + proc_desc[pdi+1].cbLineOffset
+ fdp->cbLineOffset);
@@ -1368,12 +1363,12 @@ read_tfile __proto((void))
short magic;
off_t sym_hdr_offset = 0;
- (void) read_seek ((PTR_T) &magic, sizeof (magic), (off_t)0, "Magic number");
+ (void) read_seek ((PTR_T) &magic, sizeof (magic), (off_t) 0, "Magic number");
if (!tfile)
{
/* Print out the global header, since this is not a T-file. */
- (void) read_seek ((PTR_T) &global_hdr, sizeof (global_hdr), (off_t)0,
+ (void) read_seek ((PTR_T) &global_hdr, sizeof (global_hdr), (off_t) 0,
"Global file header");
print_global_hdr (&global_hdr);
@@ -1394,32 +1389,32 @@ read_tfile __proto((void))
print_sym_hdr (&sym_hdr);
- lines = (LINER *) read_seek ((PTR_T)0,
+ lines = (LINER *) read_seek ((PTR_T) 0,
sym_hdr.cbLine,
sym_hdr.cbLineOffset,
"Line numbers");
- dense_nums = (DNR *) read_seek ((PTR_T)0,
+ dense_nums = (DNR *) read_seek ((PTR_T) 0,
sym_hdr.idnMax * sizeof (DNR),
sym_hdr.cbDnOffset,
"Dense numbers");
- proc_desc = (PDR *) read_seek ((PTR_T)0,
+ proc_desc = (PDR *) read_seek ((PTR_T) 0,
sym_hdr.ipdMax * sizeof (PDR),
sym_hdr.cbPdOffset,
"Procedure tables");
- l_symbols = (SYMR *) read_seek ((PTR_T)0,
+ l_symbols = (SYMR *) read_seek ((PTR_T) 0,
sym_hdr.isymMax * sizeof (SYMR),
sym_hdr.cbSymOffset,
"Local symbols");
- opt_symbols = (OPTR *) read_seek ((PTR_T)0,
+ opt_symbols = (OPTR *) read_seek ((PTR_T) 0,
sym_hdr.ioptMax * sizeof (OPTR),
sym_hdr.cbOptOffset,
"Optimization symbols");
- aux_symbols = (AUXU *) read_seek ((PTR_T)0,
+ aux_symbols = (AUXU *) read_seek ((PTR_T) 0,
sym_hdr.iauxMax * sizeof (AUXU),
sym_hdr.cbAuxOffset,
"Auxiliary symbols");
@@ -1427,34 +1422,34 @@ read_tfile __proto((void))
if (sym_hdr.iauxMax > 0)
{
aux_used = calloc (sym_hdr.iauxMax, 1);
- if (aux_used == (char *)0)
+ if (aux_used == (char *) 0)
{
perror ("calloc");
exit (1);
}
}
- l_strings = (char *) read_seek ((PTR_T)0,
+ l_strings = (char *) read_seek ((PTR_T) 0,
sym_hdr.issMax,
sym_hdr.cbSsOffset,
"Local string table");
- e_strings = (char *) read_seek ((PTR_T)0,
+ e_strings = (char *) read_seek ((PTR_T) 0,
sym_hdr.issExtMax,
sym_hdr.cbSsExtOffset,
"External string table");
- file_desc = (FDR *) read_seek ((PTR_T)0,
+ file_desc = (FDR *) read_seek ((PTR_T) 0,
sym_hdr.ifdMax * sizeof (FDR),
sym_hdr.cbFdOffset,
"File tables");
- rfile_desc = (ulong *) read_seek ((PTR_T)0,
+ rfile_desc = (ulong *) read_seek ((PTR_T) 0,
sym_hdr.crfd * sizeof (ulong),
sym_hdr.cbRfdOffset,
"Relative file tables");
- e_symbols = (EXTR *) read_seek ((PTR_T)0,
+ e_symbols = (EXTR *) read_seek ((PTR_T) 0,
sym_hdr.iextMax * sizeof (EXTR),
sym_hdr.cbExtOffset,
"External symbols");
@@ -1526,9 +1521,9 @@ main (argc, argv)
if (sym_hdr.ifdMax == 0)
last_aux_in_use = 0;
else
- last_aux_in_use =
- file_desc[sym_hdr.ifdMax-1].iauxBase +
- file_desc[sym_hdr.ifdMax-1].caux - 1;
+ last_aux_in_use
+ = (file_desc[sym_hdr.ifdMax-1].iauxBase
+ + file_desc[sym_hdr.ifdMax-1].caux - 1);
if (last_aux_in_use < sym_hdr.iauxMax-1)
{
OpenPOWER on IntegriCloud