⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.exp

📁 lwip在ucos上的移植
💻 EXP
📖 第 1 页 / 共 2 页
字号:
# Test that repeating the list linenum command doesn't print the same# lines over again.  Note that this test makes sure that the argument# linenum is dropped, when we repeat the previous command. 'x/5i $pc'# works the same way.  proc test_repeat_list_command {} {    global gdb_prompt    set testcnt 0    send_gdb "list list0.c:10\n"    gdb_expect {	-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }	timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }    }    send_gdb "\n"    gdb_expect {	-re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }	timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }    }    send_gdb "\n"    gdb_expect {	-re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }	timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }    }    send_gdb "\n"    gdb_expect {	-re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }	timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }    }    pass "repeat list commands to page forward using 'return' ($testcnt tests)"    gdb_stop_suppressing_tests;}proc test_list_backwards {} {    global gdb_prompt    set testcnt 0    send_gdb "list list0.c:33\n"    gdb_expect {	-re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list list0.c:33" ; gdb_suppress_tests }	timeout { fail "list list0.c:33 (timeout)" ; gdb_suppress_tests }    }    send_gdb "list -\n"    gdb_expect {	-re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list 18-27" ; gdb_suppress_tests }	timeout { fail "list 18-27 (timeout)" ; gdb_suppress_tests }    }    send_gdb "list -\n"    gdb_expect {	-re "8\[ \t\]+breakpoint\[(\]\[)\];.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list 8-17" ; gdb_suppress_tests }	timeout { fail "list 8-17 (timeout)" ; gdb_suppress_tests }    }    send_gdb "list -\n"    gdb_expect {	-re "1\[ \t\]+#include .*7\[ \t\]+set_debug_traps\[(\]\[)\]+;\r\n$gdb_prompt $" { incr testcnt }	-re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests }	timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests }    }    pass "$testcnt successive \"list -\" commands to page backwards"    gdb_stop_suppressing_tests;}## Test "list first,last"#proc test_list_range {} {    global gdb_prompt    gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2"    gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2"#    gdb_test     "list -1,6" 	"Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative"#    gdb_test     "list -100,-40" 	"Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"    gdb_test "list 30,45" "30\[ \t\]+foo \(.*\);.*43\[ \t\]+\}" "list range; upper bound past EOF"    gdb_test "list 45,100" "Line number 45 out of range; .*list0.c has 43 lines." "list range; both bounds past EOF"    gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files"}## Test "list filename:function"#proc test_list_filename_and_function {} {    global gdb_prompt    set testcnt 0    # gcc appears to generate incorrect debugging information for code    # in include files, which breaks this test.    # SunPRO cc is the second case below, it's also correct.    setup_xfail "a29k-*-udi"    send_gdb "list list0.c:main\n"    gdb_expect {	-re "1\[ \t\]+#include .*10\[ \t\]+x = 0;\r\n$gdb_prompt $" {	    incr testcnt	}	-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {	    pass "list function in source file 1"	}	-re ".*$gdb_prompt $" { fail "list list0.c:main" }	timeout { fail "list list0.c:main (timeout)" }    }    # The i960 and a29k-amd-udi are the second case    # Not sure what the point of having this function be unused is.    # AIX is legitimately removing it.    setup_xfail "rs6000-*-aix*"    send_gdb "list list0.c:unused\n"    gdb_expect {	-re "40\[ \t\]+unused.*43\[ \t\]+\}\r\n$gdb_prompt $" {	    incr testcnt	}	-re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" {	    incr testcnt	}	-re ".*$gdb_prompt $" { fail "list list0.c:unused" }	timeout { fail "list list0.c:unused (timeout)" }    }    clear_xfail "rs6000-*-aix*"    # gcc appears to generate incorrect debugging information for code    # in include files, which breaks this test.    # Ultrix gdb is the second case, one line different but still correct.    # SunPRO cc is the third case.    setup_xfail "rs6000-*-*" 1804    setup_xfail "powerpc-*-*" 1804    setup_xfail "a29k-*-udi"    setup_xfail_format "DWARF 1"    setup_xfail_format "COFF"    send_gdb "list list0.h:foo\n"    gdb_expect {	-re "2\[ \t\]+including file.  This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {	    incr testcnt	}	-re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {	    incr testcnt	}	-re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {	    incr testcnt	}	-re "No source file named list0.h.\r\n$gdb_prompt $" {	    fail "list list0.h:foo"	}	-re ".*$gdb_prompt $" { fail "list list0.h:foo" }	timeout { fail "list list0.h:foo (timeout)" }    }    # Ultrix gdb is the second case.    # a29k-amd-udi is the third case.    send_gdb "list list1.c:bar\n"    gdb_expect {	-re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" {	    incr testcnt	}	-re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" {	    incr testcnt	}	-re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" {	    incr testcnt	}	-re ".*$gdb_prompt $" { fail "list list1.c:bar" }	timeout { fail "list list1.c:bar (timeout)" }    }    # The i960 and a29k-amd-udi are the second case    # Not sure what the point of having this function be unused is.    # AIX is legitimately removing it.    setup_xfail "rs6000-*-aix*"    send_gdb "list list1.c:unused\n"    gdb_expect {	-re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {	    incr testcnt	}	-re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" {	    incr testcnt	}	-re ".*$gdb_prompt $" { fail "list list1.c:unused" }	timeout { fail "list list1.c:unused (timeout)" }    }    clear_xfail "rs6000-*-aix*"    pass "list filename:function ($testcnt tests)"    # Test some invalid specs    # The following test takes the FIXME result on most systems using    # DWARF.  It fails to notice that main() is not in the file requested.       setup_xfail "*-*-*"# Does this actually work ANYWHERE?  I believe not, as this is an `aspect' of# lookup_symbol(), where, when it is given a specific symtab which does not# contain the requested symbol, it will subsequently search all of the symtabs# for the requested symbol.    gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected"    gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"    setup_xfail_format "DWARF 1"    gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function"}proc test_forward_search {} {	global timeout	gdb_test "set listsize 4" ""	# On SunOS4, this gives us lines 19-22.  On AIX, it gives us	# lines 20-23.  This depends on whether the line number of a function	# is considered to be the openbrace or the first statement--either one	# is acceptable.	gdb_test "list long_line" "24\[ \t\]+long_line .*"	gdb_test "search 4321" " not found"	gdb_test "search 6789" "28\[ \t\]+oof .6789.;"	# Test that GDB won't crash if the line being searched is extremely long.	set oldtimeout $timeout	set timeout [expr "$timeout + 300"]	verbose "Timeout is now $timeout seconds" 2	gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"	set timeout $oldtimeout	verbose "Timeout is now $timeout seconds" 2}# Start with a fresh gdb.gdb_exitgdb_startgdb_reinitialize_dir $srcdir/$subdirgdb_load ${binfile}if [target_info exists gdb_stub] {    gdb_step_for_stub;}gdb_test "set width 0" "" "set width 0"test_listsizeget_debug_formatif [ set_listsize 10 ] then {    test_list_include_file    test_list_filename_and_number    test_list_function    test_list_forward    test_list_backwards    test_repeat_list_command    test_list_range    test_list_filename_and_function    test_forward_search}remote_exec build "rm -f list0.h"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -