📄 funcargs.exp
字号:
gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \ "print un (little-endian, sizeof long != sizeof int)" } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } { gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \ "print un (big-endian, sizeof long == 8, sizeof int = 4)" } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } { gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \ "print un (big-endian, sizeof long == 4, sizeof int = 2)" } else { fail "print un (unknown case)" } gdb_stop_suppressing_tests;}## Locate actual args; discard, shuffle, and call#proc discard_and_shuffle {} { global gdb_prompt global hex global decimal global det_file global gcc_compiled delete_breakpoints gdb_breakpoint call6a gdb_breakpoint call6b gdb_breakpoint call6c gdb_breakpoint call6d gdb_breakpoint call6e gdb_breakpoint call6f gdb_breakpoint call6g gdb_breakpoint call6h # Run; should stop at call6a and print actual arguments. # Print backtrace. gdb_run_cmd gdb_expect { -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" } -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; } timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; } } setup_xfail "rs6000-*-*" if {!$gcc_compiled} { setup_xfail "mips-sgi-irix5*" } send_gdb "backtrace 100\n" gdb_expect { -re "backtrace 100\[\r\n\]+.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r.* main \\(.*\\) .*\r$gdb_prompt $" { pass "backtrace from call6a" } -re "backtrace 100\[\r\n\]+.* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r.* main \\(.*\\) .*\r$gdb_prompt $" { xfail "backtrace from call6a" } -re "$gdb_prompt $" { fail "backtrace from call6a" gdb_suppress_tests } timeout { fail "(timeout) backtrace from call6a" gdb_suppress_tests } } # Continue; should stop at call6b and print actual arguments. # Print backtrace. gdb_continue call6b send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6b" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6c and print actual arguments. # Print backtrace. gdb_continue call6c send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6c" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6d and print actual arguments. # Print backtrace. gdb_continue call6d send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6d" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6e and print actual arguments. # Print backtrace. gdb_continue call6e send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6e" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#5 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6f and print actual arguments. # Print backtrace. gdb_continue call6f send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6f" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#5 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#6 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6g and print actual arguments. # Print backtrace. gdb_continue call6g send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6g" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#6 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#7 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6h and print actual arguments. # Print backtrace. gdb_continue call6h send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6h" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#7 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#8 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # monitor only allows 8 breakpoints; w89k board allows 10, so # break them up into two groups. delete_breakpoints gdb_breakpoint call6i gdb_breakpoint call6j gdb_breakpoint call6k # Continue; should stop at call6i and print actual arguments. # Print backtrace. gdb_continue call6i send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6i" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) " ".*\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#8 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#9 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6j and print actual arguments. # Print backtrace. gdb_continue call6j send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6j" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6j \\(ul=8\\) " ".*\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) " ".*\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#9 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#10 .* main \\(.*\\) " } ] { gdb_suppress_tests; } # Continue; should stop at call6k and print actual arguments. # Print backtrace. gdb_continue call6k send_gdb "backtrace 100\n" if [gdb_expect_list "backtrace from call6k" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call6k \\(\\) " ".*\[\r\n\]#1 .* call6j \\(ul=8\\) " ".*\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) " ".*\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) " ".*\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#10 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) " ".*\[\r\n\]#11 .* main \\(.*\\) " } ] { gdb_suppress_tests; } gdb_stop_suppressing_tests;}## Locate actual args; shuffle round robin and call#proc shuffle_round_robin {} { global gdb_prompt global hex global decimal global det_file global gcc_compiled delete_breakpoints gdb_breakpoint call7a gdb_breakpoint call7b gdb_breakpoint call7c gdb_breakpoint call7d gdb_breakpoint call7e gdb_breakpoint call7f gdb_breakpoint call7g gdb_breakpoint call7h # Run; should stop at call7a and print actual arguments. # Print backtrace. gdb_run_cmd gdb_expect { -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" { pass "run to call7a" } -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; } timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; } } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" } send_gdb "backtrace 100\n" gdb_expect { -re "backtrace 100\[\r\n\]+.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r.* main \\(.*\\) .*\r$gdb_prompt $" { pass "backtrace from call7a" } -re "backtrace 100\[\r\n\]+.* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r.* main \\(.*\\) .*\r$gdb_prompt $" { xfail "backtrace from call7a" } -re "$gdb_prompt $" { fail "backtrace from call7a" ; return } timeout { fail "(timeout) backtrace from call7a" ; return } } # Continue; should stop at call7b and print actual arguments. # Print backtrace. gdb_continue call7b if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } send_gdb "backtrace 100\n" gdb_expect_list "backtrace from call7b" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) " ".*\[\r\n\]#1 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) " ".*\[\r\n\]#2 .* main \\(.*\\) " } # Continue; should stop at call7c and print actual arguments. # Print backtrace. gdb_continue call7c send_gdb "backtrace 100\n" gdb_expect_list "backtrace from call7c" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) " ".*\[\r\n\]#1 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) " ".*\[\r\n\]#2 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) " ".*\[\r\n\]#3 .* main \\(.*\\) " } # Continue; should stop at call7d and print actual arguments. # Print backtrace. gdb_continue call7d send_gdb "backtrace 100\n" gdb_expect_list "backtrace from call7d" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) " ".*\[\r\n\]#1 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) " ".*\[\r\n\]#2 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) " ".*\[\r\n\]#3 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) " ".*\[\r\n\]#4 .* main \\(.*\\) " } gdb_continue call7e send_gdb "backtrace 100\n" gdb_expect_list "backtrace from call7e" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) " ".*\[\r\n\]#1 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) " ".*\[\r\n\]#2 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) " ".*\[\r\n\]#3 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) " ".*\[\r\n\]#4 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) " ".*\[\r\n\]#5 .* main \\(.*\\) " } # Continue; should stop at call7f and print actual arguments. # Print backtrace. gdb_continue call7f send_gdb "backtrace 100\n" gdb_expect_list "backtrace from call7f" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) " ".*\[\r\n\]#1 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) " ".*\[\r\n\]#2 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) " ".*\[\r\n\]#3 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) " ".*\[\r\n\]#4 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) " ".*\[\r\n\]#5 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) " ".*\[\r\n\]#6 .* main \\(.*\\) " } # Continue; should stop at call7g and print actual arguments. # Print backtrace. gdb_continue call7g send_gdb "backtrace 100\n" gdb_expect_list "backtrace from call7g" ".*$gdb_prompt $" { ".*\[\r\n\]#0 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) " ".*\[\r\n\]#1 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) " ".*\[\r\n\]#2 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) " ".*\[\r\n\]#3 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) " ".*\[\r\n\]#4 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) " ".*\[\r\n\]#5 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) " ".*\[\r\n\]#6 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) " ".*\[\r\n\]#7 .* main \\(.*\\) " }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -