This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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] [1/2] Discontiguous PSYMTABs (partial DIEs base address)


Hi,

It fixes this testcase run (when `complaints' is on):

-Reading symbols from /home/jkratoch/redhat/sources/gdb/testsuite/gdb.cp/m-static...Invalid .debug_ranges data (no base address)...done.
+Reading symbols from /home/jkratoch/redhat/sources/gdb/testsuite/gdb.cp/m-static...done.

Currently the base address required for the CU DW_AT_ranges resolution is set
only during full symbols reading which is too late for the secondary patch
which uses OBJFILE->PSYMTABS_ADDRMAP built from these ranges to find which
psymtabs expand to the full symtabs (chicken-egg problem).

It has no real benefits but it is a non-regression standalone patch required by
the next patch [2/2].

Going to post the results of some more verifications, posting as Doug Evans has
asked.


Regards,
Jan
2008-04-21  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Set CU BASE_ADDRESS already from partial DIEs.
	* dwarf2read.c (read_partial_die): New variables BASE_ADDRESS and
	BASE_ADDRESS_TYPE.  Set these variables from DW_AT_LOW_PC and
	DW_AT_ENTRY_PC.  Set CU->HEADER.BASE_KNOWN and CU->HEADER.BASE_ADDRESS
	from these variables if it was still unset.

--- ./gdb/dwarf2read.c	19 Apr 2008 05:06:54 -0000	1.255
+++ ./gdb/dwarf2read.c	21 Apr 2008 13:49:11 -0000
@@ -5808,6 +5851,15 @@ read_partial_die (struct partial_die_inf
   struct attribute attr;
   int has_low_pc_attr = 0;
   int has_high_pc_attr = 0;
+  CORE_ADDR base_address;
+  enum
+    {
+      base_address_none,
+      base_address_low_pc,
+      /* Overrides BASE_ADDRESS_LOW_PC.  */
+      base_address_entry_pc
+    }
+  base_address_type = base_address_none;
 
   memset (part_die, 0, sizeof (struct partial_die_info));
 
@@ -5845,11 +5897,25 @@ read_partial_die (struct partial_die_inf
 	case DW_AT_low_pc:
 	  has_low_pc_attr = 1;
 	  part_die->lowpc = DW_ADDR (&attr);
+	  if (part_die->tag == DW_TAG_compile_unit
+	      && base_address_type < base_address_low_pc)
+	    {
+	      base_address = DW_ADDR (&attr);
+	      base_address_type = base_address_low_pc;
+	    }
 	  break;
 	case DW_AT_high_pc:
 	  has_high_pc_attr = 1;
 	  part_die->highpc = DW_ADDR (&attr);
 	  break;
+	case DW_AT_entry_pc:
+	  if (part_die->tag == DW_TAG_compile_unit
+	      && base_address_type < base_address_entry_pc)
+	    {
+	      base_address = DW_ADDR (&attr);
+	      base_address_type = base_address_entry_pc;
+	    }
+	  break;
 	case DW_AT_ranges:
 	  if (dwarf2_ranges_read (DW_UNSND (&attr), &part_die->lowpc,
 				  &part_die->highpc, cu))
@@ -5942,6 +6010,14 @@ read_partial_die (struct partial_die_inf
       && (part_die->lowpc != 0
 	  || dwarf2_per_objfile->has_section_at_zero))
     part_die->has_pc_info = 1;
+
+  if (base_address_type != base_address_none && !cu->header.base_known)
+    {
+      gdb_assert (part_die->tag == DW_TAG_compile_unit);
+      cu->header.base_known = 1;
+      cu->header.base_address = base_address;
+    }
+
   return info_ptr;
 }
 

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