This is the mail archive of the binutils@sourceware.org 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]

PR 6832, Crash while handling DW_AT_abstract_origin for a last comp unit


I think this patch should lay this old PR to rest.  When we have
multiple debug info sections it is necessary to keep track of the
relevant section to which any DW_FORM_ref_addr offset applies.  In
fact, this patch is needed even when there is only one debug info
section except in the case where line number and function lookup
matches before parsing all CUs, or we get a match immediately after
parsing the last CU.  After that, stash->sec_info_ptr will be
invalid.

Committed.

	PR 6832
	* dwarf2.c (struct comp_unit): Add sec_info_ptr.
	(find_abstract_instance_name): Use it.
	(parse_comp_unit): Set it.

Index: bfd/dwarf2.c
===================================================================
RCS file: /cvs/src/src/bfd/dwarf2.c,v
retrieving revision 1.127
diff -u -p -r1.127 dwarf2.c
--- bfd/dwarf2.c	4 Jan 2010 11:44:30 -0000	1.127
+++ bfd/dwarf2.c	11 Jan 2010 03:03:04 -0000
@@ -216,6 +216,9 @@ struct comp_unit
      by its reference.  */
   bfd_byte *info_ptr_unit;
 
+  /* Pointer to the start of the debug section, for DW_FORM_ref_addr.  */
+  bfd_byte *sec_info_ptr;
+
   /* The offset into .debug_line of the line number table.  */
   unsigned long line_offset;
 
@@ -1811,7 +1814,7 @@ find_abstract_instance_name (struct comp
       if (!die_ref)
 	abort ();
 
-      info_ptr = unit->stash->sec_info_ptr + die_ref;
+      info_ptr = unit->sec_info_ptr + die_ref;
     }
   else 
     info_ptr = unit->info_ptr_unit + die_ref;
@@ -2219,6 +2222,7 @@ parse_comp_unit (struct dwarf2_debug *st
   unit->end_ptr = end_ptr;
   unit->stash = stash;
   unit->info_ptr_unit = info_ptr_unit;
+  unit->sec_info_ptr = stash->sec_info_ptr;
 
   for (i = 0; i < abbrev->num_attrs; ++i)
     {

-- 
Alan Modra
Australia Development Lab, IBM


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