📄 call-ar-st.exp
字号:
"tbreak in print_long_arg_list after stepping into memcpy" # The short match case below handles cases where a buffer # overflows or something, and expect can't deal with the full # line. Perhaps a more elegant solution exists... -sts 1999-08-17 send_gdb "continue\n" if {![gdb_skip_float_test "step into print_long_arg_list"]} { gdb_expect { -re ".*print_long_arg_list \\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.375\}, d3=\{double1 = 675.09375\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" { pass "step into print_long_arg_list" } -re ".*print_long_arg_list.*\\(a=22.25, b=33.375, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}.*\\) at .*${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list (short match)"} -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } timeout { fail "step into print_long_arg_list (timeout)" } } } else { # If skipping float tests, don't expect anything in arg list. gdb_expect { -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" } -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } timeout { fail "step into print_long_arg_list (timeout)" } } }}set ws "\[\n\r\t \]+"#call print_small_structs(struct1, struct2, struct3, struct4, flags, # flags_combo, three_char, five_char, int_char_combo, # d1, d2, d3, f1, f2, f3)if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \ ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } { # On 32-bit SPARC, some of the args are passed by ref, others by # value, and GDB gets confused and says "Invalid cast" because it # thinks it has to cast the structure into a pointer to structure. if { [test_debug_format "stabs"] } then { setup_kfail "gdb/1539" "sparc-*-*" } send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n" gdb_expect_list "print print_small_structs from print_long_arg_list" ".*$gdb_prompt $" { "\[\t\r\n \]+alpha" "\[\t\r\n \]+gamma" "\[\t\r\n \]+epsilon" "\[\t\r\n \]+alpha" "\[\t\r\n \]+gamma" "\[\t\r\n \]+epsilon" "\[\t\r\n \]+ch1: y[ \t]*ch2: n" "\[\t\r\n \]+Contents of three_char_t:" "\[\t\r\n \]+a\[ \t\]*b\[ \t\]*c" "\[\t\r\n \]+Contents of five_char_t:" "\[\t\r\n \]+l\[ \t\]*m\[ \t\]*n\[ \t\]*o\[ \t\]*p" "\[\t\r\n \]+Contents of int_char_combo_t:" "\[\t\r\n \]+123\[ \t\]*z" "\[\t\r\n \]+Sum of the 4 struct values and seed :" "\[\t\r\n \]+52" "\[\t\r\n \]+Contents of struct1:" "\[\t\r\n \]+6\[ \t\]*0" "\[\t\r\n \]+Contents of struct2:" "\[\t\r\n \]+10\[ \t\]*0" "\[\t\r\n \]+Contents of struct3:" "\[\t\r\n \]+12\[ \t\]*0" "\[\t\r\n \]+Contents of one_double_t:" "\[\t\r\n \]+10.500000" "\[\t\r\n \]+Contents of one_double_t:" "\[\t\r\n \]+-3.375000" "\[\t\r\n \]+Contents of one_double_t:" "\[\t\r\n \]+675.093750" "\[\t\r\n \]+Contents of two_floats_t:" "\[\t\r\n \]+45.234001\[ \t\]*43.599998" "\[\t\r\n \]+Contents of two_floats_t:" "\[\t\r\n \]+78.010002\[ \t\]*122.099998" "\[\t\r\n \]+Contents of two_floats_t:" "\[\t\r\n \]+-1232.344971\[ \t\]*-199.210007" }}#go -until 1300gdb_test "tbreak 1300" \ "Breakpoint.* file .*call-ar-st.c, line 1300.*" \ "tbreakpoint line 1300"if ![gdb_skip_stdio_test "continuing to 1300"] { gdb_test "continue" "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ "continue to 1300"} else { gdb_test "continue" "" ""}#step send_gdb "step\n" gdb_expect { -re "init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" { pass "step into init_bit_flags_combo"} -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" } timeout { fail "step into init_bit_flags_combo (timeout)" } }#call print_bit_flags_combo(*bit_flags_combo)if ![gdb_skip_stdio_test "continuing to 1300"] { send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n" gdb_expect { -re ".*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*$gdb_prompt $" { pass "print print_bit_flags_combo from init_bit_flags_combo" } -re ".*$gdb_prompt $" { fail "print print_bit_flags_combo from init_bit_flags_combo" } timeout { fail "(timeout) print_bit_flags_combo from init_bit_flags_combo" } }}#go -until 1305gdb_test "tbreak 1305" \ "Breakpoint.* file .*call-ar-st.c, line 1305.*" \ "tbreakpoint line 1305"gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1305\[\r\n\t \]+1305.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \"continue to 1305"#call print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)# FIXME:# HP aCC demangler currently does not handle hp aCC functions with >10 args# DTS CLLbs16994 coulter 990114if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*" CLLbs16994}if {![gdb_skip_float_test "print print_long_arg_list"] && \ ![gdb_skip_stdio_test "print print_long_arg_list"] } { send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n" gdb_expect_list "print print_long_arg_list" ".*$gdb_prompt $" { "\[ \n\r\t\]+double : 22.250000" "\[ \n\r\t\]+double : 33.375000" "\[ \n\r\t\]+int : 0" "\[ \n\r\t\]+int : -25" "\[ \n\r\t\]+int : 100" "\[ \n\r\t\]+int : 2345" "\[ \n\r\t\]+alpha" "\[ \n\r\t\]+gamma" "\[ \n\r\t\]+epsilon" "\[ \n\r\t\]+ch1: y\[ \t\]+ch2: n" "\[ \n\r\t\]+Contents of three_char_t:" "\[ \n\r\t\]+x\[ \t\]+y\[ \t\]+z" "\[ \n\r\t\]+Contents of five_char_t:" "\[ \n\r\t\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o" "\[ \n\r\t\]+Contents of int_char_combo_t:" "\[ \n\r\t\]+123\[ \t\]+z" "\[ \n\r\t\]+Sum of the 4 struct values and seed :" "\[ \n\r\t\]+52" "\[ \n\r\t\]+Contents of struct1:" "\[ \n\r\t\]+6\[ \t\]+0" "\[ \n\r\t\]+Contents of struct2:" "\[ \n\r\t\]+10\[ \t\]+0" "\[ \n\r\t\]+Contents of struct3:" "\[ \n\r\t\]+12\[ \t\]+0" "\[ \n\r\t\]+Contents of one_double_t:" "\[ \n\r\t\]+1.111110" "\[ \n\r\t\]+Contents of one_double_t:" "\[ \n\r\t\]+-345.340000" "\[ \n\r\t\]+Contents of one_double_t:" "\[ \n\r\t\]+546464.200000" "\[ \n\r\t\]+Contents of two_floats_t:" "\[ \n\r\t\]+0.234000\[ \t\]+453.100006" "\[ \n\r\t\]+Contents of two_floats_t:" "\[ \n\r\t\]+78.345001\[ \t\]+23.090000" "\[ \n\r\t\]+Contents of two_floats_t:" "\[ \n\r\t\]+-2.345000\[ \t\]+1.000000" }}#go -until 1311gdb_test "tbreak 1311" \ "Breakpoint.* file .*call-ar-st.c, line 1311.*" \ "tbreakpoint line 1311"gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1311\[ \t\n\r\]+1311.*compute_with_small_structs\\(35\\);" \"continue to 1311"#call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)if ![gdb_skip_stdio_test "print sum_struct_print(...)"] { send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n" gdb_expect { -re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" { pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" } -re ".*$gdb_prompt $" { fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" } timeout { fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" } }}#call print_struct_rep(*struct1, *struct2, *struct3)if ![gdb_skip_stdio_test "print print_struct_rep(...)"] { send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n" gdb_expect_list "print print_struct_rep(*struct1, *struct2, *struct3)" \ ".*$gdb_prompt $" { "\[ \t\n\r\]+Contents of struct1:" "\[ \t\n\r\]+ 22 0" "\[ \t\n\r\]+Contents of struct2:" "\[ \t\n\r\]+ 42 0" "\[ \t\n\r\]+Contents of struct3:" "\[ \t\n\r\]+ 62 0" }}if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] { send_gdb "print print_one_large_struct(*list1)\n" gdb_expect { -re ".* 4 1.*$gdb_prompt $" { pass "print print_one_large_struct(*list1)" } -re ".*$gdb_prompt $" { fail "print print_one_large_struct(*list1)" } timeout { fail "(timeout) print_one_large_struct(*list1)" } }}set timeout $oldtimeoutreturn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -