2010-05-24 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Mon, 24 May 2010 22:03:59 +0000 (22:03 +0000)
committerMichael Snyder <msnyder@vmware.com>
Mon, 24 May 2010 22:03:59 +0000 (22:03 +0000)
* gdb.base/call-ar-st.exp: Replace send_gdb with gdb_test.
* gdb.base/callfuncs.exp: Replace send_gdb with gdb_test.
* gdb.base/call-rt-st.exp: Replace send_gdb with gdb_test.
* gdb.base/call-signal-resume.exp: Replace send_gdb with gdb_test.
* gdb.base/call-strs.exp: Replace send_gdb with gdb_test.
* gdb.base/catch-syscall.exp: Replace send_gdb with gdb_test.
* gdb.base/charset.exp: Replace send_gdb with gdb_test.
* gdb.base/checkpoint.exp: Replace send_gdb with gdb_test.
* gdb.base/commands.exp: Replace send_gdb with gdb_test.
* gdb.base/condbreak.exp: Replace send_gdb with gdb_test.
* gdb.base/cond-exprs.exp: Replace send_gdb with gdb_test.
* gdb.base/consecutive.exp: Replace send_gdb with gdb_test.
* gdb.base/constvars.exp: Replace send_gdb with gdb_test.
* gdb.base/corefile.exp: Replace send_gdb with gdb_test.

15 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/call-ar-st.exp
gdb/testsuite/gdb.base/call-rt-st.exp
gdb/testsuite/gdb.base/call-signal-resume.exp
gdb/testsuite/gdb.base/call-strs.exp
gdb/testsuite/gdb.base/callfuncs.exp
gdb/testsuite/gdb.base/catch-syscall.exp
gdb/testsuite/gdb.base/charset.exp
gdb/testsuite/gdb.base/checkpoint.exp
gdb/testsuite/gdb.base/commands.exp
gdb/testsuite/gdb.base/cond-expr.exp
gdb/testsuite/gdb.base/condbreak.exp
gdb/testsuite/gdb.base/consecutive.exp
gdb/testsuite/gdb.base/constvars.exp
gdb/testsuite/gdb.base/corefile.exp

index 6d34cd74dc472e80be099f5919a9b259bc454fd7..4e7326d7cbd67c754066c30ba5a1cf91724c0b93 100644 (file)
@@ -1,3 +1,20 @@
+2010-05-24  Michael Snyder  <msnyder@vmware.com>
+
+       * gdb.base/call-ar-st.exp: Replace send_gdb with gdb_test.
+       * gdb.base/callfuncs.exp: Replace send_gdb with gdb_test.
+       * gdb.base/call-rt-st.exp: Replace send_gdb with gdb_test.
+       * gdb.base/call-signal-resume.exp: Replace send_gdb with gdb_test.
+       * gdb.base/call-strs.exp: Replace send_gdb with gdb_test.
+       * gdb.base/catch-syscall.exp: Replace send_gdb with gdb_test.
+       * gdb.base/charset.exp: Replace send_gdb with gdb_test.
+       * gdb.base/checkpoint.exp: Replace send_gdb with gdb_test.
+       * gdb.base/commands.exp: Replace send_gdb with gdb_test.
+       * gdb.base/condbreak.exp: Replace send_gdb with gdb_test.
+       * gdb.base/cond-exprs.exp: Replace send_gdb with gdb_test.
+       * gdb.base/consecutive.exp: Replace send_gdb with gdb_test.
+       * gdb.base/constvars.exp: Replace send_gdb with gdb_test.
+       * gdb.base/corefile.exp: Replace send_gdb with gdb_test.
+
 2010-05-21  Tom Tromey  <tromey@redhat.com>
 
        * gdb.dwarf2/pieces.exp (pieces_test_f3): New proc.
        * lib/gdb.ada/arrayidx.exp: Use gdb_test_no_output instead of gdb_test
        when testing commands that should produce no output.
 
-2010-05-19  Michael Snyder  <msnyder@vmware.com>
-
-       * gdb.base/whatis.exp: Replace send_gdb with gdb_test.
-
 2010-05-17  Joel Brobecker  <brobecker@adacore.com>
 
        * gdb.ada/watch_arg/watch.adb: Rewrite testcase to avoid the
index 763c5095b616dc489a30d789eec32c5d5e977528..5a94b4411ab491305e86a9a29444676e0f0efd20 100644 (file)
@@ -61,24 +61,19 @@ set timeout [expr "$timeout + 60"]
 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; }
-    }
+    gdb_test_no_output "set language c"
 
