mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 22:48:57 +08:00
dwarf2.c remove varinfo and funcinfo sec field
The "sec" field in these structures is only set and used in lookup functions. It always starts off as NULL. So the only possible effect of the field is to modify the return of the lookup, which was its purpose back in 2005 when HJ fixed PR990. Since then we solved the problem of relocatable object files with the fix for PR2338, so this field is now redundant. * dwarf.c (struct funcinfo, struct varinfo): Remove "sec" field. (lookup_symbol_in_function_table): Don't set or test "sec". (lookup_symbol_in_variable_table): Likewise. (info_hash_lookup_funcinfo, info_hash_lookup_varinfo): Likewise.
This commit is contained in:
22
bfd/dwarf2.c
22
bfd/dwarf2.c
@ -1810,8 +1810,6 @@ struct funcinfo
|
|||||||
bool is_linkage;
|
bool is_linkage;
|
||||||
const char *name;
|
const char *name;
|
||||||
struct arange arange;
|
struct arange arange;
|
||||||
/* Where the symbol is defined. */
|
|
||||||
asection *sec;
|
|
||||||
/* The offset of the funcinfo from the start of the unit. */
|
/* The offset of the funcinfo from the start of the unit. */
|
||||||
uint64_t unit_offset;
|
uint64_t unit_offset;
|
||||||
};
|
};
|
||||||
@ -1848,8 +1846,6 @@ struct varinfo
|
|||||||
const char *name;
|
const char *name;
|
||||||
/* The address of the variable. */
|
/* The address of the variable. */
|
||||||
bfd_vma addr;
|
bfd_vma addr;
|
||||||
/* Where the symbol is defined. */
|
|
||||||
asection *sec;
|
|
||||||
/* Is this a stack variable? */
|
/* Is this a stack variable? */
|
||||||
bool stack;
|
bool stack;
|
||||||
};
|
};
|
||||||
@ -3354,7 +3350,6 @@ lookup_symbol_in_function_table (struct comp_unit *unit,
|
|||||||
bfd_vma best_fit_len = 0;
|
bfd_vma best_fit_len = 0;
|
||||||
struct arange *arange;
|
struct arange *arange;
|
||||||
const char *name = bfd_asymbol_name (sym);
|
const char *name = bfd_asymbol_name (sym);
|
||||||
asection *sec = bfd_asymbol_section (sym);
|
|
||||||
|
|
||||||
for (each_func = unit->function_table;
|
for (each_func = unit->function_table;
|
||||||
each_func;
|
each_func;
|
||||||
@ -3364,8 +3359,7 @@ lookup_symbol_in_function_table (struct comp_unit *unit,
|
|||||||
arange;
|
arange;
|
||||||
arange = arange->next)
|
arange = arange->next)
|
||||||
{
|
{
|
||||||
if ((!each_func->sec || each_func->sec == sec)
|
if (addr >= arange->low
|
||||||
&& addr >= arange->low
|
|
||||||
&& addr < arange->high
|
&& addr < arange->high
|
||||||
&& each_func->name
|
&& each_func->name
|
||||||
&& strcmp (name, each_func->name) == 0
|
&& strcmp (name, each_func->name) == 0
|
||||||
@ -3380,7 +3374,6 @@ lookup_symbol_in_function_table (struct comp_unit *unit,
|
|||||||
|
|
||||||
if (best_fit)
|
if (best_fit)
|
||||||
{
|
{
|
||||||
best_fit->sec = sec;
|
|
||||||
*filename_ptr = best_fit->file;
|
*filename_ptr = best_fit->file;
|
||||||
*linenumber_ptr = best_fit->line;
|
*linenumber_ptr = best_fit->line;
|
||||||
return true;
|
return true;
|
||||||
@ -3402,7 +3395,6 @@ lookup_symbol_in_variable_table (struct comp_unit *unit,
|
|||||||
unsigned int *linenumber_ptr)
|
unsigned int *linenumber_ptr)
|
||||||
{
|
{
|
||||||
const char *name = bfd_asymbol_name (sym);
|
const char *name = bfd_asymbol_name (sym);
|
||||||
asection *sec = bfd_asymbol_section (sym);
|
|
||||||
struct varinfo* each;
|
struct varinfo* each;
|
||||||
|
|
||||||
for (each = unit->variable_table; each; each = each->prev_var)
|
for (each = unit->variable_table; each; each = each->prev_var)
|
||||||
@ -3410,13 +3402,11 @@ lookup_symbol_in_variable_table (struct comp_unit *unit,
|
|||||||
&& each->file != NULL
|
&& each->file != NULL
|
||||||
&& each->name != NULL
|
&& each->name != NULL
|
||||||
&& each->addr == addr
|
&& each->addr == addr
|
||||||
&& (!each->sec || each->sec == sec)
|
|
||||||
&& strcmp (name, each->name) == 0)
|
&& strcmp (name, each->name) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (each)
|
if (each)
|
||||||
{
|
{
|
||||||
each->sec = sec;
|
|
||||||
*filename_ptr = each->file;
|
*filename_ptr = each->file;
|
||||||
*linenumber_ptr = each->line;
|
*linenumber_ptr = each->line;
|
||||||
return true;
|
return true;
|
||||||
@ -5079,7 +5069,6 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table,
|
|||||||
struct info_list_node *node;
|
struct info_list_node *node;
|
||||||
struct arange *arange;
|
struct arange *arange;
|
||||||
const char *name = bfd_asymbol_name (sym);
|
const char *name = bfd_asymbol_name (sym);
|
||||||
asection *sec = bfd_asymbol_section (sym);
|
|
||||||
|
|
||||||
for (node = lookup_info_hash_table (hash_table, name);
|
for (node = lookup_info_hash_table (hash_table, name);
|
||||||
node;
|
node;
|
||||||
@ -5090,8 +5079,7 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table,
|
|||||||
arange;
|
arange;
|
||||||
arange = arange->next)
|
arange = arange->next)
|
||||||
{
|
{
|
||||||
if ((!each_func->sec || each_func->sec == sec)
|
if (addr >= arange->low
|
||||||
&& addr >= arange->low
|
|
||||||
&& addr < arange->high
|
&& addr < arange->high
|
||||||
&& (!best_fit
|
&& (!best_fit
|
||||||
|| arange->high - arange->low < best_fit_len))
|
|| arange->high - arange->low < best_fit_len))
|
||||||
@ -5104,7 +5092,6 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table,
|
|||||||
|
|
||||||
if (best_fit)
|
if (best_fit)
|
||||||
{
|
{
|
||||||
best_fit->sec = sec;
|
|
||||||
*filename_ptr = best_fit->file;
|
*filename_ptr = best_fit->file;
|
||||||
*linenumber_ptr = best_fit->line;
|
*linenumber_ptr = best_fit->line;
|
||||||
return true;
|
return true;
|
||||||
@ -5127,7 +5114,6 @@ info_hash_lookup_varinfo (struct info_hash_table *hash_table,
|
|||||||
unsigned int *linenumber_ptr)
|
unsigned int *linenumber_ptr)
|
||||||
{
|
{
|
||||||
const char *name = bfd_asymbol_name (sym);
|
const char *name = bfd_asymbol_name (sym);
|
||||||
asection *sec = bfd_asymbol_section (sym);
|
|
||||||
struct varinfo* each;
|
struct varinfo* each;
|
||||||
struct info_list_node *node;
|
struct info_list_node *node;
|
||||||
|
|
||||||
@ -5136,10 +5122,8 @@ info_hash_lookup_varinfo (struct info_hash_table *hash_table,
|
|||||||
node = node->next)
|
node = node->next)
|
||||||
{
|
{
|
||||||
each = (struct varinfo *) node->info;
|
each = (struct varinfo *) node->info;
|
||||||
if (each->addr == addr
|
if (each->addr == addr)
|
||||||
&& (!each->sec || each->sec == sec))
|
|
||||||
{
|
{
|
||||||
each->sec = sec;
|
|
||||||
*filename_ptr = each->file;
|
*filename_ptr = each->file;
|
||||||
*linenumber_ptr = each->line;
|
*linenumber_ptr = each->line;
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user