-# Copyright 1998, 1999, 2000, 2001
+# Copyright 1998, 1999, 2000, 2001, 2004, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
strace $tracelevel
}
-set prms_id 0
-set bug_id 0
set testfile "call-ar-st"
set srcfile ${testfile}.c
}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ untested "couldn't compile ${srcdir}/${subdir}/${srcfile}"
+ return -1
}
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
-# Set the current language to C. This counts as a test. If it
-# fails, then we skip the other tests.
-
-proc set_lang_c {} {
- global gdb_prompt
-
- send_gdb "set language c\n"
- gdb_expect {
- -re ".*$gdb_prompt $" {}
- timeout { fail "set language c (timeout)" ; return 0; }
- }
-
- send_gdb "show language\n"
- gdb_expect {
- -re ".* source language is \"c\".*$gdb_prompt $" {
- pass "set language to \"c\""
- return 1
- }
- -re ".*$gdb_prompt $" {
- fail "setting language to \"c\""
- return 0
- }
- timeout {
- fail "can't show language (timeout)"
- return 0
- }
- }
-}
-
-source ${binfile}.ci
-
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
-send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print address off"
+gdb_test_no_output "set width 0"
if ![runto_main] then {
continue
}
+get_debug_format
+
#go -until 1209
gdb_test "tbreak 1209" \
- "Breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \
+ "Temporary breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \
"tbreakpoint line 1209"
gdb_test continue \
#call print_double_array(double_array)
if {![gdb_skip_float_test "print print_double_array(double_array)"] && \
![gdb_skip_stdio_test "print print_double_array(double_array)"] } {
- send_gdb "print print_double_array(double_array)\n"
- gdb_expect_list "print print_double_array(double_array)" ".*$gdb_prompt $" {
+ gdb_test_sequence "print print_double_array(double_array)" "" {
"\[ \t\r\n\]+array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]"
"\[ \t\r\n\]+"
- }
+ }
}
#call print_char_array(char_array)
if ![gdb_skip_stdio_test "print_char_array(char_array)"] {
- send_gdb "print print_char_array(char_array)\n"
- gdb_expect_list "print print_char_array(char_array)" ".*$gdb_prompt $" {
+ gdb_test_sequence "print print_char_array(char_array)" "" {
"\[ \t\r\n\]+array_c :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+\[ \t\r\n\]+Z"
}
}
-
-
-
#go -until 1216
gdb_test "tbreak 1216" \
-"Breakpoint.*file.*$srcfile, line 1216.*" \
+"Temporary breakpoint.*file.*$srcfile, line 1216.*" \
"tbreakpoint line 1216"
if ![gdb_skip_stdio_test "continue to 1216"] {
- send_gdb "continue\n"
- gdb_expect_list "continue to 1216" ".*$gdb_prompt $" {
+ gdb_test_sequence "continue" "continue to 1216" {
"\[ \t\r\n\]+array_c :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+\[ \t\r\n\]+Z"
"\[ \t\r\n\]+1216.*print_double_array\\(double_array\\)"
}
} else {
- gdb_test "continue" "" ""
+ gdb_test "continue" ".*" ""
}
# I am disabling this test, because it takes too long. I verified by
#set timeout $oldtimeout
#go -until 1220
gdb_test "tbreak 1220" \
- "Breakpoint.* file .*$srcfile, line 1220.*" \
+ "Temporary breakpoint.* file .*$srcfile, line 1220.*" \
"tbreakpoint line 1220"
if {![gdb_skip_float_test "continuing to breakpoint 1220"] && \
![gdb_skip_stdio_test "continuing to breakpoint 1220"] } {
- send_gdb "continue\n"
- gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" {
+ gdb_test_sequence "continue" "continuing to breakpoint 1220" {
"Continuing\\."
"\[ \t\r\n\]+array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*"
"\[ \t\r\n\]+"
- ".*array_f :"
- ".*student id :\[\t \]+.*YELLOW"
- ".*array_i :"
- ".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)."
+ "array_f :"
+ "student id :\[\t \]+.*YELLOW"
+ "array_i :"
+ "main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)."
}
} else {
- gdb_test "continue" "" ""
+ gdb_test "continue" ".*" ""
}
#step
-send_gdb "step\n"
-gdb_expect {
- -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"}
- -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" }
- timeout { fail "step inside print_all_arrays (timeout)" }
-}
-
+gdb_test "step" \
+ "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*" \
+ "step inside print_all_arrays"
#step -over
if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
- send_gdb "next\n"
- gdb_expect {
- -re "array_i :.*307.*print_char_array.*$gdb_prompt $" {
- pass "next over print_int_array in print-all_arrays"
- }
- -re ".*$gdb_prompt $" {
- fail "next over print_int_array in print-all_arrays"
- }
- timeout {
- fail "next over print_int_array in print-all_arrays (timeout)"
- }
- }
+ gdb_test "next" \
+ "array_i :.*307.*print_char_array.*" \
+ "next over print_int_array in print-all_arrays"
} else {
- gdb_test "next" "" ""
+ gdb_test "next" ".*" ""
}
#call print_double_array(array_d)
if {![gdb_skip_float_test "print print_double_array(array_d)"] && \
![gdb_skip_stdio_test "print print_double_array(array_d)"] } {
- send_gdb "print print_double_array(array_d)\n"
- gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" {
+ gdb_test_sequence "print print_double_array(array_d)" "" {
"array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*"
"\[ \t\r\n\]+"
}
}
#go -until 1236
gdb_test "tbreak 1236" \
-"Breakpoint.* file .*$srcfile, line 1236.*" \
+"Temporary breakpoint.* file .*$srcfile, line 1236.*" \
"tbreakpoint line 1236"
if {![gdb_skip_float_test "continuing to 1236"] && \
![gdb_skip_stdio_test "continuing to 1236"] } {
- send_gdb "continue\n"
- gdb_expect_list "continuing to 1236" ".*$gdb_prompt $" {
+ gdb_test_sequence "continue" "continuing to 1236" {
"Continuing\\..*array_c"
- ".*array_f"
+ "array_f"
"\[ \t\r\n\]+array_d :"
"\[ \t\r\n\]+========="
"\[ \t\r\n\]+0.000000"
- "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600"
+ "\[ \t\r\n\]+23.456\[0-9\]* 46.913\[0-9\]* 70.370\[0-9\]* 93.826\[0-9\]* 117.283\[0-9\]* 140.740\[0-9\]* 164.196\[0-9\]* 187.653\[0-9\]*"
"\[ \t\r\n\]+.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)."
}
} else {
- gdb_test "continue" "" ""
+ gdb_test "continue" ".*" ""
}
#call sum_array_print(10, *list1, *list2, *list3, *list4)
if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
- send_gdb "print sum_array_print(10, *list1, *list2, *list3, *list4)\n"
- gdb_expect {
- -re ".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*$gdb_prompt $" {
- pass "print sum_array_print(10, *list1, *list2, *list3, *list4)"
- }
- -re ".*$gdb_prompt $" { fail "print sum_array_print(10, *list1, *list2, *list3, *list4)" }
- timeout { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
- }
+ gdb_test "print sum_array_print(10, *list1, *list2, *list3, *list4)" \
+ ".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*" \
+ "print sum_array_print(10, *list1, *list2, *list3, *list4)"
}
#step over
if ![gdb_skip_stdio_test "next to 1237"] {
- send_gdb "next\n"
- gdb_expect {
- -re ".*BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1237"}
- -re ".*$gdb_prompt $" { fail "next to 1237" }
- timeout { fail "next to 1237(timeout)" }
- }
+ gdb_test "next" \
+ "BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*" \
+ "next to 1237"
} else {
- gdb_test "next" "" ""
+ gdb_test "next" ".*" ""
}
#call print_array_rep(\*list1, \*list2, \*list3)
if ![gdb_skip_stdio_test "print print_array_rep(...)"] {
- send_gdb "print print_array_rep(\*list1, \*list2, \*list3)\n"
- gdb_expect {
- -re ".*$gdb_prompt $" {
- pass "print print_array_rep(*list1, *list2, *list3)"
- }
- -re ".*$gdb_prompt $" {
- fail "print print_array_rep(*list1, *list2, *list3)"
- }
- timeout {
- fail "(timeout) print print_array_rep(*list1, *list2, *list3)"
- }
- }
+ gdb_test "print print_array_rep(\*list1, \*list2, \*list3)" \
+ "Contents of linked list3:.*" \
+ "print print_array_rep(*list1, *list2, *list3)"
}
#go -until 1241
gdb_test "tbreak 1241" \
- "Breakpoint..* file .*$srcfile, line 1241.*" \
+ "Temporary breakpoint..* file .*$srcfile, line 1241.*" \
"tbreakpoint line 1241"
-send_gdb "continue\n"
-gdb_expect {
- -re ".*main \\(\\) at .*call-ar-st.c:1241\r\n1241\[\t \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" {
- pass "continue to 1241"}
- -re ".*$gdb_prompt $" { fail "continue to 1241"}
- timeout { fail "(timeout) continue to 1241"}
-}
-
+gdb_test "continue" \
+ "main \\(\\) at .*call-ar-st.c:1241\r\n1241\[\t \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*" \
+ "continue to 1241"
# Run into sum_array_print, and verify that the arguments were passed
gdb_test "break sum_array_print" \
".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \
"set breakpoint in sum_array_print"
+gdb_test_no_output "set print frame-arguments all"
gdb_test "continue" \
".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:1105\[ \t\n\r\]+1105.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \
"check args of sum_array_print"
#go -until 1281
gdb_test "tbreak 1281" \
- "Breakpoint.* file .*call-ar-st.c, line 1281.*" \
+ "Temporary breakpoint.* file .*call-ar-st.c, line 1281.*" \
"tbreakpoint line 1281"
if ![gdb_skip_stdio_test "continuing to 1281"] {
- send_gdb "continue\n"
- gdb_expect {
- -re "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*$gdb_prompt $" {
- pass "continue to 1281"
- }
- -re ".*$gdb_prompt $" { fail "continue to 1281"}
- timeout { fail "(timeout) continue to 1281"}
- }
+ gdb_test "continue" \
+ "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*" \
+ "continue to 1281"
} else {
- gdb_test "continue" "" ""
+ gdb_test "continue" ".*" ""
}
#call print_small_structs(*struct1, *struct2, *struct3, *struct4,
if {![gdb_skip_float_test "print print_small_structs(...)"] && \
![gdb_skip_stdio_test "print print_small_structs(...)"] } {
- send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
- gdb_expect_list "print print_small_structs" ".*$gdb_prompt $" {
+ gdb_test_sequence "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)" "print print_small_structs" {
"\[\t\r\n \]+alpha"
"\[\t\r\n \]+gamma"
"\[\t\r\n \]+epsilon"
}
#call compute_with_small_structs(20)
-send_gdb "print compute_with_small_structs(20)\n"
-gdb_expect {
- -re ".*\[0-9\]+ =.*$gdb_prompt $" {
- pass "print compute_with_small_structs(20)"
- }
- -re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" }
- timeout { fail "(timeout) compute_with_small_structs(20)" }
- }
+gdb_test "print compute_with_small_structs(20)" \
+ "\[0-9\]+ = void" \
+ "print compute_with_small_structs(20)"
#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098,
if {![gdb_skip_float_test "print print_ten_doubles(...)"] && \
![gdb_skip_stdio_test "print print_ten_doubles(...)"]} {
- send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n"
- gdb_expect_list "print print_ten_doubles" ".*$gdb_prompt $" {
- "\[\t\r\n \]+Two Doubles : 123.456000.*123.456000"
- "\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000"
- "\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000"
- "\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450"
- "\[\t\r\n \]+Two Doubles : -0.111111.*216.970650"
+ gdb_test_sequence "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)" "print print_ten_doubles" {
+ "\[\t\r\n \]+Two Doubles : 123.45\[0-9\]*.*123.45\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : -0.1200\[0-9\]*.*-1.2300\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : 343434.\[0-9\]*.*89.09\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : 3.1400\[0-9\]*.*-5678.123\[0-9\]*"
+ "\[\t\r\n \]+Two Doubles : -0.1111\[0-9\]*.*216.97\[0-9\]*"
}
}
#go -until 1286
gdb_test "tbreak 1286" \
- "Breakpoint .* file .*call-ar-st.c, line 1286.*" \
+ "Temporary breakpoint .* file .*call-ar-st.c, line 1286.*" \
"tbreakpoint line 1286"
gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1286\[\t\r\n \]+1286.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1286"
# FIXME: use step for hppa* testing for now
# guo 990621
#
- send_gdb "step\n"
- gdb_expect {
- -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"}
- -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
- timeout { fail "step into print_long_arg_list (timeout)" }
- }
+ gdb_test "step" \
+ "print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);" \
+ "step into print_long_arg_list"
} else {
# We can't just assume that a "step" will get us into
# print_long_arg_list here,either.
gdb_test "tbreak print_long_arg_list" \
- "Breakpoint .* file .*call-ar-st.c, line .*" \
+ "Temporary breakpoint .* file .*call-ar-st.c, line .*" \
"tbreak in print_long_arg_list after stepping into memcpy"
# The short match case below handles cases where a buffer
# overflows or something, and expect can't deal with the full
# line. Perhaps a more elegant solution exists... -sts 1999-08-17
- send_gdb "continue\n"
if {![gdb_skip_float_test "step into print_long_arg_list"]} {
- gdb_expect {
- -re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" { pass "step into print_long_arg_list" }
- -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}.*\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list (short match)"}
- -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
- timeout { fail "step into print_long_arg_list (timeout)" }
+ gdb_test_multiple "continue" "step into print_long_arg_list" {
+ -re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {
+ pass "step into print_long_arg_list"
+ }
+ -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}.*\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {
+ pass "step into print_long_arg_list (short match)"
+ }
}
} else {
# If skipping float tests, don't expect anything in arg list.
- gdb_expect {
- -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" }
- -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
- timeout { fail "step into print_long_arg_list (timeout)" }
- }
+ gdb_test "continue" \
+ "print_long_arg_list \\(.*\\).*" \
+ "step into print_long_arg_list"
}
}
if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \
![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } {
- # On Solaris, some of the args are passed by ref, others by value,
- # and GDB gets confused and says "Invalid cast" because it thinks
- # it has to cast the structure into a pointer to structure. A real
- # GDB bug, probably for all Sparc configs, but obscure. -sts 1999-08-17.
- setup_xfail "sparc*-*-solaris*"
- send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n"
- gdb_expect_list "print print_small_structs from print_long_arg_list" ".*$gdb_prompt $" {
+
+ # On 32-bit SPARC, some of the args are passed by ref, others by
+ # value, and GDB gets confused and says "Invalid cast" because it
+ # thinks it has to cast the structure into a pointer to structure.
+ if { [test_debug_format "stabs"] } then {
+ setup_kfail "gdb/1539" "sparc-*-*"
+ }
+
+ gdb_test_sequence "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)" "print print_small_structs from print_long_arg_list" {
"\[\t\r\n \]+alpha"
"\[\t\r\n \]+gamma"
"\[\t\r\n \]+epsilon"
#go -until 1300
gdb_test "tbreak 1300" \
- "Breakpoint.* file .*call-ar-st.c, line 1300.*" \
+ "Temporary breakpoint.* file .*call-ar-st.c, line 1300.*" \
"tbreakpoint line 1300"
if ![gdb_skip_stdio_test "continuing to 1300"] {
gdb_test "continue" "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
"continue to 1300"
} else {
- gdb_test "continue" "" ""
+ gdb_test "continue" ".*" ""
}
#step
- send_gdb "step\n"
- gdb_expect {
- -re "
-init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" {
- pass "step into init_bit_flags_combo"}
- -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" }
- timeout { fail "step into init_bit_flags_combo (timeout)" }
- }
+gdb_test "step" \
+ "init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;" \
+ "step into init_bit_flags_combo"
#call print_bit_flags_combo(*bit_flags_combo)
if ![gdb_skip_stdio_test "continuing to 1300"] {
- send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
- gdb_expect {
- -re ".*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*$gdb_prompt $" {
- pass "print print_bit_flags_combo from init_bit_flags_combo"
- }
- -re ".*$gdb_prompt $" {
- fail "print print_bit_flags_combo from init_bit_flags_combo"
- }
- timeout {
- fail "(timeout) print_bit_flags_combo from init_bit_flags_combo"
- }
- }
+ gdb_test "print print_bit_flags_combo(*bit_flags_combo)" \
+ "alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*" \
+ "print print_bit_flags_combo from init_bit_flags_combo"
}
#go -until 1305
gdb_test "tbreak 1305" \
- "Breakpoint.* file .*call-ar-st.c, line 1305.*" \
+ "Temporary breakpoint.* file .*call-ar-st.c, line 1305.*" \
"tbreakpoint line 1305"
gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1305\[\r\n\t \]+1305.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \
if {![gdb_skip_float_test "print print_long_arg_list"] && \
![gdb_skip_stdio_test "print print_long_arg_list"] } {
- send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
- gdb_expect_list "print print_long_arg_list" ".*$gdb_prompt $" {
+ gdb_test_sequence "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)" "print print_long_arg_list" {
"\[ \n\r\t\]+double : 22.250000"
"\[ \n\r\t\]+double : 33.375000"
"\[ \n\r\t\]+int : 0"
#go -until 1311
gdb_test "tbreak 1311" \
- "Breakpoint.* file .*call-ar-st.c, line 1311.*" \
+ "Temporary breakpoint.* file .*call-ar-st.c, line 1311.*" \
"tbreakpoint line 1311"
gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1311\[ \t\n\r\]+1311.*compute_with_small_structs\\(35\\);" \
#call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
if ![gdb_skip_stdio_test "print sum_struct_print(...)"] {
- send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n"
- gdb_expect {
- -re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" {
- pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
- }
- -re ".*$gdb_prompt $" {
- fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
- }
- timeout {
- fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
- }
- }
+ gdb_test "print sum_struct_print(10,*struct1,*struct2,*struct3,*struct4)" \
+ "Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*" \
+ "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
}
#call print_struct_rep(*struct1, *struct2, *struct3)
if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
- send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n"
- gdb_expect_list "print print_struct_rep(*struct1, *struct2, *struct3)" \
- ".*$gdb_prompt $" {
+ gdb_test_sequence "print print_struct_rep(*struct1, *struct2, *struct3)" \
+ "print print_struct_rep(*struct1, *struct2, *struct3)" {
"\[ \t\n\r\]+Contents of struct1:"
"\[ \t\n\r\]+ 22 0"
"\[ \t\n\r\]+Contents of struct2:"
}
if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
- send_gdb "print print_one_large_struct(*list1)\n"
- gdb_expect {
- -re ".* 4 1.*$gdb_prompt $" {
- pass "print print_one_large_struct(*list1)"
- }
- -re ".*$gdb_prompt $" {
- fail "print print_one_large_struct(*list1)"
- }
- timeout {
- fail "(timeout) print_one_large_struct(*list1)"
- }
- }
+ gdb_test "print print_one_large_struct(*list1)" \
+ " 4 1.*" \
+ "print print_one_large_struct(*list1)"
}
set timeout $oldtimeout