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

📄 mi-support.exp

📁 lwip在ucos上的移植
💻 EXP
📖 第 1 页 / 共 2 页
字号:
	    }	    timeout {		perror "Unable to select sim target"		return -1	    }	}	send_gdb "48-target-download\n"	gdb_expect 10 {	    -re "48\\^done.*$mi_gdb_prompt$" {	    }	    timeout {		perror "Unable to download to sim target"		return -1	    }	}    }    return 0}# mi_gdb_test COMMAND PATTERN MESSAGE -- send a command to gdb; test the result.## COMMAND is the command to execute, send to GDB with send_gdb.  If#   this is the null string no command is sent.# PATTERN is the pattern to match for a PASS, and must NOT include#   the \r\n sequence immediately before the gdb prompt.# MESSAGE is an optional message to be printed.  If this is#   omitted, then the pass/fail messages use the command string as the#   message.  (If this is the empty string, then sometimes we don't#   call pass or fail at all; I don't understand this at all.)## Returns:#    1 if the test failed,#    0 if the test passes,#   -1 if there was an internal error.#  proc mi_gdb_test { args } {    global verbose    global mi_gdb_prompt    global GDB    upvar timeout timeout    if [llength $args]>2 then {	set message [lindex $args 2]    } else {	set message [lindex $args 0]    }    set command [lindex $args 0]    set pattern [lindex $args 1]    if [llength $args]==5 {	set question_string [lindex $args 3];	set response_string [lindex $args 4];    } else {	set question_string "^FOOBAR$"    }    if $verbose>2 then {	send_user "Sending \"$command\" to gdb\n"	send_user "Looking to match \"$pattern\"\n"	send_user "Message is \"$message\"\n"    }    set result -1    set string "${command}\n";    if { $command != "" } {	while { "$string" != "" } {	    set foo [string first "\n" "$string"];	    set len [string length "$string"];	    if { $foo < [expr $len - 1] } {		set str [string range "$string" 0 $foo];		if { [send_gdb "$str"] != "" } {		    global suppress_flag;		    if { ! $suppress_flag } {			perror "Couldn't send $command to GDB.";		    }		    fail "$message";		    return $result;		}		gdb_expect 2 {		    -re "\[\r\n\]" { }		    timeout { }		}		set string [string range "$string" [expr $foo + 1] end];	    } else {		break;	    }	}	if { "$string" != "" } {	    if { [send_gdb "$string"] != "" } {		global suppress_flag;		if { ! $suppress_flag } {		    perror "Couldn't send $command to GDB.";		}		fail "$message";		return $result;	    }	}    }    if [info exists timeout] {	set tmt $timeout;    } else {	global timeout;	if [info exists timeout] {	    set tmt $timeout;	} else {	    set tmt 60;	}    }    gdb_expect $tmt {	 -re "\\*\\*\\* DOSEXIT code.*" {	     if { $message != "" } {		 fail "$message";	     }	     gdb_suppress_entire_file "GDB died";	     return -1;	 }	 -re "Ending remote debugging.*$mi_gdb_prompt\[ \]*$" {	    if ![isnative] then {		warning "Can`t communicate to remote target."	    }	    gdb_exit	    gdb_start	    set result -1	}	 -re "(${question_string})$" {	    send_gdb "$response_string\n";	    exp_continue;	}	 -re "Undefined.* command:.*$mi_gdb_prompt\[ \]*$" {	    perror "Undefined command \"$command\"."            fail "$message"	    set result 1	}	 -re "Ambiguous command.*$mi_gdb_prompt\[ \]*$" {	    perror "\"$command\" is not a unique command name."            fail "$message"	    set result 1	}	 -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {	    if ![string match "" $message] then {		pass "$message"	    }	    set result 0	}	 -re "Program exited with code \[0-9\]+.*$mi_gdb_prompt\[ \]*$" {	    if ![string match "" $message] then {		set errmsg "$message: the program exited"	    } else {		set errmsg "$command: the program exited"	    }	    fail "$errmsg"	    return -1	}	 -re "The program is not being run.*$mi_gdb_prompt\[ \]*$" {	    if ![string match "" $message] then {		set errmsg "$message: the program is no longer running"	    } else {		set errmsg "$command: the program is no longer running"	    }	    fail "$errmsg"	    return -1	}	 -re ".*$mi_gdb_prompt\[ \]*$" {	    if ![string match "" $message] then {		fail "$message"	    }	    set result 1	}	 "<return>" {	    send_gdb "\n"	    perror "Window too small."            fail "$message"	}	 -re "\\(y or n\\) " {	    send_gdb "n\n"	    perror "Got interactive prompt."            fail "$message"	}	 eof {	     perror "Process no longer exists"	     if { $message != "" } {		 fail "$message"	     }	     return -1	}	 full_buffer {	    perror "internal buffer is full."            fail "$message"	}	timeout	{	    if ![string match "" $message] then {		fail "$message (timeout)"	    }	    set result 1	}    }    return $result}## MI run command.  (A modified version of gdb_run_cmd)## In patterns, the newline sequence ``\r\n'' is matched explicitly as# ``.*$'' could swallow up output that we attempt to match elsewhere.proc mi_run_cmd {args} {    global suppress_flag    if { $suppress_flag } {	return -1    }    global mi_gdb_prompt    if [target_info exists gdb_init_command] {	send_gdb "[target_info gdb_init_command]\n";	gdb_expect 30 {	    -re "$mi_gdb_prompt$" { }	    default {		perror "gdb_init_command for target failed";		return;	    }	}    }    if [target_info exists use_gdb_stub] {	if [target_info exists gdb,do_reload_on_run] {	    # Specifying no file, defaults to the executable	    # currently being debugged.	    if { [mi_gdb_load ""] < 0 } {		return;	    }	    send_gdb "000-exec-continue\n";	    gdb_expect 60 {		-re "Continu\[^\r\n\]*\[\r\n\]" {}		default {}	    }	    return;	}    }    send_gdb "000-exec-run $args\n"    gdb_expect {	-re "000\\^running\r\n${mi_gdb_prompt}" {	}	timeout {	    perror "Unable to start target"	    return	}    }    # NOTE: Shortly after this there will be a ``000*stopping,...(gdb)''}## Just like run-to-main but works with the MI interface#proc mi_run_to_main { } {    global suppress_flag    if { $suppress_flag } {	return -1    }    global mi_gdb_prompt    global hex    global decimal    global srcdir    global subdir    global binfile    global srcfile    set test "mi run-to-main"    mi_delete_breakpoints    mi_gdb_reinitialize_dir $srcdir/$subdir    mi_gdb_load ${binfile}    mi_gdb_test "200-break-insert main" \	    "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \	    "breakpoint at main"    mi_run_cmd    gdb_expect {	-re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {	    pass "$test"	    return 0	}	timeout {	    fail "$test (timeout)"	    return -1	}    }}# Next to the next statementproc mi_next { test } {    global suppress_flag    if { $suppress_flag } {	return -1    }    global mi_gdb_prompt    send_gdb "220-exec-next\n"    gdb_expect {	-re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\{.*\},,file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {	    pass "$test"	    return 0	}	timeout {	    fail "$test"	    return -1	}    }}# Step to the next statementproc mi_step { test } {    global suppress_flag    if { $suppress_flag } {	return -1    }    global mi_gdb_prompt    send_gdb "220-exec-step\n"    gdb_expect {	-re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\{.*\},,file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {	    pass "$test"	    return 0	}	timeout {	    fail "$test"	    return -1	}    }}# Local variables: # change-log-default-name: "../gdb.mi/ChangeLog-mi"# End: 

⌨️ 快捷键说明

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