From: Michael Chastain Date: Tue, 11 Nov 2003 20:04:52 +0000 (+0000) Subject: 2003-11-07 Michael Chastain X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f594e5e9c9b41dbe1223b25be5ddeacc5cd72e2e;p=binutils-gdb.git 2003-11-07 Michael Chastain * symtab.h (struct minimal_symbol): Add size. * dbxread.c: Use it. * elfread.c: (record_minimal_symbol_and_info): Do not use info. Rename to record_minimal_symbol. (elf_symtab_read): Set MSYMBOL_SIZE explicitly. * minsyms.c (prim_record_minimal_symbol_and_info): Initialize MSYMBOL_SIZE. (install_minimal_symbols): Ditto. * objfiles.c (terminate_minimal_symbol_table): Ditto. * arm-tdep.c: Delete unused MSYMBOL_SIZE. * m68hc11-tdep.c: Ditto. * mips-tdep.c: Ditto. * sh64-tdep.c: Ditto. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f933464aee5..0047c882b5a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2003-11-07 Michael Chastain + + * symtab.h (struct minimal_symbol): Add size. + * dbxread.c: Use it. + * elfread.c: (record_minimal_symbol_and_info): Do not use info. + Rename to record_minimal_symbol. + (elf_symtab_read): Set MSYMBOL_SIZE explicitly. + * minsyms.c (prim_record_minimal_symbol_and_info): Initialize MSYMBOL_SIZE. + (install_minimal_symbols): Ditto. + * objfiles.c (terminate_minimal_symbol_table): Ditto. + * arm-tdep.c: Delete unused MSYMBOL_SIZE. + * m68hc11-tdep.c: Ditto. + * mips-tdep.c: Ditto. + * sh64-tdep.c: Ditto. + 2003-11-10 Michael Chastain * MAINTAINERS: Change my e-mail address. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 6faca9fdb03..e7aef4a4024 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -81,15 +81,10 @@ static int arm_debug; /* Macros for setting and testing a bit in a minimal symbol that marks it as Thumb function. The MSB of the minimal symbol's "info" field - is used for this purpose. This field is already being used to store - the symbol size, so the assumption is that the symbol size cannot - exceed 2^31. + is used for this purpose. MSYMBOL_SET_SPECIAL Actually sets the "special" bit. - MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. - MSYMBOL_SIZE Returns the size of the minimal symbol, - i.e. the "info" field with the "special" bit - masked out. */ + MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. */ #define MSYMBOL_SET_SPECIAL(msym) \ MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \ @@ -98,9 +93,6 @@ static int arm_debug; #define MSYMBOL_IS_SPECIAL(msym) \ (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0) -#define MSYMBOL_SIZE(msym) \ - ((long) MSYMBOL_INFO (msym) & 0x7fffffff) - /* The list of available "set arm ..." and "show arm ..." commands. */ static struct cmd_list_element *setarmcmdlist = NULL; static struct cmd_list_element *showarmcmdlist = NULL; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index f0fadfd959f..c736c3475e4 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -64,14 +64,6 @@ #include "aout/stab_gnu.h" /* We always use GNU stabs, not native, now */ -/* This macro returns the size field of a minimal symbol, which is normally - stored in the "info" field. The macro can be overridden for specific - targets (e.g. MIPS16) that use the info field for other purposes. */ -#ifndef MSYMBOL_SIZE -#define MSYMBOL_SIZE(msym) ((long) MSYMBOL_INFO (msym)) -#endif - - /* We put a pointer to this structure in the read_symtab_private field of the psymtab. */ diff --git a/gdb/elfread.c b/gdb/elfread.c index 8814f894b2b..d899c09a757 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -105,15 +105,15 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip) } static struct minimal_symbol * -record_minimal_symbol_and_info (char *name, CORE_ADDR address, - enum minimal_symbol_type ms_type, char *info, /* FIXME, is this really char *? */ - asection *bfd_section, struct objfile *objfile) +record_minimal_symbol (char *name, CORE_ADDR address, + enum minimal_symbol_type ms_type, + asection *bfd_section, struct objfile *objfile) { if (ms_type == mst_text || ms_type == mst_file_text) address = SMASH_TEXT_ADDRESS (address); return prim_record_minimal_symbol_and_info - (name, address, ms_type, info, bfd_section->index, bfd_section, objfile); + (name, address, ms_type, NULL, bfd_section->index, bfd_section, objfile); } /* @@ -163,7 +163,6 @@ elf_symtab_read (struct objfile *objfile, int dynamic) char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack); #endif struct dbx_symfile_info *dbx = objfile->sym_stab_info; - unsigned long size; int stripped = (bfd_get_symcount (objfile->obfd) == 0); if (dynamic) @@ -223,9 +222,9 @@ elf_symtab_read (struct objfile *objfile, int dynamic) if (symaddr == 0) continue; symaddr += offset; - msym = record_minimal_symbol_and_info + msym = record_minimal_symbol ((char *) sym->name, symaddr, - mst_solib_trampoline, NULL, sym->section, objfile); + mst_solib_trampoline, sym->section, objfile); #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; @@ -436,11 +435,15 @@ elf_symtab_read (struct objfile *objfile, int dynamic) /* ms_type = mst_unknown; */ continue; /* Skip this symbol. */ } - /* Pass symbol size field in via BFD. FIXME!!! */ - size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size; - msym = record_minimal_symbol_and_info + msym = record_minimal_symbol ((char *) sym->name, symaddr, - ms_type, (void *) size, sym->section, objfile); + ms_type, sym->section, objfile); + if (msym) + { + /* Pass symbol size field in via BFD. FIXME!!! */ + unsigned long size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size; + MSYMBOL_SIZE(msym) = size; + } #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index e8217226929..cc0ad71adbe 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -50,16 +50,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ analysis to compute correct stack frame layout. The MSB of the minimal symbol's "info" field is used for this purpose. - This field is already being used to store the symbol size, so the - assumption is that the symbol size cannot exceed 2^30. MSYMBOL_SET_RTC Actually sets the "RTC" bit. MSYMBOL_SET_RTI Actually sets the "RTI" bit. MSYMBOL_IS_RTC Tests the "RTC" bit in a minimal symbol. - MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. - MSYMBOL_SIZE Returns the size of the minimal symbol, - i.e. the "info" field with the "special" bit - masked out. */ + MSYMBOL_IS_RTI Tests the "RTC" bit in a minimal symbol. */ #define MSYMBOL_SET_RTC(msym) \ MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym)) \ @@ -75,9 +70,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define MSYMBOL_IS_RTI(msym) \ (((long) MSYMBOL_INFO (msym) & 0x40000000) != 0) -#define MSYMBOL_SIZE(msym) \ - ((long) MSYMBOL_INFO (msym) & 0x3fffffff) - enum insn_return_kind { RETURN_RTS, RETURN_RTC, diff --git a/gdb/minsyms.c b/gdb/minsyms.c index afa36b10e2e..df35956ea14 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -611,6 +611,7 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address, MSYMBOL_TYPE (msymbol) = ms_type; /* FIXME: This info, if it remains, needs its own field. */ MSYMBOL_INFO (msymbol) = info; /* FIXME! */ + MSYMBOL_SIZE (msymbol) = 0; /* The hash pointers must be cleared! If they're not, add_minsym_to_hash_table will NOT add this msymbol to the hash table. */ @@ -890,6 +891,7 @@ install_minimal_symbols (struct objfile *objfile) SYMBOL_LINKAGE_NAME (&msymbols[mcount]) = NULL; SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0; MSYMBOL_INFO (&msymbols[mcount]) = NULL; + MSYMBOL_SIZE (&msymbols[mcount]) = 0; MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown; SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index c0d8b08127c..027ae9221f5 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -226,17 +226,13 @@ mips_saved_regsize (void) /* Functions for setting and testing a bit in a minimal symbol that marks it as 16-bit function. The MSB of the minimal symbol's - "info" field is used for this purpose. This field is already - being used to store the symbol size, so the assumption is - that the symbol size cannot exceed 2^31. + "info" field is used for this purpose. ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special", i.e. refers to a 16-bit function, and sets a "special" bit in a minimal symbol to mark it as a 16-bit function - MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol - MSYMBOL_SIZE returns the size of the minimal symbol, i.e. - the "info" field with the "special" bit masked out */ + MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol */ static void mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym) diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 0a5ed81806c..9ea0dc9ba47 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -386,6 +386,7 @@ terminate_minimal_symbol_table (struct objfile *objfile) DEPRECATED_SYMBOL_NAME (m) = NULL; SYMBOL_VALUE_ADDRESS (m) = 0; MSYMBOL_INFO (m) = NULL; + MSYMBOL_SIZE (m) = 0; MSYMBOL_TYPE (m) = mst_unknown; SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown); } diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index ca87b8e86f1..51b676811f2 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -197,17 +197,13 @@ sh_sh64_register_name (int reg_nr) /* Macros and functions for setting and testing a bit in a minimal symbol that marks it as 32-bit function. The MSB of the minimal - symbol's "info" field is used for this purpose. This field is - already being used to store the symbol size, so the assumption is - that the symbol size cannot exceed 2^31. + symbol's "info" field is used for this purpose. ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special", i.e. refers to a 32-bit function, and sets a "special" bit in a minimal symbol to mark it as a 32-bit function - MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol - MSYMBOL_SIZE returns the size of the minimal symbol, i.e. - the "info" field with the "special" bit masked out */ + MSYMBOL_IS_SPECIAL tests the "special" bit in a minimal symbol */ #define MSYMBOL_IS_SPECIAL(msym) \ (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0) diff --git a/gdb/symtab.h b/gdb/symtab.h index 4a6127f6e44..ce1c9fa41a2 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -325,6 +325,12 @@ struct minimal_symbol char *info; + /* Size of this symbol. end_psymtab in dbxread.c uses this + information to calculate the end of the partial symtab based on the + address of the last symbol plus the size of the last symbol. */ + + unsigned long size; + #ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Which source file is this symbol in? Only relevant for mst_file_*. */ char *filename; @@ -346,6 +352,7 @@ struct minimal_symbol }; #define MSYMBOL_INFO(msymbol) (msymbol)->info +#define MSYMBOL_SIZE(msymbol) (msymbol)->size #define MSYMBOL_TYPE(msymbol) (msymbol)->type