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

📄 ptype.exp

📁 这个是LINUX下的GDB调度工具的源码
💻 EXP
📖 第 1 页 / 共 2 页
字号:
##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*" }if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"##### test ptype command with pointers###setup_xfail "mips-idt-*" "mips-sgi-*"#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-*-*"#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" get_debug_format# Print the type of the identifier ID, and check the response:# - Expect to see PROTOTYPED as the type.  PROTOTYPED is not a regular#   expression; it's a literal string.# - If we instead see the unprototyped type PLAIN, and we're using STABS#   generated by GCC, that's an xfail; as of 9 Feb 2002, GCC never emits#   prototyped function types in STABS.  Like PROTOTYPED, PLAIN is a#   literal string, not a regular expression.# - Otherwise, it's a failure.proc ptype_maybe_prototyped { id prototyped plain } {    global gdb_prompt    global gcc_compiled    # Turn `prototyped' and `plain', which are literal strings, into    # regular expressions by quoting any special characters they contain.    regsub -all "\[\]\[*()\]" $prototyped "\\\\&" prototyped    regsub -all "\[\]\[*()\]" $plain "\\\\&" plain    send_gdb "ptype $id\n"    gdb_expect {        -re "type = $prototyped\[\r\n\]+$gdb_prompt $" {            pass "ptype $id"        }        -re "type = $plain\[\r\n\]+$gdb_prompt $" {            if {$gcc_compiled} { setup_xfail_format "stabs" }            fail "ptype $id (compiler doesn't emit prototyped types)"        }        -re "$gdb_prompt $" {            fail "ptype $id"        }        timeout {            fail "ptype $id (timeout)"        }    }}ptype_maybe_prototyped "func_type" "int (*)(int (*)(int, float), float)" \                                   "int (*)()"ptype_maybe_prototyped "old_fptr" "double (*)()" "double (*)()"ptype_maybe_prototyped "new_fptr" "double (*)(void)" "double (*)()"ptype_maybe_prototyped "fptr" "int (*)(int, float)" "int (*)()"ptype_maybe_prototyped "fptr2" "int *(*)(int (*)(int, float), float)" \                               "int *(*)()"ptype_maybe_prototyped "xptr" "int (*)(int (*)(), int (*)(void), int)" \                              "int (*)()"ptype_maybe_prototyped "ffptr" "int (*(*)(char))(short int)" \                               "int (*(*)())()"ptype_maybe_prototyped "fffptr" "int (*(*(*)(char))(short int))(long int)" \                                "int (*(*(*)())())()"# 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 + -