📄 call-ar-st.exp
字号:
-re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" } timeout { fail "(timeout) compute_with_small_structs(20)" } }#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)if {![target_info exists gdb,skip_float_tests]} { send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n" gdb_expect { -re ".*Two Doubles : 123.456000.*123.456000\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450\[\t\r\n \]+Two Doubles : -0.111111.*216.970650\[\t\r\n \]+.*$gdb_prompt $" { pass "print print_ten_doubles" } -re ".*$gdb_prompt $" { fail "print print_ten_doubles" } timeout { fail "(timeout) print_ten_doubles" } }}#go -until 1286gdb_test "tbreak 1286" \ "Breakpoint .* file .*call-ar-st.c, line 1286.*" \ "tbreakpoint line 1286"gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1286\[\t\r\n \]+1286.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1286"if { [istarget "hppa*-*-hpux*"] } { # # NOTE:(FIXME) # the aCC demangler cannot demangle the name of a function with >10 args. # so I added a .* after the name of the function, to match the # incredibly long mangled name # (getting aCC's libdemangle.a bundled w/ the system?) # DTS CLLbs16994 coulter 990114 # # FIXME: use step for hppa* testing for now # guo 990621 # send_gdb "step\n" 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 ".*$gdb_prompt $" { fail "step into print_long_arg_list" } timeout { fail "step into print_long_arg_list (timeout)" } }} else { # We can't just assume that a "step" will get us into # print_long_arg_list here,either. gdb_test "tbreak print_long_arg_list" \ "Breakpoint .* file .*call-ar-st.c, line .*" \ "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 {![target_info exists gdb,skip_float_tests]} { 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 {![target_info exists gdb,skip_float_tests]} { # On Solaris, 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. A real # GDB bug, probably for all Sparc configs, but obscure. -sts 1999-08-17. setup_xfail "sparc*-*-solaris*" 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 { -re ".*alpha${ws}gamma${ws}epsilon${ws}alpha${ws}gamma${ws}epsilon${ws}ch1: y.*ch2: n${ws}Contents of three_char_t:${ws}a.*b.*c${ws}Contents of five_char_t:${ws}l.*m.*n.*o.*p${ws}Contents of int_char_combo_t:${ws}123.*z${ws}Sum of the 4 struct values and seed :${ws}52${ws}Contents of struct1:${ws}6.*0${ws}Contents of struct2:${ws}10.*0${ws}Contents of struct3:${ws}12.*0${ws}Contents of one_double_t:${ws}10.500000${ws}Contents of one_double_t:${ws}-3.375000${ws}Contents of one_double_t:${ws}675.093750${ws}Contents of two_floats_t:${ws}45.234001.*43.599998${ws}Contents of two_floats_t:${ws}78.010002.*122.099998${ws}Contents of two_floats_t:${ws}-1232.344971.*-199.210007${ws}.*$gdb_prompt $" { pass "print print_small_structs from print_long_arg_list" } -re ".*$gdb_prompt $" { fail "print print_small_structs from print_long_arg_list" } timeout { fail "(timeout) print_small_structs from print_long_arg_list" } }}#go -until 1300gdb_test "tbreak 1300" \ "Breakpoint.* file .*call-ar-st.c, line 1300.*" \ "tbreakpoint line 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"#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)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 {![target_info exists gdb,skip_float_tests]} { 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 { -re ".*double : 22.250000.*double : 33.375000.*int : 0.*int : -25.*int : 100.*int : 2345.*alpha.*gamma.*epsilon.*ch1: y.*ch2: n.*Contents of three_char_t:.*x.*y.*z.*Contents of five_char_t:.*h.*e.*l.*l.*o.*Contents of int_char_combo_t:.*123.*z.*Sum of the 4 struct values and seed :.*52.*Contents of struct1:.*6\[ \]+0.*Contents of struct2:.*10\[ \]+0.*Contents of struct3:.*12.*0.*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.*453.100006\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+78.345001.*23.090000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+-2.345000.*1.000000.*$gdb_prompt $" { pass "print print_long_arg_list" } -re ".*$gdb_prompt $" { fail "print print_long_arg_list" } timeout { fail "(timeout) print_long_arg_list" } }}#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)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)send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n"gdb_expect { -re ".*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\[ \t\n\r\]+.*$gdb_prompt $" { pass "print print_struct_rep(*struct1, *struct2, *struct3)" } -re ".*$gdb_prompt $" { fail "print print_struct_rep(*struct1, *struct2, *struct3)" } timeout { fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" } }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)" } }return~
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -