* ecoff.c (ecoff_emit_aggregate): Take fdr argument. Map fdr

index through rfd map if it exists.  Check for a couple of cases
	which gdb handles specially.  Change all callers.
	(ecoff_type_to_string): Take fdr argument rather than aux_ptr and
	bigendian argument.  Change all callers.
	(ecoff_print_symbol): Handle stStruct, stUnion and stEnum.
This commit is contained in:
Ian Lance Taylor 1994-04-15 16:29:56 +00:00
parent e904716cb4
commit 2ec2e6a90a
2 changed files with 94 additions and 46 deletions

View File

@ -1,3 +1,12 @@
Fri Apr 15 12:22:07 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* ecoff.c (ecoff_emit_aggregate): Take fdr argument. Map fdr
index through rfd map if it exists. Check for a couple of cases
which gdb handles specially. Change all callers.
(ecoff_type_to_string): Take fdr argument rather than aux_ptr and
bigendian argument. Change all callers.
(ecoff_print_symbol): Handle stStruct, stUnion and stEnum.
Thu Apr 14 13:05:10 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) Thu Apr 14 13:05:10 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* coff-mips.c (mips_howto_table): Add dummy entries to account for * coff-mips.c (mips_howto_table): Add dummy entries to account for

View File

@ -49,11 +49,12 @@ static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *abfd));
static boolean ecoff_set_symbol_info PARAMS ((bfd *abfd, SYMR *ecoff_sym, static boolean ecoff_set_symbol_info PARAMS ((bfd *abfd, SYMR *ecoff_sym,
asymbol *asym, int ext, asymbol *asym, int ext,
asymbol **indirect_ptr_ptr)); asymbol **indirect_ptr_ptr));
static void ecoff_emit_aggregate PARAMS ((bfd *abfd, char *string, static void ecoff_emit_aggregate PARAMS ((bfd *abfd, FDR *fdr,
char *string,
RNDXR *rndx, long isym, RNDXR *rndx, long isym,
CONST char *which)); const char *which));
static char *ecoff_type_to_string PARAMS ((bfd *abfd, union aux_ext *aux_ptr, static char *ecoff_type_to_string PARAMS ((bfd *abfd, FDR *fdr,
unsigned int indx, int bigendian)); unsigned int indx));
static boolean ecoff_slurp_reloc_table PARAMS ((bfd *abfd, asection *section, static boolean ecoff_slurp_reloc_table PARAMS ((bfd *abfd, asection *section,
asymbol **symbols)); asymbol **symbols));
static void ecoff_compute_section_file_positions PARAMS ((bfd *abfd)); static void ecoff_compute_section_file_positions PARAMS ((bfd *abfd));
@ -1269,57 +1270,76 @@ ecoff_get_symtab (abfd, alocation)
/* Write aggregate information to a string. */ /* Write aggregate information to a string. */
static void static void
ecoff_emit_aggregate (abfd, string, rndx, isym, which) ecoff_emit_aggregate (abfd, fdr, string, rndx, isym, which)
bfd *abfd; bfd *abfd;
FDR *fdr;
char *string; char *string;
RNDXR *rndx; RNDXR *rndx;
long isym; long isym;
CONST char *which; const char *which;
{ {
int ifd = rndx->rfd; const struct ecoff_debug_swap * const debug_swap =
int indx = rndx->index; &ecoff_backend (abfd)->debug_swap;
int sym_base, ss_base; struct ecoff_debug_info * const debug_info = &ecoff_data (abfd)->debug_info;
CONST char *name; unsigned int ifd = rndx->rfd;
unsigned int indx = rndx->index;
const char *name;
if (ifd == 0xfff) if (ifd == 0xfff)
ifd = isym; ifd = isym;
sym_base = ecoff_data (abfd)->debug_info.fdr[ifd].isymBase; /* An ifd of -1 is an opaque type. An escaped index of 0 is a
ss_base = ecoff_data (abfd)->debug_info.fdr[ifd].issBase; struct return type of a procedure compiled without -g. */
if (ifd == 0xffffffff
if (indx == indexNil) || (rndx->rfd == 0xfff && indx == 0))
name = "/* no name */"; name = "<undefined>";
else if (indx == indexNil)
name = "<no name>";
else else
{ {
const struct ecoff_debug_swap * const debug_swap
= &ecoff_backend (abfd)->debug_swap;
SYMR sym; SYMR sym;
indx += sym_base; if (debug_info->external_rfd == NULL)
(*debug_swap->swap_sym_in) fdr = debug_info->fdr + ifd;
(abfd, else
((char *) ecoff_data (abfd)->debug_info.external_sym {
+ indx * debug_swap->external_sym_size), RFDT rfd;
&sym);
name = ecoff_data (abfd)->debug_info.ss + ss_base + sym.iss; (*debug_swap->swap_rfd_in) (abfd,
((char *) debug_info->external_rfd
+ ((fdr->rfdBase + ifd)
* debug_swap->external_rfd_size)),
&rfd);
fdr = debug_info->fdr + rfd;
}
indx += fdr->isymBase;
(*debug_swap->swap_sym_in) (abfd,
((char *) debug_info->external_sym
+ indx * debug_swap->external_sym_size),
&sym);
name = debug_info->ss + fdr->issBase + sym.iss;
} }
sprintf (string, sprintf (string,
"%s %s { ifd = %d, index = %ld }", "%s %s { ifd = %u, index = %lu }",
which, name, ifd, which, name, ifd,
((long) indx ((long) indx
+ ecoff_data (abfd)->debug_info.symbolic_header.iextMax)); + debug_info->symbolic_header.iextMax));
} }
/* Convert the type information to string format. */ /* Convert the type information to string format. */
static char * static char *
ecoff_type_to_string (abfd, aux_ptr, indx, bigendian) ecoff_type_to_string (abfd, fdr, indx)
bfd *abfd; bfd *abfd;
union aux_ext *aux_ptr; FDR *fdr;
unsigned int indx; unsigned int indx;
int bigendian;
{ {
union aux_ext *aux_ptr;
int bigendian;
AUXU u; AUXU u;
struct qual { struct qual {
unsigned int type; unsigned int type;
@ -1327,7 +1347,6 @@ ecoff_type_to_string (abfd, aux_ptr, indx, bigendian)
int high_bound; int high_bound;
int stride; int stride;
} qualifiers[7]; } qualifiers[7];
unsigned int basic_type; unsigned int basic_type;
int i; int i;
static char buffer1[1024]; static char buffer1[1024];
@ -1336,6 +1355,9 @@ ecoff_type_to_string (abfd, aux_ptr, indx, bigendian)
char *p2 = buffer2; char *p2 = buffer2;
RNDXR rndx; RNDXR rndx;
aux_ptr = ecoff_data (abfd)->debug_info.external_aux + fdr->iauxBase;
bigendian = fdr->fBigendian;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
{ {
qualifiers[i].low_bound = 0; qualifiers[i].low_bound = 0;
@ -1415,7 +1437,7 @@ ecoff_type_to_string (abfd, aux_ptr, indx, bigendian)
case btStruct: /* Structure (Record) */ case btStruct: /* Structure (Record) */
ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
ecoff_emit_aggregate (abfd, p1, &rndx, ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
(long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
"struct"); "struct");
indx++; /* skip aux words */ indx++; /* skip aux words */
@ -1427,7 +1449,7 @@ ecoff_type_to_string (abfd, aux_ptr, indx, bigendian)
case btUnion: /* Union */ case btUnion: /* Union */
ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
ecoff_emit_aggregate (abfd, p1, &rndx, ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
(long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
"union"); "union");
indx++; /* skip aux words */ indx++; /* skip aux words */
@ -1439,7 +1461,7 @@ ecoff_type_to_string (abfd, aux_ptr, indx, bigendian)
case btEnum: /* Enumeration */ case btEnum: /* Enumeration */
ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx); ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
ecoff_emit_aggregate (abfd, p1, &rndx, ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
(long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]), (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
"enum"); "enum");
indx++; /* skip aux words */ indx++; /* skip aux words */
@ -1720,17 +1742,19 @@ ecoff_print_symbol (abfd, filep, symbol, how)
if (ecoffsymbol (symbol)->fdr != NULL if (ecoffsymbol (symbol)->fdr != NULL
&& ecoff_ext.asym.index != indexNil) && ecoff_ext.asym.index != indexNil)
{ {
FDR *fdr;
unsigned int indx; unsigned int indx;
int bigendian; int bigendian;
bfd_size_type sym_base; bfd_size_type sym_base;
union aux_ext *aux_base; union aux_ext *aux_base;
fdr = ecoffsymbol (symbol)->fdr;
indx = ecoff_ext.asym.index; indx = ecoff_ext.asym.index;
/* sym_base is used to map the fdr relative indices which /* sym_base is used to map the fdr relative indices which
appear in the file to the position number which we are appear in the file to the position number which we are
using. */ using. */
sym_base = ecoffsymbol (symbol)->fdr->isymBase; sym_base = fdr->isymBase;
if (ecoffsymbol (symbol)->local) if (ecoffsymbol (symbol)->local)
sym_base += sym_base +=
ecoff_data (abfd)->debug_info.symbolic_header.iextMax; ecoff_data (abfd)->debug_info.symbolic_header.iextMax;
@ -1738,11 +1762,11 @@ ecoff_print_symbol (abfd, filep, symbol, how)
/* aux_base is the start of the aux entries for this file; /* aux_base is the start of the aux entries for this file;
asym.index is an offset from this. */ asym.index is an offset from this. */
aux_base = (ecoff_data (abfd)->debug_info.external_aux aux_base = (ecoff_data (abfd)->debug_info.external_aux
+ ecoffsymbol (symbol)->fdr->iauxBase); + fdr->iauxBase);
/* The aux entries are stored in host byte order; the /* The aux entries are stored in host byte order; the
order is indicated by a bit in the fdr. */ order is indicated by a bit in the fdr. */
bigendian = ecoffsymbol (symbol)->fdr->fBigendian; bigendian = fdr->fBigendian;
/* This switch is basically from gcc/mips-tdump.c */ /* This switch is basically from gcc/mips-tdump.c */
switch (ecoff_ext.asym.st) switch (ecoff_ext.asym.st)
@ -1764,9 +1788,10 @@ ecoff_print_symbol (abfd, filep, symbol, how)
(long) (indx + sym_base)); (long) (indx + sym_base));
else else
fprintf (file, "\n First symbol: %ld", fprintf (file, "\n First symbol: %ld",
(long) (AUX_GET_ISYM (bigendian, ((long)
&aux_base[ecoff_ext.asym.index]) (AUX_GET_ISYM (bigendian,
+ sym_base)); &aux_base[ecoff_ext.asym.index])
+ sym_base)));
break; break;
case stProc: case stProc:
@ -1775,11 +1800,11 @@ ecoff_print_symbol (abfd, filep, symbol, how)
; ;
else if (ecoffsymbol (symbol)->local) else if (ecoffsymbol (symbol)->local)
fprintf (file, "\n End+1 symbol: %-7ld Type: %s", fprintf (file, "\n End+1 symbol: %-7ld Type: %s",
(long) (AUX_GET_ISYM (bigendian, ((long)
&aux_base[ecoff_ext.asym.index]) (AUX_GET_ISYM (bigendian,
+ sym_base), &aux_base[ecoff_ext.asym.index])
ecoff_type_to_string (abfd, aux_base, indx + 1, + sym_base)),
bigendian)); ecoff_type_to_string (abfd, fdr, indx + 1));
else else
fprintf (file, "\n Local symbol: %ld", fprintf (file, "\n Local symbol: %ld",
((long) indx ((long) indx
@ -1788,11 +1813,25 @@ ecoff_print_symbol (abfd, filep, symbol, how)
->debug_info.symbolic_header.iextMax))); ->debug_info.symbolic_header.iextMax)));
break; break;
case stStruct:
fprintf (file, "\n struct; End+1 symbol: %ld",
(long) (indx + sym_base));
break;
case stUnion:
fprintf (file, "\n union; End+1 symbol: %ld",
(long) (indx + sym_base));
break;
case stEnum:
fprintf (file, "\n enum; End+1 symbol: %ld",
(long) (indx + sym_base));
break;
default: default:
if (! ECOFF_IS_STAB (&ecoff_ext.asym)) if (! ECOFF_IS_STAB (&ecoff_ext.asym))
fprintf (file, "\n Type: %s", fprintf (file, "\n Type: %s",
ecoff_type_to_string (abfd, aux_base, indx, ecoff_type_to_string (abfd, fdr, indx));
bigendian));
break; break;
} }
} }