}
\f
/* Debug symbols usually don't have section information. We need to dig that
- out of the minimal symbols and stash that in the debug symbol. */
+ out of the minimal symbols and stash that in the debug symbol.
-void
+ DEFAULT_SECTION is the section index to use as the default if the
+ correct section cannot be found. It may be -1, in which case a
+ built-in default is used. */
+
+static void
fixup_section (struct general_symbol_info *ginfo,
- CORE_ADDR addr, struct objfile *objfile)
+ CORE_ADDR addr, struct objfile *objfile,
+ int default_section)
{
struct minimal_symbol *msym;
a search of the section table. */
struct obj_section *s;
- int fallback = -1;
+ int fallback = default_section;
ALL_OBJFILE_OSECTIONS (objfile, s)
{
/* We should have an objfile by now. */
gdb_assert (objfile);
+ /* Note that if this ends up as -1, fixup_section will handle that
+ reasonably well. So, it's fine to use the objfile's section
+ index without doing the check that is done by the wrapper macros
+ like SECT_OFF_TEXT. */
+ int default_section = objfile->sect_index_text;
switch (sym->aclass ())
{
case LOC_STATIC:
+ default_section = objfile->sect_index_data;
+ /* FALLTHROUGH. */
case LOC_LABEL:
addr = sym->value_address ();
break;
return sym;
}
- fixup_section (sym, addr, objfile);
+ fixup_section (sym, addr, objfile, default_section);
return sym;
}
compiler (armcc). */
bool producer_is_realview (const char *producer);
-void fixup_section (struct general_symbol_info *ginfo,
- CORE_ADDR addr, struct objfile *objfile);
-
extern unsigned int symtab_create_debug;
/* Print a "symtab-create" debug statement. */