-    send_gdb "show language\n"
-    gdb_expect {
+    gdb_test_multiple "show language" "set language to \"c\"" {
        -re ".* source language is \"c\".*$gdb_prompt $" {
            pass "set language to \"c\""
            return 1
        }
        -re ".*$gdb_prompt $" {
-           fail "setting language to \"c\""
+           fail "set language to \"c\""
            return 0
        }
        timeout {
-           fail "can't show language (timeout)"
+           fail "(timeout) set language to \"c\""
            return 0
        }
     }
@@ -90,9 +85,9 @@ 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 {
@@ -201,28 +196,15 @@ if {![gdb_skip_float_test "continuing to breakpoint 1220"] && \
 }
 
 #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" "" ""
 }
@@ -265,24 +247,16 @@ if {![gdb_skip_float_test "continuing to 1236"] && \
 #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" "" ""
 }
@@ -290,18 +264,9 @@ if ![gdb_skip_stdio_test "next to 1237"] {
 #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
@@ -309,14 +274,9 @@ gdb_test "tbreak 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
@@ -355,14 +315,9 @@ gdb_test "tbreak 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" "" ""
 }
@@ -412,14 +367,9 @@ if {![gdb_skip_float_test "print print_small_structs(...)"] && \
 }
 
 #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, 
@@ -456,12 +406,9 @@ if { [istarget "hppa*-*-hpux*"] } {
     # 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
@@ -472,21 +419,20 @@ if { [istarget "hppa*-*-hpux*"] } {
     # 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"
     }
 }
 
@@ -558,29 +504,15 @@ if ![gdb_skip_stdio_test "continuing to 1300"] {
 }
 
 #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"
 }
 
 
@@ -655,18 +587,9 @@ gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1311\[ \t\n\r\]+
 
 #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)"
 }
 
 
@@ -685,18 +608,9 @@ if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
 }
 
 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
index 593b375f3c6416e3cd6228d899424be5d0974522..58c0eeed10de0995bba879de2d9f130ec4c2eed2 100644 (file)
@@ -58,44 +58,15 @@ if [target_info exists gdb,cannot_call_functions] {
     continue
 }
 
-# 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
-       }
-    }
-}
-
 # 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 {
@@ -108,29 +79,17 @@ gdb_test "break loop_count" \
     "Breakpoint.* file .*call-rt-st.c, line 128\\." \
     "breakpoint loop_count"
 
+gdb_test "continue" \
+    "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+128\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+" \
+    "continue to loop_count"
 
-send_gdb "continue\n"
-gdb_expect {
- -re  "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+128\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" {
-                 pass "continue to loop_count"}
-      -re ".*$gdb_prompt $" { fail "continue to loop_count"}           
-      timeout           { fail "(timeout) continue to loop_count"}
-}
-
-send_gdb "finish\n"
-gdb_expect {
-    -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:777\[ \t\r\n\]+777\[\t \]+return 0;.*$gdb_prompt $" {
+gdb_test_multiple "finish" "finish out from loop count" {
+    -re "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:777\[ \t\r\n\]+777\[\t \]+return 0;.*$gdb_prompt $" {
        pass "finish out from loop_count (line 777)"
     }
     -re  "Run till exit from .0  loop_count \\(\\) at.*call-rt-st.c:128\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:775\[ \t\r\n\]+775\[\t \]+loop_count.*$gdb_prompt $" {
        pass "finish out from loop_count (line 775)"
     }
-    -re ".*$gdb_prompt $" {
-       fail "finish out from loop_count"
-    }
-    timeout {
-       fail "finish out from loop_count (timeout)"
-    }
 }
 
 # Ask GDB to print the value of EXPR, and expect to see the regexp
@@ -142,20 +101,13 @@ proc print_struct_call { expr result } {
     global gdb_prompt
 
     set command "print $expr"
-    send_gdb "${command}\n"
-    gdb_expect {
+    gdb_test_multiple "${command}" "${command}" {
         -re "$result\[\r\n\]+$gdb_prompt $" {
             pass "$command"
         }
         -re "Function return value unknown.\[\r\n\]+$gdb_prompt $" {
             unsupported "$command"
         }
-        -re "$gdb_prompt $" {
-            fail "$command"
-        }
-        timeout {
-            fail "$command (timeout)"
-        }
     }
 }
 
index 58a12c0afbefdc205b42b94e7e2bc56a897533ad..d3db0cf366f9f790ebc981f4a0c246b3e2c90d41 100644 (file)
@@ -53,24 +53,14 @@ if [target_info exists gdb,cannot_call_functions] {
 }
 
 proc get_dummy_frame_number { } {
-  global gdb_prompt
-
-  send_gdb "bt\n"
-  gdb_expect {
-    -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $"
-      {
-       return $expect_out(1,string)
-      }
-    -re "$gdb_prompt $"
-      {
-       return ""
-      }
-    timeout
-      {
-       return ""
-      }
-  }
-  return ""
+    global gdb_prompt
+
+    gdb_test_multiple "bt" "backtrace" {
+       -re "#(\[0-9\]*) *<function called from gdb>.*$gdb_prompt $" {
+           return $expect_out(1,string)
+       }
+    }
+    return ""
 }
 
 # Start with a fresh gdb.
index 6a84ea4d70e1be4ca6a0db2af5e9fae6fb075c4a..938f5e03ee9f3f2fad3913fb6c4f8355d5896a13 100644 (file)
@@ -52,36 +52,6 @@ if [target_info exists gdb,cannot_call_functions] {
     continue
 }
 
-# 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
-       }
-    }
-}
-
-
 
 # Start with a fresh gdb.
 
