gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 8 Mar 2012 19:37:08 +0000 (19:37 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 8 Mar 2012 19:37:08 +0000 (19:37 +0000)
Fix CU relative vs. absolute DIE offsets.
* dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter
offset to offset_in_cu.
* dwarf2read.c (process_enumeration_scope): Add CU offset to
TYPE_OFFSET.
(dwarf2_fetch_die_location_block): Rename parameter offset to
offset_in_cu.  New variable offset, add CU offset to OFFSET_IN_CU.

gdb/testsuite/
Fix CU relative vs. absolute DIE offsets.
* gdb.dwarf2/dw2-op-call.S: New compilation unit preceding the existing
one.

gdb/ChangeLog
gdb/dwarf2loc.h
gdb/dwarf2read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/dw2-op-call.S

index 2851d516d856c6b1cde3732344db6fc3274606d9..9eb949bc176948795ce4eacd761fef3d9dda4cb8 100644 (file)
@@ -1,3 +1,13 @@
+2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix CU relative vs. absolute DIE offsets.
+       * dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter
+       offset to offset_in_cu.
+       * dwarf2read.c (process_enumeration_scope): Add CU offset to
+       TYPE_OFFSET.
+       (dwarf2_fetch_die_location_block): Rename parameter offset to
+       offset_in_cu.  New variable offset, add CU offset to OFFSET_IN_CU.
+
 2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * libunwind-frame.c: Rename to ...
index a7f835fe6a724b0d3390ee656ebc9a697b6a7af7..45b0fd8b3e037d268a55fefdd3fc96c068f7a678 100644 (file)
@@ -61,7 +61,7 @@ const gdb_byte *dwarf2_find_location_expression
    CORE_ADDR pc);
 
 struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block
-  (unsigned int offset, struct dwarf2_per_cu_data *per_cu,
+  (unsigned int offset_in_cu, struct dwarf2_per_cu_data *per_cu,
    CORE_ADDR (*get_frame_pc) (void *baton),
    void *baton);
 
index 307d98e93d289ff71ed2965235d15242071e5506..6eed8d53b08c3809c7196bc09462c1d5742e9223 100644 (file)
@@ -8031,7 +8031,8 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
        = lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile,
                                            cu->per_cu->debug_types_section,
                                            cu->per_cu->offset);
-      if (type_sig->type_offset != die->offset)
+      if (type_sig->per_cu.offset + type_sig->type_offset
+         != die->offset)
        return;
     }
 
@@ -14202,11 +14203,12 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr,
    dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE.  */
 
 struct dwarf2_locexpr_baton
-dwarf2_fetch_die_location_block (unsigned int offset,
+dwarf2_fetch_die_location_block (unsigned int offset_in_cu,
                                 struct dwarf2_per_cu_data *per_cu,
                                 CORE_ADDR (*get_frame_pc) (void *baton),
                                 void *baton)
 {
+  unsigned int offset = per_cu->offset + offset_in_cu;
   struct dwarf2_cu *cu;
   struct die_info *die;
   struct attribute *attr;
index a5b57f5be72517e40e319890e3f66cd250255145..22b3849de5d62582ff20af1fe9bf6f5432269c43 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       Fix CU relative vs. absolute DIE offsets.
+       * gdb.dwarf2/dw2-op-call.S: New compilation unit preceding the existing
+       one.
+
 2012-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix false FAIL on distros with relro linkage as default.
index c36996655c5df10ad6eea09c3a802a3bbd0657c3..39345b9a54820d6c220c2950797ae22287f505b6 100644 (file)
@@ -23,6 +23,23 @@ array2:      .2byte  2
 array3:        .2byte  3
 
        .section .debug_info
+.Lcu0_begin:
+       /* CU header */
+       .4byte  .Lcu0_end - .Lcu0_start         /* Length of Compilation Unit */
+.Lcu0_start:
+       .2byte  2                               /* DWARF Version */
+       .4byte  .Labbrev1_begin                 /* Offset into abbrev section */
+       .byte   4                               /* Pointer size */
+
+       /* CU die */
+       .uleb128 1                              /* Abbrev: DW_TAG_compile_unit */
+       .ascii  "file0.txt\0"                   /* DW_AT_name */
+       .ascii  "GNU C 3.3.3\0"                 /* DW_AT_producer */
+       .byte   2                               /* DW_LANG_C (C) */
+
+       .byte   0                               /* End of children of CU */
+.Lcu0_end:
+
 .Lcu1_begin:
        /* CU header */
        .4byte  .Lcu1_end - .Lcu1_start         /* Length of Compilation Unit */