aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2020-05-12 09:47:15 +0200
committerTom de Vries <tdevries@suse.de>2020-05-12 09:47:15 +0200
commit111b33f0b8d4872296bb0173bb82b0c5ddb9785d (patch)
tree3c0990e16c598f860efdb56bf7d72e63260f63ad /gdb/testsuite
parentebf470809eba7c34713a2ea95e73e794582bcbd4 (diff)
downloadfsf-binutils-gdb-111b33f0b8d4872296bb0173bb82b0c5ddb9785d.zip
fsf-binutils-gdb-111b33f0b8d4872296bb0173bb82b0c5ddb9785d.tar.gz
fsf-binutils-gdb-111b33f0b8d4872296bb0173bb82b0c5ddb9785d.tar.bz2
[gdb/testsuite] Fix duplicate test-names in gdb.dwarf2
We currently have these duplicate test-names in gdb.dwarf2: ... $ grep ^DUPLICATE: gdb.sum DUPLICATE: gdb.dwarf2/comp-unit-lang.exp: show language DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (int)" DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (void *)" DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (int)" DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (int)" DUPLICATE: gdb.dwarf2/data-loc.exp: ptype foo.array_type DUPLICATE: gdb.dwarf2/varval.exp: get integer valueof "sizeof (int)" DUPLICATE: gdb.dwarf2/varval.exp: get integer valueof "sizeof (void *)" DUPLICATE: gdb.dwarf2/implref-struct.exp: print-object=off: \ set print object off DUPLICATE: gdb.dwarf2/implref-struct.exp: print-object=on: \ set print object on DUPLICATE: gdb.dwarf2/dw2-bad-parameter-type.exp: ptype f ... Fix as appropriate. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-05-12 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/comp-unit-lang.exp: Use with_test_prefix. * gdb.dwarf2/dw2-bad-parameter-type.exp: Same. * gdb.dwarf2/implref-struct.exp: Same. * gdb.dwarf2/varval.exp: Ensure get_sizeof is called once per type. * gdb.dwarf2/data-loc.exp: Same. Remove duplicate test.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp10
-rw-r--r--gdb/testsuite/gdb.dwarf2/data-loc.exp14
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp9
-rw-r--r--gdb/testsuite/gdb.dwarf2/implref-struct.exp10
-rw-r--r--gdb/testsuite/gdb.dwarf2/varval.exp9
6 files changed, 38 insertions, 22 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2817ebd..53181b6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-05-12 Tom de Vries <tdevries@suse.de>
+
+ * gdb.dwarf2/comp-unit-lang.exp: Use with_test_prefix.
+ * gdb.dwarf2/dw2-bad-parameter-type.exp: Same.
+ * gdb.dwarf2/implref-struct.exp: Same.
+ * gdb.dwarf2/varval.exp: Ensure get_sizeof is called once per type.
+ * gdb.dwarf2/data-loc.exp: Same. Remove duplicate test.
+
2020-05-11 Simon Marchi <simon.marchi@polymtl.ca>
* gdb.base/jit-so.exp (one_jit_test): Change test name.
diff --git a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
index a27678b..8ff6b73 100644
--- a/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
+++ b/gdb/testsuite/gdb.dwarf2/comp-unit-lang.exp
@@ -73,8 +73,14 @@ proc do_test {cu_lang gdb_lang} {
gdb_test "show language" "\"auto; currently $gdb_lang\".*"
}
+proc do_test_with_prefix {cu_lang gdb_lang} {
+ with_test_prefix $gdb_lang {
+ do_test $cu_lang $gdb_lang
+ }
+}
+
# Some paths in the debugger fall back to C. Check C++ as well to
# make sure the test doesn't happen to work because of such a
# fallback.
-do_test DW_LANG_C "c"
-do_test DW_LANG_C_plus_plus "c\\+\\+"
+do_test_with_prefix DW_LANG_C "c"
+do_test_with_prefix DW_LANG_C_plus_plus "c\\+\\+"
diff --git a/gdb/testsuite/gdb.dwarf2/data-loc.exp b/gdb/testsuite/gdb.dwarf2/data-loc.exp
index 5fde074..de21dff 100644
--- a/gdb/testsuite/gdb.dwarf2/data-loc.exp
+++ b/gdb/testsuite/gdb.dwarf2/data-loc.exp
@@ -43,6 +43,7 @@ Dwarf::assemble $asm_file {
} {
declare_labels integer_label array_label array_ptr_label
set int_size [get_sizeof "int" 4]
+ set voidp_size [get_sizeof "void *" 96]
integer_label: DW_TAG_base_type {
{DW_AT_byte_size $int_size DW_FORM_sdata}
@@ -63,16 +64,16 @@ Dwarf::assemble $asm_file {
{DW_AT_type :$integer_label}
{DW_AT_lower_bound {
DW_OP_push_object_address
- DW_OP_plus_uconst [get_sizeof "void *" 96]
+ DW_OP_plus_uconst $voidp_size
DW_OP_deref
- DW_OP_deref_size [get_sizeof "int" 4]
+ DW_OP_deref_size $int_size
} SPECIAL_expr}
{DW_AT_upper_bound {
DW_OP_push_object_address
- DW_OP_plus_uconst [get_sizeof "void *" 96]
+ DW_OP_plus_uconst $voidp_size
DW_OP_deref
- DW_OP_plus_uconst [get_sizeof "int" 4]
- DW_OP_deref_size [get_sizeof "int" 4]
+ DW_OP_plus_uconst $int_size
+ DW_OP_deref_size $int_size
} SPECIAL_expr}
}
}
@@ -226,9 +227,6 @@ gdb_test "print foo.five_tdef" \
gdb_test "ptype foo.five_tdef" \
"type = array \\(2 .. 6\\) of integer"
-gdb_test "ptype foo.array_type" \
- "type = array \\(<>\\) of integer"
-
gdb_test "print foo.five_tdef(2)" \
" = 5"
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
index 8ff08af..8b51de0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.exp
@@ -31,7 +31,10 @@ clean_restart $executable
# The first access (as we do not use -readnow) prints some:
# Dwarf Error: Cannot find DIE at 0x0 referenced from DIE at 0x29 [in module ...]
-gdb_test "ptype f"
-
-gdb_test "ptype f"
+with_test_prefix "first" {
+ gdb_test "ptype f"
+}
+with_test_prefix "second" {
+ gdb_test "ptype f"
+}
gdb_test "p 5" " = 5" "is alive"
diff --git a/gdb/testsuite/gdb.dwarf2/implref-struct.exp b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
index b7f1f16..b00408b 100644
--- a/gdb/testsuite/gdb.dwarf2/implref-struct.exp
+++ b/gdb/testsuite/gdb.dwarf2/implref-struct.exp
@@ -177,9 +177,11 @@ foreach_with_prefix print-object {"off" "on"} {
# Test assignment through the synthetic reference.
gdb_test_no_output "set (ref = s2)"
-foreach_with_prefix print-object {"off" "on"} {
- gdb_test_no_output "set print object ${print-object}"
+with_test_prefix "after assignment" {
+ foreach_with_prefix print-object {"off" "on"} {
+ gdb_test_no_output "set print object ${print-object}"
- gdb_test "print ref" " = \\(S &\\) @${address}: \\{${s2_members}\\}" "print ref after assignment"
- gdb_test "print s1" " = \\{${s2_members}\\}" "print s1 after assignment"
+ gdb_test "print ref" " = \\(S &\\) @${address}: \\{${s2_members}\\}" "print ref"
+ gdb_test "print s1" " = \\{${s2_members}\\}" "print s1"
+ }
}
diff --git a/gdb/testsuite/gdb.dwarf2/varval.exp b/gdb/testsuite/gdb.dwarf2/varval.exp
index 8a05a4e..876725b 100644
--- a/gdb/testsuite/gdb.dwarf2/varval.exp
+++ b/gdb/testsuite/gdb.dwarf2/varval.exp
@@ -38,6 +38,9 @@ set asm_file [standard_output_file ${srcfile2}]
if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
return -1
}
+set int_size [get_sizeof "int" -1]
+# gdb always assumes references are implemented as pointers.
+set addr_size [get_sizeof "void *" -1]
proc setup_exec { arg_bad } {
global asm_file executable srcfile bad
@@ -45,7 +48,7 @@ proc setup_exec { arg_bad } {
# Create the DWARF.
Dwarf::assemble ${asm_file} {
- global srcdir subdir srcfile bad
+ global srcdir subdir srcfile bad int_size addr_size
cu {} {
DW_TAG_compile_unit {
@@ -58,10 +61,6 @@ proc setup_exec { arg_bad } {
varval2_label varval3_def_label varval3_decl_label \
int_array_label int_array_of_1_label
- set int_size [get_sizeof "int" -1]
-
- # gdb always assumes references are implemented as pointers.
- set addr_size [get_sizeof "void *" -1]
int_label: DW_TAG_base_type {
{DW_AT_byte_size ${int_size} DW_FORM_udata}