aboutsummaryrefslogtreecommitdiff
path: root/bfd/coffgen.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1993-02-12 22:24:47 +0000
committerIan Lance Taylor <ian@airs.com>1993-02-12 22:24:47 +0000
commite61cfdf820936a36b55fd9a20ef35f6971551dd5 (patch)
treef78bd9299c41f5c78bb941269e59553ab5b6970a /bfd/coffgen.c
parent33742334a84ad5821959b7cbf3f13821acebd331 (diff)
downloadgdb-e61cfdf820936a36b55fd9a20ef35f6971551dd5.zip
gdb-e61cfdf820936a36b55fd9a20ef35f6971551dd5.tar.gz
gdb-e61cfdf820936a36b55fd9a20ef35f6971551dd5.tar.bz2
Fri Feb 12 14:23:07 1993 Ian Lance Taylor (ian@cygnus.com)
* coffgen.c (coff_print_symbol): Print correct tagndx value; cleaned up output formatting a bit.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r--bfd/coffgen.c181
1 files changed, 87 insertions, 94 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 4e410fd..21f023e 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -369,7 +369,7 @@ struct internal_syment *syment)
{
/* Normalize the symbol flags */
- if (coff_symbol_ptr->symbol.section == &bfd_com_section) {
+ if (bfd_is_com_section (coff_symbol_ptr->symbol.section)) {
/* a common symbol is undefined with a value */
syment->n_scnum = N_UNDEF;
syment->n_value = coff_symbol_ptr->symbol.value;
@@ -664,7 +664,7 @@ DEFUN(coff_write_alien_symbol,(abfd, symbol, written),
native->u.syment.n_scnum = N_UNDEF;
native->u.syment.n_value = symbol->value;
}
- else if (symbol->section == &bfd_com_section)
+ else if (bfd_is_com_section (symbol->section))
{
native->u.syment.n_scnum = N_UNDEF;
native->u.syment.n_value = symbol->value;
@@ -1276,113 +1276,106 @@ DEFUN (coff_make_debug_symbol, (abfd, ptr, sz),
return &new->symbol;
}
+/* Print out information about COFF symbol. */
+
void
-DEFUN(coff_print_symbol,(abfd, filep, symbol, how),
- bfd *abfd AND
- PTR filep AND
- asymbol *symbol AND
- bfd_print_symbol_type how)
+coff_print_symbol (abfd, filep, symbol, how)
+ bfd *abfd;
+ PTR filep;
+ asymbol *symbol;
+ bfd_print_symbol_type how;
{
- FILE *file = (FILE *)filep;
- switch (how) {
+ FILE *file = (FILE *) filep;
+
+ switch (how)
+ {
case bfd_print_symbol_name:
- fprintf(file, "%s", symbol->name);
+ fprintf (file, "%s", symbol->name);
break;
+
case bfd_print_symbol_more:
- fprintf(file, "coff %lx %lx", (unsigned long) coffsymbol(symbol)->native,
- (unsigned long) coffsymbol(symbol)->lineno);
+ fprintf (file, "coff %s %s",
+ coffsymbol(symbol)->native ? "n" : "g",
+ coffsymbol(symbol)->lineno ? "l" : " ");
break;
- case bfd_print_symbol_nm:
-
- {
- CONST char *section_name = symbol->section->name;
- bfd_print_symbol_vandf((PTR) file, symbol);
-
-
- fprintf(file, " %-5s %s %s %s",
- section_name,
- coffsymbol(symbol)->native ? "n" : "g",
- coffsymbol(symbol)->lineno ? "l" : " ",
- symbol->name);
- }
-
+ case bfd_print_symbol_nm:
+ bfd_print_symbol_vandf ((PTR) file, symbol);
+ fprintf (file, " %-5s %s %s %s",
+ symbol->section->name,
+ coffsymbol(symbol)->native ? "n" : "g",
+ coffsymbol(symbol)->lineno ? "l" : " ",
+ symbol->name);
break;
- case bfd_print_symbol_all:
- /* Print out the symbols in a reasonable way */
- {
- CONST char *section_name = symbol->section->name;
-
+ case bfd_print_symbol_all:
if (coffsymbol(symbol)->native)
- {
- unsigned int aux;
- combined_entry_type *combined = coffsymbol(symbol)->native;
- combined_entry_type *root = obj_raw_syments(abfd);
-
- fprintf(file,"[%3d]",
- combined - root);
-
-
- fprintf(file, "(sc %2d)(fl%4x)(ty%3x)(sc%3d) nx(%d) %08x %s",
- combined->u.syment.n_scnum,
- combined->u.syment.n_flags,
- combined->u.syment.n_type,
- combined->u.syment.n_sclass,
- combined->u.syment.n_numaux,
- combined->u.syment.n_value,
- symbol->name
- );
- for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
{
- fprintf(file,"\n");
- switch (combined->u.syment.n_sclass) {
- case C_FILE:
- fprintf(file, "File ");
- break;
- default:
- fprintf(file, "AUX lnno %x size %x tagndx %x",
- combined[aux+1].u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
- combined[aux+1].u.auxent.x_sym.x_misc.x_lnsz.x_size,
- combined[aux+1].u.auxent.x_sym.x_tagndx.l);
- break;
-
+ unsigned int aux;
+ combined_entry_type *combined = coffsymbol (symbol)->native;
+ combined_entry_type *root = obj_raw_syments (abfd);
+ struct lineno_cache_entry *l = coffsymbol(symbol)->lineno;
+
+ fprintf (file,"[%3d]", combined - root);
+
+ fprintf (file,
+ "(sc %2d)(fl 0x%02x)(ty %3x)(sc %3d) (nx %d) 0x%08x %s",
+ combined->u.syment.n_scnum,
+ combined->u.syment.n_flags,
+ combined->u.syment.n_type,
+ combined->u.syment.n_sclass,
+ combined->u.syment.n_numaux,
+ combined->u.syment.n_value,
+ symbol->name);
+
+ for (aux = 0; aux < combined->u.syment.n_numaux; aux++)
+ {
+ combined_entry_type *auxp = combined + aux + 1;
+ long tagndx;
+
+ if (auxp->fix_tag)
+ tagndx = auxp->u.auxent.x_sym.x_tagndx.p - root;
+ else
+ tagndx = auxp->u.auxent.x_sym.x_tagndx.l;
+
+ fprintf (file, "\n");
+ switch (combined->u.syment.n_sclass)
+ {
+ case C_FILE:
+ fprintf (file, "File ");
+ break;
+ default:
+
+ fprintf (file, "AUX lnno %d size 0x%x tagndx %d",
+ auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
+ auxp->u.auxent.x_sym.x_misc.x_lnsz.x_size,
+ tagndx);
+ break;
+ }
}
-
- }
- {
- struct lineno_cache_entry *l = coffsymbol(symbol)->lineno;
- if (l)
+ if (l)
+ {
+ printf ("\n%s :", l->u.sym->name);
+ l++;
+ while (l->line_number)
+ {
+ printf ("\n%4d : 0x%x",
+ l->line_number,
+ l->u.offset);
+ l++;
+ }
+ }
+ }
+ else
{
- printf("\n%s :", l->u.sym->name);
- l++;
- while (l->line_number)
- {
- printf("\n%4d : %x",
- l->line_number,
- l->u.offset);
- l++;
-
- }
+ bfd_print_symbol_vandf ((PTR) file, symbol);
+ fprintf (file, " %-5s %s %s %s",
+ symbol->section->name,
+ coffsymbol(symbol)->native ? "n" : "g",
+ coffsymbol(symbol)->lineno ? "l" : " ",
+ symbol->name);
}
- }
-
-
-
- }
-
- else {
- bfd_print_symbol_vandf((PTR) file, symbol);
- fprintf(file, " %-5s %s %s %s",
- section_name,
- coffsymbol(symbol)->native ? "n" : "g",
- coffsymbol(symbol)->lineno ? "l" : " ",
- symbol->name);
- }
-
- }
-
}
}