@@ -89,9 +59,9 @@ 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 {
     perror "couldn't run to breakpoint"
@@ -102,163 +72,81 @@ set prev_timeout $timeout
 set timeout 120
 
 #step
-send_gdb "step\n"
-gdb_expect {
-        -re ".*strcpy\\(buf, \"test string\"\\);.*$gdb_prompt $" {pass "step after assignment to s"}
-        -re ".*$gdb_prompt $" { fail "step after assignment to s" }
-        timeout { fail "step after assignment to s (timeout)" }
-    }
-
+gdb_test "step" \
+    "strcpy\\(buf, \"test string\"\\);" \
+    "step after assignment to s"
 
 #next
-send_gdb "next\n"
-gdb_expect {
-        -re ".*str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);.*$gdb_prompt $" {pass "next over strcpy"}
-        -re ".*$gdb_prompt $" { fail "next over strcpy" }
-        timeout { fail "next over strcpy (timeout)" }
-    }
+gdb_test "next" \
+    "str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);" \
+    "next over strcpy"
 
 #print buf
-send_gdb "print buf\n"
-gdb_expect {
-    -re ".*\"test string\",.*repeats 88 times.*$gdb_prompt $" {
-        pass "print buf"
-      }
-    -re ".*$gdb_prompt $" { fail "print buf" }
-    timeout           { fail "(timeout) print buf" }
-  }
-
+gdb_test "print buf" \
+    "\"test string\",.*repeats 88 times.*"
 
 #print s
-send_gdb "print s\n"
-gdb_expect {
-    -re ".*= \"test string\".*$gdb_prompt $" {
-        pass "print s"
-      }
-    -re ".*$gdb_prompt $" { fail "print s" }
-    timeout           { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
-  }
-
+gdb_test "print s" \
+    " = \"test string\".*"
 
 #print str_func1(s)
 if ![gdb_skip_stdio_test "print str_func1(s)"] {
-    send_gdb "print  str_func1(s)\n"
-    gdb_expect {
-       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-           pass "print str_func1(s)"
-       }
-       -re ".*$gdb_prompt $" { fail "print str_func1(s)" }
-       timeout               { fail "(timeout) print str_func1(s)" }
-    }
+    gdb_test "print str_func1(s)" \
+       "first string arg is: test string.*\"test string\".*"
 }
 
-
 #print str_func1("test string")
 if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
-    send_gdb "print  str_func1(\"test string\")\n"
-    gdb_expect {
-       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-           pass "print str_func1(\"test string\")"
-       }
-       -re ".*$gdb_prompt $" { fail "print str_func1(\"test string\")" }
-       timeout     { fail "(timeout) print str_func1(\"test string\")" }
-    }
+    gdb_test "print str_func1(\"test string\")" \
+       "first string arg is: test string.*\"test string\".*"
 }
 
 #call str_func1(s)
 if ![gdb_skip_stdio_test "call str_func1(s)"] {
-    send_gdb "call  str_func1(s)\n"
-    gdb_expect {
-       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-           pass "call str_func1(s)"
-       }
-       -re ".*$gdb_prompt $" { fail "call str_func1(s)" }
-       timeout               { fail "(timeout) call str_func1(s)" }
-    }
+    gdb_test "call str_func1(s)" \
+       "first string arg is: test string.*\"test string\".*"
 }
 
 #call str_func1("test string")
 if ![gdb_skip_stdio_test "call str_func1 (...)"] {
-    send_gdb "call  str_func1(\"test string\")\n"
-    gdb_expect {
-       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-           pass "call str_func1(\"test string\")"
-       }
-       -re ".*$gdb_prompt $" { fail "call str_func1(\"test string\")" }
-       timeout     { fail "(timeout) call str_func1(\"test string\")" }
-    }
+    gdb_test "call str_func1(\"test string\")" \
+       "first string arg is: test string.*\"test string\".*"
 }
 
 #print str_func1(buf)
 if ![gdb_skip_stdio_test "print str_func1(buf)"] {
-    send_gdb "print  str_func1(buf)\n"
-    gdb_expect {
-       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-           pass "print str_func1(buf)"
-       }
-       -re ".*$gdb_prompt $" { fail "print str_func1(buf)" }
-       timeout               { fail "(timeout) print str_func1(buf)" }
-    }
+    gdb_test "print str_func1(buf)" \
+       "first string arg is: test string.*\"test string\".*"
 }
 
 #call str_func1(buf)
 if ![gdb_skip_stdio_test "call str_func1(buf)"] {
-    send_gdb "call str_func1(buf)\n"
-    gdb_expect {
-       -re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
-           pass "call str_func1(buf)"
-       }
-       -re ".*$gdb_prompt $" { fail "call str_func1(buf)" }
-       timeout               { fail "(timeout) call str_func1(buf)" }
-    }
+    gdb_test "call str_func1(buf)" \
+       "first string arg is: test string.*\"test string\".*"
 }
 
 #print str_func("a","b","c","d","e","f","g")
 if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
