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

📄 mi-support.exp

📁 lwip在ucos上的移植
💻 EXP
📖 第 1 页 / 共 2 页
字号:
# Copyright (C) 1999, 2000 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.  # Please email any bugs, comments, and/or additions to this file to:# bug-gdb@prep.ai.mit.edu# This file was based on a file written by Fred Fish. (fnf@cygnus.com)# Test setup routines that work with the MI interpreter.# The variable mi_gdb_prompt is a regexp which matches the gdb mi prompt.# Set it if it is not already set.global mi_gdb_promptif ![info exists mi_gdb_prompt] then {    set mi_gdb_prompt "\[(\]gdb\[)\] \r\n"}set MIFLAGS "-i=mi"## mi_gdb_exit -- exit the GDB, killing the target program if necessary#proc mi_gdb_exit {} {    catch mi_uncatched_gdb_exit}proc mi_uncatched_gdb_exit {} {    global GDB    global GDBFLAGS    global verbose    global gdb_spawn_id;    global gdb_prompt    global mi_gdb_prompt    global MIFLAGS    gdb_stop_suppressing_tests;    if { [info procs sid_exit] != "" } {	sid_exit    }    if ![info exists gdb_spawn_id] {	return;    }    verbose "Quitting $GDB $GDBFLAGS $MIFLAGS"    if { [is_remote host] && [board_info host exists fileid] } {	send_gdb "999-gdb-exit\n";	gdb_expect 10 {	    -re "y or n" {		send_gdb "y\n";		exp_continue;	    }            -re "Undefined command.*$gdb_prompt $" {                send_gdb "quit\n"		exp_continue;            }	    -re "DOSEXIT code" { }	    default { }	}    }    if ![is_remote host] {	remote_close host;    }    unset gdb_spawn_id}## start gdb -- start gdb running, default procedure## When running over NFS, particularly if running many simultaneous# tests on different hosts all using the same server, things can# get really slow.  Give gdb at least 3 minutes to start up.#proc mi_gdb_start { } {    global verbose    global GDB    global GDBFLAGS    global gdb_prompt    global mi_gdb_prompt    global timeout    global gdb_spawn_id;    global MIFLAGS    gdb_stop_suppressing_tests;    verbose "Spawning $GDB -nw $GDBFLAGS $MIFLAGS"    if [info exists gdb_spawn_id] {	return 0;    }    if ![is_remote host] {	if { [which $GDB] == 0 } then {	    perror "$GDB does not exist."	    exit 1	}    }    set res [remote_spawn host "$GDB -nw $GDBFLAGS $MIFLAGS [host_info gdb_opts]"];    if { $res < 0 || $res == "" } {	perror "Spawning $GDB failed."	return 1;    }    gdb_expect {	-re ".*UI_OUT.*$mi_gdb_prompt$" {	    verbose "GDB initialized."	}	-re ".*$mi_gdb_prompt$" {	    untested "Skip mi tests (output not in headless format)."	    remote_close host;	    return -1;	}	-re ".*$gdb_prompt $" {	    untested "Skip mi tests (got non-mi prompt)."	    remote_close host;	    return -1;	}	-re ".*unrecognized option.*for a complete list of options." {	    untested "Skip mi tests (not compiled with mi support)."	    remote_close host;	    return -1;	}	timeout {	    perror "(timeout) GDB never initialized after 10 seconds."	    remote_close host;	    return -1	}    }    set gdb_spawn_id -1;    # FIXME: mi output does not go through pagers, so these can be removed.    # force the height to "unlimited", so no pagers get used    send_gdb "100-gdb-set height 0\n"    gdb_expect 10 {	-re ".*100-gdb-set height 0\r\n100\\\^done\r\n$mi_gdb_prompt$" { 	    verbose "Setting height to 0." 2	}	timeout {	    warning "Couldn't set the height to 0"	}    }    # force the width to "unlimited", so no wraparound occurs    send_gdb "101-gdb-set width 0\n"    gdb_expect 10 {	-re ".*101-gdb-set width 0\r\n101\\\^done\r\n$mi_gdb_prompt$" {	    verbose "Setting width to 0." 2	}	timeout {	    warning "Couldn't set the width to 0."	}    }    # Finally start SID.    if { [info procs sid_start] != "" } {	verbose "Spawning SID"	sid_start    }    return 0;}# Many of the tests depend on setting breakpoints at various places and# running until that breakpoint is reached.  At times, we want to start# with a clean-slate with respect to breakpoints, so this utility proc # lets us do this without duplicating this code everywhere.#proc mi_delete_breakpoints {} {    global mi_gdb_prompt# FIXME: The mi operation won't accept a prompt back and will use the 'all' arg    send_gdb "102-break-delete\n"    gdb_expect 30 {	 -re "Delete all breakpoints.*y or n.*$" {	    send_gdb "y\n";	    exp_continue         }	 -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {            # This happens if there were no breakpoints	 }	 timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return }    }# The correct output is not "No breakpoints or watchpoints." but an# empty BreakpointTable. Also, a query is not acceptable with mi.    send_gdb "103-break-list\n"    gdb_expect 30 {	 -re "103-break-list\r\n103\\\^done,BreakpointTable=\{\}\r\n$mi_gdb_prompt$" {}	 -re "103-break-list\r\n103\\\^doneNo breakpoints or watchpoints.\r\n\r\n$mi_gdb_prompt$" {warning "Unexpected console text received"}	 -re "$mi_gdb_prompt$" { perror "Breakpoints not deleted" ; return }	 -re "Delete all breakpoints.*or n.*$" {	    warning "Unexpected prompt for breakpoints deletion";	    send_gdb "y\n";	    exp_continue	}	 timeout { perror "-break-list (timeout)" ; return }    }}proc mi_gdb_reinitialize_dir { subdir } {    global mi_gdb_prompt    global suppress_flag    if { $suppress_flag } {	return    }    if [is_remote host] {	return "";    }    send_gdb "104-environment-directory\n"    gdb_expect 60 {	-re ".*Reinitialize source path to empty.*y or n. " {            warning "Got confirmation prompt for dir reinitialization."	    send_gdb "y\n"	    gdb_expect 60 {		-re "$mi_gdb_prompt$" {}                timeout {error "Dir reinitialization failed (timeout)"}	    }	}	-re "$mi_gdb_prompt$" {}        timeout {error "Dir reinitialization failed (timeout)"}    }    send_gdb "105-environment-directory $subdir\n"    gdb_expect 60 {	-re "Source directories searched.*$mi_gdb_prompt$" {	    verbose "Dir set to $subdir"	}	-re "105\\\^done\r\n$mi_gdb_prompt$" {            # FIXME: We return just the prompt for now.	    verbose "Dir set to $subdir"	    # perror "Dir \"$subdir\" failed."	}    }}## load a file into the debugger.# return a -1 if anything goes wrong.#proc mi_gdb_load { arg } {    global verbose    global loadpath    global loadfile    global GDB    global mi_gdb_prompt    upvar timeout timeout    # ``gdb_unload''    # ``gdb_file_cmd''# FIXME: Several of these patterns are only acceptable for console# output.  Queries are an error for mi.    send_gdb "105-file-exec-and-symbols $arg\n"    gdb_expect 120 {        -re "Reading symbols from.*done.*$mi_gdb_prompt$" {            verbose "\t\tLoaded $arg into the $GDB"            # All OK        }        -re "has no symbol-table.*$mi_gdb_prompt$" {            perror "$arg wasn't compiled with \"-g\""            return -1        }        -re "A program is being debugged already.*Kill it.*y or n. $" {            send_gdb "y\n"                verbose "\t\tKilling previous program being debugged"            exp_continue        }        -re "Load new symbol table from \".*\".*y or n. $" {            send_gdb "y\n"            gdb_expect 120 {                -re "Reading symbols from.*done.*$mi_gdb_prompt$" {                    verbose "\t\tLoaded $arg with new symbol table into $GDB"                    # All OK                }                timeout {                    perror "(timeout) Couldn't load $arg, other program already loaded."                    return -1                }            }	}        -re "No such file or directory.*$mi_gdb_prompt$" {            perror "($arg) No such file or directory\n"            return -1        }        -re "105-file-exec-and-symbols .*\r\n105\\\^done\r\n$mi_gdb_prompt$" {            # We are just giving the prompt back for now	    # All OK            }        timeout {            perror "couldn't load $arg into $GDB (timed out)."            return -1        }        eof {            # This is an attempt to detect a core dump, but seems not to            # work.  Perhaps we need to match .* followed by eof, in which            # gdb_expect does not seem to have a way to do that.            perror "couldn't load $arg into $GDB (end of file)."            return -1        }    }        # ``load''    if { [info procs send_target_sid] != "" } {	# For SID, things get complex	send_target_sid	gdb_expect 60 {	    -re "\\^done,.*$mi_gdb_prompt$" {	    }	    timeout {		perror "Unable to connect to SID target"		return -1	    }	}	send_gdb "48-target-download\n"	gdb_expect 10 {	    -re "48\\^done.*$mi_gdb_prompt$" {	    }	    timeout {		perror "Unable to download to SID target"		return -1	    }	}    } elseif { [target_info protocol] == "sim" } {	# For the simulator, just connect to it directly.	send_gdb "47-target-select sim\n"	gdb_expect 10 {	    -re "47\\^connected.*$mi_gdb_prompt$" {

⌨️ 快捷键说明

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