[gdb/testsuite] Remove superfluous 3rd argument from gdb_test call

There's a pattern:
...
gdb_test <command> <pattern> <command>
...
that can be written shorter as:
...
gdb_test <command> <pattern>
...

Detect this pattern in proc gdb_test:
...
     global gdb_prompt
     upvar timeout timeout

     if [llength $args]>2 then {
 	set message [lindex $args 2]
+	if { $message == [lindex $args 0] } {
+	    error "HERE"
+	}
     } else {
 	set message [lindex $args 0]
     }
...
and fix all occurences in gdb.ada.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-10-31  Tom de Vries  <tdevries@suse.de>

	* gdb.ada/array_bounds.exp: Drop superfluous 3rd argument to gdb_test.
	* gdb.ada/array_subscript_addr.exp: Same.
	* gdb.ada/arrayidx.exp: Same.
	* gdb.ada/arrayparam.exp: Same.
	* gdb.ada/arrayptr.exp: Same.
	* gdb.ada/boolean_expr.exp: Same.
	* gdb.ada/call_pn.exp: Same.
	* gdb.ada/complete.exp: Same.
	* gdb.ada/fixed_cmp.exp: Same.
	* gdb.ada/fun_addr.exp: Same.
	* gdb.ada/funcall_param.exp: Same.
	* gdb.ada/interface.exp: Same.
	* gdb.ada/mod_from_name.exp: Same.
	* gdb.ada/null_array.exp: Same.
	* gdb.ada/packed_array.exp: Same.
	* gdb.ada/packed_tagged.exp: Same.
	* gdb.ada/print_chars.exp: Same.
	* gdb.ada/print_pc.exp: Same.
	* gdb.ada/ptype_arith_binop.exp: Same.
	* gdb.ada/ptype_field.exp: Same.
	* gdb.ada/ptype_tagged_param.exp: Same.
	* gdb.ada/rec_return.exp: Same.
	* gdb.ada/ref_tick_size.exp: Same.
	* gdb.ada/str_ref_cmp.exp: Same.
	* gdb.ada/taft_type.exp: Same.
	* gdb.ada/tagged.exp: Same.
	* gdb.ada/type_coercion.exp: Same.
	* gdb.ada/uninitialized_vars.exp: Same.

Change-Id: Ibb84a41573c7f21295f3fd42da9b96534205c5c4
This commit is contained in:
Tom de Vries
2019-10-31 17:37:02 +01:00
parent e20f9590e7
commit 3d11e68e4b
29 changed files with 89 additions and 144 deletions

View File

@ -1,3 +1,34 @@
2019-10-31 Tom de Vries <tdevries@suse.de>
* gdb.ada/array_bounds.exp: Drop superfluous 3rd argument to gdb_test.
* gdb.ada/array_subscript_addr.exp: Same.
* gdb.ada/arrayidx.exp: Same.
* gdb.ada/arrayparam.exp: Same.
* gdb.ada/arrayptr.exp: Same.
* gdb.ada/boolean_expr.exp: Same.
* gdb.ada/call_pn.exp: Same.
* gdb.ada/complete.exp: Same.
* gdb.ada/fixed_cmp.exp: Same.
* gdb.ada/fun_addr.exp: Same.
* gdb.ada/funcall_param.exp: Same.
* gdb.ada/interface.exp: Same.
* gdb.ada/mod_from_name.exp: Same.
* gdb.ada/null_array.exp: Same.
* gdb.ada/packed_array.exp: Same.
* gdb.ada/packed_tagged.exp: Same.
* gdb.ada/print_chars.exp: Same.
* gdb.ada/print_pc.exp: Same.
* gdb.ada/ptype_arith_binop.exp: Same.
* gdb.ada/ptype_field.exp: Same.
* gdb.ada/ptype_tagged_param.exp: Same.
* gdb.ada/rec_return.exp: Same.
* gdb.ada/ref_tick_size.exp: Same.
* gdb.ada/str_ref_cmp.exp: Same.
* gdb.ada/taft_type.exp: Same.
* gdb.ada/tagged.exp: Same.
* gdb.ada/type_coercion.exp: Same.
* gdb.ada/uninitialized_vars.exp: Same.
2019-10-30 Tom de Vries <tdevries@suse.de> 2019-10-30 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (gdb_test_multiple): Handle -early pattern flag. * lib/gdb.exp (gdb_test_multiple): Handle -early pattern flag.

View File

