This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] fine_nearest_line: find the most nested inline function


there is a small thinko in dwarf2.c:lookup_address_in_function_table.
As a consequence, the result may not be the most nested inlined function.

In order to find inlined functions, we find the function that has the
smallest range that contains the address.  But we compare ranges with
the first range of the best function instead of the best range of the
best function.

No regressions on i386-linux.

Ok for trunk ?


2014-05-27  Tristan Gingold  <>

	* dwarf2.c (lookup_address_in_function_table): Add best_fit_len
	to keep the length of the best fit range.

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index e5579d8..6c2a651 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1995,6 +1995,7 @@ lookup_address_in_function_table (struct comp_unit *unit,
   struct funcinfo* each_func;
   struct funcinfo* best_fit = NULL;
   struct arange *arange;
+  bfd_vma best_fit_len = 0;
   for (each_func = unit->function_table;
@@ -2007,9 +2008,11 @@ lookup_address_in_function_table (struct comp_unit *unit,
 	  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;
+		}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]