-    send_gdb "print  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
-    gdb_expect {
-       -re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
-           pass "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
-       }
-       -re ".*$gdb_prompt $" { fail "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-       timeout           { fail "(timeout) print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-    }
+    gdb_test "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
+       "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*"
 }
 
 #call str_func("a","b","c","d","e","f","g")
 if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
-    send_gdb "call  str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
-    gdb_expect {
-       -re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
-           pass "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
-       }
-       -re ".*$gdb_prompt $" { fail "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-       timeout           { fail "(timeout) call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
-    }
+    gdb_test "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
+       "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*"
 }
 
 #print str_func(s,s,s,s,s,s,s)
 if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
-    send_gdb "print  str_func(s,s,s,s,s,s,s)\n"
-    gdb_expect {
-       -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
-           pass "print str_func(s,s,s,s,s,s,s)"
-       }
-       -re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s)" }
-       timeout     { fail "(timeout) print str_func(s,s,s,s,s,s,s)" }
-    }
+    gdb_test "print str_func(s,s,s,s,s,s,s)" \
+       "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
 }
 
 #call str_func(s,s,s,s,s,s,s)
 if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
-    send_gdb "call  str_func(s,s,s,s,s,s,s)\n"
-    gdb_expect {
-       -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
-           pass "call str_func(s,s,s,s,s,s,s)"
-       }
-       -re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s)" }
-       timeout               { fail "(timeout) call str_func(s,s,s,s,s,s,s)" }
-    }
+    gdb_test "call str_func(s,s,s,s,s,s,s)" \
+       "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
 }
 
 gdb_exit
index f7fc6418d06fb44366eba5060198b4db137c88a1..d6600519ecf2f5bd430cac70f1b529e8779d2646 100644 (file)
@@ -58,27 +58,17 @@ if [target_info exists gdb,cannot_call_functions] {
 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; }
-    }
+    gdb_test_no_output "set language c" 
+
+    set success 0
 
-    send_gdb "show language\n"
-    gdb_expect {
+    gdb_test_multiple "show language" "set language to \"c\"" {
        -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
+           set success 1
        }
     }
+    return $success
 }
 
 # FIXME:  Before calling this proc, we should probably verify that