@ -30,18 +30,13 @@ if ![runto "bar.adb:$bp_location" ] then {
} }
gdb_test "print itable'first" \ gdb_test "print itable'first" \
"= 2" \ "= 2"
"print itable'first"
gdb_test "print itable'last" \ gdb_test "print itable'last" \
"= 5" \ "= 5"
"print itable'last"
gdb_test "print table'first" \ gdb_test "print table'first" \
"= zero" \ "= zero"
"print table'first"
gdb_test "print table'last" \ gdb_test "print table'last" \
"= two" \ "= two"
"print table'last"

View File

@ -29,6 +29,4 @@ runto "p.adb:$bp_location"
# Verify that we can compare a string slice with another string. # Verify that we can compare a string slice with another string.
gdb_test "print a(2)'Address" \ gdb_test "print a(2)'Address" \
"= \\(system\\.address\\) 0x\[0-9a-fA-F\]+" \ "= \\(system\\.address\\) 0x\[0-9a-fA-F\]+"
"print a(2)'Address"

View File

@ -90,44 +90,34 @@ if $old_gcc {
setup_xfail "*-*-*" setup_xfail "*-*-*"
} }
gdb_test "print one_two_three" \ gdb_test "print one_two_three" \
"= \\(1 => 1, 2 => 2, 3 => 3\\)" \ "= \\(1 => 1, 2 => 2, 3 => 3\\)"
"print one_two_three"
gdb_test "print e_one_two_three" \ gdb_test "print e_one_two_three" \
"= \\(one => 1, two => 2, three => 3\\)" \ "= \\(one => 1, two => 2, three => 3\\)"
"print e_one_two_three"
gdb_test "print r_two_three" \ gdb_test "print r_two_three" \
"= \\(two => 2, three => 3\\)" \ "= \\(two => 2, three => 3\\)"
"print r_two_three"
gdb_test "print u_one_two_three" \ gdb_test "print u_one_two_three" \
"= \\(1 => 1, 2 => 2, 3 => 3\\)" \ "= \\(1 => 1, 2 => 2, 3 => 3\\)"
"print u_one_two_three"
gdb_test "print p_one_two_three" \ gdb_test "print p_one_two_three" \
"= \\(one => false, two => true, three => true\\)" \ "= \\(one => false, two => true, three => true\\)"
"print p_one_two_three"
if $old_gcc { if $old_gcc {
setup_xfail "*-*-*" setup_xfail "*-*-*"
} }
gdb_test "print few_reps" \ gdb_test "print few_reps" \
"= \\(1 => 1, 2 => 2, 3 => 3, 4 => 3, 5 => 3, 6 => 3, 7 => 3, 8 => 4, 9 => 5\\)" \ "= \\(1 => 1, 2 => 2, 3 => 3, 4 => 3, 5 => 3, 6 => 3, 7 => 3, 8 => 4, 9 => 5\\)"
"print few_reps"
if $old_gcc { if $old_gcc {
setup_xfail "*-*-*" setup_xfail "*-*-*"
} }
gdb_test "print many_reps" \ gdb_test "print many_reps" \
"= \\(1 => 1, 2 => 2, 3 => 3 <repeats 12 times>, 15 => 4, 16 => 5\\)" \ "= \\(1 => 1, 2 => 2, 3 => 3 <repeats 12 times>, 15 => 4, 16 => 5\\)"
"print many_reps"
if $old_gcc { if $old_gcc {
setup_xfail "*-*-*" setup_xfail "*-*-*"
} }
gdb_test "print empty" \ gdb_test "print empty" \
"= \\(\\)" \ "= \\(\\)"
"print empty"

View File

@ -30,8 +30,7 @@ runto "foo.adb:$bp_location"
# works without problem. # works without problem.
gdb_test "print call_me (\"bonjour\")" \ gdb_test "print call_me (\"bonjour\")" \
"= void" \ "= void"
"print call_me (\"bonjour\")"
# Verify that the array was passed properly by checking the global # Verify that the array was passed properly by checking the global
# variables that Call_Me sets as side-effects. Use the package name to avoid # variables that Call_Me sets as side-effects. Use the package name to avoid

View File

@ -30,8 +30,7 @@ if ![runto "foo.adb:$bp_location" ] then {
} }
gdb_test "print string_p" \ gdb_test "print string_p" \
"= \\(foo\\.string_access\\) 0x\[0-9a-zA-Z\]+" \ "= \\(foo\\.string_access\\) 0x\[0-9a-zA-Z\]+"
"print string_p"
gdb_test "print string_p (3..4)" "= \"ll\"" gdb_test "print string_p (3..4)" "= \"ll\""

View File

