From: Michael Snyder Date: Tue, 17 Oct 2000 20:00:21 +0000 (+0000) Subject: 2000-10-16 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=13a5e3b8410e0157f5fb92e53b05a044236087b2;p=binutils-gdb.git 2000-10-16 Michael Snyder * lib/gdb.exp (gdb_skip_float_test): New proc. Skip test if no floating point support. (gdb_skip_stdio_test): New proc. Skip test if no stdio support. * gdb.base/call-ar-st.exp: Use above procs to skip tests. * gdb.base/call-rt-st.exp: Ditto. * gdb.base/call-strs.exp: Ditto. * gdb.base/sizeof.exp (check_sizeof): Skip if no printf support. * gdb.base/varargs.exp: Skip entire test if no printf support. * gdb.base/ending-run.exp (Step to return): Skip if no printf supt. * gdb.base/shlib-call.exp: Skip several tests if no printf support. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 36d079cfaf0..4535794e3c5 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2000-10-16 Michael Snyder + + * gdb.base/sizeof.exp (check_sizeof): Skip if no printf support. + * gdb.base/varargs.exp: Skip entire test if no printf support. + * gdb.base/ending-run.exp (Step to return): Skip if no printf supt. + * gdb.base/shlib-call.exp: Skip several tests if no printf support. + +2000-10-13 Michael Snyder + + * lib/gdb.exp (gdb_skip_float_test): New proc. Skip test if + no floating point support. + (gdb_skip_stdio_test): New proc. Skip test if no stdio support. + * gdb.base/call-ar-st.exp: Use above procs to skip tests. + * gdb.base/call-rt-st.exp: Ditto. + * gdb.base/call-strs.exp: Ditto. + 2000-08-02 Jimmy Guo * gdb.base/sizeof.c: include . diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index c832ba46bfb..dbf992f6f60 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -85,10 +85,8 @@ proc set_lang_c {} { } } - source ${binfile}.ci - # Start with a fresh gdb. gdb_exit @@ -116,7 +114,8 @@ gdb_test continue \ #call print_double_array(double_array) -if {![target_info exists gdb,skip_float_tests]} { +if {![gdb_skip_float_test "print print_double_array(double_array)"] && \ + ![gdb_skip_stdio_test "print print_double_array(double_array)"] } { send_gdb "print print_double_array(double_array)\n" gdb_expect_list "print print_double_array(double_array)" ".*$gdb_prompt $" { "\[ \t\r\n\]+array_d :" @@ -140,33 +139,40 @@ if {![target_info exists gdb,skip_float_tests]} { #call print_char_array(char_array) -send_gdb "print print_char_array(char_array)\n" -gdb_expect_list "print print_char_array(char_array)" ".*$gdb_prompt $" { - "\[ \t\r\n\]+array_c :" - "\[ \t\r\n\]+=========" - "\[ \t\r\n\]+\[ \t\r\n\]+Z" - "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" - "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" - "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+" +if ![gdb_skip_stdio_test "print_char_array(char_array)"] { + send_gdb "print print_char_array(char_array)\n" + gdb_expect_list "print print_char_array(char_array)" ".*$gdb_prompt $" { + "\[ \t\r\n\]+array_c :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+\[ \t\r\n\]+Z" + "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" + "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" + "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+" + } } + #go -until 1216 gdb_test "tbreak 1216" \ "Breakpoint.*file.*$srcfile, line 1216.*" \ "tbreakpoint line 1216" -send_gdb "continue\n" -gdb_expect_list "continue to 1216" ".*$gdb_prompt $" { - "\[ \t\r\n\]+array_c :" - "\[ \t\r\n\]+=========" - "\[ \t\r\n\]+\[ \t\r\n\]+Z" - "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" - "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" - "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa" - "\[ \t\r\n\]+main.*at.*:1216" - "\[ \t\r\n\]+1216.*print_double_array\\(double_array\\)" +if ![gdb_skip_stdio_test "continue to 1216"] { + send_gdb "continue\n" + gdb_expect_list "continue to 1216" ".*$gdb_prompt $" { + "\[ \t\r\n\]+array_c :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+\[ \t\r\n\]+Z" + "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" + "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" + "\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa" + "\[ \t\r\n\]+main.*at.*:1216" + "\[ \t\r\n\]+1216.*print_double_array\\(double_array\\)" + } +} else { + gdb_test "continue" "" "" } # I am disabling this test, because it takes too long. I verified by @@ -184,74 +190,87 @@ gdb_expect_list "continue to 1216" ".*$gdb_prompt $" { #set timeout $oldtimeout #go -until 1220 gdb_test "tbreak 1220" \ - "Breakpoint.* file .*$srcfile, line 1220.*" \ - "tbreakpoint line 1220" - -send_gdb "continue\n" -gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" { - "Continuing\\." - "\[ \t\r\n\]+array_d :" - "\[ \t\r\n\]+=========" - "\[ \t\r\n\]+0.000000" - "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" - "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" - "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" - "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" - "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" - "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" - "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" - "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" - "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" - "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" - "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" - "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" - "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" - ".*array_f :" - ".*student id :\[\t \]+.*YELLOW" - ".*array_i :" - ".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." + "Breakpoint.* file .*$srcfile, line 1220.*" \ + "tbreakpoint line 1220" + +if ![gdb_skip_stdio_test "continuing to breakpoint 1220"] { + send_gdb "continue\n" + gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" { + "Continuing\\." + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" + ".*array_f :" + ".*student id :\[\t \]+.*YELLOW" + ".*array_i :" + ".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." + } +} else { + gdb_test "continue" "" "" } #step - send_gdb "step\n" - gdb_expect { - -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"} - -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" } - timeout { fail "step inside print_all_arrays (timeout)" } - } +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)" } +} #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\\(array_c\\);.*$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)" } + -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)" + } } - - +} else { + gdb_test "next" "" "" +} #call print_double_array(array_d) -if {![target_info exists gdb,skip_float_tests]} { - send_gdb "print print_double_array(array_d)\n" - gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" { - "array_d :" - "\[ \t\r\n\]+=========" - "\[ \t\r\n\]+\[ \t\r\n\]+0.000000" - "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" - "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" - "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" - "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" - "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" - "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" - "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" - "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" - "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" - "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" - "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" - "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" - "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" - } +if {![gdb_skip_float_test "print print_double_array(array_d)"] && \ + ![gdb_skip_stdio_test "print print_double_array(array_d)"] } { + send_gdb "print print_double_array(array_d)\n" + gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" { + "array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" + } } #go -until 1236 @@ -259,58 +278,74 @@ gdb_test "tbreak 1236" \ "Breakpoint.* file .*$srcfile, line 1236.*" \ "tbreakpoint line 1236" -send_gdb "continue\n" -gdb_expect_list "continuing to 1236" ".*$gdb_prompt $" { - "Continuing\\..*array_c" - ".*array_f" - "\[ \t\r\n\]+array_d :" - "\[ \t\r\n\]+=========" - "\[ \t\r\n\]+0.000000" - "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" - "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" - "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" - "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" - "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" - "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" - "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" - "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" - "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" - "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" - "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" - "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" - "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)." +if ![gdb_skip_stdio_test "continuing to 1236"] { + send_gdb "continue\n" + gdb_expect_list "continuing to 1236" ".*$gdb_prompt $" { + "Continuing\\..*array_c" + ".*array_f" + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)." + } +} else { + gdb_test "continue" "" "" } #call sum_array_print(10, *list1, *list2, *list3, *list4) -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)" } - } +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)" } + } +} #step over -send_gdb "n\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)" } +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)" } + } +} else { + gdb_test "next" "" "" } #call print_array_rep(\*list1, \*list2, \*list3) -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)" } - } +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)" + } + } +} #go -until 1241 gdb_test "tbreak 1241" \ @@ -361,17 +396,25 @@ gdb_test "tbreak 1281" \ "Breakpoint.* file .*call-ar-st.c, line 1281.*" \ "tbreakpoint line 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"} +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"} + } +} else { + gdb_test "continue" "" "" } -#call print_small_structs(*struct1, *struct2, *struct3, *struct4,*flags, *flags_combo, -#*three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3) -if {![target_info exists gdb,skip_float_tests]} { +#call print_small_structs(*struct1, *struct2, *struct3, *struct4, +# *flags, *flags_combo, *three_char, *five_char, +# *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3) + +if {![gdb_skip_float_test "print print_small_structs(...)"] && \ + ![gdb_skip_stdio_test "print print_small_structs(...)"] } { send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n" gdb_expect_list "print print_small_structs" ".*$gdb_prompt $" { "\[\t\r\n \]+alpha" @@ -421,8 +464,11 @@ gdb_expect { } -#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065) -if {![target_info exists gdb,skip_float_tests]} { +#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, +# 3.14, -5678.12345, -0.11111111, 216.97065) + +if {![gdb_skip_float_test "print print_ten_doubles(...)"] && \ + ![gdb_skip_stdio_test "print print_ten_doubles(...)"]} { send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n" gdb_expect_list "print print_ten_doubles" ".*$gdb_prompt $" { "\[\t\r\n \]+Two Doubles : 123.456000.*123.456000" @@ -469,7 +515,7 @@ if { [istarget "hppa*-*-hpux*"] } { # 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 {![target_info exists gdb,skip_float_tests]} { + 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)"} @@ -488,8 +534,12 @@ if { [istarget "hppa*-*-hpux*"] } { set ws "\[\n\r\t \]+" -#call print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3) -if {![target_info exists gdb,skip_float_tests]} { +#call print_small_structs(struct1, struct2, struct3, struct4, flags, +# flags_combo, three_char, five_char, int_char_combo, +# d1, d2, d3, f1, f2, f3) + +if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \ + ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } { # On Solaris, some of the args are passed by ref, others by value, # and GDB gets confused and says "Invalid cast" because it thinks # it has to cast the structure into a pointer to structure. A real @@ -539,8 +589,12 @@ gdb_test "tbreak 1300" \ "Breakpoint.* file .*call-ar-st.c, line 1300.*" \ "tbreakpoint line 1300" -gdb_test continue "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ - "continue to 1300" +if ![gdb_skip_stdio_test "continuing to 1300"] { + gdb_test "continue" "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ + "continue to 1300" +} else { + gdb_test "continue" "" "" +} #step send_gdb "step\n" @@ -553,14 +607,20 @@ init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=1 } #call print_bit_flags_combo(*bit_flags_combo) -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" } - } +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" + } + } +} #go -until 1305 @@ -579,7 +639,8 @@ gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1305\[\r\n\t \]+ if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*" CLLbs16994} -if {![target_info exists gdb,skip_float_tests]} { +if {![gdb_skip_float_test "print print_long_arg_list"] && \ + ![gdb_skip_stdio_test "print print_long_arg_list"] } { send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n" gdb_expect_list "print print_long_arg_list" ".*$gdb_prompt $" { "\[ \n\r\t\]+double : 22.250000" @@ -632,36 +693,50 @@ gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1311\[ \t\n\r\]+ #call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4) -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)" } - } +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)" + } + } +} #call print_struct_rep(*struct1, *struct2, *struct3) -send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n" -gdb_expect_list "print print_struct_rep(*struct1, *struct2, *struct3)" ".*$gdb_prompt $" { - "\[ \t\n\r\]+Contents of struct1:" - "\[ \t\n\r\]+ 22 0" - "\[ \t\n\r\]+Contents of struct2:" - "\[ \t\n\r\]+ 42 0" - "\[ \t\n\r\]+Contents of struct3:" - "\[ \t\n\r\]+ 62 0" +if ![gdb_skip_stdio_test "print print_struct_rep(...)"] { + send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n" + gdb_expect_list "print print_struct_rep(*struct1, *struct2, *struct3)" \ + ".*$gdb_prompt $" { + "\[ \t\n\r\]+Contents of struct1:" + "\[ \t\n\r\]+ 22 0" + "\[ \t\n\r\]+Contents of struct2:" + "\[ \t\n\r\]+ 42 0" + "\[ \t\n\r\]+Contents of struct3:" + "\[ \t\n\r\]+ 62 0" + } } -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)" } - } +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)" + } + } +} return - diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 3838269191f..70b337776c3 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -135,103 +135,117 @@ gdb_expect { timeout { fail "(timeout)finish out from loop_count"} } - -send_gdb "print print_struct_rep(*struct1)\n" -gdb_expect { - -re ".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+.\[0-9\]+ = \{value = 5, head = 0\}.*$gdb_prompt $" { - pass "print print_struct_rep(*struct1, *struct2, *struct3)" - } - -re ".*$gdb_prompt $" { fail "print print_struct_rep(*struct1, *struct2, *struct3)" } - timeout { fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" } - } - -send_gdb "print print_one_large_struct(*list1)\n" -gdb_expect { - -re ".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+.\[0-9\]+ = \{next_index = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}, values = \{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\}, head = 0\}.*$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)" } - } - -if {![target_info exists gdb,skip_float_tests]} { - send_gdb "print print_one_double(*d1)\n" - gdb_expect { - -re ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \{double1 = 1\\.11111\}.*$gdb_prompt $" { - pass "print print_one_double(*d1)" - } - -re ".*$gdb_prompt $" { fail "print print_one_double(*d1)" } - timeout { fail "(timeout) print_one_double(*d1)" } - } - - send_gdb "print print_two_floats(*f3)\n" - gdb_expect { - -re ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \{float1 = -2\\.34500003, float2 = 1\}.*$gdb_prompt $" { - pass "print print_two_floats(*f3)" +if ![gdb_skip_stdio_test "print print_struct_rep(*struct1)"] { + send_gdb "print print_struct_rep(*struct1)\n" + gdb_expect { + -re ".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+.\[0-9\]+ = \{value = 5, head = 0\}.*$gdb_prompt $" { + pass "print print_struct_rep(*struct1, *struct2, *struct3)" + } + -re ".*$gdb_prompt $" { + fail "print print_struct_rep(*struct1, *struct2, *struct3)" + } + timeout { + fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" + } } - -re ".*$gdb_prompt $" { fail "print print_two_floats(*f3)" } - timeout { fail "(timeout) print_two_floats(*f3)" } - } } -send_gdb "print print_bit_flags(*flags)\n" -gdb_expect { - -re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" { - pass "print print_bit_flags(*flags)" - } - -re ".*$gdb_prompt $" { fail "print print_bit_flags(*flags)" } - timeout { fail "(timeout) print_bit_flags(*flags)" } - } - -send_gdb "print print_bit_flags_combo(*flags_combo)\n" -gdb_expect { - -re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" { - pass "print print_bit_flags_combo(*flags_combo)" - } - -re ".*$gdb_prompt $" { fail "print print_bit_flags_combo(*flags_combo)" } - timeout { fail "(timeout) print_bit_flags_combo(*flags_combo)" } - } - -send_gdb "print print_three_chars(*three_char)\n" -gdb_expect { - -re ".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+.\[0-9\]+ = \{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\}\[ \r\n\]+$gdb_prompt $" { - pass "print print_three_chars(*three_char)" - } - -re ".*$gdb_prompt $" { fail "print print_three_chars(*three_char)" } - timeout { fail "(timeout) print_three_chars(*three_char)" } - } - -send_gdb "print print_five_chars(*five_char)\n" -gdb_expect { - -re ".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+.\[0-9\]+ = \{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\}\[ \r\n\]+$gdb_prompt $" { - pass "print print_five_chars(*five_char)" - } - -re ".*$gdb_prompt $" { fail "print print_five_chars(*five_char)" } - timeout { fail "(timeout) print_five_chars(*five_char)" } - } - -send_gdb "print print_int_char_combo(*int_char_combo)\n" -gdb_expect { - -re ".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+.\[0-9\]+ = \{int1 = 13, ch1 = 33 '!'\}\[ \r\n\]+$gdb_prompt $" { - pass "print print_int_char_combo(*int_char_combo)" - } - -re ".*$gdb_prompt $" { fail "print print_int_char_combo(*int_char_combo)" } - timeout { fail "(timeout) print_int_char_combo(*int_char_combo)" } - } - -return - - - - - - +if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] { + send_gdb "print print_one_large_struct(*list1)\n" + gdb_expect { + -re ".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+.\[0-9\]+ = \{next_index = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}, values = \{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\}, head = 0\}.*$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)" } + } +} +if {![gdb_skip_float_test "print print_one_double(*d1)"] && \ + ![gdb_skip_stdio_test "print print_one_double(*d1)"] } { + send_gdb "print print_one_double(*d1)\n"; + gdb_expect { + -re ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \{double1 = 1\\.11111\}.*$gdb_prompt $" { + pass "print print_one_double(*d1)" + } + -re ".*$gdb_prompt $" { fail "print print_one_double(*d1)" } + timeout { fail "(timeout) print_one_double(*d1)" } + } +} +if ![gdb_skip_stdio_test "print print_two_floats(*f3)"] { + send_gdb "print print_two_floats(*f3)\n" + gdb_expect { + -re ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \{float1 = -2\\.34500003, float2 = 1\}.*$gdb_prompt $" { + pass "print print_two_floats(*f3)" + } + -re ".*$gdb_prompt $" { fail "print print_two_floats(*f3)" } + timeout { fail "(timeout) print_two_floats(*f3)" } + } +} +if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] { + send_gdb "print print_bit_flags(*flags)\n" + gdb_expect { + -re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" { + pass "print print_bit_flags(*flags)" + } + -re ".*$gdb_prompt $" { fail "print print_bit_flags(*flags)" } + timeout { fail "(timeout) print_bit_flags(*flags)" } + } +} +if ![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"] { + send_gdb "print print_bit_flags_combo(*flags_combo)\n" + gdb_expect { + -re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" { + pass "print print_bit_flags_combo(*flags_combo)" + } + -re ".*$gdb_prompt $" { + fail "print print_bit_flags_combo(*flags_combo)" + } + timeout { + fail "(timeout) print_bit_flags_combo(*flags_combo)" + } + } +} +if ![gdb_skip_stdio_test "print print_three_chars(*three_chars)"] { + send_gdb "print print_three_chars(*three_char)\n" + gdb_expect { + -re ".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+.\[0-9\]+ = \{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\}\[ \r\n\]+$gdb_prompt $" { + pass "print print_three_chars(*three_char)" + } + -re ".*$gdb_prompt $" { fail "print print_three_chars(*three_char)" } + timeout { fail "(timeout) print_three_chars(*three_char)" } + } +} +if ![gdb_skip_stdio_test "print print_five_chars(*five_chars)"] { + send_gdb "print print_five_chars(*five_char)\n" + gdb_expect { + -re ".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+.\[0-9\]+ = \{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\}\[ \r\n\]+$gdb_prompt $" { + pass "print print_five_chars(*five_char)" + } + -re ".*$gdb_prompt $" { fail "print print_five_chars(*five_char)" } + timeout { fail "(timeout) print_five_chars(*five_char)" } + } +} +if ![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"] { + send_gdb "print print_int_char_combo(*int_char_combo)\n" + gdb_expect { + -re ".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+.\[0-9\]+ = \{int1 = 13, ch1 = 33 '!'\}\[ \r\n\]+$gdb_prompt $" { + pass "print print_int_char_combo(*int_char_combo)" + } + -re ".*$gdb_prompt $" { + fail "print print_int_char_combo(*int_char_combo)" + } + timeout { + fail "(timeout) print_int_char_combo(*int_char_combo)" + } + } +} +return diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp index 5e6cbff6ecd..f14c37000ee 100644 --- a/gdb/testsuite/gdb.base/call-strs.exp +++ b/gdb/testsuite/gdb.base/call-strs.exp @@ -143,105 +143,125 @@ gdb_expect { #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)" } - } +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)" } + } +} #print str_func1("test string") -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\")" } - } +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\")" } + } +} #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)" } - } +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)" } + } +} #call str_func1("test string") -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\")" } - } +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\")" } + } +} #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)" } - } +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)" } + } +} #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)" } - } +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)" } + } +} #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\")" } - } +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\")" } + } +} #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\")" } - } +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\")" } + } +} #print str_func(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)" } - } +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)" } + } +} #call str_func(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)" } - } +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_exit return 0 diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 089a8a51058..0a9e92c3d52 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -129,7 +129,13 @@ gdb_expect { # is output from the program. # gdb_test "cont" ".*Breakpoint.*31.*" -gdb_test "next" ".*1 2 7 14 23 34 47 62 79 Goodbye!.*32.*" "Step to return" + +if ![gdb_skip_stdio_test "Step to return"] { + gdb_test "next" ".*1 2 7 14 23 34 47 62 79 Goodbye!.*32.*" \ + "Step to return" +} else { + gdb_test "next" "" "" +} set old_timeout $timeout set timeout 50 diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index 0381657ea3a..09073e61993 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -139,13 +139,19 @@ gdb_expect { #step -over - send_gdb "next\n" - gdb_expect { - -re ".*address of sgs is $hex.*g = shr2\\(g\\).*$gdb_prompt $" { - pass "next over shr1" } - -re ".*$gdb_prompt $" { fail "next over shr1" } - timeout { fail "next over shr1 (timeout)" } - } + if ![gdb_skip_stdio_test "next over shr1"] { + send_gdb "next\n" + gdb_expect { + -re ".*address of sgs is $hex.*g = shr2\\(g\\).*$gdb_prompt $" { + pass "next over shr1" + } + -re ".*$gdb_prompt $" { fail "next over shr1" } + timeout { fail "next over shr1 (timeout)" } + } + } else { + gdb_test "next" "" "" + } + #print g send_gdb "print g\n" @@ -157,21 +163,27 @@ gdb_expect { } #print shr1(1) -send_gdb "print shr1(1)\n" -gdb_expect { - -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" { - pass "print shr1(1)" } - -re ".*$gdb_prompt $" { fail "print shr1(1)" } - timeout { fail "(timeout) print shr1(1)" } + if ![gdb_skip_stdio_test "print shr1(1)"] { + send_gdb "print shr1(1)\n" + gdb_expect { + -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" { + pass "print shr1(1)" + } + -re ".*$gdb_prompt $" { fail "print shr1(1)" } + timeout { fail "(timeout) print shr1(1)" } + } } #print shr1(g) -send_gdb "print shr1(g)\n" -gdb_expect { - -re ".*address of sgs is $hex.*\[0-9\]* = 4.*$gdb_prompt $" { - pass "print shr1(g)" } - -re ".*$gdb_prompt $" { fail "print shr1(g)" } - timeout { fail "(timeout) print shr1(g)" } + if ![gdb_skip_stdio_test "print shr1(g)"] { + send_gdb "print shr1(g)\n" + gdb_expect { + -re ".*address of sgs is $hex.*\[0-9\]* = 4.*$gdb_prompt $" { + pass "print shr1(g)" + } + -re ".*$gdb_prompt $" { fail "print shr1(g)" } + timeout { fail "(timeout) print shr1(g)" } + } } #break shr2 @@ -180,19 +192,22 @@ gdb_test "break shr2" \ "Breakpoint.*file.*shr2.c, line.*" \ "breakpoint function shr2" -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:7.*7.*return 2.x;" \ -"run until breakpoint set at a function" +gdb_test "continue" \ + "Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:7.*7.*return 2.x;" \ + "run until breakpoint set at a function" #print shr1(1) -send_gdb "print shr1(1)\n" -gdb_expect { - -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" { - pass "print shr1(1)" - } - -re ".*$gdb_prompt $" { fail "print shr1(1)" } - timeout { fail "(timeout) print shr1(1)" } - } +if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] { + send_gdb "print shr1(1)\n" + gdb_expect { + -re ".*address of sgs is $hex.*\[0-9\]* = 2.*$gdb_prompt $" { + pass "print shr1(1) 2nd time" + } + -re ".*$gdb_prompt $" { fail "print shr1(1) 2nd time" } + timeout { fail "(timeout) print shr1(1) 2nd time" } + } +} #print mainshr1(1) send_gdb "print mainshr1(1)\n" @@ -250,9 +265,17 @@ send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" # PR's 16495, 18213 # test that we can re-set breakpoints in shared libraries gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library" -gdb_test "run" "Starting program:.*Breakpoint 1,.*" "run to bp in shared library" + +# FIXME: should not send "run" explicitly. Non-portable. + +gdb_test "run" "Starting program:.*Breakpoint 1,.*" \ + "run to bp in shared library" + gdb_test "cont" ".*Program exited normally..*" -gdb_test "run" "Starting program:.*Breakpoint 1,.*" "re-run to bp in shared library (PR's 16495, 18213)" + +gdb_test "run" "Starting program:.*Breakpoint 1,.*" \ + "re-run to bp in shared library (PR's 16495, 18213)" + gdb_test "cont" ".*Program exited normally..*" return 0 diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp index a51a7b4148a..b9642feb90e 100644 --- a/gdb/testsuite/gdb.base/sizeof.exp +++ b/gdb/testsuite/gdb.base/sizeof.exp @@ -92,6 +92,11 @@ set sizeof_long_double [get_sizeof "long double" 8] proc check_sizeof { type size } { global gdb_prompt + + if [gdb_skip_stdio_test "check sizeof $type == $size"] { + return; + } + set pat [string_to_regexp ${type}] send_gdb "next\n" gdb_expect { diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp index 2fb8f3bc398..f440f479996 100644 --- a/gdb/testsuite/gdb.base/varargs.exp +++ b/gdb/testsuite/gdb.base/varargs.exp @@ -69,6 +69,10 @@ 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 $" +if [gdb_skip_stdio_test "varargs.exp"] { + # Nothing in this module is testable without printf. + return; +} if ![runto_main] then { perror "couldn't run to breakpoint" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 191bf1866f8..594bf9e52e4 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1687,3 +1687,30 @@ proc gdbtk_analyze_results {results} { } } } + +# Print a message and return true if a test should be skipped +# due to lack of floating point suport. + +proc gdb_skip_float_test { msg } { + if [target_info exists gdb,skip_float_tests] { + verbose "Skipping test '$msg': no float tests."; + return 1; + } + return 0; +} + +# Print a message and return true if a test should be skipped +# due to lack of stdio support. + +proc gdb_skip_stdio_test { msg } { + if [target_info exists gdb,noinferiorio] { + verbose "Skipping test '$msg': no inferior i/o."; + return 1; + } + return 0; +} + +proc gdb_skip_bogus_test { msg } { + return 0; +} +