diff options
author | Michael Snyder <msnyder@specifix.com> | 2010-05-26 18:05:22 +0000 |
---|---|---|
committer | Michael Snyder <msnyder@specifix.com> | 2010-05-26 18:05:22 +0000 |
commit | dbfc61a025214ccb9904df869243c82904629913 (patch) | |
tree | 8aa61f17f1e4ea51d25197164c6efef3fbf89d89 | |
parent | 66ec62955c0fdb9ad9e1fd040afbe291f148e680 (diff) | |
download | gdb-dbfc61a025214ccb9904df869243c82904629913.tar.gz |
2010-05-25 Michael Snyder <msnyder@vmware.com>
* gdb.ada/formatted_ref.exp: Replace send_gdb with gdb_test.
* gdb.asm/asm-source.exp: Replace send_gdb with gdb_test.
* gdb.base/a2-run.exp: Replace send_gdb with gdb_test.
* gdb.base/all-bin.exp: Replace send_gdb with gdb_test.
* gdb.base/annota1.exp: Replace send_gdb with gdb_test.
* gdb.base/annota3.exp: Replace send_gdb with gdb_test.
* gdb.base/assign.exp: Replace send_gdb with gdb_test.
* gdb.base/attach.exp: Replace send_gdb with gdb_test.
* gdb.base/bitfields.exp: Replace send_gdb with gdb_test.
* gdb.base/bitfields2.exp: Replace send_gdb with gdb_test.
* gdb.base/bitops.exp: Replace send_gdb with gdb_test.
-rw-r--r-- | gdb/testsuite/ChangeLog | 65 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/formatted_ref.exp | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.asm/asm-source.exp | 30 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/a2-run.exp | 29 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/all-bin.exp | 491 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/annota1.exp | 239 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/annota3.exp | 19 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/assign.exp | 527 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/attach.exp | 29 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/bitfields.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/bitfields2.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/bitops.exp | 393 |
12 files changed, 518 insertions, 1320 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a7bd51ad62f..823e513e9a2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2010-05-25 Michael Snyder <msnyder@vmware.com> + + * gdb.ada/formatted_ref.exp: Replace send_gdb with gdb_test. + + * gdb.asm/asm-source.exp: Replace send_gdb with gdb_test. + + * gdb.base/a2-run.exp: Replace send_gdb with gdb_test. + * gdb.base/all-bin.exp: Replace send_gdb with gdb_test. + * gdb.base/annota1.exp: Replace send_gdb with gdb_test. + * gdb.base/annota3.exp: Replace send_gdb with gdb_test. + * gdb.base/assign.exp: Replace send_gdb with gdb_test. + * gdb.base/attach.exp: Replace send_gdb with gdb_test. + * gdb.base/bitfields.exp: Replace send_gdb with gdb_test. + * gdb.base/bitfields2.exp: Replace send_gdb with gdb_test. + * gdb.base/bitops.exp: Replace send_gdb with gdb_test. + 2010-05-25 Tom Tromey <tromey@redhat.com> * gdb.base/macscp.exp: Add missing space after setup_kfail. @@ -36,6 +52,38 @@ 2010-05-25 Michael Snyder <msnyder@vmware.com> + * gdb.ada/formatted_ref.exp: Replace send_gdb with gdb_test. + + * gdb.asm/asm-source.exp: Replace send_gdb with gdb_test. + + * gdb.cp/annota2.exp: Replace send_gdb with gdb_test. + * gdb.cp/annota3.exp: Replace send_gdb with gdb_test. + * gdb.cp/anon-union.exp: Replace send_gdb with gdb_test. + * gdb.cp/cplusfuncs.exp: Replace send_gdb with gdb_test. + * gdb.cp/demangle.exp: Replace send_gdb with gdb_test. + * gdb.cp/formatted-ref.exp: Replace send_gdb with gdb_test. + * gdb.cp/local.exp: Replace send_gdb with gdb_test. + * gdb.cp/method.exp: Replace send_gdb with gdb_test. + * gdb.cp/misc.exp: Replace send_gdb with gdb_test. + * gdb.cp/namespace.exp: Replace send_gdb with gdb_test. + * gdb.cp/ovldbreak.exp: Replace send_gdb with gdb_test. + * gdb.cp/pr-1023.exp: Replace send_gdb with gdb_test. + * gdb.cp/ref-types.exp: Replace send_gdb with gdb_test. + * gdb.cp/templates.exp: Replace send_gdb with gdb_test. + * gdb.cp/userdef.exp: Replace send_gdb with gdb_test. + +2010-05-25 Michael Snyder <msnyder@vmware.com> + + * gdb.base/a2-run.exp: Replace send_gdb with gdb_test. + * gdb.base/all-bin.exp: Replace send_gdb with gdb_test. + * gdb.base/annota1.exp: Replace send_gdb with gdb_test. + * gdb.base/annota3.exp: Replace send_gdb with gdb_test. + * gdb.base/assign.exp: Replace send_gdb with gdb_test. + * gdb.base/attach.exp: Replace send_gdb with gdb_test. + * gdb.base/bitfields.exp: Replace send_gdb with gdb_test. + * gdb.base/bitfields2.exp: Replace send_gdb with gdb_test. + * gdb.base/bitops.exp: Replace send_gdb with gdb_test. + * gdb.base/break.exp: Replace send_gdb with gdb_test. * 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. @@ -74,6 +122,23 @@ * gdb.base/nodebug.exp: Replace send_gdb with gdb_test. * gdb.base/pointers.exp: Replace send_gdb with gdb_test. * gdb.base/ptype.exp: Replace send_gdb with gdb_test. + * gdb.base/relational.exp: Replace send_gdb with gdb_test. + * gdb.base/relocate.exp: Replace send_gdb with gdb_test. + * gdb.base/return.exp: Replace send_gdb with gdb_test. + * gdb.base/return2.exp: Replace send_gdb with gdb_test. + * gdb.base/sepdebug.exp: Replace send_gdb with gdb_test. + * gdb.base/setvar.exp: Replace send_gdb with gdb_test. + * gdb.base/shlib-call.exp: Replace send_gdb with gdb_test. + * gdb.base/shreloc.exp: Replace send_gdb with gdb_test. + * gdb.base/sigall.exp: Replace send_gdb with gdb_test. + * gdb.base/sigbpt.exp: Replace send_gdb with gdb_test. + * gdb.base/signull.exp: Replace send_gdb with gdb_test. + * gdb.base/so-impl-ld.exp:Replace send_gdb with gdb_test. + * gdb.base/varargs.exp: Replace send_gdb with gdb_test. + * gdb.base/volatile.exp: Replace send_gdb with gdb_test. + * gdb.base/watch_thread_num.exp: Replace send_gdb with gdb_test. + * gdb.base/watchpoint.exp: Replace send_gdb with gdb_test. + * gdb.base/whatis.exp: Replace send_gdb with gdb_test. 2010-05-25 Doug Evans <dje@google.com> diff --git a/gdb/testsuite/gdb.ada/formatted_ref.exp b/gdb/testsuite/gdb.ada/formatted_ref.exp index 0fe5c8dd7c7..ea118f689ac 100644 --- a/gdb/testsuite/gdb.ada/formatted_ref.exp +++ b/gdb/testsuite/gdb.ada/formatted_ref.exp @@ -46,16 +46,13 @@ proc get_address { var } { global expect_out global gdb_prompt - send_gdb "print $var'access\n" - gdb_expect { + gdb_test_multiple "print $var'access" "address of $var" { -re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" { return $expect_out(1,string) - } - timeout { - perror "couldn't find address of $var" - return "" } } + perror "couldn't find address of $var" + return "" } proc test_p_x { var val addr } { diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 3abe1eda016..d3a8f11d0c8 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -297,24 +297,16 @@ gdb_test "s" "$line_foo2\[ \]*.*" "step into foo2" # Test 'info target', and incidentally capture the entry point address. set entry_point 0 -send_gdb "info target\n" -gdb_expect { +gdb_test_multiple "info target" "info target" { -re "Symbols from .*asm-source.*Entry point: 0x(\[01232456789abcdefABCDEF\]+).*$gdb_prompt $" { set entry_point $expect_out(1,string) pass "info target" } - -re ".*$gdb_prompt $" { - fail "info target" - } - timeout { - fail "info target (timeout)" - } } # Capture the start symbol (may be '_start' or 'start') set entry_symbol "" -send_gdb "info symbol 0x$entry_point\n" -gdb_expect { +gdb_test_multiple "info symbol 0x$entry_point" "info symbol" { -re "info symbol 0x$entry_point\[\r\n\]+(\[^\r\n\]*) in section .*$gdb_prompt $" { # We match the echoed `info symbol' command here, to help us # reliably identify the beginning of the start symbol in the @@ -330,12 +322,6 @@ gdb_expect { set entry_symbol $expect_out(1,string) pass "info symbol" } - -re ".*$gdb_prompt $" { - fail "info symbol" - } - timeout { - fail "info symbol (timeout)" - } } # Now try a 'list' from the other source file. @@ -388,10 +374,9 @@ gdb_test "info source" \ # with dynamic linking, where the system's shared libc was compiled # with debugging info; for example, on Linux, this produces 47kb of # output. So we consume it as we go. -send_gdb "info sources\n" set seen_asmsrc_1 0 set seen_asmsrc_2 0 -gdb_expect { +gdb_test_multiple "info sources" "info sources" { -re "^\[^,\]*asmsrc1.s(, |\[\r\n\]+)" { set seen_asmsrc_1 1 exp_continue @@ -410,9 +395,6 @@ gdb_expect { fail "info sources" } } - timeout { - fail "info sources (timeout)" - } } @@ -431,8 +413,7 @@ gdb_test "return" "\#0 main .*$line_main_exit\[ \t\]+gdbasm_exit0" "return from # Disassemble something, check the output proc test_dis { command var } { global gdb_prompt - send_gdb "${command}\n" - gdb_expect { + gdb_test_multiple "${command}" "${command}" { -re "${var}.*:.*(Cannot access|Bad address)" { # The "disassembler" was only accessing the local # executable and that would cause attempts to disassemble @@ -442,9 +423,6 @@ proc test_dis { command var } { -re "${var}.*:.*${gdb_prompt}" { pass "${command}" } - timeout { - fail "${command} (timeout)" - } } } diff --git a/gdb/testsuite/gdb.base/a2-run.exp b/gdb/testsuite/gdb.base/a2-run.exp index 7cc05fad140..a1710e56573 100644 --- a/gdb/testsuite/gdb.base/a2-run.exp +++ b/gdb/testsuite/gdb.base/a2-run.exp @@ -150,11 +150,10 @@ if [istarget "*-*-vxworks*"] then { # Use "set args" command to specify no arguments as default and run again. if [istarget "*-*-vxworks*"] then { - send_gdb "set args main\n" + gdb_test_no_output "set args main" } else { - send_gdb "set args\n" + gdb_test_no_output "set args" } -gdb_expect -re "$gdb_prompt $" gdb_run_cmd @@ -192,11 +191,11 @@ if [istarget "*-*-vxworks*"] then { # Use "set args" command to specify an argument and run again. setup_xfail "mips-idt-*" if [istarget "*-*-vxworks*"] then { - send_gdb "set args vxmain \"6\"\n" + gdb_test_no_output "set args vxmain \"6\"" } else { - send_gdb "set args 6\n" + gdb_test_no_output "set args 6" } -gdb_expect -re "$gdb_prompt $" + gdb_run_cmd if [istarget "*-*-vxworks*"] then { @@ -234,22 +233,12 @@ if [istarget "*-*-vxworks*"] then { # GOAL: Test that shell is being used with "run". For remote debugging # targets, there is no guarantee that a "shell" (whatever that is) is used. if ![is_remote target] then { - send_gdb "run `echo 8`\n" - gdb_expect { - -re "Starting program.*40320.*$gdb_prompt $" { - pass "run \"$testfile\" with shell" - } - -re ".*$gdb_prompt $" { - fail "run \"$testfile\" with shell" - } - timeout { - fail "(timeout) run \"$testfile\" with shell" - } - } + gdb_test "run `echo 8`" \ + "Starting program.*40320.*" \ + "run \"$testfile\" with shell" } # Reset the default arguments for VxWorks if [istarget "*-*-vxworks*"] then { - send_gdb "set args main\n" - gdb_expect -re ".*$gdb_prompt $" {} + gdb_test_no_output "set args main" } diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp index b73c3aa1ce5..ed8c3774821 100644 --- a/gdb/testsuite/gdb.base/all-bin.exp +++ b/gdb/testsuite/gdb.base/all-bin.exp @@ -61,404 +61,125 @@ if ![runto_main] then { gdb_test "next" "return 0;" "continuing after dummy()" -send_gdb "print v_int+v_char\n" -gdb_expect { - -re ".*71.*$gdb_prompt $" { - pass "print value of v_int+v_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_char" } - timeout { fail "(timeout) print value of v_int+v_char" } - } - -send_gdb "print v_int+v_short\n" -gdb_expect { - -re ".*9.*$gdb_prompt $" { - pass "print value of v_int+v_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_short" } - timeout { fail "(timeout) print value of v_int+v_short" } - } - - -send_gdb "print v_int+v_signed_char\n" -gdb_expect { - -re ".*72.*$gdb_prompt $" { - pass "print value of v_int+v_signed_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_char" } - timeout { fail "(timeout) print value of v_int+v_signed_char" } - } - - -send_gdb "print v_int+v_unsigned_char\n" -gdb_expect { - -re ".*73.*$gdb_prompt $" { - pass "print value of v_int+v_unsigned_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_char" } - timeout { fail "(timeout) print value of v_int+v_unsigned_char" } - } - - -send_gdb "print v_int+v_signed_short\n" -gdb_expect { - -re ".*10.*$gdb_prompt $" { - pass "print value of v_int+v_signed_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_short" } - timeout { fail "(timeout) print value of v_int+v_signed_short" } - } - - -send_gdb "print v_int+v_unsigned_short\n" -gdb_expect { - -re ".*11.*$gdb_prompt $" { - pass "print value of v_int+v_unsigned_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_short" } - timeout { fail "(timeout) print value of v_int+v_unsigned_short" } - } - - -send_gdb "print v_int+v_signed_int\n" -gdb_expect { - -re ".*13.*$gdb_prompt $" { - pass "print value of v_int+v_signed_int" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_int" } - timeout { fail "(timeout) print value of v_int+v_signed_int" } - } - - -send_gdb "print v_int+v_unsigned_int\n" -gdb_expect { - -re ".*14.*$gdb_prompt $" { - pass "print value of v_int+v_unsigned_int" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_int" } - timeout { fail "(timeout) print value of v_int+v_unsigned_int" } - } - - -send_gdb "print v_int+v_long\n" -gdb_expect { - -re ".*15.*$gdb_prompt $" { - pass "print value of v_int+v_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_long" } - timeout { fail "(timeout) print value of v_int+v_long" } - } - - -send_gdb "print v_int+v_signed_long\n" -gdb_expect { - -re ".*16.*$gdb_prompt $" { - pass "print value of v_int+v_signed_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_long" } - timeout { fail "(timeout) print value of v_int+v_signed_long" } - } - - -send_gdb "print v_int+v_unsigned_long\n" -gdb_expect { - -re ".*17.*$gdb_prompt $" { - pass "print value of v_int+v_unsigned_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_long" } - timeout { fail "(timeout) print value of v_int+v_unsigned_long" } - } - - -send_gdb "print v_int+v_float\n" -gdb_expect { - -re ".*106.34343.*$gdb_prompt $" { - pass "print value of v_int+v_float" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_float" } - timeout { fail "(timeout) print value of v_int+v_float" } - } - - -send_gdb "print v_int+v_double\n" -gdb_expect { - -re ".*206.565.*$gdb_prompt $" { - pass "print value of v_int+v_double" - } - -re ".*$gdb_prompt $" { fail "print value of v_int+v_double" } - timeout { fail "(timeout) print value of v_int+v_double" } -} +gdb_test "print v_int+v_char" " = 71" "print value of v_int+v_char" + +gdb_test "print v_int+v_short" " = 9" "print value of v_int+v_short" + +gdb_test "print v_int+v_signed_char" " = 72" \ + "print value of v_int+v_signed_char" + +gdb_test "print v_int+v_unsigned_char" " = 73" \ + "print value of v_int+v_unsigned_char" + +gdb_test "print v_int+v_signed_short" " = 10" \ + "print value of v_int+v_signed_short" + +gdb_test "print v_int+v_unsigned_short" " = 11" \ + "print value of v_int+v_unsigned_short" + +gdb_test "print v_int+v_signed_int" " = 13" \ + "print value of v_int+v_signed_int" + +gdb_test "print v_int+v_unsigned_int" " = 14" \ + "print value of v_int+v_unsigned_int" + +gdb_test "print v_int+v_long" " = 15" "print value of v_int+v_long" + +gdb_test "print v_int+v_signed_long" " = 16" \ + "print value of v_int+v_signed_long" + +gdb_test "print v_int+v_unsigned_long" " = 17" \ + "print value of v_int+v_unsigned_long" + +gdb_test "print v_int+v_float" " = 106.34343.*" \ + "print value of v_int+v_float" + +gdb_test "print v_int+v_double" " = 206.565.*" \ + "print value of v_int+v_double" # # test the relational operators with mixed types # -send_gdb "print v_int <= v_char\n" -gdb_expect { - -re ".*1.*$gdb_prompt $" { - pass "print value of v_int<=v_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_char" } - timeout { fail "(timeout) print value of v_int<=v_char" } - } - -send_gdb "print v_int <= v_short\n" -gdb_expect { - -re ".*$false.*$gdb_prompt $" { - pass "print value of v_int<=v_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_short" } - timeout { fail "(timeout) print value of v_int<=v_short" } - } - - -send_gdb "print v_int <= v_signed_char\n" -gdb_expect { - -re ".*1.*$gdb_prompt $" { - pass "print value of v_int<=v_signed_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_char" } - timeout { fail "(timeout) print value of v_int<=v_signed_char" } - } - - -send_gdb "print v_int <= v_unsigned_char\n" -gdb_expect { - -re ".*1.*$gdb_prompt $" { - pass "print value of v_int<=v_unsigned_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_char" } - timeout { fail "(timeout) print value of v_int<=v_unsigned_char" } - } - - -send_gdb "print v_int <= v_signed_short\n" -gdb_expect { - -re ".*$false.*$gdb_prompt $" { - pass "print value of v_int<=v_signed_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_short" } - timeout { fail "(timeout) print value of v_int<=v_signed_short" } - } - - -send_gdb "print v_int <= v_unsigned_short\n" -gdb_expect { - -re ".*$false.*$gdb_prompt $" { - pass "print value of v_int<=v_unsigned_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_short" } - timeout { fail "(timeout) print value of v_int<=v_unsigned_short" } - } - - -send_gdb "print v_int <= v_signed_int\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int<=v_signed_int" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_int" } - timeout { fail "(timeout) print value of v_int<=v_signed_int" } - } - - -send_gdb "print v_int <= v_unsigned_int\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int<=v_unsigned_int" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_int" } - timeout { fail "(timeout) print value of v_int<=v_unsigned_int" } - } - - -send_gdb "print v_int <= v_long\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int<=v_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_long" } - timeout { fail "(timeout) print value of v_int<=v_long" } - } - - -send_gdb "print v_int <= v_signed_long\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int<=v_signed_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_long" } - timeout { fail "(timeout) print value of v_int<=v_signed_long" } - } - - -send_gdb "print v_int <= v_unsigned_long\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int<=v_unsigned_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_long" } - timeout { fail "(timeout) print value of v_int<=v_unsigned_long" } - } - - -send_gdb "print v_int <= v_float\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int<=v_float" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_float" } - timeout { fail "(timeout) print value of v_int<=v_float" } - } - - -send_gdb "print v_int <= v_double\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int<=v_double" - } - -re ".*$gdb_prompt $" { fail "print value of v_int<=v_double" } - timeout { fail "(timeout) print value of v_int<=v_double" } - } +gdb_test "print v_int <= v_char" " = 1" "print value of v_int<=v_char" + +gdb_test "print v_int <= v_short" " = $false" \ + "print value of v_int<=v_short" + +gdb_test "print v_int <= v_signed_char" " = 1" \ + "print value of v_int<=v_signed_char" + +gdb_test "print v_int <= v_unsigned_char" " = 1" \ + "print value of v_int<=v_unsigned_char" + +gdb_test "print v_int <= v_signed_short" " = $false" \ + "print value of v_int<=v_signed_short" + +gdb_test "print v_int <= v_unsigned_short" " = $false" \ + "print value of v_int<=v_unsigned_short" +gdb_test "print v_int <= v_signed_int" " = $true" \ + "print value of v_int<=v_signed_int" +gdb_test "print v_int <= v_unsigned_int" " = $true" \ + "print value of v_int<=v_unsigned_int" + +gdb_test "print v_int <= v_long" " = $true" "print value of v_int<=v_long" + +gdb_test "print v_int <= v_signed_long" " = $true" \ + "print value of v_int<=v_signed_long" + +gdb_test "print v_int <= v_unsigned_long" " = $true" \ + "print value of v_int<=v_unsigned_long" + +gdb_test "print v_int <= v_float" " = $true" "print value of v_int<=v_float" + +gdb_test "print v_int <= v_double" " = $true" \ + "print value of v_int<=v_double" # # test the logical operators with mixed types # -gdb_test "set variable v_char=0" "" "set v_char=0" -gdb_test "set variable v_double=0.0" "" "set v_double=0" -gdb_test "set variable v_unsigned_long=0" "" "set v_unsigned_long=0" - -send_gdb "print v_int && v_char\n" -gdb_expect { - -re ".*$false.*$gdb_prompt $" { - pass "print value of v_int&&v_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_char" } - timeout { fail "(timeout) print value of v_int&&v_char" } - } - -send_gdb "print v_int && v_short\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_short" } - timeout { fail "(timeout) print value of v_int&&v_short" } - } - - -send_gdb "print v_int && v_signed_char\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_signed_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_char" } - timeout { fail "(timeout) print value of v_int&&v_signed_char" } - } - - -send_gdb "print v_int && v_unsigned_char\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_unsigned_char" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_char" } - timeout { fail "(timeout) print value of v_int&&v_unsigned_char" } - } - - -send_gdb "print v_int && v_signed_short\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_signed_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_short" } - timeout { fail "(timeout) print value of v_int&&v_signed_short" } - } - - -send_gdb "print v_int && v_unsigned_short\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_unsigned_short" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_short" } - timeout { fail "(timeout) print value of v_int&&v_unsigned_short" } - } - - -send_gdb "print v_int && v_signed_int\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_signed_int" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_int" } - timeout { fail "(timeout) print value of v_int&&v_signed_int" } - } - - -send_gdb "print v_int && v_unsigned_int\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_unsigned_int" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_int" } - timeout { fail "(timeout) print value of v_int&&v_unsigned_int" } - } - - -send_gdb "print v_int && v_long\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_long" } - timeout { fail "(timeout) print value of v_int&&v_long" } - } - - -send_gdb "print v_int && v_signed_long\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_signed_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_long" } - timeout { fail "(timeout) print value of v_int&&v_signed_long" } - } - - -send_gdb "print v_int && v_unsigned_long\n" -gdb_expect { - -re ".*$false.*$gdb_prompt $" { - pass "print value of v_int&&v_unsigned_long" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_long" } - timeout { fail "(timeout) print value of v_int&&v_unsigned_long" } - } - - -send_gdb "print v_int && v_float\n" -gdb_expect { - -re ".*$true.*$gdb_prompt $" { - pass "print value of v_int&&v_float" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_float" } - timeout { fail "(timeout) print value of v_int&&v_float" } - } - - -send_gdb "print v_int && v_double\n" -gdb_expect { - -re ".*$false.*$gdb_prompt $" { - pass "print value of v_int&&v_double" - } - -re ".*$gdb_prompt $" { fail "print value of v_int&&v_double" } - timeout { fail "(timeout) print value of v_int&&v_double" } - } +gdb_test_no_output "set variable v_char=0" "set v_char=0" +gdb_test_no_output "set variable v_double=0.0" "set v_double=0" +gdb_test_no_output "set variable v_unsigned_long=0" "set v_unsigned_long=0" + +gdb_test "print v_int && v_char" " = $false" "print value of v_int&&v_char" + +gdb_test "print v_int && v_short" " = $true" "print value of v_int&&v_short" + +gdb_test "print v_int && v_signed_char" " = $true" \ + "print value of v_int&&v_signed_char" + +gdb_test "print v_int && v_unsigned_char" " = $true" \ + "print value of v_int&&v_unsigned_char" + +gdb_test "print v_int && v_signed_short" " = $true" \ + "print value of v_int&&v_signed_short" + +gdb_test "print v_int && v_unsigned_short" " = $true" \ + "print value of v_int&&v_unsigned_short" + +gdb_test "print v_int && v_signed_int" " = $true" \ + "print value of v_int&&v_signed_int" + +gdb_test "print v_int && v_unsigned_int" " = $true" \ + "print value of v_int&&v_unsigned_int" + +gdb_test "print v_int && v_long" " = $true" "print value of v_int&&v_long" + +gdb_test "print v_int && v_signed_long" " = $true" \ + "print value of v_int&&v_signed_long" + +gdb_test "print v_int && v_unsigned_long" " = $false" \ + "print value of v_int&&v_unsigned_long" + +gdb_test "print v_int && v_float" " = $true" "print value of v_int&&v_float" + +gdb_test "print v_int && v_double" " = $false" \ + "print value of v_int&&v_double" diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index 241d46b526e..eeb70d70b9e 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -61,8 +61,7 @@ set main_line 32 # The commands we test here produce many lines of output; disable "press # <return> to continue" prompts. -send_gdb "set height 0\n" -gdb_expect -re "$gdb_prompt $" +gdb_test_no_output "set height 0" # # break at main @@ -113,15 +112,14 @@ gdb_expect { # annotate-record # annotate-breakpoints-table-end # -send_gdb "info break\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ - {pass "breakpoint info"} - -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" \ - { setup_xfail "*-*-*" 1270 - fail "breakpoint info"} - -re ".*$gdb_prompt$" { fail "breakpoint info" } - timeout { fail "breakpoint info (timeout)" } +gdb_test_multiple "info break" "breakpoint info" { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at ${escapedsrcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" { + pass "breakpoint info" + } + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-headers\r\n\r\n\032\032field 0\r\nNum \r\n\032\032field 1\r\nType \r\n\032\032field 2\r\nDisp \r\n\032\032field 3\r\nEnb \r\n\032\032field 4\r\nAddress +\r\n\032\032field 5\r\nWhat\r\n\r\n\032\032breakpoints-table\r\n\r\n\032\032record\r\n\r\n\032\032field 0\r\n1 \r\n\032\032field 1\r\nbreakpoint \r\n\032\032field 2\r\nkeep \r\n\032\032field 3\r\ny \r\n\032\032field 4\r\n$hex +\r\n\032\032field 5\r\nin main at .*${srcfile}:$main_line\r\n\r\n\032\032breakpoints-table-end\r\n$gdb_prompt$" { + setup_xfail "*-*-*" 1270 + fail "breakpoint info" + } } @@ -145,18 +143,11 @@ gdb_expect { # #exp_internal 1 set binexp [string_to_regexp $binfile] -send_gdb "run\n" -gdb_expect { +gdb_test_multiple "run" "run until main breakpoint" { -re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)+\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" { pass "run until main breakpoint" } - -re ".*$gdb_prompt$" { - fail "run until main breakpoint" - } - timeout { - fail "run until main breakpoint (timeout)" - } - } +} #exp_internal 0 #exit 0 @@ -165,10 +156,10 @@ gdb_expect { # We don't care about the annotated output for this operation, it is the same as # the one produced by run above # -send_gdb "next\n" -gdb_expect { - -re ".*$gdb_prompt$" { pass "go after array init line" } - timeout { fail "go after array init line (timeout)" } +gdb_test_multiple "next" "go after array init line" { + -re "source .*annota1.c.*$gdb_prompt$" { + pass "go after array init line" + } } @@ -184,12 +175,10 @@ gdb_expect { # FIXME: annotate-value-begin and annotate-value-end not tested (the gdb output # command would cause them to be used) # -send_gdb "print my_array\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n.\r\n\032\032array-section-begin 0 -\r\n1\r\n\032\032elt\r\n, 2\r\n\032\032elt\r\n, 3\r\n\032\032elt\r\n\r\n\032\032array-section-end\r\n.\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" \ - { pass "print array" } - -re ".*$gdb_prompt$" { fail "print array" } - timeout { fail "print array (timeout)" } +gdb_test_multiple "print my_array" "print array" { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032value-history-begin 1 -\r\n.*= \r\n\032\032value-history-value\r\n.\r\n\032\032array-section-begin 0 -\r\n1\r\n\032\032elt\r\n, 2\r\n\032\032elt\r\n, 3\r\n\032\032elt\r\n\r\n\032\032array-section-end\r\n.\r\n\r\n\032\032value-history-end\r\n$gdb_prompt$" { + pass "print array" + } } @@ -200,12 +189,10 @@ gdb_expect { # #exp_internal 1 -send_gdb "print non_existent_value\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032error-begin\r\nNo symbol \"non_existent_value\" in current context.\r\n\r\n\032\032error\r\n$gdb_prompt$" \ - { pass "print non_existent_value" } - -re ".*$gdb_prompt$" { fail "print non_existent_value" } - timeout { fail "print non_existent_value (timeout)" } +gdb_test_multiple "print non_existent_value" "print non_existent_value" { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032error-begin\r\nNo symbol \"non_existent_value\" in current context.\r\n\r\n\032\032error\r\n$gdb_prompt$" { + pass "print non_existent_value" + } } @@ -213,25 +200,22 @@ gdb_expect { # break at signal handler. So that, once we are in the sig handler, if we do a bt # we can test annotate-signal-handler-caller # -send_gdb "break handle_USR1\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" \ - { pass "break handle_USR1" } - -re ".*$gdb_prompt$" { fail "break handle_USR1" } - timeout { fail "break handle_USR1 (timeout)" } +gdb_test_multiple "break handle_USR1" "break handle_USR1" { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex: file.*$srcfile, line.*\r\n$gdb_prompt$" { + pass "break handle_USR1" + } } # # break at printf. When we are stopped at printf, we can test # -send_gdb "break printf\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \ - { pass "break printf" } - -re "\r\n\032\032post-prompt\r\nwarning: Breakpoint address adjusted from $hex to $hex.\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" \ - { pass "break printf" } - -re ".*$gdb_prompt$" { fail "break printf" } - timeout { fail "break printf (timeout)" } +gdb_test_multiple "break printf" "break printf" { + -re "\r\n\032\032post-prompt\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" { + pass "break printf" + } + -re "\r\n\032\032post-prompt\r\nwarning: Breakpoint address adjusted from $hex to $hex.\r\n\r\n\032\032breakpoints-invalid\r\nBreakpoint.*at $hex.*$gdb_prompt$" { + pass "break printf" + } } # @@ -255,16 +239,17 @@ gdb_test_multiple "continue" "continue to printf" { # annotate-frame-address-end # set pat_begin "\r\n\032\032post-prompt\r\n\r\n\032\032frame-begin 0 $hex\r\n.0 \r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n \\(.*frame-end\r\n\r\n\032\032frame-begin 1 $hex\r\n.1 \r\n\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n" + set pat_end "\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032frame-end\r\n(\r\n\032\032frame-begin .*\r\n\r\n\032\032frame-end\r\n)*$gdb_prompt$" -send_gdb "backtrace\n" -gdb_expect { - -re "$pat_begin$escapedsrcfile$pat_end" - { pass "backtrace from shlibrary" } - -re "$pat_begin.*$srcfile$pat_end" - { setup_xfail "*-*-*" 1270 - fail "backtrace from shlibrary" } - -re ".*$gdb_prompt$" { fail "backtrace from shlibrary" } - timeout { fail "backtrace from shlibrary (timeout)" } + +gdb_test_multiple "backtrace" "backtrace from shlibrary" { + -re "$pat_begin$escapedsrcfile$pat_end" { + pass "backtrace from shlibrary" + } + -re "$pat_begin.*$srcfile$pat_end" { + setup_xfail "*-*-*" 1270 + fail "backtrace from shlibrary" + } } @@ -280,71 +265,60 @@ if [target_info exists gdb,nosignals] { unsupported "send SIGUSR1" unsupported "backtrace @ signal handler" } else { - send_gdb "signal SIGUSR1\n" - gdb_expect { - -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ - { pass "send SIGUSR1" } - -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ - { setup_xfail "*-*-*" 1270 - fail "send SIGUSR1" } - -re ".*$gdb_prompt$" { fail "send SIGUSR1" } - timeout { fail "send SIGUSR1 (timeout)" } + gdb_test_multiple "signal SIGUSR1" "send SIGUSR1" { + -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" { + pass "send SIGUSR1" + } + -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" { + setup_xfail "*-*-*" 1270 + fail "send SIGUSR1" + } } # # test: # annotate-signal-handler-caller # - send_gdb "backtrace\n" - gdb_expect { + gdb_test_multiple "backtrace" "backtrace @ signal handler" { -re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)+\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" { pass "backtrace @ signal handler" } - -re ".*$gdb_prompt$" { fail "backtrace @ signal handler" } - timeout { fail "backtrace @ signal handler (timeout)" } } } # # delete all the breakpoints # -send_gdb "delete 1\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ - { pass "delete bp 1" } - -re ".*$gdb_prompt$" { fail "delete bp 1" } - timeout { fail "delete bp 1 (timeout)" } +gdb_test_multiple "delete 1" "delete bp 1" { + -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" { + pass "delete bp 1" + } } -send_gdb "delete 2\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ - { pass "delete bp 2" } - -re ".*$gdb_prompt$" { fail "delete bp 2 " } - timeout { fail "delete bp 2 (timeout)" } +gdb_test_multiple "delete 2" "delete bp 2" { + -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" { + pass "delete bp 2" + } } -send_gdb "delete 3\n" -gdb_expect { - -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" \ - { pass "delete bp 3" } - -re ".*$gdb_prompt$" { fail "delete bp 3" } - timeout { fail "delete bp 3 (timeout)" } +gdb_test_multiple "delete 3" "delete bp 3" { + -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" { + pass "delete bp 3" + } } # # break at main, after value is initialized. This is in preparation # to test the annotate output for the display command. # -send_gdb "break main\n" -gdb_expect { - -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*$gdb_prompt$" \ - { pass "break at 28" } - -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*$gdb_prompt$" \ - { setup_xfail "*-*-*" 1270 - fail "break at 28" } - -re ".*$gdb_prompt$" { fail "break at 28" } - timeout { fail "break at 28 (timeout)" } +gdb_test_multiple "break main" "break at 28" { + -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${escapedsrcfile}, line $main_line.*$gdb_prompt$" { + pass "break at 28" + } + -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*${srcfile}, line $main_line.*$gdb_prompt$" { + setup_xfail "*-*-*" 1270 + fail "break at 28" + } } # @@ -357,12 +331,10 @@ gdb_expect { # annotate-display-end # FIXME: annotate-display-value not tested # -send_gdb "display value\n" -gdb_expect { - -re "post-prompt\r\n\r\n\032\032display-begin\r\n1\r\n\032\032display-number-end\r\n: \r\n\032\032display-format\r\n\r\n\032\032display-expression\r\nvalue\r\n\032\032display-expression-end\r\n = \r\n\032\032display-expression\r\n7\r\n\r\n\032\032display-end\r\n$gdb_prompt$" \ - { pass "set up display" } - -re ".*$gdb_prompt$" { fail "set up display" } - timeout { fail "set up display (timeout)" } +gdb_test_multiple "display value" "set up display" { + -re "post-prompt\r\n\r\n\032\032display-begin\r\n1\r\n\032\032display-number-end\r\n: \r\n\032\032display-format\r\n\r\n\032\032display-expression\r\nvalue\r\n\032\032display-expression-end\r\n = \r\n\032\032display-expression\r\n7\r\n\r\n\032\032display-end\r\n$gdb_prompt$" { + pass "set up display" + } } @@ -388,49 +360,36 @@ gdb_expect { # Test that breakpoints-invalid is issued once and only once for # breakpoint ignore count changes, after annotation stopped. # -send_gdb "break 46\n" -gdb_expect { +gdb_test_multiple "break 46" "break at 46" { -re "Breakpoint 5 at $hex: file .*$srcfile, line 46.*$gdb_prompt$" { pass "break at 46" } - -re ".*$gdb_prompt$" { fail "break at 46" } - timeout { fail "break at 46 (timeout)" } } -send_gdb "ignore 5 4\n" -gdb_expect { +gdb_test_multiple "ignore 5 4" "ignore 5 4" { -re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" { pass "ignore 5 4" } - -re ".*$gdb_prompt$" { fail "ignore 5 4" } - timeout { fail "ignore 5 4 (timeout)" } } -send_gdb "continue\n" -gdb_expect { +gdb_test_multiple "continue" "annotate ignore count change" { -re ".*$srcfile:46:.*\032\032stopped\r\n\r\n\032\032breakpoints-invalid\r\n$gdb_prompt$" { pass "annotate ignore count change" } - -re ".*$gdb_prompt$" { fail "annotate ignore count change" } - timeout { fail "annotate ignore count change (timeout)" } } # check that ignore command is working, or the above can provide # misleading assurance ... -send_gdb "next\n" -gdb_expect { - -re "$gdb_prompt$" {} - timeout { fail "next to exit loop" } +gdb_test_multiple "next" "next to exit loop" { + -re "source .*annota1.c.*$gdb_prompt$" { + } } -send_gdb "next\n" -gdb_expect { +gdb_test_multiple "next" "breakpoint ignore count" { -re ".*$srcfile:49:.*$gdb_prompt$" { pass "breakpoint ignore count" } - -re ".*$gdb_prompt$" { fail "breakpoint ignore count" } - timeout { fail "breakpoint ignore count (timeout)" } } # @@ -456,12 +415,10 @@ if [target_info exists gdb,nosignals] { unsupported "signal sent" } else { setup_xfail hppa*-*-hpux11* - send_gdb "signal SIGTRAP\n" - gdb_expect { - -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ - { pass "signal sent" } - -re ".*$gdb_prompt$" { fail "signal sent" } - timeout { fail "signal sent (timeout)" } + gdb_test_multiple "signal SIGTRAP" "signal sent" { + -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" { + pass "signal sent" + } } } @@ -503,29 +460,25 @@ proc thread_test {} { set gdb_prompt \ "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n" - send_gdb "set annotate 2\n" - gdb_expect { - -re "set annotate 2\r\n$gdb_prompt$" {} + gdb_test_multiple "set annotate 2" "" { + -re "set annotate 2\r\n$gdb_prompt$" { + } } - send_gdb "next 2\n" - gdb_expect { + gdb_test_multiple "next 2" "new thread" { -re ".*\032\032new-thread" { - pass "new thread" + pass "new thread" } - timeout { fail "new thread (timeout)" } } } } proc thread_switch {} { - send_gdb "thread 1\n" - gdb_expect { - -re ".*\032\032thread-changed" { + gdb_test_multiple "thread 1" "thread switch" { + -re ".*\032\032thread-changed" { pass "thread switch" - } - timeout { fail "thread switch (timeout)" } } + } } thread_test diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp index e8b06577555..574a86a784b 100644 --- a/gdb/testsuite/gdb.base/annota3.exp +++ b/gdb/testsuite/gdb.base/annota3.exp @@ -61,8 +61,7 @@ set main_line 32 # The commands we test here produce many lines of output; disable "press # <return> to continue" prompts. -send_gdb "set height 0\n" -gdb_expect -re "$gdb_prompt $" +gdb_test_no_output "set height 0" # # break at main @@ -100,26 +99,18 @@ gdb_expect_list "annotation set at level 3" "\r\n$gdb_prompt$" { # # if construct: # -send_gdb "if 1\n" -gdb_expect { +gdb_test_multiple "if 1" "start if construct" { -re "^if 1\r\n\r\n\032\032post-prompt\r\n\r\n\032\032pre-commands\r\n >\r\n\032\032commands\r\n$" { pass "start if construct" } - -re ".*\032\032commands\r\n" { - fail "start if construct" - } - timeout { fail "start if construct (timeout)" } } -send_gdb "end\n" -gdb_expect { + +gdb_test_multiple "end" "end if construct" { -re "^end\r\n\r\n\032\032post-commands\r\n$gdb_prompt$" { pass "end if construct" } - -re ".*$gdb_prompt$" { - fail "end if construct" - } - timeout { fail "end if construct (timeout)" } } + # # info break: # diff --git a/gdb/testsuite/gdb.base/assign.exp b/gdb/testsuite/gdb.base/assign.exp index 4eda7d61554..6b9d2b45501 100644 --- a/gdb/testsuite/gdb.base/assign.exp +++ b/gdb/testsuite/gdb.base/assign.exp @@ -57,385 +57,152 @@ if ![runto_main] then { gdb_test "next" "return 0;" "continuing after dummy()" -send_gdb "print v_int=57\n" -gdb_expect { - -re ".*57.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*57.*$gdb_prompt $" { - pass "v_int=57" - } - -re ".*$gdb_prompt $" { fail "v_int=57" } - timeout { fail "(timeout) v_int=57" } - } - } - -re ".*$gdb_prompt $" { fail "v_int=57" } - timeout { fail "(timeout) v_int=57" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6" - - -send_gdb "print v_int+=57\n" -gdb_expect { - -re ".*63.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*63.*$gdb_prompt $" { - pass "v_int+=57" - } - -re ".*$gdb_prompt $" { fail "v_int+=57" } - timeout { fail "(timeout) v_int+=57" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=57" } - timeout { fail "(timeout) v_int+=57" } - } - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (2)" - -send_gdb "print v_int-=57\n" -gdb_expect { - -re ".*-51.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*-51.*$gdb_prompt $" { - pass "v_int-=57" - } - -re ".*$gdb_prompt $" { fail "v_int-=57" } - timeout { fail "(timeout) v_int-=57" } - } - } - -re ".*$gdb_prompt $" { fail "v_int-=57" } - timeout { fail "(timeout) v_int-=57" } - } - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (3)" - -send_gdb "print v_int*=5\n" -gdb_expect { - -re ".*30.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*30.*$gdb_prompt $" { - pass "v_int*=5" - } - -re ".*$gdb_prompt $" { fail "v_int*=5" } - timeout { fail "(timeout) v_int*=5" } - } - } - -re ".*$gdb_prompt $" { fail "v_int*=5" } - timeout { fail "(timeout) v_int*=5" } - } - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (4)" - -send_gdb "print v_int/=4\n" -gdb_expect { - -re ".*1.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*1.*$gdb_prompt $" { - pass "v_int/=4" - } - -re ".*$gdb_prompt $" { fail "v_int/=4" } - timeout { fail "(timeout) v_int/=4" } - } - } - -re ".*$gdb_prompt $" { fail "v_int/=4" } - timeout { fail "(timeout) v_int/=4" } - } - - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (5)" - -send_gdb "print v_int%=4\n" -gdb_expect { - -re ".*2.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*2.*$gdb_prompt $" { - pass "v_int%=4" - } - -re ".*$gdb_prompt $" { fail "v_int%=4" } - timeout { fail "(timeout) v_int%=4" } - } - } - -re ".*$gdb_prompt $" { fail "v_int%=4" } - timeout { fail "(timeout) v_int%=4" } - } - - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (6)" - - - -send_gdb "print v_int+=v_char\n" -gdb_expect { - -re ".*71.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*71.*$gdb_prompt $" { - pass "v_int+=char" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_char" } - timeout { fail "(timeout) v_int+=v_char" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_char" } - timeout { fail "(timeout) v_int+=v_char" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (7)" - - - -send_gdb "print v_int+=v_signed_char\n" -gdb_expect { - -re ".*72.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*72.*$gdb_prompt $" { - pass "v_int+=signed_char" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_char" } - timeout { fail "(timeout) v_int+=v_signed_char" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_char" } - timeout { fail "(timeout) v_int+=v_signed_char" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (8)" - - - -send_gdb "print v_int+=v_unsigned_char\n" -gdb_expect { - -re ".*73.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*73.*$gdb_prompt $" { - pass "v_int+=unsigned_char" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" } - timeout { fail "(timeout) v_int+=v_unsigned_char" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" } - timeout { fail "(timeout) v_int+=v_unsigned_char" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (9)" - - - -send_gdb "print v_int+=v_short\n" -gdb_expect { - -re ".*9.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*9.*$gdb_prompt $" { - pass "v_int+=short" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_short" } - timeout { fail "(timeout) v_int+=v_short" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_short" } - timeout { fail "(timeout) v_int+=v_short" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (10)" - - - -send_gdb "print v_int+=v_signed_short\n" -gdb_expect { - -re ".*10.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*10.*$gdb_prompt $" { - pass "v_int+=signed_short" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_short" } - timeout { fail "(timeout) v_int+=v_signed_short" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_short" } - timeout { fail "(timeout) v_int+=v_signed_short" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (11)" - - - -send_gdb "print v_int+=v_unsigned_short\n" -gdb_expect { - -re ".*11.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*11.*$gdb_prompt $" { - pass "v_int=+unsigned_short" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" } - timeout { fail "(timeout) v_int+=v_unsigned_short" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" } - timeout { fail "(timeout) v_int+=v_unsigned_short" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (12)" - - - -send_gdb "print v_int+=v_signed_int\n" -gdb_expect { - -re ".*13.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*13.*$gdb_prompt $" { - pass "v_int+=signed_int" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_int" } - timeout { fail "(timeout) v_int+=v_signed_int" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_int" } - timeout { fail "(timeout) v_int+=v_signed_int" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (13)" - - - -send_gdb "print v_int+=v_unsigned_int\n" -gdb_expect { - -re ".*14.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*14.*$gdb_prompt $" { - pass "v_int+=unsigned_int" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" } - timeout { fail "(timeout) v_int+=v_unsigned_int" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" } - timeout { fail "(timeout) v_int+=v_unsigned_int" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (14)" - - - -send_gdb "print v_int+=v_long\n" -gdb_expect { - -re ".*15.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*15.*$gdb_prompt $" { - pass "v_int+=long" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_long" } - timeout { fail "(timeout) v_int+=v_long" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_long" } - timeout { fail "(timeout) v_int+=v_long" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (15)" - - - -send_gdb "print v_int+=v_signed_long\n" -gdb_expect { - -re ".*16.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*16.*$gdb_prompt $" { - pass "v_int+=signed_long" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_long" } - timeout { fail "(timeout) v_int+=v_signed_long" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_signed_long" } - timeout { fail "(timeout) v_int+=v_signed_long" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (16)" - - -send_gdb "print v_int+=v_unsigned_long\n" -gdb_expect { - -re ".*17.*$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*17.*$gdb_prompt $" { - pass "v_int+=unsigned_long" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" } - timeout { fail "(timeout) v_int+=v_unsigned_long" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" } - timeout { fail "(timeout) v_int+=v_unsigned_long" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (17)" - - -send_gdb "print v_int+=v_float\n" -gdb_expect { - -re ".*106\r\n$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*106\r\n$gdb_prompt $" { - pass "v_int+=v_float" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_float" } - timeout { fail "(timeout) v_int+=v_float" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_float" } - timeout { fail "(timeout) v_int+=v_float" } - } - - -gdb_test "set variable v_int = 6" "" "set v_int to 6 (18)" - - -send_gdb "print v_int+=v_double\n" -gdb_expect { - -re ".*206\r\n$gdb_prompt $" { - send_gdb "print v_int\n" - gdb_expect { - -re ".*206\r\n$gdb_prompt $" { - pass "v_int+=double" - } - -re ".*$gdb_prompt $" { fail "v_int+=v_double" } - timeout { fail "(timeout) v_int+=v_double" } - } - } - -re ".*$gdb_prompt $" { fail "v_int+=v_double" } - timeout { fail "(timeout) v_int+=v_double" } - } +gdb_test_multiple "print v_int=57" "v_int=57" { + -re " = 57.*$gdb_prompt $" { + gdb_test "print v_int" " = 57" "v_int=57" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6" + +gdb_test_multiple "print v_int+=57" "v_int+=57" { + -re " = 63.*$gdb_prompt $" { + gdb_test "print v_int" " = 63" "v_int+=57" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (2)" + +gdb_test_multiple "print v_int-=57" "v_int-=57" { + -re " = -51.*$gdb_prompt $" { + gdb_test "print v_int" " = -51" "v_int-=57" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (3)" + +gdb_test_multiple "print v_int*=5" "v_int*=5" { + -re " = 30.*$gdb_prompt $" { + gdb_test "print v_int" " = 30" "v_int*=5" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (4)" + +gdb_test_multiple "print v_int/=4" "v_int/=4" { + -re " = 1.*$gdb_prompt $" { + gdb_test "print v_int" " = 1" "v_int/=4" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (5)" + +gdb_test_multiple "print v_int%=4" "v_int%=4" { + -re " = 2.*$gdb_prompt $" { + gdb_test "print v_int" " = 2" "v_int%=4" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (6)" + +gdb_test_multiple "print v_int+=v_char" "v_int+=char" { + -re " = 71.*$gdb_prompt $" { + gdb_test "print v_int" " = 71" "v_int+=char" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (7)" + +gdb_test_multiple "print v_int+=v_signed_char" "v_int+=signed_char" { + -re " = 72.*$gdb_prompt $" { + gdb_test "print v_int" " = 72" "v_int+=signed_char" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (8)" + +gdb_test_multiple "print v_int+=v_unsigned_char" "v_int+=unsigned_char" { + -re " = 73.*$gdb_prompt $" { + gdb_test "print v_int" " = 73" "v_int+=unsigned_char" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (9)" + +gdb_test_multiple "print v_int+=v_short" "v_int+=short" { + -re " = 9.*$gdb_prompt $" { + gdb_test "print v_int" " = 9" "v_int+=short" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (10)" + +gdb_test_multiple "print v_int+=v_signed_short" "v_int+=signed_short" { + -re " = 10.*$gdb_prompt $" { + gdb_test "print v_int" " = 10" "v_int+=signed_short" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (11)" + +gdb_test_multiple "print v_int+=v_unsigned_short" "v_int=+unsigned_short" { + -re " = 11.*$gdb_prompt $" { + gdb_test "print v_int" " = 11" "v_int=+unsigned_short" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (12)" + +gdb_test_multiple "print v_int+=v_signed_int" "v_int+=signed_int" { + -re " = 13.*$gdb_prompt $" { + gdb_test "print v_int" " = 13" "v_int+=signed_int" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (13)" + +gdb_test_multiple "print v_int+=v_unsigned_int" "v_int+=unsigned_int" { + -re " = 14.*$gdb_prompt $" { + gdb_test "print v_int" " = 14" "v_int+=unsigned_int" + } +} +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (14)" +gdb_test_multiple "print v_int+=v_long" "v_int+=long" { + -re " = 15.*$gdb_prompt $" { + gdb_test "print v_int" " = 15" "v_int+=long" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (15)" + +gdb_test_multiple "print v_int+=v_signed_long" "v_int+=signed_long" { + -re " = 16.*$gdb_prompt $" { + gdb_test "print v_int" " = 16" "v_int+=signed_long" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (16)" + +gdb_test_multiple "print v_int+=v_unsigned_long" "v_int+=unsigned_long" { + -re " = 17.*$gdb_prompt $" { + gdb_test "print v_int" " = 17" "v_int+=unsigned_long" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (17)" + +gdb_test_multiple "print v_int+=v_float" "v_int+=v_float" { + -re " = 106.*$gdb_prompt $" { + gdb_test "print v_int" " = 106" "v_int+=v_float" + } +} + +gdb_test_no_output "set variable v_int = 6" "set v_int to 6 (18)" + +gdb_test_multiple "print v_int+=v_double" "v_int+=double" { + -re " = 206.*$gdb_prompt $" { + gdb_test "print v_int" " = 206" "v_int+=double" + } +} diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index b19e74bd8d6..0d0d8496a83 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -250,30 +250,11 @@ proc do_attach_tests {} { # Verify that the modification really happened. - send_gdb "tbreak 19\n" - gdb_expect { - -re "Temporary breakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" { - pass "after attach2, set tbreak postloop" - } - -re "$gdb_prompt $" { - fail "after attach2, set tbreak postloop" - } - timeout { - fail "(timeout) after attach2, set tbreak postloop" - } - } - send_gdb "continue\n" - gdb_expect { - -re "main.*at.*$srcfile:19.*$gdb_prompt $" { - pass "after attach2, reach tbreak postloop" - } - -re "$gdb_prompt $" { - fail "after attach2, reach tbreak postloop" - } - timeout { - fail "(timeout) after attach2, reach tbreak postloop" - } - } + gdb_test "tbreak 19" "Temporary breakpoint .*at.*$srcfile, line 19.*" \ + "after attach2, set tbreak postloop" + + gdb_test "continue" "main.*at.*$srcfile:19.*" \ + "after attach2, reach tbreak postloop" # Allow the test process to exit, to cleanup after ourselves. diff --git a/gdb/testsuite/gdb.base/bitfields.exp b/gdb/testsuite/gdb.base/bitfields.exp index 1a8e14273db..994a5c1f150 100644 --- a/gdb/testsuite/gdb.base/bitfields.exp +++ b/gdb/testsuite/gdb.base/bitfields.exp @@ -197,8 +197,7 @@ proc bitfield_signedness {} { # Determine if the target has signed bitfields so we can xfail the # the signed bitfield tests if it doesn't. - send_gdb "print i\n" - gdb_expect { + gdb_test_multiple "print i" "determining signed-ness of bitfields" { -re ".* = -256.*$gdb_prompt $" { pass "determining signed-ness of bitfields" } @@ -255,7 +254,7 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test_no_output "set print sevenbit-strings" bitfield_uniqueness if [istarget "mips-idt-*"] then { diff --git a/gdb/testsuite/gdb.base/bitfields2.exp b/gdb/testsuite/gdb.base/bitfields2.exp index 68ab3a9658d..c854de8e661 100644 --- a/gdb/testsuite/gdb.base/bitfields2.exp +++ b/gdb/testsuite/gdb.base/bitfields2.exp @@ -288,7 +288,7 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" +gdb_test_no_output "set print sevenbit-strings" runto_main bitfield_uniqueness diff --git a/gdb/testsuite/gdb.base/bitops.exp b/gdb/testsuite/gdb.base/bitops.exp index 634d4a67b0f..12c8f3b60bc 100644 --- a/gdb/testsuite/gdb.base/bitops.exp +++ b/gdb/testsuite/gdb.base/bitops.exp @@ -37,323 +37,80 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir -send_gdb "print !1\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of !1" - } - -re ".*$gdb_prompt $" { fail "print value of !1" } - timeout { fail "(timeout) print value of !1" } - } - - -send_gdb "print !0\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { - pass "print value of !0" - } - -re ".*$gdb_prompt $" { fail "print value of !0" } - timeout { fail "(timeout) print value of !0" } - } - - -send_gdb "print !100\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of !100" - } - -re ".*$gdb_prompt $" { fail "print value of !100" } - timeout { fail "(timeout) print value of !100" } - } - - -send_gdb "print !1000\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of !1000" - } - -re ".*$gdb_prompt $" { fail "print value of !1000" } - timeout { fail "(timeout) print value of !1000" } - } - - -send_gdb "print !10\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of !10" - } - -re ".*$gdb_prompt $" { fail "print value of !10" } - timeout { fail "(timeout) print value of !10" } - } - - -send_gdb "print !2\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of !2 " - } - -re ".*$gdb_prompt $" { fail "print value of !2" } - timeout { fail "(timeout) print value of !2" } - } - - -send_gdb "print 10 | 5\n" -gdb_expect { - -re ".\[0-9\]* = 15.*$gdb_prompt $" { - pass "print value of 10 | 5" - } - -re ".*$gdb_prompt $" { fail "print value of 10 | 5" } - timeout { fail "(timeout) print value of 10 | 5" } - } - - -send_gdb "print 10 & 5\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 10 & 5" - } - -re ".*$gdb_prompt $" { fail "print value of 10 & 5" } - timeout { fail "(timeout) print value of 10 & 5" } - } - - -send_gdb "print 10 ^ 5\n" -gdb_expect { - -re ".\[0-9\]* = 15.*$gdb_prompt $" { - pass "print value of 10 ^ 5" - } - -re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" } - timeout { fail "(timeout) print value of 10 ^ 5" } - } - - -send_gdb "print -!0\n" -gdb_expect { - -re ".\[0-9\]* = -1.*$gdb_prompt $" { - pass "print value of -!0" - } - -re ".*$gdb_prompt $" { fail "print value of -!0" } - timeout { fail "(timeout) print value of -!0" } - } - - -send_gdb "print ~-!0\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of ~-!0" - } - -re ".*$gdb_prompt $" { fail "print value of ~-!0" } - timeout { fail "(timeout) print value of ~-!0" } - } - - - -send_gdb "print 3 * 2 / 4.0 * 2.0\n" -gdb_expect { - -re ".\[0-9\]* = 3.*$gdb_prompt $" { - pass "print value of 3 * 2 / 4.0 * 2.0" - } - -re ".*$gdb_prompt $" { fail "print value of 3 * 2 / 4.0 * 2.0" } - timeout { fail "(timeout) print value of 3 * 2 / 4.0 * 2.0" } - } - - -send_gdb "print 8 << 2 >> 4\n" -gdb_expect { - -re ".\[0-9\]* = 2.*$gdb_prompt $" { - pass "print value of 8 << 2 >> 4" - } - -re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" } - timeout { fail "(timeout) print value of 8 << 2 >> 4" } - } - - -send_gdb "print -1 < 0 > 1\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of -1 < 0 > 1" - } - -re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" } - timeout { fail "(timeout) print value of -1 < 0 > 1" } - } - - -send_gdb "print 15 ^ 10 ^ 5 ^ 7\n" -gdb_expect { - -re ".\[0-9\]* = 7.*$gdb_prompt $" { - pass "print value of 15 ^ 10 ^ 5 ^ 7" - } - -re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" } - timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" } - } - - -send_gdb "print 3.5 < 4.0\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { - pass "print value of 3.5 < 4.0" - } - -re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" } - timeout { fail "(timeout) print value of 3.5 < 4.0" } - } - - -send_gdb "print 3.5 < -4.0\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 3.5 < -4.0" - } - -re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" } - timeout { fail "(timeout) print value of 3.5 < -4.0" } - } - - -send_gdb "print 2 > -3\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { - pass "print value of 2 > -3" - } - -re ".*$gdb_prompt $" { fail "print value of 2 > -3" } - timeout { fail "(timeout) print value of 2 > -3" } - } - - -send_gdb "print -3>4\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of -3>4" - } - -re ".*$gdb_prompt $" { fail "print value of -3>4" } - timeout { fail "(timeout) print value of -3>4" } - } - - -send_gdb "print (-3 > 4)\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of (-3 > 4)" - } - -re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" } - timeout { fail "(timeout) print value of (-3 > 4)" } - } - - -send_gdb "print 3>=2.5\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { - pass "print value of 3>=2.5" - } - -re ".*$gdb_prompt $" { fail "print value of 3>=2.5" } - timeout { fail "(timeout) print value of 3>=2.5" } - } - - -send_gdb "print 3>=4.5\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 3>=4.5" - } - -re ".*$gdb_prompt $" { fail "print value of 3>=4.5" } - timeout { fail "(timeout) print value of 3>=4.5" } - } - - -send_gdb "print 3==3.0\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { - pass "print value of 3==3.0" - } - -re ".*$gdb_prompt $" { fail "print value of 3==3.0" } - timeout { fail "(timeout) print value of 3==3.0" } - } - - -send_gdb "print 3==4.0\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 3==4.0" - } - -re ".*$gdb_prompt $" { fail "print value of 3==4.0" } - timeout { fail "(timeout) print value of 3==4.0" } - } - - -send_gdb "print 3!=3.0\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 3!=3.0" - } - -re ".*$gdb_prompt $" { fail "print value of 3!=3.0" } - timeout { fail "(timeout) print value of 3!=3.0" } - } - - -send_gdb "print 3!=5.0\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { - pass "print value of 3!=5.0" - } - -re ".*$gdb_prompt $" { fail "print value of 3!=5.0" } - timeout { fail "(timeout) print value of 3!=5.0" } - } - - -send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" - } - -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" } - timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" } - } - - -send_gdb "print 1.0 || 0\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { +gdb_test "print !1" ".\[0-9\]* = 0" "print value of !1" + +gdb_test "print !0" ".\[0-9\]* = 1" "print value of !0" + +gdb_test "print !100" ".\[0-9\]* = 0" "print value of !100" + +gdb_test "print !1000" ".\[0-9\]* = 0" "print value of !1000" + +gdb_test "print !10" ".\[0-9\]* = 0" "print value of !10" + +gdb_test "print !2" ".\[0-9\]* = 0" "print value of !2 " + +gdb_test "print 10 | 5" ".\[0-9\]* = 15" "print value of 10 | 5" + +gdb_test "print 10 & 5" ".\[0-9\]* = 0" "print value of 10 & 5" + +gdb_test "print 10 ^ 5" ".\[0-9\]* = 15" "print value of 10 ^ 5" + +gdb_test "print -!0" ".\[0-9\]* = -1" "print value of -!0" + +gdb_test "print ~-!0" ".\[0-9\]* = 0" "print value of ~-!0" + +gdb_test "print 3 * 2 / 4.0 * 2.0" ".\[0-9\]* = 3" \ + "print value of 3 * 2 / 4.0 * 2.0" + +gdb_test "print 8 << 2 >> 4" ".\[0-9\]* = 2" \ + "print value of 8 << 2 >> 4" + +gdb_test "print -1 < 0 > 1" ".\[0-9\]* = 0" \ + "print value of -1 < 0 > 1" + +gdb_test "print 15 ^ 10 ^ 5 ^ 7" ".\[0-9\]* = 7" \ + "print value of 15 ^ 10 ^ 5 ^ 7" + +gdb_test "print 3.5 < 4.0" ".\[0-9\]* = 1" \ + "print value of 3.5 < 4.0" + +gdb_test "print 3.5 < -4.0" ".\[0-9\]* = 0" \ + "print value of 3.5 < -4.0" + +gdb_test "print 2 > -3" ".\[0-9\]* = 1" "print value of 2 > -3" + +gdb_test "print -3>4" ".\[0-9\]* = 0" "print value of -3>4" + +gdb_test "print (-3 > 4)" ".\[0-9\]* = 0" "print value of (-3 > 4)" + +gdb_test "print 3>=2.5" ".\[0-9\]* = 1" "print value of 3>=2.5" + +gdb_test "print 3>=4.5" ".\[0-9\]* = 0" "print value of 3>=4.5" + +gdb_test "print 3==3.0" ".\[0-9\]* = 1" "print value of 3==3.0" + +gdb_test "print 3==4.0" ".\[0-9\]* = 0" "print value of 3==4.0" + +gdb_test "print 3!=3.0" ".\[0-9\]* = 0" "print value of 3!=3.0" + +gdb_test "print 3!=5.0" ".\[0-9\]* = 1" "print value of 3!=5.0" + +gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" \ + ".\[0-9\]* = 0" \ + "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" + +gdb_test "print 1.0 || 0" ".\[0-9\]* = 1" \ pass "print value of 1.0 || 0" - } - -re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" } - timeout { fail "(timeout) print value of 1.0 || 0" } - } - - -send_gdb "print 0.0 || 1.0\n" -gdb_expect { - -re ".\[0-9\]* = 1.*$gdb_prompt $" { - pass "print value of 0.0 || 1.0" - } - -re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" } - timeout { fail "(timeout) print value of 0.0 || 1.0" } - } - - -send_gdb "print 0.0 || 0\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 0.0 || 0" - } - -re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" } - timeout { fail "(timeout) print value of 0.0 || 0" } - } - - -send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8" - } - -re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8" } - timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8" } - } - - -send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n" -gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { - pass "print value of 0 == 8 > 128 >> 1 + 2 * 2" - } - -re ".*$gdb_prompt $" { fail "print value of 0 == 8 > 128 >> 1 + 2 * 2" } - timeout { fail "(timeout) print value of 0 == 8 > 128 >> 1 + 2 * 2" } - } + +gdb_test "print 0.0 || 1.0" ".\[0-9\]* = 1" \ + "print value of 0.0 || 1.0" + +gdb_test "print 0.0 || 0" ".\[0-9\]* = 0" \ + "print value of 0.0 || 0" + +gdb_test "print 0 || 1 && 0 | 0 ^ 0 == 8" ".\[0-9\]* = 0" \ + "print value of 0 || 1 && 0 | 0 ^ 0 == 8" + +gdb_test "print 0 == 8 > 128 >> 1 + 2 * 2" ".\[0-9\]* = 0" \ + "print value of 0 == 8 > 128 >> 1 + 2 * 2" |