2003-11-07 Michael Chastain <mec@shout.net>
authorMichael Chastain <mec@google.com>
Tue, 11 Nov 2003 20:04:52 +0000 (20:04 +0000)
committerMichael Chastain <mec@google.com>
Tue, 11 Nov 2003 20:04:52 +0000 (20:04 +0000)
* 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.

gdb/ChangeLog
gdb/arm-tdep.c
gdb/dbxread.c
gdb/elfread.c
gdb/m68hc11-tdep.c
gdb/minsyms.c
gdb/mips-tdep.c
gdb/objfiles.c
gdb/sh64-tdep.c
gdb/symtab.h

index f933464..0047c88 100644 (file)
@@ -1,3 +1,18 @@
+2003-11-07  Michael Chastain  <mec@shout.net>
+
+       * 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  <mec.gnu@mindspring.com>
 
        * MAINTAINERS: Change my e-mail address.
index 6faca9f..e7aef4a 100644 (file)
@@ -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;
index f0fadfd..c736c34 100644 (file)
 #include "aout/stab_gnu.h"     /* We always use GNU stabs, not native, now */
 \f
 
-/* 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.  */
 
index 8814f89..d899c09 100644 (file)
@@ -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;
index e821722..cc0ad71 100644 (file)
@@ -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,
index afa36b1..df35956 100644 (file)
@@ -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);
 
index c0d8b08..027ae92 100644 (file)
@@ -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)
index 0a5ed81..9ea0dc9 100644 (file)
@@ -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);
   }
index ca87b8e..51b6768 100644 (file)
@@ -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)
index 4a6127f..ce1c9fa 100644 (file)
@@ -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
 
 \f