@ -28,10 +28,7 @@ gdb_test_no_output "set lang ada" \
"changing the language to ada" "changing the language to ada"
gdb_test "print 1 = 2" \ gdb_test "print 1 = 2" \
"= false" \ "= false"
"print 1 = 2"
gdb_test "print 3 = 3" \ gdb_test "print 3 = 3" \
"= true" \ "= true"
"print 3 = 3"

View File

@ -35,7 +35,7 @@ gdb_test "print last_node_id" "= 0" "print last_node_id before calling pn"
# Now, call procedure Pn, which should set Last_Node_Id to the value # Now, call procedure Pn, which should set Last_Node_Id to the value
# of the parameter used in the function call. Verify that we can print # of the parameter used in the function call. Verify that we can print
# the returned value correctly, while we're at it. # the returned value correctly, while we're at it.
gdb_test "print pn (4321)" "= 4321" "print pn (4321)" gdb_test "print pn (4321)" "= 4321"
# Make sure that last_node_id now has the correct value... # Make sure that last_node_id now has the correct value...
gdb_test "print last_node_id" "= 4321" "print last_node_id after calling pn" gdb_test "print last_node_id" "= 4321" "print last_node_id after calling pn"

View File

@ -33,8 +33,7 @@ set eol "\[\r\n\]*"
proc test_gdb_complete { expr expected_output } { proc test_gdb_complete { expr expected_output } {
gdb_test "complete p $expr" \ gdb_test "complete p $expr" \
"$expected_output" \ "$expected_output"
"complete p $expr"
} }
# A convenience function that verifies that the "complete EXPR" command # A convenience function that verifies that the "complete EXPR" command

View File

@ -27,20 +27,15 @@ set bp_location [gdb_get_line_number "STOP" ${testdir}/fixed.adb]
runto "fixed.adb:$bp_location" runto "fixed.adb:$bp_location"
gdb_test "print My_Var > 10.0" \ gdb_test "print My_Var > 10.0" \
"= true" \ "= true"
"print My_Var > 10.0"
gdb_test "print My_Var > 20.0" \ gdb_test "print My_Var > 20.0" \
"= false" \ "= false"
"print My_Var > 20.0"
# Do the same, but with integer values. # Do the same, but with integer values.
gdb_test "print My_Var > 10" \ gdb_test "print My_Var > 10" \
"= true" \ "= true"
"print My_Var > 10"
gdb_test "print My_Var > 20" \ gdb_test "print My_Var > 20" \
"= false" \ "= false"
"print My_Var > 20"

View File

@ -27,7 +27,4 @@ clean_restart ${testfile}
# the inferior is *not* running (no frame). # the inferior is *not* running (no frame).
gdb_test "print foo'address" \ gdb_test "print foo'address" \
"= .* 0x\[0-9a-zA-Z\]+ <foo>" \ "= .* 0x\[0-9a-zA-Z\]+ <foo>"
"print foo'address"

View File

@ -30,6 +30,4 @@ runto "foo.adb:$bp_location"
# class-wide. # class-wide.
gdb_test "p ident (ident (my_parameter))" \ gdb_test "p ident (ident (my_parameter))" \
"= \\(one => 1, two => 2, three => 3\\)" \ "= \\(one => 1, two => 2, three => 3\\)"
"p ident (ident (my_parameter))"

View File

@ -27,11 +27,7 @@ set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
runto "foo.adb:$bp_location" runto "foo.adb:$bp_location"
gdb_test "print r" \ gdb_test "print r" \
"= \\(x => 1, y => 2, w => 3, h => 4\\)" \ "= \\(x => 1, y => 2, w => 3, h => 4\\)"
"print r"
gdb_test "print s" \ gdb_test "print s" \
"= \\(x => 1, y => 2, w => 3, h => 4\\)" \ "= \\(x => 1, y => 2, w => 3, h => 4\\)"
"print s"

View File

@ -30,7 +30,4 @@ if ![runto "foo.adb:$bp_location" ] then {
} }
gdb_test "print xp" \ gdb_test "print xp" \
"= \\(y => \\(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10\\)\\)" \ "= \\(y => \\(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10\\)\\)"
"print xp"

View File