index ca6f3fd7d1311c0102b31cec269fd383346fb8a0..c20e80d9726f6404f487dd4b2b18c077890f0531 100644 (file)
@@ -278,15 +278,7 @@ proc do_syscall_tests {} {
     global gdb_prompt srcdir
 
     # First, we need to set GDB datadir.
-    send_gdb "set data-directory $srcdir/..\n"
-    gdb_expect 10 {
-       -re "$gdb_prompt $" {
-           verbose "Setting GDB datadir to $srcdir/..." 2
-       }
-       timeout {
-           error "Couldn't set GDB datadir."
-       }
-    }
+    gdb_test_no_output "set data-directory $srcdir/.."
 
     # Verify that the 'catch syscall' help is available
     set thistest "help catch syscall"
index 45595ff9a14dcef3afd2cc064f8d324976dd461b..6350b4ee557945e55b2ca428c819479366f19eed 100644 (file)
@@ -374,15 +374,7 @@ foreach target_charset $charset_subset {
        set param target-charset
        set L ""
     }
-    send_gdb "set $param $target_charset\n" 
-    gdb_expect {
-        -re "$gdb_prompt $" {
-            pass "set $param $target_charset"
-        }
-        timeout {
-            fail "set $param $target_charset (timeout)"
-        }
-    }
+    gdb_test_no_output "set $param $target_charset"
 
     # Try printing the null character.  There seems to be a bug in
     # gdb_test that requires us to use gdb_expect here.
index 650591cd50df1d73f2fe9fe60862dd5ea20ae4a2..afb66a2562251014948f413f501f7a08f59d9a99 100644 (file)
@@ -337,18 +337,9 @@ gdb_load ${binfile}
 runto_main
 gdb_breakpoint $break1_loc
 
-send_gdb "commands\n"
-send_gdb "  silent\n"
-send_gdb "  if (lines % 2)\n"
-send_gdb "    checkpoint\n"
-send_gdb "  end\n"
-send_gdb "  continue\n"
-send_gdb "end\n"
-
-gdb_expect {
-    -re ".*$gdb_prompt $" { pass "set checkpoint breakpoint" }
-    timeout { fail "(timeout) set checkpoint breakpoint" }
-}
+gdb_test "commands\nsilent\nif (lines % 2)\ncheckpoint\nend\n  continue\nend" \
+    "" \
+    "set checkpoint breakpoint"
 
 set prev_timeout $timeout
 set timeout [expr $timeout + 120]
index 42bd89b9ce21b8fa8dbc204de2a445fca6426466..5ffadcb426304641fe010aae3cdd335705bac270 100644 (file)
@@ -136,15 +136,13 @@ proc if_while_breakpoint_command_test {} {
     delete_breakpoints
     gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #1"
 
-    send_gdb "commands\n"
-    gdb_expect {
-       -re "End with" {
-           pass "commands in if_while_breakpoint_command_test"
-       }
-        default {
-           fail "(timeout or eof) commands in if_while_breakpoint_command_test"
+    gdb_test_multiple "commands" \
+       "commands in if_while_breakpoint_command_test" {
+           -re "End with" {
+               pass "commands in if_while_breakpoint_command_test"
+           }
        }
-    }
+
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
     gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
            "" \
@@ -182,21 +180,18 @@ proc infrun_breakpoint_command_test {} {
 # to get around a synchronization problem in expect.
 # part1: issue the gdb command "commands"
 # part2: send the list of commands
-    send_gdb "commands\n"
-    gdb_expect {
-       -re "End with" {
-           pass "commands in infrun_breakpoint_command_test #1"
-       }
-        default {
-           fail "(timeout or eof) commands in infrun_breakpoint_command_test"
+    gdb_test_multiple "commands" \
+       "commands in infrun_breakpoint_command_test #1" {
+           -re "End with" {
+               pass "commands in infrun_breakpoint_command_test #1"
+           }
        }
-    }
     gdb_test "step\nstep\nstep\nstep\nend" "" \
        "commands in infrun_breakpoint_command_test #2"
 
-       gdb_test "continue" \
-               "Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[      \]*if \\(value > 1\\) \{.*\[0-9\]*\[      \]*value \\*= factorial \\(value - 1\\);.*" \
-               "continue in infrun_breakpoint_command_test"
+    gdb_test "continue" \
+       "Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[      \]*if \\(value > 1\\) \{.*\[0-9\]*\[      \]*value \\*= factorial \\(value - 1\\);.*" \
+       "continue in infrun_breakpoint_command_test"
 
     gdb_stop_suppressing_tests;
 }
@@ -229,15 +224,13 @@ proc user_defined_command_test {} {
 
     gdb_test "set \$foo = 4" "" "set foo in user_defined_command_test"
 
-    send_gdb "define mycommand\n"
-    gdb_expect {
-       -re "End with"  {
-           pass "define mycommand in user_defined_command_test"
-       }
-        default {
-           fail "(timeout or eof) define mycommand in user_defined_command_test"
+    gdb_test_multiple "define mycommand" \
+       "define mycommand in user_defined_command_test" {
+           -re "End with"  {
+               pass "define mycommand in user_defined_command_test"
+           }
        }
-    }
+
     # This test should alternate between 0xdeadbeef and 0xfeedface two times.
     gdb_test "while \$arg0 > 0\nset \$arg0 -= 1\nif \(\$arg0 % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
            "" \
@@ -282,52 +275,37 @@ proc watchpoint_command_test {} {
     #
     set wp_id -1
 
-    send_gdb "watch local_var\n"
-    gdb_expect {
-        -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $" {
+    gdb_test_multiple "watch local_var" "watch local_var" {
+        -re "\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $" {
             set wp_id $expect_out(1,string)
             pass "watch local_var"
         }
-        -re "$gdb_prompt $"\
-            {fail "watch local_var"}
-        timeout {fail "(timeout) watch local_var"}
     }
 
     if {$wp_id == -1} {return}
 
-    send_gdb "commands $wp_id\n"
-    gdb_expect {
-      -re "Type commands for breakpoint.*, one per line.*>" {
-         pass "begin commands on watch"
-      }
-      -re "$gdb_prompt $" {fail "begin commands on watch"}
-      timeout             {fail "(timeout) begin commands on watch"}
-    }
-    send_gdb "print value\n"
-    gdb_expect {
-       -re ">"               {pass "add print command to watch"}
-       -re "$gdb_prompt $"   {fail "add print command to watch"}
-       timeout               {fail "(timeout) add print command to watch"}
-    }
-    send_gdb "continue\n"
-    gdb_expect {
-       -re ">"               {pass "add continue command to watch"}
-       -re "$gdb_prompt $"   {fail "add continue command to watch"}
-       timeout               {fail "(timeout) add continue command to watch"}
+    gdb_test_multiple "commands $wp_id\n" "begin commands on watch" {
+       -re "Type commands for breakpoint.*, one per line.*>$" {
+           pass "begin commands on watch"
+       }
     }
-    send_gdb "end\n"
-    gdb_expect {
-       -re "$gdb_prompt $"   {pass "end commands on watch"}
-       timeout               {fail "(timeout) end commands on watch"}
+    gdb_test_multiple "print value" "add print command to watch" {
+       -re ">$" {
+           pass "add print command to watch"
+       }
     }
-    send_gdb "continue\n"
-    gdb_expect {
-       -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(57|82).*$gdb_prompt $" {
-           pass "continue with watch"
+    gdb_test_multiple "continue" "add continue command to watch" {
+       -re ">$" {
+           pass "add continue command to watch"
        }
-       -re "$gdb_prompt $"   {fail "continue with watch"}
-       timeout               {fail "(timeout) continue with watch"}
     }
+    gdb_test "end" \
+       "" \
+       "end commands on watch"
+
+    gdb_test "continue" \
+       "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(57|82).*" \
+       "continue with watch"
 }
 
 proc test_command_prompt_position {} {
@@ -448,41 +426,35 @@ proc bp_deleted_in_command_test {} {
              "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
              "breakpoint in bp_deleted_in_command_test"
     
-    send_gdb "commands\n"
-    gdb_expect {
-      -re "Type commands for breakpoint.*>" {
+    gdb_test_multiple "commands" "begin commands in bp_deleted_in_command_test" {
+      -re "Type commands for breakpoint.*>$" {
           pass "begin commands in bp_deleted_in_command_test"
       }
-      -re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
-      timeout             {fail "(timeout) begin commands bp_deleted_in_command_test"}
     }
-    send_gdb "silent\n"
-    gdb_expect {
-        -re ">"               {pass "add silent command"}
-        -re "$gdb_prompt $"   {fail "add silent command"}
-        timeout               {fail "(timeout) add silent command"}
+    gdb_test_multiple "silent" "add silent command" {
+        -re ">$" {
+           pass "add silent command"
+       }
     }
-    send_gdb "clear factorial\n"
-    gdb_expect {
-        -re ">"               {pass "add clear command"}
-        -re "$gdb_prompt $"   {fail "add clear command"}
-        timeout               {fail "(timeout) add clear command"} }
-    send_gdb "printf \"factorial command-list executed\\n\"\n"
-    gdb_expect {
-        -re ">"               {pass "add printf command"}
-        -re "$gdb_prompt $"   {fail "add printf command"}
-        timeout               {fail "(timeout) add printf command"}
+    gdb_test_multiple "clear factorial" "add clear command" {
+        -re ">$" {
+           pass "add clear command"
+       }
     }
-    send_gdb "cont\n"
-    gdb_expect {
-        -re ">"               {pass "add cont command"}
-        -re "$gdb_prompt $"   {fail "add cont command"}
-        timeout               {fail "(timeout) add cont command"} }
-    send_gdb "end\n"
-    gdb_expect {
-        -re "$gdb_prompt $"   {pass "end commands"}
-        timeout               {fail "(timeout) end commands"}
+    gdb_test_multiple "printf \"factorial command-list executed\\n\"" \
+       "add printf command" {
+        -re ">$" {
+           pass "add printf command"
+       }
+    }
+    gdb_test_multiple "cont" "add cont command" {
+        -re ">$" {
+           pass "add cont command"
+       }
     }
+    gdb_test "end" \
+       "" \
+       "end commands"
 
     gdb_run_cmd
     gdb_expect {
@@ -515,36 +487,31 @@ proc temporary_breakpoint_commands {} {
            "Temporary breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
            "breakpoint in temporary_breakpoint_commands"
     
-    send_gdb "commands\n"
-    gdb_expect {
-       -re "Type commands for breakpoint.*>" {
-           pass "begin commands in bp_deleted_in_command_test"
+    gdb_test_multiple "commands" \
+       "begin commands in bp_deleted_in_command_test" {
+           -re "Type commands for breakpoint.*>$" {
+               pass "begin commands in bp_deleted_in_command_test"
+           }
+       }
+    gdb_test_multiple "silent" "add silent tbreak command" {
+       -re ">$" {
+           pass "add silent tbreak command"
        }
-       -re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
-       timeout             {fail "(timeout) begin commands bp_deleted_in_command_test"}
     }
-    send_gdb "silent\n"
-    gdb_expect {
-       -re ">"               {pass "add silent tbreak command"}
-       -re "$gdb_prompt $"   {fail "add silent tbreak command"}
-       timeout               {fail "(timeout) add silent tbreak command"}
-     }
-    send_gdb "printf \"factorial tbreak commands executed\\n\"\n"
-    gdb_expect {
-       -re ">"               {pass "add printf tbreak command"}
-       -re "$gdb_prompt $"   {fail "add printf tbreak command"}
-       timeout               {fail "(timeout) add printf tbreak command"}
-     }
-    send_gdb "cont\n"
-    gdb_expect {
-       -re ">"               {pass "add cont tbreak command"}
-       -re "$gdb_prompt $"   {fail "add cont tbreak command"}
-       timeout               {fail "(timeout) add cont tbreak command"} }
-    send_gdb "end\n"
-    gdb_expect {
-       -re "$gdb_prompt $"   {pass "end tbreak commands"}
-       timeout               {fail "(timeout) end tbreak commands"}
-     }
+    gdb_test_multiple "printf \"factorial tbreak commands executed\\n\"\n" \
+       "add printf tbreak command" {
+           -re ">$" {
+               pass "add printf tbreak command"
+           }
+       }
+    gdb_test_multiple "cont" "add cont tbreak command" {
+       -re ">$" {
+           pass "add cont tbreak command"
+       }
+    }
+    gdb_test "end" \
+       "" \
+       "end tbreak commands"
 
     gdb_run_cmd
     gdb_expect {
index 1bb6a00633e38a44213d3f25e82c1e2e50555aab..76635e04ba4bd0555b2a710d5fc1355c9cf1636f 100644 (file)
@@ -55,57 +55,26 @@ if ![runto_main] then {
     continue
 }
 
-send_gdb "print (2 ? 3 : 4)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 3.*$gdb_prompt $" {
-        pass "print value of cond expr (const true)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (const true)" }
-    timeout           { fail "(timeout) print value of cond expr (const true)" }
-  }
-
-send_gdb "print (0 ? 3 : 4)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 4.*$gdb_prompt $" {
-        pass "print value of cond expr (const false)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (const false)" }
-    timeout           { fail "(timeout) print value of cond expr (const false)" }
-  }
+gdb_test "print (2 ? 3 : 4)" "\[0-9\]* = 3" \
+    "print value of cond expr (const true)"
+
+gdb_test "print (0 ? 3 : 4)" "\[0-9\]* = 4" \
+    "print value of cond expr (const false)"
 
 gdb_test "set variable x=14" "" "set variable x=14"
 gdb_test "set variable y=2" "" "set variable y=2"
 gdb_test "set variable z=3" "" "set variable z=3"
 
-send_gdb "print (x ? y : z)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 2.*$gdb_prompt $" {
-        pass "print value of cond expr (var true)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (var true)" }
-    timeout           { fail "(timeout) print value of cond expr (var true)" }
-  }
+gdb_test "print (x ? y : z)" "\[0-9\]* = 2" \
+    "print value of cond expr (var true)"
 
 gdb_test "set variable x=0" "" "set variable x=0"
 
-send_gdb "print (x ? y : z)\n"
-gdb_expect {
-    -re ".\[0-9\]* = 3.*$gdb_prompt $" {
-        pass "print value of cond expr (var false)"
-      }
-    -re ".*$gdb_prompt $" { fail "print value of cond expr (var false)" }
-    timeout           { fail "(timeout) print value of cond expr (var false)" }
-  }
-
-
-send_gdb "whatis (0 ? 3 : 4)\n"
-gdb_expect {
-    -re "type = int.*$gdb_prompt $" {
-        pass "print whatis of cond expr"
-      }
-    -re ".*$gdb_prompt $" { fail "print whatis of cond expr" }
-    timeout           { fail "(timeout) print whatis of cond expr" }
-  }
+gdb_test "print (x ? y : z)" "\[0-9\]* = 3" \
+    "print value of cond expr (var false)"
+
+gdb_test "whatis (0 ? 3 : 4)" "type = int" \
+    "print whatis of cond expr"
 
 
 
index ea4e0ba103f266e1a3a98b2bab763c17057b691f..37f7aa70c30c02dbd19ef3a7542d62eb36896baf 100644 (file)
@@ -205,39 +205,25 @@ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.
 # take precedence over real code.
 #
 # Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior.
-send_gdb "continue\n"
-gdb_expect {
+gdb_test_multiple "continue" "run until breakpoint at marker1" {
     -re  "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
        pass "run until breakpoint at marker1"
     }
     -re  "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
        xfail "run until breakpoint at marker1"
     }
-    -re "$gdb_prompt $" {
-       fail "run until breakpoint at marker1"
-    }
-    timeout {
-       fail "(timeout) run until breakpoint at marker1"
-    }
 }
 
 # run until the breakpoint at marker2
 # Same issues here as above.
 setup_xfail hppa2.0w-*-* 11512CLLbs
-send_gdb "continue\n"
-gdb_expect {
+gdb_test_multiple "continue" "run until breakpoint at marker2" {
     -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
        pass "run until breakpoint at marker2"
     }
     -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
        xfail "run until breakpoint at marker2"
     }
-    -re "$gdb_prompt $" {
-       fail "run until breakpoint at marker2"
-    }
-    timeout {
-       fail "(timeout) run until breakpoint at marker2"
-    }
 }
 
 # Test combinations of conditional and thread-specific breakpoints.
index b8850f03a4574dac1c346a147e2999874fb0e54e..5b5f26dd1af392a43fbbea9af917160d84ffd081 100644 (file)
@@ -60,27 +60,17 @@ gdb_test "continue" "Breakpoint $decimal, foo .*" \
 set bp_addr 0
 set stop_addr 0
 
-send_gdb "x /2i \$pc\n"
-gdb_expect {
+gdb_test_multiple "x /2i \$pc" "get breakpoint address for foo" {
     -re "=> $hex.*${nl}   ($hex).*$gdb_prompt $" {
        set bp_addr $expect_out(1,string)
        pass "get breakpoint address for foo"
     }
-    -re ".*$gdb_prompt $" {
-       fail "get breakpoint address for foo"
-       return 0;
-    }
-    timeout {
-       fail "get breakpoint address for foo (timeout)"
-       return 0;
-    }
 }
 
 gdb_test "break \*$bp_addr" "Breakpoint $decimal at $bp_addr: file .*" \
        "set bp, 2nd instr"
 
-send_gdb "step\n"
-gdb_expect {
+gdb_test_multiple "step" "stopped at bp, 2nd instr" {
     -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
        set stop_addr $expect_out(1,string)
        if [eval expr "$bp_addr == $stop_addr"] then {
@@ -89,12 +79,5 @@ gdb_expect {
            fail "stopped at bp, 2nd instr (wrong address)"
        }
     }
-    -re ".*$gdb_prompt $" {
-       fail "stopped at bp, 2nd instr"
-    }
-    timeout {
-       fail "stopped at bp, 2nd instr (timeout)"
-
-    }
 }
 
index efd81704a0b78bb091ffe6454bbbf2477b7ee096..4d698d8115d1fe16cfdb4075b27914a350411531 100644 (file)
@@ -90,52 +90,26 @@ proc local_compiler_xfail_check_2 { } {
     }
 }
 
-send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
+gdb_test "break marker1" "Breakpoint $decimal at .*" 
 
-    send_gdb "cont\n"
-    gdb_expect {
-        -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
-            send_gdb "up\n"
-            gdb_expect {
-               -re ".*main.*$gdb_prompt $" {
-                   pass "up from marker1"
-               }
-                -re ".*$gdb_prompt $" {
-                   fail "up from marker1"
-               }
-                timeout { fail "up from marker1 (timeout)" }
-            }
-        }
-        -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
-           fail "continue to marker1 (demangling)"
-            send_gdb "up\n"
-            gdb_expect {
-               -re ".*main.*$gdb_prompt $" {
-                   pass "up from marker1"
-               }
-                -re ".*$gdb_prompt $" {
-                   fail "up from marker1"
-               }
-                timeout { fail "up from marker1 (timeout)" }
-            }
-        }
-        -re "$gdb_prompt $" { fail "continue to marker1"  }
-        timeout { fail "(timeout) continue to marker1"  }
+gdb_test_multiple "cont" "up from marker1" {
+    -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
+       pass "continue to marker1"
+       gdb_test "up" " main .*" "up from marker1"
     }
+    -re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
+       fail "continue to marker1 (demangling)"
+       gdb_test "up" " main .*" "up from marker1"
+    }
+}
 
 # test function parameters
 
 local_compiler_xfail_check
 local_compiler_xfail_check_2
 
-send_gdb "ptype qux1\n"
-gdb_expect {
-    -re "type = int \\(const char, const char, const char \\*, char \\* const\\).*$gdb_prompt $" {
-        pass "ptype qux1"
-    }
-    -re ".*$gdb_prompt $" { fail "ptype qux1" }
-    timeout           { fail "(timeout) ptype qux1" }
-}   
+gdb_test "ptype qux1" \
+    "type = int \\(const char, const char, const char \\*, char \\* const\\).*"
 
 # test vars and pointers
 
index b756cbb7663880aca9fed3de4fd88e53cb1d3bef..61040a6cb83949f079df96bc03397ff5ef389df4 100644 (file)
@@ -123,8 +123,7 @@ gdb_load ${binfile}
 
 # Test basic corefile recognition via core-file command.
 
-send_gdb "core-file $corefile\n"
-gdb_expect {
+gdb_test_multiple "core-file $corefile" "core-file command" {
     -re ".* program is being debugged already.*y or n. $" {
        # gdb_load may connect us to a gdbserver.
        send_gdb "y\n"
@@ -139,8 +138,6 @@ gdb_expect {
     -re ".*registers from core file: File in wrong format.* $" {
        fail "core-file command (could not read registers from core file)"
     }
-    -re ".*$gdb_prompt $"      { fail "core-file command" }
-    timeout            { fail "(timeout) core-file command" }
 }
 
 # Test correct mapping of corefile sections by printing some variables.
This page took 0.061246 seconds and 4 git commands to generate.