PR symtab/8424:

* blockframe.c (find_pc_partial_function_gnu_ifunc): Check
	SYMBOL_SECTION, not SYMBOL_OBJ_SECTION.
	* breakpoint.c (resolve_sal_pc): Update.
	* elfread.c (elf_gnu_ifunc_record_cache): Update.
	* findvar.c (struct minsym_lookup_data) <objfile>: New field.
	(minsym_lookup_iterator_cb): Use it.
	(default_read_var_value): Update.
	* hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline):
	Update.
	* infcmd.c (jump_command): Update.
	* linespec.c (minsym_found): Update.
	* maint.c (maintenance_translate_address): Update.
	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Update.
	(prim_record_minimal_symbol_full): Don't set SYMBOL_OBJ_SECTION.
	* parse.c (write_exp_msymbol): Update.
	* printcmd.c (address_info): Update.
	* psymtab.c (find_pc_sect_psymbol): Update.
	(fixup_psymbol_section): Check SYMBOL_SECTION, not
	SYMBOL_OBJ_SECTION.
	(add_psymbol_to_bcache): Correctly initialize SYMBOL_SECTION.
	Don't initialize SYMBOL_OBJ_SECTION.
	* spu-tdep.c (spu_catch_start): Update.
	* stabsread.c (define_symbol): Don't set SYMBOL_SECTION.
	* symmisc.c (dump_msymbols, print_symbol): Update.
	* symtab.c (fixup_section): Don't set 'obj_section'.  Change
	how fallback section is computed.
	(fixup_symbol_section): Update.
	(find_pc_sect_symtab, find_function_start_sal, skip_prologue_sal):
	Update.
	(allocate_symbol, initialize_symbol, allocate_template_symbol):
	Initialize SYMBOL_SECTION.
	* symtab.h (struct general_symbol_info) <section>: Update comment.
	<obj_section>: Remove.
	(SYMBOL_OBJ_SECTION): Add 'objfile' argument.  Rewrite.
	(SYMBOL_OBJFILE): New macro.
This commit is contained in:
Tom Tromey 2013-04-08 20:18:11 +00:00
parent e6dc44a8f5
commit e27d198cc4
18 changed files with 125 additions and 75 deletions

View File

@ -1,3 +1,42 @@
2013-04-08 Tom Tromey <tromey@redhat.com>
PR symtab/8424:
* blockframe.c (find_pc_partial_function_gnu_ifunc): Check
SYMBOL_SECTION, not SYMBOL_OBJ_SECTION.
* breakpoint.c (resolve_sal_pc): Update.
* elfread.c (elf_gnu_ifunc_record_cache): Update.
* findvar.c (struct minsym_lookup_data) <objfile>: New field.
(minsym_lookup_iterator_cb): Use it.
(default_read_var_value): Update.
* hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline):
Update.
* infcmd.c (jump_command): Update.
* linespec.c (minsym_found): Update.
* maint.c (maintenance_translate_address): Update.
* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Update.
(prim_record_minimal_symbol_full): Don't set SYMBOL_OBJ_SECTION.
* parse.c (write_exp_msymbol): Update.
* printcmd.c (address_info): Update.
* psymtab.c (find_pc_sect_psymbol): Update.
(fixup_psymbol_section): Check SYMBOL_SECTION, not
SYMBOL_OBJ_SECTION.
(add_psymbol_to_bcache): Correctly initialize SYMBOL_SECTION.
Don't initialize SYMBOL_OBJ_SECTION.
* spu-tdep.c (spu_catch_start): Update.
* stabsread.c (define_symbol): Don't set SYMBOL_SECTION.
* symmisc.c (dump_msymbols, print_symbol): Update.
* symtab.c (fixup_section): Don't set 'obj_section'. Change
how fallback section is computed.
(fixup_symbol_section): Update.
(find_pc_sect_symtab, find_function_start_sal, skip_prologue_sal):
Update.
(allocate_symbol, initialize_symbol, allocate_template_symbol):
Initialize SYMBOL_SECTION.
* symtab.h (struct general_symbol_info) <section>: Update comment.
<obj_section>: Remove.
(SYMBOL_OBJ_SECTION): Add 'objfile' argument. Rewrite.
(SYMBOL_OBJFILE): New macro.
2013-04-08 Tom Tromey <tromey@redhat.com>
* coffread.c (record_minimal_symbol): Update.

View File

@ -292,8 +292,8 @@ find_pc_partial_function_gnu_ifunc (CORE_ADDR pc, const char **name,
{
if (SYMBOL_VALUE_ADDRESS (msymbol + i)
!= SYMBOL_VALUE_ADDRESS (msymbol)
&& SYMBOL_OBJ_SECTION (msymbol + i)
== SYMBOL_OBJ_SECTION (msymbol))
&& SYMBOL_SECTION (msymbol + i)
== SYMBOL_SECTION (msymbol))
break;
}

View File

@ -9814,7 +9814,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
if (sym != NULL)
{
fixup_symbol_section (sym, sal->symtab->objfile);
sal->section = SYMBOL_OBJ_SECTION (sym);
sal->section = SYMBOL_OBJ_SECTION (sal->symtab->objfile, sym);
}
else
{
@ -9830,7 +9830,7 @@ resolve_sal_pc (struct symtab_and_line *sal)
msym = lookup_minimal_symbol_by_pc (sal->pc);
if (msym.minsym)
sal->section = SYMBOL_OBJ_SECTION (msym.minsym);
sal->section = SYMBOL_OBJ_SECTION (msym.objfile, msym.minsym);
do_cleanups (old_chain);
}

View File

@ -752,8 +752,8 @@ elf_gnu_ifunc_record_cache (const char *name, CORE_ADDR addr)
if (SYMBOL_VALUE_ADDRESS (msym.minsym) != addr)
return 0;
/* minimal symbols have always SYMBOL_OBJ_SECTION non-NULL. */
sect = SYMBOL_OBJ_SECTION (msym.minsym)->the_bfd_section;
objfile = SYMBOL_OBJ_SECTION (msym.minsym)->objfile;
sect = SYMBOL_OBJ_SECTION (msym.objfile, msym.minsym)->the_bfd_section;
objfile = msym.objfile;
/* If .plt jumps back to .plt the symbol is still deferred for later
resolution and it has no use for GDB. Besides ".text" this symbol can

View File

@ -414,6 +414,9 @@ struct minsym_lookup_data
if found. It should be initialized to NULL before the search
is started. */
struct minimal_symbol *result;
/* The objfile in which the symbol was found. */
struct objfile *objfile;
};
/* A callback function for gdbarch_iterate_over_objfiles_in_search_order.
@ -429,6 +432,7 @@ minsym_lookup_iterator_cb (struct objfile *objfile, void *cb_data)
gdb_assert (data->result == NULL);
data->result = lookup_minimal_symbol (data->name, NULL, objfile);
data->objfile = objfile;
/* The iterator should stop iff a match was found. */
return (data->result != NULL);
@ -475,7 +479,8 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
{
CORE_ADDR addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_OBJ_SECTION (var));
SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var),
var));
store_typed_address (value_contents_raw (v), type, addr);
}
@ -496,7 +501,8 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
v = allocate_value_lazy (type);
if (overlay_debugging)
addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_OBJ_SECTION (var));
SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var),
var));
else
addr = SYMBOL_VALUE_ADDRESS (var);
break;
@ -541,7 +547,8 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
v = allocate_value_lazy (type);
if (overlay_debugging)
addr = symbol_overlayed_address
(BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var));
(BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var),
var));
else
addr = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
break;
@ -600,11 +607,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var));
if (overlay_debugging)
addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (msym),
SYMBOL_OBJ_SECTION (msym));
SYMBOL_OBJ_SECTION (lookup_data.objfile,
msym));
else
addr = SYMBOL_VALUE_ADDRESS (msym);
obj_section = SYMBOL_OBJ_SECTION (msym);
obj_section = SYMBOL_OBJ_SECTION (lookup_data.objfile, msym);
if (obj_section
&& (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
addr = target_translate_tls_address (obj_section->objfile, addr);

View File

@ -184,7 +184,7 @@ hppa64_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch,
if (! minsym.minsym)
return 0;
sec = SYMBOL_OBJ_SECTION (minsym.minsym)->the_bfd_section;
sec = SYMBOL_OBJ_SECTION (minsym.objfile, minsym.minsym)->the_bfd_section;
if (bfd_get_section_vma (sec->owner, sec) <= pc
&& pc < (bfd_get_section_vma (sec->owner, sec)

View File

@ -1170,8 +1170,8 @@ jump_command (char *arg, int from_tty)
if (sfn != NULL)
{
fixup_symbol_section (sfn, 0);
if (section_is_overlay (SYMBOL_OBJ_SECTION (sfn)) &&
!section_is_mapped (SYMBOL_OBJ_SECTION (sfn)))
if (section_is_overlay (SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sfn), sfn)) &&
!section_is_mapped (SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sfn), sfn)))
{
if (!query (_("WARNING!!! Destination is in "
"unmapped overlay! Jump anyway? ")))

View File

@ -3399,7 +3399,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
sal = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol),
(struct obj_section *) 0, 0);
sal.section = SYMBOL_OBJ_SECTION (msymbol);
sal.section = SYMBOL_OBJ_SECTION (objfile, msymbol);
/* The minimal symbol might point to a function descriptor;
resolve it to the actual code address instead. */

View File

@ -493,7 +493,7 @@ maintenance_translate_address (char *arg, int from_tty)
const char *symbol_offset
= pulongest (address - SYMBOL_VALUE_ADDRESS (sym.minsym));
sect = SYMBOL_OBJ_SECTION(sym.minsym);
sect = SYMBOL_OBJ_SECTION(sym.objfile, sym.minsym);
if (sect != NULL)
{
const char *section_name;

View File

@ -593,9 +593,10 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc,
/* Some types of debug info, such as COFF,
don't fill the bfd_section member, so don't
throw away symbols on those platforms. */
&& SYMBOL_OBJ_SECTION (&msymbol[hi]) != NULL
&& SYMBOL_OBJ_SECTION (objfile, &msymbol[hi]) != NULL
&& (!matching_obj_sections
(SYMBOL_OBJ_SECTION (&msymbol[hi]), section)))
(SYMBOL_OBJ_SECTION (objfile, &msymbol[hi]),
section)))
{
hi--;
continue;
@ -612,8 +613,8 @@ lookup_minimal_symbol_by_pc_section_1 (CORE_ADDR pc,
== MSYMBOL_SIZE (&msymbol[hi - 1]))
&& (SYMBOL_VALUE_ADDRESS (&msymbol[hi])
== SYMBOL_VALUE_ADDRESS (&msymbol[hi - 1]))
&& (SYMBOL_OBJ_SECTION (&msymbol[hi])
== SYMBOL_OBJ_SECTION (&msymbol[hi - 1])))
&& (SYMBOL_OBJ_SECTION (objfile, &msymbol[hi])
== SYMBOL_OBJ_SECTION (objfile, &msymbol[hi - 1])))
{
hi--;
continue;
@ -942,7 +943,6 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
SYMBOL_VALUE_ADDRESS (msymbol) = address;
SYMBOL_SECTION (msymbol) = section;
SYMBOL_OBJ_SECTION (msymbol) = NULL;
MSYMBOL_TYPE (msymbol) = ms_type;
MSYMBOL_TARGET_FLAG_1 (msymbol) = 0;

View File

@ -502,7 +502,7 @@ write_exp_msymbol (struct minimal_symbol *msymbol)
struct gdbarch *gdbarch = get_objfile_arch (objfile);
CORE_ADDR addr = SYMBOL_VALUE_ADDRESS (msymbol);
struct obj_section *section = SYMBOL_OBJ_SECTION (msymbol);
struct obj_section *section = SYMBOL_OBJ_SECTION (objfile, msymbol);
enum minimal_symbol_type type = MSYMBOL_TYPE (msymbol);
CORE_ADDR pc;

View File

@ -1219,7 +1219,9 @@ address_info (char *exp, int from_tty)
if (msymbol != NULL)
{
gdbarch = get_objfile_arch (msymbol_objfile (msymbol));
struct objfile *objfile = msymbol_objfile (msymbol);
gdbarch = get_objfile_arch (objfile);
load_addr = SYMBOL_VALUE_ADDRESS (msymbol);
printf_filtered ("Symbol \"");
@ -1228,7 +1230,7 @@ address_info (char *exp, int from_tty)
printf_filtered ("\" is at ");
fputs_filtered (paddress (gdbarch, load_addr), gdb_stdout);
printf_filtered (" in a file compiled without debugging");
section = SYMBOL_OBJ_SECTION (msymbol);
section = SYMBOL_OBJ_SECTION (objfile, msymbol);
if (section_is_overlay (section))
{
load_addr = overlay_unmapped_address (load_addr, section);
@ -1249,7 +1251,7 @@ address_info (char *exp, int from_tty)
current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is ");
val = SYMBOL_VALUE (sym);
section = SYMBOL_OBJ_SECTION (sym);
section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
gdbarch = get_objfile_arch (SYMBOL_SYMTAB (sym)->objfile);
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
@ -1354,15 +1356,15 @@ address_info (char *exp, int from_tty)
case LOC_UNRESOLVED:
{
struct minimal_symbol *msym;
struct bound_minimal_symbol msym;
msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (sym), NULL, NULL);
if (msym == NULL)
msym = lookup_minimal_symbol_and_objfile (SYMBOL_LINKAGE_NAME (sym));
if (msym.minsym == NULL)
printf_filtered ("unresolved");
else
{
section = SYMBOL_OBJ_SECTION (msym);
load_addr = SYMBOL_VALUE_ADDRESS (msym);
section = SYMBOL_OBJ_SECTION (msym.objfile, msym.minsym);
load_addr = SYMBOL_VALUE_ADDRESS (msym.minsym);
if (section
&& (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)

View File

@ -429,7 +429,8 @@ find_pc_sect_psymbol (struct objfile *objfile,
if (section) /* Match on a specific section. */
{
fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, p),
section))
continue;
}
best_pc = SYMBOL_VALUE_ADDRESS (p);
@ -453,7 +454,8 @@ find_pc_sect_psymbol (struct objfile *objfile,
if (section) /* Match on a specific section. */
{
fixup_psymbol_section (p, objfile);
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (p), section))
if (!matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, p),
section))
continue;
}
best_pc = SYMBOL_VALUE_ADDRESS (p);
@ -469,7 +471,10 @@ fixup_psymbol_section (struct partial_symbol *psym, struct objfile *objfile)
{
CORE_ADDR addr;
if (psym == NULL || SYMBOL_OBJ_SECTION (psym) != NULL)
if (!psym)
return;
if (SYMBOL_SECTION (psym) >= 0)
return;
gdb_assert (objfile);
@ -1603,8 +1608,7 @@ add_psymbol_to_bcache (const char *name, int namelength, int copy_name,
{
SYMBOL_VALUE_ADDRESS (&psymbol) = coreaddr;
}
SYMBOL_SECTION (&psymbol) = 0;
SYMBOL_OBJ_SECTION (&psymbol) = NULL;
SYMBOL_SECTION (&psymbol) = -1;
SYMBOL_SET_LANGUAGE (&psymbol, language, &objfile->objfile_obstack);
PSYMBOL_DOMAIN (&psymbol) = domain;
PSYMBOL_CLASS (&psymbol) = class;

View File

@ -1920,7 +1920,7 @@ spu_catch_start (struct objfile *objfile)
/* If we have debugging information, try to use it -- this
will allow us to properly skip the prologue. */
pc = SYMBOL_VALUE_ADDRESS (minsym);
symtab = find_pc_sect_symtab (pc, SYMBOL_OBJ_SECTION (minsym));
symtab = find_pc_sect_symtab (pc, SYMBOL_OBJ_SECTION (objfile, minsym));
if (symtab != NULL)
{
struct blockvector *bv = BLOCKVECTOR (symtab);

View File

@ -650,19 +650,6 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
current_symbol = sym = allocate_symbol (objfile);
switch (type & N_TYPE)
{
case N_TEXT:
SYMBOL_SECTION (sym) = SECT_OFF_TEXT (objfile);
break;
case N_DATA:
SYMBOL_SECTION (sym) = SECT_OFF_DATA (objfile);
break;
case N_BSS:
SYMBOL_SECTION (sym) = SECT_OFF_BSS (objfile);
break;
}
if (processing_gcc_compilation)
{
/* GCC 2.x puts the line number in desc. SunOS apparently puts in the

View File

@ -218,7 +218,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
index = 0;
ALL_OBJFILE_MSYMBOLS (objfile, msymbol)
{
struct obj_section *section = SYMBOL_OBJ_SECTION (msymbol);
struct obj_section *section = SYMBOL_OBJ_SECTION (objfile, msymbol);
switch (MSYMBOL_TYPE (msymbol))
{
@ -464,7 +464,8 @@ print_symbol (void *args)
struct symbol *symbol = ((struct print_symbol_args *) args)->symbol;
int depth = ((struct print_symbol_args *) args)->depth;
struct ui_file *outfile = ((struct print_symbol_args *) args)->outfile;
struct obj_section *section = SYMBOL_OBJ_SECTION (symbol);
struct obj_section *section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (symbol),
symbol);
print_spaces (depth, outfile);
if (SYMBOL_DOMAIN (symbol) == LABEL_DOMAIN)

View File

@ -1018,10 +1018,7 @@ fixup_section (struct general_symbol_info *ginfo,
point to the actual function code. */
msym = lookup_minimal_symbol_by_pc_name (addr, ginfo->name, objfile);
if (msym)
{
ginfo->obj_section = SYMBOL_OBJ_SECTION (msym);
ginfo->section = SYMBOL_SECTION (msym);
}
ginfo->section = SYMBOL_SECTION (msym);
else
{
/* Static, function-local variables do appear in the linker
@ -1061,20 +1058,31 @@ fixup_section (struct general_symbol_info *ginfo,
a search of the section table. */
struct obj_section *s;
int fallback = -1;
ALL_OBJFILE_OSECTIONS (objfile, s)
{
int idx = s - objfile->sections;
CORE_ADDR offset = ANOFFSET (objfile->section_offsets, idx);
if (fallback == -1)
fallback = idx;
if (obj_section_addr (s) - offset <= addr
&& addr < obj_section_endaddr (s) - offset)
{
ginfo->obj_section = s;
ginfo->section = idx;
return;
}
}
/* If we didn't find the section, assume it is in the first
section. If there is no allocated section, then it hardly
matters what we pick, so just pick zero. */
if (fallback == -1)
ginfo->section = 0;
else
ginfo->section = fallback;
}
}
@ -1086,9 +1094,6 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
if (!sym)
return NULL;
if (SYMBOL_OBJ_SECTION (sym))
return sym;
/* We either have an OBJFILE, or we can get at it from the sym's
symtab. Anything else is a bug. */
gdb_assert (objfile || SYMBOL_SYMTAB (sym));
@ -1096,6 +1101,9 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
if (objfile == NULL)
objfile = SYMBOL_SYMTAB (sym)->objfile;
if (SYMBOL_OBJ_SECTION (objfile, sym))
return sym;
/* We should have an objfile by now. */
gdb_assert (objfile);
@ -2131,7 +2139,8 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
fixup_symbol_section (sym, objfile);
if (matching_obj_sections (SYMBOL_OBJ_SECTION (sym), section))
if (matching_obj_sections (SYMBOL_OBJ_SECTION (objfile, sym),
section))
break;
}
if (sym == NULL)
@ -2763,7 +2772,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
fixup_symbol_section (sym, NULL);
sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
SYMBOL_OBJ_SECTION (sym), 0);
SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym), 0);
/* We always should have a line for the function start address.
If we don't, something is odd. Create a plain SAL refering
@ -2774,7 +2783,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
init_sal (&sal);
sal.pspace = current_program_space;
sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
sal.section = SYMBOL_OBJ_SECTION (sym);
sal.section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
}
if (funfirstline)
@ -2815,7 +2824,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
fixup_symbol_section (sym, NULL);
pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
section = SYMBOL_OBJ_SECTION (sym);
section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
name = SYMBOL_LINKAGE_NAME (sym);
objfile = SYMBOL_SYMTAB (sym)->objfile;
}
@ -2830,10 +2839,10 @@ skip_prologue_sal (struct symtab_and_line *sal)
return;
}
pc = SYMBOL_VALUE_ADDRESS (msymbol);
section = SYMBOL_OBJ_SECTION (msymbol);
name = SYMBOL_LINKAGE_NAME (msymbol);
objfile = msymbol_objfile (msymbol);
pc = SYMBOL_VALUE_ADDRESS (msymbol);
section = SYMBOL_OBJ_SECTION (objfile, msymbol);
name = SYMBOL_LINKAGE_NAME (msymbol);
}
gdbarch = get_objfile_arch (objfile);
@ -5146,6 +5155,7 @@ void
initialize_symbol (struct symbol *sym)
{
memset (sym, 0, sizeof (*sym));
SYMBOL_SECTION (sym) = -1;
}
/* Allocate and initialize a new 'struct symbol' on OBJFILE's
@ -5157,6 +5167,7 @@ allocate_symbol (struct objfile *objfile)
struct symbol *result;
result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol);
SYMBOL_SECTION (result) = -1;
return result;
}
@ -5170,6 +5181,7 @@ allocate_template_symbol (struct objfile *objfile)
struct template_symbol *result;
result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol);
SYMBOL_SECTION (&result->base) = -1;
return result;
}

View File

@ -165,16 +165,9 @@ struct general_symbol_info
/* Which section is this symbol in? This is an index into
section_offsets for this objfile. Negative means that the symbol
does not get relocated relative to a section.
Disclaimer: currently this is just used for xcoff, so don't
expect all symbol-reading code to set it correctly (the ELF code
also tries to set it correctly). */
does not get relocated relative to a section. */
short section;
/* The section associated with this symbol. It can be NULL. */
struct obj_section *obj_section;
};
extern void symbol_set_demangled_name (struct general_symbol_info *,
@ -202,7 +195,10 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, struct obj_section *);
#define SYMBOL_VALUE_CHAIN(symbol) (symbol)->ginfo.value.chain
#define SYMBOL_LANGUAGE(symbol) (symbol)->ginfo.language
#define SYMBOL_SECTION(symbol) (symbol)->ginfo.section
#define SYMBOL_OBJ_SECTION(symbol) (symbol)->ginfo.obj_section
#define SYMBOL_OBJ_SECTION(objfile, symbol) \
(((symbol)->ginfo.section >= 0) \
? (&(((objfile)->sections)[(symbol)->ginfo.section])) \
: NULL)
/* Initializes the language dependent portion of a symbol
depending upon the language for the symbol. */
@ -731,6 +727,7 @@ extern const struct symbol_impl *symbol_impls;
#define SYMBOL_BLOCK_OPS(symbol) (SYMBOL_IMPL (symbol).ops_block)
#define SYMBOL_REGISTER_OPS(symbol) (SYMBOL_IMPL (symbol).ops_register)
#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
#define SYMBOL_OBJFILE(symbol) (SYMBOL_SYMTAB (symbol)->objfile)
extern int register_symbol_computed_impl (enum address_class,
const struct symbol_computed_ops *);