📄 call-ar-st.exp
字号:
# Copyright (C) 1998# Free Software Foundation, Inc.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to:# bug-gdb@prep.ai.mit.edu# This file was written by Elena Zannoni (ezannoni@cygnus.com)if $tracelevel then { strace $tracelevel}set prms_id 0set bug_id 0set testfile "call-ar-st"set srcfile ${testfile}.cset binfile ${objdir}/${subdir}/${testfile}if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}# Create and source the file that provides information about the compiler# used to compile the test case.if [get_compiler_info ${binfile}] { return -1;}# The a29k can't call functions, so don't even bother with this test.if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "This target can not call functions" continue}# Set the current language to C. This counts as a test. If it# fails, then we skip the other tests.proc set_lang_c {} { global gdb_prompt send_gdb "set language c\n" gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language c (timeout)" ; return 0; } } send_gdb "show language\n" gdb_expect { -re ".* source language is \"c\".*$gdb_prompt $" { pass "set language to \"c\"" return 1 } -re ".*$gdb_prompt $" { fail "setting language to \"c\"" return 0 } timeout { fail "can't show language (timeout)" return 0 } }}source ${binfile}.ci# Start with a fresh gdb.gdb_exitgdb_startgdb_reinitialize_dir $srcdir/$subdirgdb_load ${binfile}send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"if ![runto_main] then { perror "couldn't run to breakpoint" continue}#go -until 1209gdb_test "tbreak 1209" \ "Breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \ "tbreakpoint line 1209"gdb_test continue \"Continuing\\..*main \\(\\) at.*$srcfile:1209.*" \"run until breakpoint set at a line"#call print_double_array(double_array)if {![target_info exists gdb,skip_float_tests]} { 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 :" "\[ \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\]+" }}#call print_char_array(char_array)send_gdb "print print_char_array(char_array)\n"gdb_expect { -re "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\]+.*\[ \t\r\n\]+.*$gdb_prompt $" { pass "print print_char_array(char_array)" } -re ".*$gdb_prompt $" { fail "print print_char_array(char_array)" } timeout { fail "(timeout) print print_char_array(char_array)" } }#go -until 1216gdb_test "tbreak 1216" \"Breakpoint.*file.*$srcfile, line 1216.*" \"tbreakpoint line 1216"send_gdb "continue\n"gdb_expect { -re "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\]+\[ \t\r\n\]+main.*at.*$srcfile:1216\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" { pass "continue to 1216" } -re ".*$gdb_prompt $" { fail "continue to 1216" } timeout { fail "(timeout) continue to 1216" }}# I am disabling this test, because it takes too long. I verified by# hand that it works, feel free to check for yourself. #call print_all_arrays(integer_array, char_array, float_array, double_array)#send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n"#gdb_expect {# -re ".*array_i :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0\[ \t\r\n\]+-1 -2 -3 -4 -5 -6 -7 -8\[ \t\r\n\]+-9 -10 -11 -12 -13 -14 -15 -16\[ \t\r\n\]+-17 -18 -19 -20 -21 -22 -23 -24\[ \t\r\n\]+-25 -26 -27 -28 -29 -30 -31 -32\[ \t\r\n\]+-33 -34 -35 -36 -37 -38 -39 -40\[ \t\r\n\]+-41 -42 -43 -44 -45 -46 -47 -48\[ \t\r\n\]+-49\[ \t\r\n\]+\[ \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\]+array_f :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+0.142450 0.284900 0.427350 0.569801 0.712251 0.854701 0.997151 1.139601\[ \t\r\n\]+1.282051 1.424501 1.566952 1.709402 1.851852 1.994302\[ \t\r\n\]+\[ \t\r\n\]+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.41750 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.*$gdb_prompt $" {# pass "print print_all_arrays(integer_array, char_array, float_array, double_array)"# }# -re ".*$gdb_prompt $" { fail "print print_all_arrays(integer_array, char_array, float_array, double_array)" }# timeout { fail "(timeout) print print_all_arrays(integer_array, char_array, float_array, double_array)" }# }#set timeout $oldtimeout#go -until 1220gdb_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"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -