summaryrefslogtreecommitdiffstats
path: root/binutils-2.24-DW_FORM_ref_addr.patch
blob: 92ef150548480f2a3c4c58a9fa60fc6664a46187 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
*** ../binutils-2.24.orig/bfd/dwarf2.c	2014-01-28 11:58:02.072737296 +0000
--- bfd/dwarf2.c	2014-01-28 11:59:38.575739971 +0000
*************** find_abstract_instance_name (struct comp
*** 2126,2131 ****
--- 2126,2153 ----
  	abort ();
  
        info_ptr = unit->sec_info_ptr + die_ref;
+ 
+       /* Now find the CU containing this pointer.  */
+       if (info_ptr >= unit->info_ptr_unit && info_ptr < unit->end_ptr)
+ 	;
+       else
+ 	{
+ 	  /* Check other CUs to see if they contain the abbrev.  */
+ 	  struct comp_unit * u;
+ 
+ 	  for (u = unit->prev_unit; u != NULL; u = u->prev_unit)
+ 	    if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
+ 	      break;
+ 
+ 	  if (u == NULL)
+ 	    for (u = unit->next_unit; u != NULL; u = u->next_unit)
+ 	      if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr)
+ 		break;
+ 
+ 	  if (u)
+ 	    unit = u;
+ 	  /* else FIXME: What do we do now ?  */
+ 	}
      }
    else if (attr_ptr->form == DW_FORM_GNU_ref_alt)
      {
*************** find_abstract_instance_name (struct comp
*** 2137,2142 ****
--- 2159,2166 ----
  	  bfd_set_error (bfd_error_bad_value);
  	  return name;
  	}
+       /* FIXME: Do we need to locate the correct CU, in a similar
+ 	 fashion to the code in the DW_FORM_ref_addr case above ?  */
      }
    else
      info_ptr = unit->info_ptr_unit + die_ref;