@ -36,13 +36,10 @@ if {[test_compiler_info {gcc-[0-3]-*}]
setup_xfail *-*-* setup_xfail *-*-*
} }
gdb_test "print my_table" \ gdb_test "print my_table" \
"= \\(\\)" \ "= \\(\\)"
"print my_table"
gdb_test "ptype my_table" \ gdb_test "ptype my_table" \
"type = array \\(10 \\.\\. 1\\) of integer" \ "type = array \\(10 \\.\\. 1\\) of integer"
"ptype my_table"
gdb_test "print my_matrix" \ gdb_test "print my_matrix" \
"= \\(m => \\((\"\", ){9}\"\"\\)\\)" \ "= \\(m => \\((\"\", ){9}\"\"\\)\\)"
"print my_matrix"

View File

@ -29,19 +29,16 @@ set bp_location [gdb_get_line_number "STOP" ${testdir}/pa.adb]
runto "pa.adb:$bp_location" runto "pa.adb:$bp_location"
gdb_test "print var" \ gdb_test "print var" \
"= \\(4 => true, false, true, false, true\\)" \ "= \\(4 => true, false, true, false, true\\)"
"print var"
# Try printing the value and the type definition of a reference # Try printing the value and the type definition of a reference
# to variable "Var". # to variable "Var".
gdb_test "ptype &var" \ gdb_test "ptype &var" \
"type = access array \\(4 \\.\\. 8\\) of boolean <packed: 1-bit elements>" \ "type = access array \\(4 \\.\\. 8\\) of boolean <packed: 1-bit elements>"
"ptype &var"
gdb_test "print &var" \ gdb_test "print &var" \
"= \\(access pa.packed_array\\) 0x.*" \ "= \\(access pa.packed_array\\) 0x.*"
"print &var"
# Print the value of U_Var, an unconstrainted packed array. # Print the value of U_Var, an unconstrainted packed array.

View File

@ -27,8 +27,7 @@ set bp_location [gdb_get_line_number "STOP" ${testdir}/comp_bug.adb]
runto "comp_bug.adb:$bp_location" runto "comp_bug.adb:$bp_location"
gdb_test "print x" \ gdb_test "print x" \
"= \\(exists => true, value => 10\\)" \ "= \\(exists => true, value => 10\\)"
"print x"
gdb_test "ptype x" \ gdb_test "ptype x" \
[multi_line "type = record" \ [multi_line "type = record" \
@ -38,6 +37,4 @@ gdb_test "ptype x" \
" value: range 0 \\.\\. 255;" \ " value: range 0 \\.\\. 255;" \
" when others => null;" \ " when others => null;" \
" end case;" \ " end case;" \
"end record" ] \ "end record" ]
"ptype x"

View File

@ -28,15 +28,12 @@ runto "foo.adb:$bp_location"
gdb_test "print C" \ gdb_test "print C" \
"= 97 'a'" \ "= 97 'a'"
"print C"
gdb_test "print WC" \ gdb_test "print WC" \
"= 98 'b'" \ "= 98 'b'"
"print WC"
gdb_test "print WWC" \ gdb_test "print WWC" \
"= 99 'c'" \ "= 99 'c'"
"print WWC"
gdb_test "print MC" " = 77 'M'" gdb_test "print MC" " = 77 'M'"

View File

@ -27,5 +27,4 @@ set bp_location [gdb_get_line_number "START" ${testdir}/dummy.adb]
runto "dummy.adb:$bp_location" runto "dummy.adb:$bp_location"
gdb_test "p /x \$pc" \ gdb_test "p /x \$pc" \
"= 0x\[0-9a-zA-Z\]+" \ "= 0x\[0-9a-zA-Z\]+"
"p /x \$pc"

View File

@ -21,11 +21,7 @@ gdb_test_no_output "set lang ada" \
"set lang ada" "set lang ada"
gdb_test "ptype 3 * 2.0" \ gdb_test "ptype 3 * 2.0" \
"= <\[0-9\]+-byte float>" \ "= <\[0-9\]+-byte float>"
"ptype 3 * 2.0"
gdb_test "ptype 3 / 2.0" \ gdb_test "ptype 3 / 2.0" \
"= <\[0-9\]+-byte float>" \ "= <\[0-9\]+-byte float>"
"ptype 3 / 2.0"

View File

@ -30,19 +30,13 @@ gdb_test "ptype circle" \
[multi_line "type = record" \ [multi_line "type = record" \
" pos: pck\\.position;" \ " pos: pck\\.position;" \
" radius: integer;" \ " radius: integer;" \
"end record" ] \ "end record" ]
"ptype circle"
gdb_test "ptype circle.pos" \ gdb_test "ptype circle.pos" \
[multi_line "type = record" \ [multi_line "type = record" \
" x: integer;" \ " x: integer;" \
" y: integer;" \ " y: integer;" \
"end record" ] \ "end record" ]
"ptype circle.pos"
gdb_test "ptype circle.pos.x" \ gdb_test "ptype circle.pos.x" \
"type = <\[0-9\]+-byte integer>" \ "type = <\[0-9\]+-byte integer>"
"ptype circle.pos.x"

