From: Jim Kingdon Date: Mon, 27 Dec 1993 16:31:56 +0000 (+0000) Subject: * dbxread.c: Move default definition of GCC_COMPILED_FLAG_SYMBOL X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=404f69a80b818c6d4a29fbb56f535b65d9d59b50;p=binutils-gdb.git * dbxread.c: Move default definition of GCC_COMPILED_FLAG_SYMBOL from here . . . * symtab.h: . . . to here. * dbxread.c (record_minimal_symbol): Move check for gcc{,2}_compiled. and __gnu_compiled* from here . . . * minsyms.c (prim_record_minimal_symbol_and_info): . . . to here. * minsyms.c (prim_record_minimal_symbol): Call prim_record_minimal_symbol_and_info rather than duplicating code. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a09d52454bb..78c7f475ca1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +Mon Dec 27 11:07:05 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + + * dbxread.c: Move default definition of GCC_COMPILED_FLAG_SYMBOL + from here . . . + * symtab.h: . . . to here. + * dbxread.c (record_minimal_symbol): Move check for gcc{,2}_compiled. + and __gnu_compiled* from here . . . + * minsyms.c (prim_record_minimal_symbol_and_info): . . . to here. + * minsyms.c (prim_record_minimal_symbol): Call + prim_record_minimal_symbol_and_info rather than duplicating code. + Sun Dec 26 20:44:02 1993 Jeffrey A. Law (law@snake.cs.utah.edu) * dbxread.c (process_one_symbol): Handle stabs-in-som just like diff --git a/gdb/dbxread.c b/gdb/dbxread.c index e6623b27c7e..d91c67e8a03 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -108,16 +108,6 @@ struct symloc { #define IGNORE_SYMBOL(type) (type == (int)N_NSYMS) #endif -/* Macro for name of symbol to indicate a file compiled with gcc. */ -#ifndef GCC_COMPILED_FLAG_SYMBOL -#define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled." -#endif - -/* Macro for name of symbol to indicate a file compiled with gcc2. */ -#ifndef GCC2_COMPILED_FLAG_SYMBOL -#define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled." -#endif - /* Remember what we deduced to be the source language of this psymtab. */ static enum language psymtab_language = language_unknown; @@ -427,24 +417,6 @@ record_minimal_symbol (name, address, type, objfile) break; #endif case N_TEXT: - /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into - the minimal symbols, because if there is also another symbol - at the same address (e.g. the first function of the file), - lookup_minimal_symbol_by_pc would have no way of getting the - right one. */ - if (name[0] == 'g' - && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0 - || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)) - return; - - { - char *tempstring = name; - if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd)) - ++tempstring; - if (STREQN (tempstring, "__gnu_compiled", 14)) - return; - } - case N_NBTEXT: case N_FN: case N_FN_SEQ: diff --git a/gdb/minsyms.c b/gdb/minsyms.c index dbb4e797d97..b45b4f4a3db 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -297,31 +297,9 @@ prim_record_minimal_symbol (name, address, ms_type) CORE_ADDR address; enum minimal_symbol_type ms_type; { - register struct msym_bunch *new; - register struct minimal_symbol *msymbol; - - if (msym_bunch_index == BUNCH_SIZE) - { - new = (struct msym_bunch *) xmalloc (sizeof (struct msym_bunch)); - msym_bunch_index = 0; - new -> next = msym_bunch; - msym_bunch = new; - } - msymbol = &msym_bunch -> contents[msym_bunch_index]; - SYMBOL_NAME (msymbol) = (char *) name; - SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown); - SYMBOL_VALUE_ADDRESS (msymbol) = address; - SYMBOL_SECTION (msymbol) = -1; - MSYMBOL_TYPE (msymbol) = ms_type; - /* FIXME: This info, if it remains, needs its own field. */ - MSYMBOL_INFO (msymbol) = NULL; /* FIXME! */ - msym_bunch_index++; - msym_count++; + prim_record_minimal_symbol (name, address, ms_type, NULL, -1); } -/* FIXME: Why don't we just combine this function with the one above - and pass it a NULL info pointer value if info is not needed? */ - void prim_record_minimal_symbol_and_info (name, address, ms_type, info, section) const char *name; @@ -333,6 +311,27 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info, section) register struct msym_bunch *new; register struct minimal_symbol *msymbol; + if (ms_type == mst_file_text) + { + /* Don't put gcc_compiled, __gnu_compiled_cplus, and friends into + the minimal symbols, because if there is also another symbol + at the same address (e.g. the first function of the file), + lookup_minimal_symbol_by_pc would have no way of getting the + right one. */ + if (name[0] == 'g' + && (strcmp (name, GCC_COMPILED_FLAG_SYMBOL) == 0 + || strcmp (name, GCC2_COMPILED_FLAG_SYMBOL) == 0)) + return; + + { + char *tempstring = name; + if (tempstring[0] == bfd_get_symbol_leading_char (objfile->obfd)) + ++tempstring; + if (STREQN (tempstring, "__gnu_compiled", 14)) + return; + } + } + if (msym_bunch_index == BUNCH_SIZE) { new = (struct msym_bunch *) xmalloc (sizeof (struct msym_bunch)); diff --git a/gdb/symtab.h b/gdb/symtab.h index 69a83a89f01..8a4f17bd20d 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -978,6 +978,16 @@ contained_in PARAMS ((struct block *, struct block *)); extern void reread_symbols PARAMS ((void)); +/* Macro for name of symbol to indicate a file compiled with gcc. */ +#ifndef GCC_COMPILED_FLAG_SYMBOL +#define GCC_COMPILED_FLAG_SYMBOL "gcc_compiled." +#endif + +/* Macro for name of symbol to indicate a file compiled with gcc2. */ +#ifndef GCC2_COMPILED_FLAG_SYMBOL +#define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled." +#endif + /* Functions for dealing with the minimal symbol table, really a misc address<->symbol mapping for things we don't have debug symbols for. */ @@ -1036,7 +1046,7 @@ extern CORE_ADDR find_line_pc PARAMS ((struct symtab *, int)); extern int -find_line_pc_range PARAMS ((struct symtab_and_line, int, +find_line_pc_range PARAMS ((struct symtab_and_line, CORE_ADDR *, CORE_ADDR *)); extern void