Use a single, consistent representation for an empty minimal
symbol table in an objfile. * objfiles.c (terminate_minimal_symbol_table): New function. (allocate_objfile): Call it. * objfiles.h (terminate_minimal_symbol_table): New declaration. (ALL_MSYMBOLS): No need to test whether (objfile)->msymbols is non-NULL. * minsyms.c (lookup_minimal_symbol_by_pc_section): To see whether objfile has minimal symbols, compare minimal_symbol_count to zero, instead of comparing msymbols with NULL. * objfiles.c (have_minimal_symbols): Same. * solib-sunos.c (solib_add_common_symbols): Call terminate_minimal_symbol_table. * symfile.c (reread_symbols): Same.
This commit is contained in:
parent
ffc65945ba
commit
158314526c
6 changed files with 54 additions and 4 deletions
|
@ -1,3 +1,20 @@
|
||||||
|
2003-02-03 Jim Blandy <jimb@redhat.com>
|
||||||
|
|
||||||
|
Use a single, consistent representation for an empty minimal
|
||||||
|
symbol table in an objfile.
|
||||||
|
* objfiles.c (terminate_minimal_symbol_table): New function.
|
||||||
|
(allocate_objfile): Call it.
|
||||||
|
* objfiles.h (terminate_minimal_symbol_table): New declaration.
|
||||||
|
(ALL_MSYMBOLS): No need to test whether (objfile)->msymbols is
|
||||||
|
non-NULL.
|
||||||
|
* minsyms.c (lookup_minimal_symbol_by_pc_section): To see whether
|
||||||
|
objfile has minimal symbols, compare minimal_symbol_count to zero,
|
||||||
|
instead of comparing msymbols with NULL.
|
||||||
|
* objfiles.c (have_minimal_symbols): Same.
|
||||||
|
* solib-sunos.c (solib_add_common_symbols): Call
|
||||||
|
terminate_minimal_symbol_table.
|
||||||
|
* symfile.c (reread_symbols): Same.
|
||||||
|
|
||||||
2003-02-03 Kevin Buettner <kevinb@redhat.com>
|
2003-02-03 Kevin Buettner <kevinb@redhat.com>
|
||||||
|
|
||||||
* s390-tdep.c (s390_address_class_type_flags)
|
* s390-tdep.c (s390_address_class_type_flags)
|
||||||
|
|
|
@ -411,8 +411,9 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, asection *section)
|
||||||
"null symbol". If there are no real symbols, then there is no
|
"null symbol". If there are no real symbols, then there is no
|
||||||
minimal symbol table at all. */
|
minimal symbol table at all. */
|
||||||
|
|
||||||
if ((msymbol = objfile->msymbols) != NULL)
|
if (objfile->minimal_symbol_count > 0)
|
||||||
{
|
{
|
||||||
|
msymbol = objfile->msymbols;
|
||||||
lo = 0;
|
lo = 0;
|
||||||
hi = objfile->minimal_symbol_count - 1;
|
hi = objfile->minimal_symbol_count - 1;
|
||||||
|
|
||||||
|
|
|
@ -281,6 +281,8 @@ allocate_objfile (bfd *abfd, int flags)
|
||||||
obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc,
|
obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc,
|
||||||
xfree);
|
xfree);
|
||||||
flags &= ~OBJF_MAPPED;
|
flags &= ~OBJF_MAPPED;
|
||||||
|
|
||||||
|
terminate_minimal_symbol_table (objfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the per-objfile information that comes from the bfd, ensuring
|
/* Update the per-objfile information that comes from the bfd, ensuring
|
||||||
|
@ -333,6 +335,33 @@ allocate_objfile (bfd *abfd, int flags)
|
||||||
return (objfile);
|
return (objfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Create the terminating entry of OBJFILE's minimal symbol table.
|
||||||
|
If OBJFILE->msymbols is zero, allocate a single entry from
|
||||||
|
OBJFILE->symbol_obstack; otherwise, just initialize
|
||||||
|
OBJFILE->msymbols[OBJFILE->minimal_symbol_count]. */
|
||||||
|
void
|
||||||
|
terminate_minimal_symbol_table (struct objfile *objfile)
|
||||||
|
{
|
||||||
|
if (! objfile->msymbols)
|
||||||
|
objfile->msymbols = ((struct minimal_symbol *)
|
||||||
|
obstack_alloc (&objfile->symbol_obstack,
|
||||||
|
sizeof (objfile->msymbols[0])));
|
||||||
|
|
||||||
|
{
|
||||||
|
struct minimal_symbol *m
|
||||||
|
= &objfile->msymbols[objfile->minimal_symbol_count];
|
||||||
|
|
||||||
|
memset (m, 0, sizeof (*m));
|
||||||
|
SYMBOL_NAME (m) = NULL;
|
||||||
|
SYMBOL_VALUE_ADDRESS (m) = 0;
|
||||||
|
MSYMBOL_INFO (m) = NULL;
|
||||||
|
MSYMBOL_TYPE (m) = mst_unknown;
|
||||||
|
SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Put one object file before a specified on in the global list.
|
/* Put one object file before a specified on in the global list.
|
||||||
This can be used to make sure an object file is destroyed before
|
This can be used to make sure an object file is destroyed before
|
||||||
another when using ALL_OBJFILES_SAFE to free all objfiles. */
|
another when using ALL_OBJFILES_SAFE to free all objfiles. */
|
||||||
|
@ -810,7 +839,7 @@ have_minimal_symbols (void)
|
||||||
|
|
||||||
ALL_OBJFILES (ofp)
|
ALL_OBJFILES (ofp)
|
||||||
{
|
{
|
||||||
if (ofp->msymbols != NULL)
|
if (ofp->minimal_symbol_count > 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,6 +515,8 @@ extern struct objfile *allocate_objfile (bfd *, int);
|
||||||
|
|
||||||
extern int build_objfile_section_table (struct objfile *);
|
extern int build_objfile_section_table (struct objfile *);
|
||||||
|
|
||||||
|
extern void terminate_minimal_symbol_table (struct objfile *objfile);
|
||||||
|
|
||||||
extern void put_objfile_before (struct objfile *, struct objfile *);
|
extern void put_objfile_before (struct objfile *, struct objfile *);
|
||||||
|
|
||||||
extern void objfile_to_front (struct objfile *);
|
extern void objfile_to_front (struct objfile *);
|
||||||
|
@ -595,8 +597,7 @@ extern int is_in_import_list (char *, struct objfile *);
|
||||||
|
|
||||||
#define ALL_MSYMBOLS(objfile, m) \
|
#define ALL_MSYMBOLS(objfile, m) \
|
||||||
ALL_OBJFILES (objfile) \
|
ALL_OBJFILES (objfile) \
|
||||||
if ((objfile)->msymbols) \
|
ALL_OBJFILE_MSYMBOLS (objfile, m)
|
||||||
ALL_OBJFILE_MSYMBOLS (objfile, m)
|
|
||||||
|
|
||||||
#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
|
#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
|
||||||
for (osect = objfile->sections; osect < objfile->sections_end; osect++)
|
for (osect = objfile->sections; osect < objfile->sections_end; osect++)
|
||||||
|
|
|
@ -184,6 +184,7 @@ solib_add_common_symbols (CORE_ADDR rtc_symp)
|
||||||
xmalloc, xfree);
|
xmalloc, xfree);
|
||||||
rt_common_objfile->minimal_symbol_count = 0;
|
rt_common_objfile->minimal_symbol_count = 0;
|
||||||
rt_common_objfile->msymbols = NULL;
|
rt_common_objfile->msymbols = NULL;
|
||||||
|
terminate_minimal_symbol_table (rt_common_objfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
init_minimal_symbol_collection ();
|
init_minimal_symbol_collection ();
|
||||||
|
|
|
@ -2019,6 +2019,7 @@ reread_symbols (void)
|
||||||
error ("Can't find the file sections in `%s': %s",
|
error ("Can't find the file sections in `%s': %s",
|
||||||
objfile->name, bfd_errmsg (bfd_get_error ()));
|
objfile->name, bfd_errmsg (bfd_get_error ()));
|
||||||
}
|
}
|
||||||
|
terminate_minimal_symbol_table (objfile);
|
||||||
|
|
||||||
/* We use the same section offsets as from last time. I'm not
|
/* We use the same section offsets as from last time. I'm not
|
||||||
sure whether that is always correct for shared libraries. */
|
sure whether that is always correct for shared libraries. */
|
||||||
|
|
Loading…
Reference in a new issue