[binutils-gdb] Use comp_unit_maybe_decode_line_info in more places

Alan Modra amodra@sourceware.org
Wed Aug 14 04:16:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c327a44f38ad5ab0dfd8da5184c4c030798ef323

commit c327a44f38ad5ab0dfd8da5184c4c030798ef323
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Aug 14 11:26:48 2019 +0930

    Use comp_unit_maybe_decode_line_info in more places
    
    	* dwarf2.c (comp_unit_maybe_decode_line_info): Declare.
    	(comp_unit_find_nearest_line): Use it here..
    	(_bfd_dwarf2_find_symbol_bias): ..and here.

Diff:
---
 bfd/ChangeLog |  6 ++++++
 bfd/dwarf2.c  | 37 +++++--------------------------------
 2 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a2c2e51..143350e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
 2019-08-14  Alan Modra  <amodra@gmail.com>
 
+	* dwarf2.c (comp_unit_maybe_decode_line_info): Declare.
+	(comp_unit_find_nearest_line): Use it here..
+	(_bfd_dwarf2_find_symbol_bias): ..and here.
+
+2019-08-14  Alan Modra  <amodra@gmail.com>
+
 	* dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove addr_size parameter.
 	* libbfd-in.h  (_bfd_dwarf2_find_nearest_line): Update prototype.
 	* coffgen.c (coff_find_nearest_line_with_names): Adjust
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 9cbd81d..65bb1e4 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -2804,6 +2804,9 @@ lookup_symbol_in_variable_table (struct comp_unit *unit,
   return FALSE;
 }
 
+static bfd_boolean comp_unit_maybe_decode_line_info (struct comp_unit *,
+						     struct dwarf2_debug *);
+
 static bfd_boolean
 find_abstract_instance (struct comp_unit *   unit,
 			bfd_byte *           orig_info_ptr,
@@ -3604,33 +3607,9 @@ comp_unit_find_nearest_line (struct comp_unit *unit,
 {
   bfd_boolean func_p;
 
-  if (unit->error)
+  if (!comp_unit_maybe_decode_line_info (unit, stash))
     return FALSE;
 
-  if (! unit->line_table)
-    {
-      if (! unit->stmtlist)
-	{
-	  unit->error = 1;
-	  return FALSE;
-	}
-
-      unit->line_table = decode_line_info (unit, stash);
-
-      if (! unit->line_table)
-	{
-	  unit->error = 1;
-	  return FALSE;
-	}
-
-      if (unit->first_child_die_ptr < unit->end_ptr
-	  && ! scan_unit_for_symbols (unit))
-	{
-	  unit->error = 1;
-	  return FALSE;
-	}
-    }
-
   *function_ptr = NULL;
   func_p = lookup_address_in_function_table (unit, addr, function_ptr);
   if (func_p && (*function_ptr)->tag == DW_TAG_inlined_subroutine)
@@ -4492,13 +4471,7 @@ _bfd_dwarf2_find_symbol_bias (asymbol ** symbols, void ** pinfo)
     {
       struct funcinfo * func;
 
-      if (unit->function_table == NULL)
-	{
-	  if (unit->line_table == NULL)
-	    unit->line_table = decode_line_info (unit, stash);
-	  if (unit->line_table != NULL)
-	    scan_unit_for_symbols (unit);
-	}
+      comp_unit_maybe_decode_line_info (unit, stash);
 
       for (func = unit->function_table; func != NULL; func = func->prev_func)
 	if (func->name && func->arange.low)



More information about the Binutils-cvs mailing list