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

📄 cplusfuncs.exp

📁 这个是LINUX下的GDB调度工具的源码
💻 EXP
📖 第 1 页 / 共 2 页
字号:
# Copyright 1992, 1997, 1999, 2001, 2002, 2003, 2004# Free Software Foundation, Inc.# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  # This file was written by Fred Fish. (fnf@cygnus.com)# Adapted for g++ 3.0 ABI by Michael Chastain. (chastain@redhat.com)if $tracelevel then {	strace $tracelevel}if { [skip_cplus_tests] } { continue }set testfile "cplusfuncs"set srcfile ${testfile}.ccset binfile ${objdir}/${subdir}/${testfile}if { [get_compiler_info $binfile "c++"] } {    return -1}if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."}## g++ changed its ABI between 2.95 and 3.0.  gdb has two demanglers# for the two different styles.  The two demanglers have some subtle# discrepancies in their output.##   old demangler         new demangler#   --- ---------         --- ---------#   "operator, "          "operator,"#   "char *"              "char*"#   "int *"               "int*"#   "long *"              "long*"#   "void *"              "void*"#   "foo &"               "foo&"#   "unsigned int"        "unsigned"#   "void"                ""## I probe for the forms in use.# The defaults are for the v3 demangler (as of 2001-02-13).#set dm_operator_comma		","set dm_type_char_star		"char*"set dm_type_char_star_quoted    "char\\*"set dm_type_foo_ref 		"foo&"set dm_type_int_star		"int*"set dm_type_long_star		"long*"set dm_type_unsigned_int	"unsigned"set dm_type_void		""set dm_type_void_star		"void*"proc probe_demangler { } {    global gdb_prompt    global dm_operator_comma    global dm_type_char_star    global dm_type_char_star_quoted    global dm_type_foo_ref    global dm_type_int_star    global dm_type_long_star    global dm_type_unsigned_int    global dm_type_void    global dm_type_void_star    send_gdb "print &'foo::operator,(foo&)'\n"    gdb_expect {	-re ".*foo::operator, \\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_operator_comma ", "	    pass "detect dm_operator_comma"	}	-re ".*foo::operator,\\(.*foo.*&.*\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_operator_comma"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_operator_comma"	}	timeout {	    fail "detect dm_operator_comma"	}    }    send_gdb "print &'dm_type_char_star'\n"    gdb_expect {	-re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_type_char_star "char *"	    set dm_type_char_star_quoted "char \\*"	    pass "detect dm_type_char_star"	}	-re ".*dm_type_char_star\\(char\\*\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_type_char_star"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_type_char_star"	}	timeout {	    fail "detect dm_type_char_star (timeout)"	}    }    send_gdb "print &'dm_type_foo_ref'\n"    gdb_expect {	-re ".*dm_type_foo_ref\\(foo &\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_type_foo_ref "foo &"	    pass "detect dm_type_foo_ref"	}	-re ".*dm_type_foo_ref\\(foo&\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_type_foo_ref"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_type_foo_ref"	}	timeout {	    fail "detect dm_type_foo_ref (timeout)"	}    }    send_gdb "print &'dm_type_int_star'\n"    gdb_expect {	-re ".*dm_type_int_star\\(int \\*\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_type_int_star "int *"	    pass "detect dm_type_int_star"	}	-re ".*dm_type_int_star\\(int\\*\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_type_int_star"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_type_int_star"	}	timeout {	    fail "detect dm_type_int_star (timeout)"	}    }    send_gdb "print &'dm_type_long_star'\n"    gdb_expect {	-re ".*dm_type_long_star\\(long \\*\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_type_long_star "long *"	    pass "detect dm_type_long_star"	}	-re ".*dm_type_long_star\\(long\\*\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_type_long_star"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_type_long_star"	}	timeout {	    fail "detect dm_type_long_star (timeout)"	}    }    send_gdb "print &'dm_type_unsigned_int'\n"    gdb_expect {	-re ".*dm_type_unsigned_int\\(unsigned int\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_type_unsigned_int "unsigned int"	    pass "detect dm_type_unsigned_int"	}	-re ".*dm_type_unsigned_int\\(unsigned\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_type_unsigned_int"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_type_unsigned_int"	}	timeout {	    fail "detect dm_unsigned int (timeout)"	}    }    send_gdb "print &'dm_type_void'\n"    gdb_expect {	-re ".*dm_type_void\\(void\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_type_void "void"	    pass "detect dm_type_void"	}	-re ".*dm_type_void\\(\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_type_void"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_type_void"	}	timeout {	    fail "detect dm_type_void (timeout)"	}    }    send_gdb "print &'dm_type_void_star'\n"    gdb_expect {	-re ".*dm_type_void_star\\(void \\*\\).*\r\n$gdb_prompt $" {	    # v2 demangler	    set dm_type_void_star "void *"	    pass "detect dm_type_void_star"	}	-re ".*dm_type_void_star\\(void\\*\\).*\r\n$gdb_prompt $" {	    # v3 demangler	    pass "detect dm_type_void_star"	}	-re ".*$gdb_prompt $" {	    fail "detect dm_type_void_star"	}	timeout {	    fail "detect dm_type_void_star (timeout)"	}    }}##  Lookup a specific C++ function and print the demangled type.#  This form accepts the demangled type as a regexp.#proc info_func_regexp { name demangled } {    global gdb_prompt    send_gdb "info function $name\n"    gdb_expect {	-re ".*File .*:\r\n(class |)$demangled\r\n.*$gdb_prompt $" {	    pass "info function for \"$name\""	}	-re ".*$gdb_prompt $" {	    fail "info function for \"$name\""	}	timeout {	    fail "info function for \"$name\" (timeout)"	}    }}##  Lookup a specific C++ function and print the demangled type.#  This form accepts the demangled type as a literal string.#proc info_func { name demangled } {    info_func_regexp "$name" [string_to_regexp "$demangled"]}## Print the address of a function.# This checks that I can lookup a fully qualified C++ function.# This also checks the argument types on the return string.# Note: carlton/2003-01-16: If you modify this, make a corresponding# modification to print_addr_2_kfail.proc print_addr_2 { name good } {    global gdb_prompt    global hex    set good_pattern [string_to_regexp $good]    send_gdb "print &'$name'\n"    gdb_expect {	-re ".* = .* $hex <$good_pattern>\r\n$gdb_prompt $" {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -