2005-07-06 H.J. Lu <hongjiu.lu@intel.com>

* dwarf2.c (varinfo): Add addr.
	(lookup_symbol_in_variable_table): Also check addr.
	(scan_unit_for_symbols): Set addr for variable.
	(comp_unit_find_line): Updated.
This commit is contained in:
H.J. Lu
2005-07-06 13:43:21 +00:00
parent 0adc9281f0
commit 5cf2e3f01e
2 changed files with 28 additions and 13 deletions

View File

@ -1,3 +1,10 @@
2005-07-06 H.J. Lu <hongjiu.lu@intel.com>
* dwarf2.c (varinfo): Add addr.
(lookup_symbol_in_variable_table): Also check addr.
(scan_unit_for_symbols): Set addr for variable.
(comp_unit_find_line): Updated.
2005-07-06 Nick Clifton <nickc@redhat.com> 2005-07-06 Nick Clifton <nickc@redhat.com>
* coff-alpha.c (alpha_adjust_reloc_in): Issue an informative error * coff-alpha.c (alpha_adjust_reloc_in): Issue an informative error

View File

@ -719,6 +719,7 @@ struct varinfo
int line; int line;
int tag; int tag;
char *name; char *name;
bfd_vma addr;
/* Where the symbol is defined */ /* Where the symbol is defined */
asection *sec; asection *sec;
/* Is this a stack variable? */ /* Is this a stack variable? */
@ -1495,6 +1496,7 @@ lookup_symbol_in_function_table (struct comp_unit *unit,
static bfd_boolean static bfd_boolean
lookup_symbol_in_variable_table (struct comp_unit *unit, lookup_symbol_in_variable_table (struct comp_unit *unit,
asymbol *sym, asymbol *sym,
bfd_vma addr,
const char **filename_ptr, const char **filename_ptr,
unsigned int *linenumber_ptr) unsigned int *linenumber_ptr)
{ {
@ -1504,6 +1506,9 @@ lookup_symbol_in_variable_table (struct comp_unit *unit,
for (each = unit->variable_table; each; each = each->prev_var) for (each = unit->variable_table; each; each = each->prev_var)
if (each->stack == 0 if (each->stack == 0
&& each->file != NULL
&& each->name != NULL
&& each->addr == addr
&& (!each->sec || each->sec == sec) && (!each->sec || each->sec == sec)
&& strcmp (name, each->name) == 0) && strcmp (name, each->name) == 0)
break; break;
@ -1749,8 +1754,6 @@ scan_unit_for_symbols (struct comp_unit *unit)
break; break;
case DW_AT_location: case DW_AT_location:
if (var->stack)
{
switch (attr.form) switch (attr.form)
{ {
case DW_FORM_block: case DW_FORM_block:
@ -1758,13 +1761,17 @@ scan_unit_for_symbols (struct comp_unit *unit)
case DW_FORM_block2: case DW_FORM_block2:
case DW_FORM_block4: case DW_FORM_block4:
if (*attr.u.blk->data == DW_OP_addr) if (*attr.u.blk->data == DW_OP_addr)
{
var->stack = 0; var->stack = 0;
var->addr = bfd_get ((attr.u.blk->size - 1) * 8,
unit->abfd,
attr.u.blk->data + 1);
}
break; break;
default: default:
break; break;
} }
}
break; break;
default: default:
@ -2073,7 +2080,8 @@ comp_unit_find_line (struct comp_unit *unit,
filename_ptr, filename_ptr,
linenumber_ptr); linenumber_ptr);
else else
return lookup_symbol_in_variable_table (unit, sym, filename_ptr, return lookup_symbol_in_variable_table (unit, sym, addr,
filename_ptr,
linenumber_ptr); linenumber_ptr);
} }