aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dwarf2
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-12-10 17:17:29 +0000
committerTom Tromey <tromey@redhat.com>2012-12-10 17:17:29 +0000
commit8b9737bf8cca3d3f999bb48a27019933f2138c2c (patch)
treebaeba3860356f90c0986f90733137348d482e61c /gdb/testsuite/gdb.dwarf2
parent93eed41f8ee40080a4e5f21fe7e950e5f34534ae (diff)
downloadbinutils-8b9737bf8cca3d3f999bb48a27019933f2138c2c.zip
binutils-8b9737bf8cca3d3f999bb48a27019933f2138c2c.tar.gz
binutils-8b9737bf8cca3d3f999bb48a27019933f2138c2c.tar.bz2
* dwarf2read.c (dwarf2_fetch_die_loc_sect_off): New function.
(dwarf2_fetch_die_loc_cu_off): Rename from dwarf2_fetch_die_location_block. Rewrite to use dwarf2_fetch_die_loc_sect_off. * dwarf2loc.h (dwarf2_fetch_die_loc_sect_off): Declare. (dwarf2_fetch_die_loc_cu_off): Rename. * dwarf2loc.c (indirect_pieced_value): Use dwarf2_fetch_die_loc_sect_off. * dwarf2expr.h (struct dwarf_expr_context) <len, data>: Update comment. (struct dwarf_expr_piece) <v.ptr.die>: Now a sect_offset. * dwarf2expr.c (add_piece): Update. (execute_stack_op) <DW_OP_GNU_implicit_pointer>: Update comment. testsuite * gdb.dwarf2/implptr-64bit.exp: Run tests with two CUs as well. (test): Add "two_cu" argument. * gdb.dwarf2/implptr-64bit.S: Move subprogram later; use ref_addr for types; allow two CUs.
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2')
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr-64bit.S57
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr-64bit.exp20
2 files changed, 55 insertions, 22 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/implptr-64bit.S b/gdb/testsuite/gdb.dwarf2/implptr-64bit.S
index be8db5c..d0d870a 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr-64bit.S
+++ b/gdb/testsuite/gdb.dwarf2/implptr-64bit.S
@@ -18,11 +18,12 @@ d:
/* Length of Compilation Unit Info */
#if OFFSET_SIZE == 4
# define OFFSET .4byte
- .4byte debug_end - 1f
+# define HEADER_LINE1
+# define HEADER_LINE2(END) .4byte END - 1f
#elif OFFSET_SIZE == 8
# define OFFSET .8byte
- .4byte 0xffffffff
- .8byte debug_end - 1f
+# define HEADER_LINE1 .4byte 0xffffffff
+# define HEADER_LINE2(END) .8byte END - 1f
#else
# error
#endif
@@ -40,6 +41,16 @@ d:
#else
# error
#endif
+
+#if TWO_CU
+# define END1 .Lcu_end_1
+#else
+# define END1 debug_end
+#endif
+
+ HEADER_LINE1
+ HEADER_LINE2(END1)
+
1:
.2byte DWARF_VERSION /* DWARF version number */
OFFSET .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
@@ -68,13 +79,6 @@ d:
.byte 0x0 /* end of children of DW_TAG_structure_type */
- .uleb128 6 /* Abbrev: DW_TAG_subprogram */
- .ascii "main\0" /* DW_AT_name */
- ADDR main /* DW_AT_low_pc */
- ADDR main + 0x100 /* DW_AT_high_pc */
- .4byte .Ltype_int - d /* DW_AT_type */
- .byte 1 /* DW_AT_external */
-
.Ltype_structptr:
.uleb128 0x5 /* DW_TAG_pointer_type */
.byte ADDR_SIZE /* DW_AT_byte_size */
@@ -90,7 +94,32 @@ d:
3:
.byte 1, 1, 1, 1
2:
- .4byte .Ltype_struct - d /* DW_AT_type */
+ REF_ADDR .Ltype_struct - d /* DW_AT_type */
+
+#if TWO_CU
+ .byte 0x0 /* end of children of CU */
+.Lcu_end_1:
+
+ HEADER_LINE1
+ HEADER_LINE2 (debug_end)
+
+1:
+ .2byte DWARF_VERSION /* DWARF version number */
+ OFFSET .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte ADDR_SIZE /* Pointer Size (in bytes) */
+
+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */
+ .ascii "GNU C 4.4.3\0" /* DW_AT_producer */
+ .byte 0x1 /* DW_AT_language */
+ .ascii "1.c\0" /* DW_AT_name */
+#endif
+
+ .uleb128 6 /* Abbrev: DW_TAG_subprogram */
+ .ascii "main\0" /* DW_AT_name */
+ ADDR main /* DW_AT_low_pc */
+ ADDR main + 0x100 /* DW_AT_high_pc */
+ REF_ADDR .Ltype_int - d /* DW_AT_type */
+ .byte 1 /* DW_AT_external */
.uleb128 0x4 /* (DW_TAG_variable) */
.ascii "p\0" /* DW_AT_name */
@@ -100,7 +129,7 @@ d:
REF_ADDR .Lvar_out - d /* referenced DIE */
.sleb128 0 /* offset */
2:
- .4byte .Ltype_structptr - d /* DW_AT_type */
+ REF_ADDR .Ltype_structptr - d /* DW_AT_type */
.byte 0x0 /* end of children of main */
@@ -152,7 +181,7 @@ debug_end:
.uleb128 0x02 /* (DW_AT_location) */
.uleb128 0xa /* (DW_FORM_block1) */
.uleb128 0x49 /* (DW_AT_type) */
- .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x10 /* (DW_FORM_ref_addr) */
.byte 0x0
.byte 0x0
@@ -176,7 +205,7 @@ debug_end:
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x49 /* DW_AT_type */
- .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x10 /* DW_FORM_ref_addr */
.uleb128 0x3f /* DW_AT_external */
.uleb128 0xc /* DW_FORM_flag */
.byte 0x0 /* Terminator */
diff --git a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
index 78f1594..066cf78 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr-64bit.exp
@@ -22,16 +22,16 @@ if {![dwarf2_support]} {
standard_testfile .S
set mainfile main.c
-proc test { dwarf_version offset_size addr_size ref_addr_size } {
+proc test { dwarf_version offset_size addr_size ref_addr_size two_cu } {
global testfile srcfile mainfile
# 32-bit targets do not support any of the testcases; keep quiet there.
set opts {quiet}
- foreach n { dwarf_version offset_size addr_size ref_addr_size } {
+ foreach n { dwarf_version offset_size addr_size ref_addr_size two_cu } {
lappend opts "additional_flags=-D[string toupper $n]=[expr "\$$n"]"
}
- set name "d${dwarf_version}o${offset_size}a${addr_size}r${ref_addr_size}"
+ set name "d${dwarf_version}o${offset_size}a${addr_size}r${ref_addr_size}t${two_cu}"
set executable ${testfile}-${name}
if [prepare_for_testing ${testfile}.exp $executable "${srcfile} ${mainfile}" $opts] {
return -1
@@ -44,8 +44,12 @@ proc test { dwarf_version offset_size addr_size ref_addr_size } {
gdb_test "p/x p->f" " = 0x1010101" $name
}
-# DWARF_VERSION OFFSET_SIZE ADDR_SIZE REF_ADDR_SIZE
-test 2 8 4 4
-test 2 4 8 8
-test 3 8 4 8
-test 3 4 8 4
+# DWARF_VERSION OFFSET_SIZE ADDR_SIZE REF_ADDR_SIZE TWO_CU
+test 2 8 4 4 0
+test 2 4 8 8 0
+test 3 8 4 8 0
+test 3 4 8 4 0
+test 2 8 4 4 1
+test 2 4 8 8 1
+test 3 8 4 8 1
+test 3 4 8 4 1