+2014-05-28 Tristan Gingold <gingold@adacore.com>
+
+ * dwarf2.c (lookup_address_in_function_table): Add best_fit_len
+ to keep the length of the best fit range.
+ (lookup_symbol_in_function_table, info_hash_lookup_funcinfo):
+ Likewise.
+
2014-05-27 DJ Delorie <dj@redhat.com>
* bfd/elf32-rx.c (get_symbol_value_maybe): New.
{
struct funcinfo* each_func;
struct funcinfo* best_fit = NULL;
+ bfd_vma best_fit_len = 0;
struct arange *arange;
for (each_func = unit->function_table;
if (addr >= arange->low && addr < arange->high)
{
if (!best_fit
- || (arange->high - arange->low
- < best_fit->arange.high - best_fit->arange.low))
- best_fit = each_func;
+ || arange->high - arange->low < best_fit_len)
+ {
+ best_fit = each_func;
+ best_fit_len = arange->high - arange->low;
+ }
}
}
}
{
struct funcinfo* each_func;
struct funcinfo* best_fit = NULL;
+ bfd_vma best_fit_len = 0;
struct arange *arange;
const char *name = bfd_asymbol_name (sym);
asection *sec = bfd_get_section (sym);
&& each_func->name
&& strcmp (name, each_func->name) == 0
&& (!best_fit
- || (arange->high - arange->low
- < best_fit->arange.high - best_fit->arange.low)))
- best_fit = each_func;
+ || arange->high - arange->low < best_fit_len))
+ {
+ best_fit = each_func;
+ best_fit_len = arange->high - arange->low;
+ }
}
}
{
struct funcinfo* each_func;
struct funcinfo* best_fit = NULL;
+ bfd_vma best_fit_len = 0;
struct info_list_node *node;
struct arange *arange;
const char *name = bfd_asymbol_name (sym);
&& addr >= arange->low
&& addr < arange->high
&& (!best_fit
- || (arange->high - arange->low
- < best_fit->arange.high - best_fit->arange.low)))
- best_fit = each_func;
+ || arange->high - arange->low < best_fit_len))
+ {
+ best_fit = each_func;
+ best_fit_len = arange->high - arange->low;
+ }
}
}