aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-03-08 19:37:08 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-03-08 19:37:08 +0000
commit7fe25d9bd274089557e2947f7ba09b6e333533cd (patch)
tree425e72499567e1844211391e2f13213d97f44866
parent05e7c244344f338bf2af7718db34eb91637587dd (diff)
downloadgdb-7fe25d9bd274089557e2947f7ba09b6e333533cd.zip
gdb-7fe25d9bd274089557e2947f7ba09b6e333533cd.tar.gz
gdb-7fe25d9bd274089557e2947f7ba09b6e333533cd.tar.bz2
gdb/
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.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/dwarf2loc.h2
-rw-r--r--gdb/dwarf2read.c6
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-op-call.S17
5 files changed, 38 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2851d51..9eb949b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
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 ...
* ia64-libunwind-tdep.c: ... here.
* libunwind-frame.h: Rename to ...
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
index a7f835f..45b0fd8 100644
--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
@@ -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);
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 307d98e..6eed8d5 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a5b57f5..22b3849 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
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.
* gdb.reverse/solib-precsave.exp: Try to compile the test using
-Wl,-z,norelro first.
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-op-call.S b/gdb/testsuite/gdb.dwarf2/dw2-op-call.S
index c369966..39345b9 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-op-call.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-op-call.S
@@ -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 */