From 3cde1ffa4b118cb3201fca4a370542d8418936fb Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Fri, 30 Jul 1993 14:17:41 +0000 Subject: [PATCH] * paread.c (pa_symtab_read): Put file-local symbols in minimal symbols. --- gdb/ChangeLog | 3 -- gdb/paread.c | 102 +++++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 76 insertions(+), 29 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c20def9..04e27b6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,15 +1,12 @@ -<<<<<<< ChangeLog Fri Jul 30 08:58:01 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * paread.c (pa_symtab_read): Put file-local symbols in minimal symbols. -======= Fri Jul 30 00:18:40 1993 Fred Fish (fnf@deneb.cygnus.com) * Makefile.in (ALLDEPFILES): Add delta68-nat.c * Makefile.in (delta68-nat.o): Add dependency. ->>>>>>> 1.1564 Thu Jul 29 12:09:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) * value.h (COERCE_ENUM): Use COERCE_REF to coerce refs; value_ind diff --git a/gdb/paread.c b/gdb/paread.c index 150757e..f8bd4bf 100644 --- a/gdb/paread.c +++ b/gdb/paread.c @@ -105,7 +105,8 @@ pa_symtab_read (abfd, addr, objfile) unsigned int i; int val; char *stringtab; - struct symbol_dictionary_record *buf, *bufp; + struct symbol_dictionary_record *buf, *bufp, *endbufp; + char *symname; CONST int symsize = sizeof (struct symbol_dictionary_record); number_of_symbols = bfd_get_symcount (abfd); @@ -121,41 +122,90 @@ pa_symtab_read (abfd, addr, objfile) val = bfd_read (stringtab, obj_stringtab_size (abfd), 1, abfd); if (val != obj_stringtab_size (abfd)) error ("Can't read in HP string table."); - - for (i = 0, bufp = buf; i < number_of_symbols; i++, bufp++) + + endbufp = buf + number_of_symbols; + for (bufp = buf; bufp < endbufp; ++bufp) { enum minimal_symbol_type ms_type; QUIT; - if (bufp->symbol_scope != SS_UNIVERSAL) - continue; - - switch (bufp->symbol_type) - { - case ST_SYM_EXT: - case ST_ARG_EXT: - continue; - case ST_CODE: - case ST_PRI_PROG: - case ST_SEC_PROG: - case ST_ENTRY: - case ST_MILLICODE: - ms_type = mst_text; - bufp->symbol_value &= ~0x3; /* clear out permission bits */ - break; - case ST_DATA: - ms_type = mst_data; - break; - default: - continue; - } + switch (bufp->symbol_scope) + { + case SS_UNIVERSAL: + switch (bufp->symbol_type) + { + case ST_SYM_EXT: + case ST_ARG_EXT: + continue; + + case ST_CODE: + case ST_PRI_PROG: + case ST_SEC_PROG: + case ST_ENTRY: + case ST_MILLICODE: + symname = bufp->name.n_strx + stringtab; + ms_type = mst_text; + bufp->symbol_value &= ~0x3; /* clear out permission bits */ + break; + case ST_DATA: + symname = bufp->name.n_strx + stringtab; + ms_type = mst_data; + break; + default: + continue; + } + break; + + case SS_GLOBAL: + case SS_LOCAL: + switch (bufp->symbol_type) + { + case ST_SYM_EXT: + case ST_ARG_EXT: + continue; + + case ST_CODE: + symname = bufp->name.n_strx + stringtab; + /* GAS leaves symbols with the prefixes "LS$", "LBB$", + and "LBE$" in .o files after assembling. And thus + they appear in the final executable. This can + cause problems if these special symbols have the + same value as real symbols. So ignore them. Is this + meant as a feature, or is it just a GAS bug? */ + if (*symname == 'L' + && (symname[2] == '$' && symname[1] == 'S' + || (symname[3] == '$' && symname[1] == 'B' + && (symname[2] == 'B' || symname[2] == 'E')))) + continue; + ms_type = mst_file_text; + bufp->symbol_value &= ~0x3; /* clear out permission bits */ + break; + + case ST_PRI_PROG: + case ST_SEC_PROG: + case ST_ENTRY: + case ST_MILLICODE: + symname = bufp->name.n_strx + stringtab; + ms_type = mst_file_text; + bufp->symbol_value &= ~0x3; /* clear out permission bits */ + break; + case ST_DATA: + symname = bufp->name.n_strx + stringtab; + ms_type = mst_file_data; + break; + default: + continue; + } + default: + continue; + } if (bufp->name.n_strx > obj_stringtab_size (abfd)) error ("Invalid symbol data; bad HP string table offset: %d", bufp->name.n_strx); - record_minimal_symbol (bufp->name.n_strx + stringtab, + record_minimal_symbol (symname, bufp->symbol_value, ms_type, objfile); } -- 2.7.4