aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dwarf2
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2015-10-28 11:36:06 -0700
committerKevin Buettner <kevinb@redhat.com>2015-11-05 15:22:51 -0700
commit2223449a47a8908db2a1992379f54294128a7ee4 (patch)
treefbad66c4188b834d57bcd20af8cff505973c8e31 /gdb/testsuite/gdb.dwarf2
parent96f9814df23564e16909bb5ba00de4a202c63417 (diff)
downloadgdb-2223449a47a8908db2a1992379f54294128a7ee4.zip
gdb-2223449a47a8908db2a1992379f54294128a7ee4.tar.gz
gdb-2223449a47a8908db2a1992379f54294128a7ee4.tar.bz2
gdb.dwarf2: Define and use gdb_target_symbol for symbol prefixes
Some of the tests in gdb.dwarf2 which use Dwarf::assemble refer to (minimal/linker) symbols created in the course of building a small test program. Some targets use a prefix such as underscore ("_") on these symbols. Many of the tests in gdb.dwarf2 do not take this into account. As a consequence, these tests fail to build, resulting either in failures or untested testcases. Here is an example from gdb.dwarf2/dw2-regno-invalid.exp: Dwarf::assemble $asm_file { cu {} { compile_unit { {low_pc main DW_FORM_addr} {high_pc main+0x10000 DW_FORM_addr} } { ... } For targets which require an underscore prefix on linker symbols, the two occurrences of "main" would have to have a prepended underscore, i.e. _main instead of main. For the above case, a call to the new proc gdb_target_symbol is used prepend the correct prefix to the symbol. I.e. the above code is rewritten (as shown in the patch) as follows: Dwarf::assemble $asm_file { cu {} { compile_unit { {low_pc [gdb_target_symbol main] DW_FORM_addr} {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr} } { ... } I also found it necessary to make an adjustment to lib/dwarf.exp so that expressions of more than just one list element can be used in DW_TAG_... constructs. Both atomic-type.exp and dw2-bad-mips-linkage-name.exp require this new functionality. gdb/testsuite/ChangeLog: * lib/gdb.exp (gdb_target_symbol_prefix, gdb_target_symbol): New procs. * lib/dwarf.exp (_handle_DW_TAG): Handle attribute values, representing expressions, of more than one list element. * gdb.dwarf2/atomic-type.exp (Dwarf::assemble): Use gdb_target_symbol to prepend linker symbol prefix to f. * gdb.dwarf2/data-loc.exp (Dwarf::assemble): Likewise, for table_1 and table_2. * gdb.dwarf2/dw2-bad-mips-linkage-name.exp (Dwarf::assemble): Likewise, for f and g. * gdb.dwarf2/dw2-ifort-parameter.exp (Dwarf::assemble): Likewise, for ptr. * gdb.dwarf2/dw2-regno-invalid.exp (Dwarf::assemble): Likewise, for main. * gdb.dwarf2/dynarr-ptr.exp (Dwarf::assemble): Likewise, for table_1_ptr and table_2_ptr.
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2')
-rw-r--r--gdb/testsuite/gdb.dwarf2/atomic-type.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/data-loc.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp4
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp2
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp8
-rw-r--r--gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp8
6 files changed, 16 insertions, 16 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/atomic-type.exp b/gdb/testsuite/gdb.dwarf2/atomic-type.exp
index fb315e3..e2a3447 100644
--- a/gdb/testsuite/gdb.dwarf2/atomic-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/atomic-type.exp
@@ -68,7 +68,7 @@ Dwarf::assemble $asm_file {
DW_TAG_subprogram {
{name f}
- {low_pc f addr}
+ {low_pc [gdb_target_symbol f] addr}
{high_pc f_end_lbl addr}
{type :$i_l}
} {
diff --git a/gdb/testsuite/gdb.dwarf2/data-loc.exp b/gdb/testsuite/gdb.dwarf2/data-loc.exp
index e9e702c..a1fb772 100644
--- a/gdb/testsuite/gdb.dwarf2/data-loc.exp
+++ b/gdb/testsuite/gdb.dwarf2/data-loc.exp
@@ -84,7 +84,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__three}
{DW_AT_type :$array_label}
{DW_AT_location {
- DW_OP_addr table_1
+ DW_OP_addr [gdb_target_symbol table_1]
} SPECIAL_expr}
{external 1 flag}
}
@@ -92,7 +92,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__three_tdef}
{DW_AT_type :$array_ptr_label}
{DW_AT_location {
- DW_OP_addr table_1
+ DW_OP_addr [gdb_target_symbol table_1]
} SPECIAL_expr}
{external 1 flag}
}
@@ -100,7 +100,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__five}
{DW_AT_type :$array_label}
{DW_AT_location {
- DW_OP_addr table_2
+ DW_OP_addr [gdb_target_symbol table_2]
} SPECIAL_expr}
{external 1 flag}
}
@@ -108,7 +108,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__five_tdef}
{DW_AT_type :$array_ptr_label}
{DW_AT_location {
- DW_OP_addr table_2
+ DW_OP_addr [gdb_target_symbol table_2]
} SPECIAL_expr}
{external 1 flag}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
index 77f6175..dfb9567 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-mips-linkage-name.exp
@@ -42,14 +42,14 @@ Dwarf::assemble $asm_file {
}
DW_TAG_subprogram {
{name f}
- {low_pc f addr}
+ {low_pc [gdb_target_symbol f] addr}
{high_pc f_end_lbl addr}
{type :$b_l}
{DW_AT_MIPS_linkage_name _Z1fv}
}
DW_TAG_subprogram {
{name g}
- {low_pc g addr}
+ {low_pc [gdb_target_symbol g] addr}
{high_pc g_end_lbl addr}
{type :$b_l}
{DW_AT_MIPS_linkage_name 42 DW_FORM_data1}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
index c71103d3..4f07b50 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.exp
@@ -53,7 +53,7 @@ Dwarf::assemble $asm_file {
{variable_parameter 1 flag}
{type :$int_label}
{location {
- addr ptr
+ addr [gdb_target_symbol ptr]
deref
} SPECIAL_expr}
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp b/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
index a7d77c5..53897bd 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
@@ -29,8 +29,8 @@ set asm_file [standard_output_file $srcfile]
Dwarf::assemble $asm_file {
cu {} {
compile_unit {
- {low_pc main DW_FORM_addr}
- {high_pc main+0x10000 DW_FORM_addr}
+ {low_pc [gdb_target_symbol main] DW_FORM_addr}
+ {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
} {
declare_labels integer_label
@@ -43,8 +43,8 @@ Dwarf::assemble $asm_file {
DW_TAG_subprogram {
{name main}
{DW_AT_external 1 flag}
- {low_pc main DW_FORM_addr}
- {high_pc main+0x10000 DW_FORM_addr}
+ {low_pc [gdb_target_symbol main] DW_FORM_addr}
+ {high_pc [gdb_target_symbol main]+0x10000 DW_FORM_addr}
} {
DW_TAG_variable {
{DW_AT_name bregx}
diff --git a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
index 3dcb3d7..0a612fe 100644
--- a/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dynarr-ptr.exp
@@ -85,7 +85,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__three_ptr}
{DW_AT_type :$array_ptr_label}
{DW_AT_location {
- DW_OP_addr table_1_ptr
+ DW_OP_addr [gdb_target_symbol table_1_ptr]
} SPECIAL_expr}
{external 1 flag}
}
@@ -93,7 +93,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__three_ptr_tdef}
{DW_AT_type :$array_typedef_label}
{DW_AT_location {
- DW_OP_addr table_1_ptr
+ DW_OP_addr [gdb_target_symbol table_1_ptr]
} SPECIAL_expr}
{external 1 flag}
}
@@ -101,7 +101,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__five_ptr}
{DW_AT_type :$array_ptr_label}
{DW_AT_location {
- DW_OP_addr table_2_ptr
+ DW_OP_addr [gdb_target_symbol table_2_ptr]
} SPECIAL_expr}
{external 1 flag}
}
@@ -109,7 +109,7 @@ Dwarf::assemble $asm_file {
{DW_AT_name foo__five_ptr_tdef}
{DW_AT_type :$array_typedef_label}
{DW_AT_location {
- DW_OP_addr table_2_ptr
+ DW_OP_addr [gdb_target_symbol table_2_ptr]
} SPECIAL_expr}
{external 1 flag}
}