diff options
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 93 |
1 files changed, 80 insertions, 13 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index cf754f9..38cc31c 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -19,13 +19,19 @@ # This file was written by Fred Fish. (fnf@cygnus.com) +# set the prompt if it doesn't exist +global prompt +if ![info exists prompt] then { + set prompt "\[(\]gdb\[)\]" +} + # Generic gdb subroutines that should work for any target. If these # need to be modified for any target, it can be done with a variable # or by passing arguments. global GDB if ![info exists GDB] then { - set GDB [transform gdb] + set GDB [findfile $base_dir/../gdb "gdb" [transform gdb ]] } global GDBFLAGS @@ -33,12 +39,6 @@ if ![info exists GDBFLAGS] then { set GDBFLAGS "" } -# set the prompt if it doesn't exist -global prompt -if ![info exists prompt] then { - set prompt "\[(\]gdb\[)\]" -} - # # gdb_version -- extract and print the version number of gcc # @@ -301,12 +301,13 @@ proc default_gdb_exit {} { # This used to be 1 for unix-gdb.exp set timeout 5 - # We used to try to send "quit" to GDB, and wait for it to die. - # Dealing with all the cases and errors got pretty hairy. Just close it, - # that is simpler. - close - - # Omitting this probably would cause strange timing-dependent failures. + # this will kill the gdb process, it's cleaner than sending a quit. + close + + # Before this was here sometimes "uit" would get sent to the next GDB + # (assuming this is immediately followed by gdb_start), which would + # cause a loss of syncronization (i.e. all the stuff that swallows a + # prompt would swallow the wrong one). wait } @@ -373,6 +374,72 @@ oaded." } } + +# +# start gdb -- start gdb running +# +proc default_gdb_start { } { + global verbose + global GDB + global GDBFLAGS + global prompt + global spawn_id + global timeout + verbose "Spawning $GDB $GDBFLAGS" + + set oldtimeout $timeout + set timeout [expr "$timeout + 60"] + if [ llength $GDBFLAGS ] then { + if {[which $GDB] != 0} then { + spawn $GDB $GDBFLAGS + } else { + perror "$GDB does not exist." + exit 1 + } + } else { + if {[which $GDB] != 0} then { + spawn $GDB + } else { + perror "$GDB does not exist." + exit 1 + } + } + expect { + -re ".*\r\n$prompt $" { + verbose "GDB initialized for native mode" + } + -re "$prompt $" { + perror "GDB never initialized." + return -1 + } + timeout { + perror "(timeout) GDB never initialized." + return -1 + } + } + set timeout $oldtimeout + # force the height to "unlimited", so no pagers get used + send "set height 0\n" + expect { + -re ".*$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 "set width 0\n" + expect { + -re ".*$prompt $" { + verbose "Setting width to 0." 2 + } + timeout { + warning "Couldn't set the width to 0." + } + } +} + # # FIXME: this is a copy of the new library procedure, but it's here too # till the new dejagnu gets installed everywhere. I'd hate to break the |