📄 ptype.exp
字号:
#setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*"#send "ptype v_char_array\n"#gdb_expect {# -re "type = char .2..*$gdb_prompt $" { pass "ptype char array" }# -re ".*$gdb_prompt $" { fail "ptype char array" }# timeout { fail "(timeout) ptype char array" }#}###setup_xfail "mips-*-*" "a29k-*-*"#send "ptype v_signed_char_array\n"#gdb_expect {# -re "type = (|signed )char .2..*$gdb_prompt $" { pass "ptype signed char array" }# -re ".*$gdb_prompt $" { fail "ptype signed char array" }# timeout { fail "(timeout) ptype signed char array" }#}###send "ptype v_unsigned_char_array\n"#gdb_expect {# -re "type = unsigned char .2..*$gdb_prompt $" { pass "ptype unsigned char array" }# -re ".*$gdb_prompt $" { fail "ptype unsigned char array" }# timeout { fail "(timeout) ptype unsigned char array" }#}####send "ptype v_int_array\n"#gdb_expect {# -re "type = int .2..*$gdb_prompt $" { pass "ptype int array" }# -re ".*$gdb_prompt $" { fail "ptype int array" }# timeout { fail "(timeout) ptype int array" }#}###send "ptype v_signed_int_array\n"#gdb_expect {# -re "type = int .2..*$gdb_prompt $" { pass "ptype signed int array" }# -re ".*$gdb_prompt $" { fail "ptype signed int array" }# timeout { fail "(timeout) ptype signed int array" }#}###send "ptype v_unsigned_int_array\n"#gdb_expect {# -re "type = unsigned int .2..*$gdb_prompt $" { pass "ptype unsigned int array" }# -re ".*$gdb_prompt $" { fail "ptype unsigned int array" }# timeout { fail "(timeout) ptype unsigned int array" }#}###send "ptype v_long_array\n"#gdb_expect {# -re "type = (long|int|long int) .2..*$gdb_prompt $" { # pass "ptype long array" }# -re ".*$gdb_prompt $" { fail "ptype long array" }# timeout { fail "(timeout) ptype long array" }#}###send "ptype v_signed_long_array\n"#gdb_expect {# -re "type = (long|int|long int) .2..*$gdb_prompt $" { # pass "ptype signed long array" }# -re ".*$gdb_prompt $" { fail "ptype signed long array" }# timeout { fail "(timeout) ptype signed long array" }#}###send "ptype v_unsigned_long_array\n"#gdb_expect {# -re "type = unsigned long .2..*$gdb_prompt $" { pass "ptype unsigned long array" }# -re ".*$gdb_prompt $" { fail "ptype unsigned long array" }# timeout { fail "(timeout) ptype unsigned long array" }#}###send "ptype v_float_array\n"#gdb_expect {# -re "type = float .2..*$gdb_prompt $" { pass "ptype float array" }# -re ".*$gdb_prompt $" { fail "ptype float array" }# timeout { fail "(timeout) ptype float array" }#}###send "ptype v_double_array\n"#gdb_expect {# -re "type = double .2..*$gdb_prompt $" { pass "ptype double array" }# -re ".*$gdb_prompt $" { fail "ptype double array" }# timeout { fail "(timeout) ptype double array" }#}#if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }setup_xfail_format "DWARF 1"if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"##### test ptype command with pointers###setup_xfail "i960-*-*" 1821#setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*"#send "ptype v_char_pointer\n"#gdb_expect {# -re "type = char \*.*$gdb_prompt $" { pass "ptype char pointer" }# -re ".*$gdb_prompt $" { fail "ptype char pointer" }# timeout { fail "(timeout) ptype char pointer" }#}###setup_xfail "mips-*-*" "a29k-*-*"#send "ptype v_signed_char_pointer\n"#gdb_expect {# -re "type = (|signed )char \*.*$gdb_prompt $"# { pass "ptype signed char pointer" }# -re ".*$gdb_prompt $" { fail "ptype signed char pointer" }# timeout { fail "(timeout) ptype signed char pointer" }#}###send "ptype v_unsigned_char_pointer\n"#gdb_expect {# -re "type = unsigned char \*.*$gdb_prompt $" { pass "ptype unsigned char pointer" }# -re ".*$gdb_prompt $" { fail "ptype unsigned char pointer" }# timeout { fail "(timeout) ptype unsigned char pointer" }#}###send "ptype v_short_pointer\n"#gdb_expect {# -re "type = (short|short int) \*.*$gdb_prompt $" { pass "ptype short pointer" }# -re ".*$gdb_prompt $" { fail "ptype short pointer" }# timeout { fail "(timeout) ptype short pointer" }#}###send "ptype v_signed_short_pointer\n"#gdb_expect {# -re "type = short \*.*$gdb_prompt $" { pass "ptype signed short pointer" }# -re ".*$gdb_prompt $" { fail "ptype signed short pointer" }# timeout { fail "(timeout) ptype signed short pointer" }#}###send "ptype v_unsigned_short_pointer\n"#gdb_expect {# -re "type = unsigned short \*.*$gdb_prompt $" { pass "ptype unsigned short pointer" }# -re ".*$gdb_prompt $" { fail "ptype unsigned short pointer" }# timeout { fail "(timeout) ptype unsigned short pointer" }#}###send "ptype v_int_pointer\n"#gdb_expect {# -re "type = int \*.*$gdb_prompt $" { pass "ptype int pointer" }# -re ".*$gdb_prompt $" { fail "ptype int pointer" }# timeout { fail "(timeout) ptype int pointer" }#}###send "ptype v_signed_int_pointer\n"#gdb_expect {# -re "type = int \*.*$gdb_prompt $" { pass "ptype signed int pointer" }# -re ".*$gdb_prompt $" { fail "ptype signed int pointer" }# timeout { fail "(timeout) ptype signed int pointer" }#}###send "ptype v_unsigned_int_pointer\n"#gdb_expect {# -re "type = unsigned int \*.*$gdb_prompt $" { pass "ptype unsigned int pointer" }# -re ".*$gdb_prompt $" { fail "ptype unsigned int pointer" }# timeout { fail "(timeout) ptype unsigned int pointer" }#}###send "ptype v_long_pointer\n"#gdb_expect {# -re "type = long \*.*$gdb_prompt $" { pass "ptype long pointer" }# -re ".*$gdb_prompt $" { fail "ptype long pointer" }# timeout { fail "(timeout) ptype long pointer" }#}###send "ptype v_signed_long_pointer\n"#gdb_expect {# -re "type = long \*.*$gdb_prompt $" { pass "ptype signed long pointer" }# -re ".*$gdb_prompt $" { fail "ptype signed long pointer" }# timeout { fail "(timeout) ptype signed long pointer" }#}###send "ptype v_unsigned_long_pointer\n"#gdb_expect {# -re "type = unsigned long \*.*$gdb_prompt $" { pass "ptype unsigned long pointer" }# -re ".*$gdb_prompt $" { fail "ptype unsigned long pointer" }# timeout { fail "(timeout) ptype unsigned long pointer" }#}###send "ptype v_float_pointer\n"#gdb_expect {# -re "type = float \*.*$gdb_prompt $" { pass "ptype float pointer" }# -re ".*$gdb_prompt $" { fail "ptype float pointer" }# timeout { fail "(timeout) ptype float pointer" }#}###send "ptype v_double_pointer\n"#gdb_expect {# -re "type = double \*.*$gdb_prompt $" { pass "ptype double pointer" }# -re ".*$gdb_prompt $" { fail "ptype double pointer" }# timeout { fail "(timeout) ptype double pointer" }#}## test ptype command with nested structure and union#if {$hp_aCC_compiler} { set outer "outer_struct::" set struct "" set union ""} else { set outer "" set struct "struct" set union "union"}gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\]+\.*int outer_int;.*\[\r\n\]+\.*(struct|) ${outer}inner_struct inner_struct_instance;.*\[\r\n\]+\.*(union|) ${outer}inner_union inner_union_instance;.*\[\r\n\]+\.*(long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure" gdb_test "ptype ${struct} ${outer}inner_struct" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure" gdb_test "ptype ${union} ${outer}inner_union" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union" gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] (struct |)${outer}inner_struct inner_struct_instance;.*\[\r\n\] (union |)${outer}inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure" gdb_test "ptype nested_su.outer_int" "type = int.*" "ptype outer int" gdb_test "ptype nested_su.inner_struct_instance" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2" gdb_test "ptype nested_su.inner_struct_instance.inner_int" "type = int.*" "ptype inner int" gdb_test "ptype nested_su.inner_union_instance" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union" # Test printing type of string constants and array constants, but# requires a running process. These call malloc, and can take a long# time to execute over a slow serial link, so increase the timeout.# UDI can't do this (PR 2416). XFAIL is not suitable, because attempting# the operation causes a slow painful death rather than a nice simple failure.if [runto_main] then { if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "This target can not call functions" continue } # We need to up this because this can be really slow on some boards. # (malloc() is called as part of the test). set timeout 60; gdb_test "ptype \"abc\"" "type = char \\\[4\\\]" gdb_test "ptype {'a','b','c'}" "type = char \\\[3\\\]" gdb_test "ptype {0,1,2}" "type = int \\\[3\\\]" gdb_test "ptype {(long)0,(long)1,(long)2}" "type = long \\\[3\\\]" gdb_test "ptype {(float)0,(float)1,(float)2}" "type = float \\\[3\\\]" gdb_test "ptype {{0,1,2},{3,4,5}}" "type = int \\\[2\\\]\\\[3\\\]" gdb_test "ptype {4,5,6}\[2\]" "type = int" gdb_test "ptype *&{4,5,6}\[1\]" "type = int"}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -