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

📄 annota1.exp

📁 lwip在ucos上的移植
💻 EXP
📖 第 1 页 / 共 2 页
字号:
## get to printf#send_gdb "continue\n"gdb_expect {  -re "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*\032\032frame-function-name\r\nprintf\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \	  { pass "continue to printf" }  -re ".*$gdb_prompt$"     { fail "continue to printf" }  timeout	            { fail "continue to printf (timeout)" }}## test:# annotate-frame-where# annotate-frame-address# annotate-frame-address-end#send_gdb "backtrace\n"gdb_expect {  -re "\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\nprintf\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${srcdir}/${subdir}/${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\032frame-end\r\n$gdb_prompt$" \	  { pass "bactrace from shlibrary" }  -re ".*$gdb_prompt$"     { fail "backtrace from shlibrary" }  timeout	            { fail "backtrace from shlibrary (timeout)" }}## test printing a frame with some arguments: # annotate-arg-begin# annotate-arg-name-end# annotate-arg-value# annotate-arg-end#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${srcdir}/${subdir}/${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$" \	{ pass "send SIGUSR1" }  -re ".*$gdb_prompt$"     { fail "send SIGUSR1" }  timeout	            { fail "send SIGUSR1 (timeout)" }}## test:# annotate-signal-handler-caller#verbose "match_max local is: [match_max]"verbose "match_max default is: [match_max -d]"# This is necessary because a 2000 buffer is not enought to get everything# up to the prompt ad the test gets a timeout.match_max 3000verbose "match_max now is: [match_max]"send_gdb "backtrace\n"gdb_expect {  -re "frame-begin 0 $hex.*0.*frame-end.*frame-begin 1 $hex.*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.*2.*(frame-begin 3 $hex.*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)" }}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)" }}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)" }}## 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 ${srcdir}/${subdir}/${srcfile}, line $main_line.*$gdb_prompt$" \	     { pass "break at 28" }     -re ".*$gdb_prompt$"  { fail "break at 28" }     timeout { fail "break at 28 (timeout)" }}## display the value; test:# annotate-display-begin# annotate-display-number-end# annotate-display-format# annotate-display-expression# annotate-display-expression-end# 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)" }}# should ask query. Test annotate-query.# we don't care about anything else here, only the query.send_gdb "run\n"gdb_expect {  -re "pre-query.*already.*\\(y or n\\).*query\r\n" {         send_gdb "y\n"         gdb_expect {	     -re ".*post-query.*$gdb_prompt$" \		     { pass "re-run" }	     -re ".*$gdb_prompt$"  { fail "re-run" }	     timeout { fail "re-run (timeout)" }	 }     }  -re ".*$gdb_prompt$"  { fail "re-run" }  timeout { fail "re-run (timeout)" }}## 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 {    -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 {    -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 {    -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" }}send_gdb "next\n"gdb_expect {    -re ".*$srcfile:49:.*$gdb_prompt$" {	pass "breakpoint ignore count"    }    -re ".*$gdb_prompt$" { fail "breakpoint ignore count" }    timeout { fail "breakpoint ignore count (timeout)" }}## Send a signal that is not handled; test:# annotate-signalled# annotate-signal-name# annotate-signal-name-end# annotate-signal-string# annotate-signal-string-end# FIXME: annotate-signal not tested (requires that the inferior be #                        stopped by a "random" signal)#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\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)" }}# Check for production of a core file# and remove it!set exec_output [remote_exec build "ls core"]if [ regexp "core not found" $exec_output]  {    pass "No core dumped"} else {  if [ regexp "No such file or directory" $exec_output] {      pass "No core dumped"  } else {      remote_exec build "rm -f core"      pass "Core dumped and removed"  }}# restore the original prompt for the rest of the testsuiteset gdb_prompt $old_gdb_prompt

⌨️ 快捷键说明

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