View File

@ -31,6 +31,4 @@ set eol "\[\r\n\]+"
set sp "\[ \t\]*" set sp "\[ \t\]*"
gdb_test "ptype s" \ gdb_test "ptype s" \
"type = <ref> new pck.shape with record${eol}${sp}r: integer;${eol}end record" \ "type = <ref> new pck.shape with record${eol}${sp}r: integer;${eol}end record"
"ptype s"

View File

@ -30,6 +30,4 @@ if ![runto "foo.adb:$bp_location" ] then {
} }
gdb_test "print bar" \ gdb_test "print bar" \
"= \\(x => 42, s => \"ABCDEFGH\"\\)" \ "= \\(x => 42, s => \"ABCDEFGH\"\\)"
"print bar"

View File

@ -32,6 +32,4 @@ runto "p.adb:$bp_location"
# the size of d1. # the size of d1.
gdb_test "print d1'size = d2'size" \ gdb_test "print d1'size = d2'size" \
"= true" \ "= true"
"print d1'size = d2'size"

View File

@ -42,10 +42,7 @@ gdb_test_multiple {print "a" = "a"} $test {
# Verify that we can compare a string slice with another string. # Verify that we can compare a string slice with another string.
gdb_test "print String_Var (1 .. 3) = \"Hel\"" \ gdb_test "print String_Var (1 .. 3) = \"Hel\"" \
"= true" \ "= true"
"print String_Var (1 .. 3) = \"Hel\""
gdb_test "print String_Var (1 .. 3) = \"hel\"" \ gdb_test "print String_Var (1 .. 3) = \"hel\"" \
"= false" \ "= false"
"print String_Var (1 .. 3) = \"hel\""

View File

@ -30,6 +30,4 @@ if ![runto "p.adb:$bp_location" ] then {
} }
gdb_test "print w.e.all" \ gdb_test "print w.e.all" \
"= \\(month => 8, year => 1974\\)" \ "= \\(month => 8, year => 1974\\)"
"print w.e.all"

View File

@ -32,23 +32,17 @@ runto "foo.adb:$bp_location"
gdb_test "ptype segm" \ gdb_test "ptype segm" \
[multi_line "type = new pck\\.object with record" \ [multi_line "type = new pck\\.object with record" \
" width: integer;" \ " width: integer;" \
"end record" ] \ "end record" ]
"ptype segm"
gdb_test "print segm" \ gdb_test "print segm" \
"= \\(position => 74, width => 8\\)" \ "= \\(position => 74, width => 8\\)"
"print segm"
# Now, test printing of an class-wide object. # Now, test printing of an class-wide object.
gdb_test "ptype obj" \ gdb_test "ptype obj" \
[multi_line "type = new pck\\.object with record" \ [multi_line "type = new pck\\.object with record" \
" width: integer;" \ " width: integer;" \
"end record" ] \ "end record" ]
"ptype obj"
gdb_test "print obj" \ gdb_test "print obj" \
"= \\(position => 74, width => 8\\)" \ "= \\(position => 74, width => 8\\)"
"print obj"

View File

@ -27,8 +27,7 @@ set bp_location [gdb_get_line_number "START" ${testdir}/assign.adb]
runto "assign.adb:$bp_location" runto "assign.adb:$bp_location"
gdb_test "p q" \ gdb_test "p q" \
"= \\(2, 3, 5, 7, 11\\)" \ "= \\(2, 3, 5, 7, 11\\)"
"p q"
gdb_test_no_output "set \$addr := q'address" \ gdb_test_no_output "set \$addr := q'address" \
"save q'address in convenience variable" "save q'address in convenience variable"
@ -43,8 +42,4 @@ gdb_test_no_output "set {Integer} \$addr := 19" \
"set {Integer} \$addr := 19" "set {Integer} \$addr := 19"
gdb_test "p q" \ gdb_test "p q" \
"= \\(19, 3, 5, 7, 11\\)" \ "= \\(19, 3, 5, 7, 11\\)"
"p q"

View File

@ -33,5 +33,4 @@ runto "parse.adb:$bp_location"
# Check that printing uninitialized variables does not crash the debugger. # Check that printing uninitialized variables does not crash the debugger.
gdb_test "info locals" \ gdb_test "info locals" \
".*" \ ".*"
"info locals"