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

📄 list.exp

📁 lwip在ucos上的移植
💻 EXP
📖 第 1 页 / 共 2 页
字号:
# Copyright (C) 1992, 1994, 1995, 1997, 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 Fred Fish. (fnf@cygnus.com)if $tracelevel then {	strace $tracelevel}set prms_id 0set bug_id 0set testfile "list"set binfile ${objdir}/${subdir}/${testfile}# Need to download the header to the host.remote_download host ${srcdir}/${subdir}/list0.h list0.hif  { [gdb_compile "${srcdir}/${subdir}/list0.c" "${binfile}0.o" object {debug}] != "" } {     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}if  { [gdb_compile "${srcdir}/${subdir}/list1.c" "${binfile}1.o" object {debug}] != "" } {     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}if  { [gdb_compile "${binfile}0.o ${binfile}1.o" ${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;}## Local utility proc just to set and verify listsize# Return 1 if success, 0 if fail.#set set_listsize_count 0;proc set_listsize { arg } {    global gdb_prompt    global set_listsize_count;    incr set_listsize_count;    if [gdb_test "set listsize $arg" "" "setting listsize to $arg #$set_listsize_count"] {	return 0;    }    if { $arg <= 0 } {	set arg "unlimited";    }    if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"] {	return 0;    }    return 1}## Test display of listsize lines around a given line number.#proc test_listsize {} {    global gdb_prompt    global hp_cc_compiler    global hp_aCC_compiler    # Show default size    gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"        # Show the default lines    # The second case is for optimized code, it is still correct.        if ![isnative] {	runto_main;	unsupported "list default lines around main";    } else {	gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;|2.*11\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"    }    # Ensure we can limit printouts to one line    if [set_listsize 1] {	gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"	gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1"    }        # Try just two lines        if [ set_listsize 2 ] {	gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2"	gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"	gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2"    }    # Try small listsize > 1 that is an odd number    if [ set_listsize 3 ] {	gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3"	gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3"	gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"    }    # Try small listsize > 2 that is an even number.    if [ set_listsize 4 ] then {	gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 1 with listsize 4"	gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 2 with listsize 4"		gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"	gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"    }    # Try a size larger than the entire file.    if [ set_listsize 100 ] then {	gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 1 with listsize 100"		gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 10 with listsize 100"    }    # Try listsize of 0 which suppresses printing.    set_listsize 0    gdb_test "list 1" "" "listsize of 0 suppresses output"    # Try listsize of -1 which is special, and means unlimited.    set_listsize -1    setup_xfail "*-*-*"    gdb_test "list 1" "1\[ \t\]+#include .*\r\n39\[ \t\]+\}" "list line 1 with unlimited listsize"}## Test "list filename:number" for C include file#proc test_list_include_file {} {    global gdb_prompt    setup_xfail "a29k-*-udi"    setup_xfail_format "DWARF 1"    setup_xfail_format "COFF"    gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file"    setup_xfail "a29k-*-udi"    setup_xfail_format "DWARF 1"    setup_xfail_format "COFF"    gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF"}## Test "list filename:number" for C source file#proc test_list_filename_and_number {} {    global gdb_prompt    set testcnt 0    send_gdb "list list0.c:1\n"    gdb_expect {	-re "1\[ \t\]+#include \"list0.h\".*10\[ \t]+x = 0;\r\n$gdb_prompt $" {	    incr testcnt 	}	-re ".*$gdb_prompt $" { fail "list list0.c:1" ; gdb_suppress_tests }	timeout { fail "list list0.c:1 (timeout)" ; gdb_suppress_tests }    }    send_gdb "list list0.c:10\n"    gdb_expect {	-re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" {	    incr testcnt 	}	-re ".*$gdb_prompt $" { fail "list list.c:10" ; gdb_suppress_tests }	timeout { fail "list list.c:10 (timeout)" ; gdb_suppress_tests }    }    send_gdb "list list1.c:1\n"    gdb_expect {	-re "1\[ \t\]+\#include.*4\[ \t\]+.*int oof\[ \t\]*\(.*\);\r\n.*$gdb_prompt $" {	    incr testcnt 	}	-re ".*$gdb_prompt $" { fail "list list1.c:1" ; gdb_suppress_tests }	timeout { fail "list list1.c:1 (timeout)" ; gdb_suppress_tests }    }    send_gdb "list list1.c:12\n"    gdb_expect {	-re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {	    incr testcnt 	}	-re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests }	timeout { fail "list list1.c:12 (timeout)" ; gdb_suppress_tests }    }    pass "list filename:number ($testcnt tests)"    gdb_stop_suppressing_tests;}## Test "list function" for C source file#proc test_list_function {} {    global gdb_prompt    global gcc_compiled    # 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"    gdb_test "list main" "(5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*10\[ \t\]+x = 0;)" "list function in source file 1"    # Ultrix gdb takes the second case below; it's also correct.    # SunPRO cc is the third case.    gdb_test "list bar" "(4\[ \t\]+void.*\[ \t\]*long_line.*;.*bar.*9\[ \t\]*.*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;|7\[ \t\]+void.*14\[ \t\]+\})" "list function in source file 2"    # Test "list function" for C include file    # Ultrix gdb is the second case, still correct.    # SunPRO cc is the third case.    setup_xfail "powerpc-*-*"    setup_xfail_format "DWARF 1"    gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"}proc test_list_forward {} {    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 "list\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 "list\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 "list\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 "successive list commands to page forward ($testcnt tests)"    gdb_stop_suppressing_tests;}

⌨️ 快捷键说明

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