forked from Imagelibrary/binutils-gdb
* gdb.*/*.exp: Replace $prompt with $gdb_prompt.
* gdb.base/scope.exp: Use gdb_test. * gdb.c++/classes.exp: Ditto. * gdb.c++/inherit.exp: Ditto. More random cleanups. Still lots to go, however.
This commit is contained in:
@@ -55,9 +55,9 @@ verbose "using GDBFLAGS = $GDBFLAGS" 2
|
||||
|
||||
# The variable prompt is a regexp which matches the gdb prompt. Set it if it
|
||||
# is not already set.
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
if ![info exists prompt] then {
|
||||
set prompt "\[(\]gdb\[)\]"
|
||||
set gdb_prompt "\[(\]gdb\[)\]"
|
||||
}
|
||||
|
||||
if ![info exists noargs] then {
|
||||
@@ -82,7 +82,7 @@ if ![info exists noresults] then {
|
||||
proc default_gdb_version {} {
|
||||
global GDB
|
||||
global GDBFLAGS
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
set fileid [open "gdb_cmd" w];
|
||||
puts $fileid "q";
|
||||
close $fileid;
|
||||
@@ -111,7 +111,7 @@ proc gdb_version { } {
|
||||
proc gdb_unload {} {
|
||||
global verbose
|
||||
global GDB
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
send_gdb "file\n"
|
||||
expect {
|
||||
-re "No exec file now.*\r" { exp_continue }
|
||||
@@ -125,7 +125,7 @@ proc gdb_unload {} {
|
||||
send_gdb "y\n"
|
||||
exp_continue
|
||||
}
|
||||
-re "$prompt $" {}
|
||||
-re "$gdb_prompt $" {}
|
||||
timeout {
|
||||
perror "couldn't unload file in $GDB (timed out)."
|
||||
return -1
|
||||
@@ -140,7 +140,7 @@ proc gdb_unload {} {
|
||||
#
|
||||
|
||||
proc delete_breakpoints {} {
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global gdb_spawn_id
|
||||
|
||||
send_gdb "delete breakpoints\n"
|
||||
@@ -149,14 +149,14 @@ proc delete_breakpoints {} {
|
||||
send_gdb "y\n";
|
||||
exp_continue
|
||||
}
|
||||
-i $gdb_spawn_id -re ".*$prompt $" { # This happens if there were no breakpoints
|
||||
-i $gdb_spawn_id -re ".*$gdb_prompt $" { # This happens if there were no breakpoints
|
||||
}
|
||||
-i $gdb_spawn_id timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return }
|
||||
}
|
||||
send_gdb "info breakpoints\n"
|
||||
expect {
|
||||
-i $gdb_spawn_id -re "No breakpoints or watchpoints..*$prompt $" {}
|
||||
-i $gdb_spawn_id -re ".*$prompt $" { perror "breakpoints not deleted" ; return }
|
||||
-i $gdb_spawn_id -re "No breakpoints or watchpoints..*$gdb_prompt $" {}
|
||||
-i $gdb_spawn_id -re ".*$gdb_prompt $" { perror "breakpoints not deleted" ; return }
|
||||
-i $gdb_spawn_id -re "Delete all breakpoints.*or n.*$" {
|
||||
send_gdb "y\n";
|
||||
exp_continue
|
||||
@@ -174,7 +174,7 @@ proc delete_breakpoints {} {
|
||||
# elsewhere.
|
||||
#
|
||||
proc gdb_run_cmd {args} {
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global gdb_spawn_id
|
||||
|
||||
set spawn_id $gdb_spawn_id
|
||||
@@ -185,12 +185,12 @@ proc gdb_run_cmd {args} {
|
||||
-re "Line.* Jump anyway.*y or n. $" {
|
||||
send_gdb "y\n"
|
||||
expect {
|
||||
-re "Continuing.*$prompt $" {}
|
||||
-re "Continuing.*$gdb_prompt $" {}
|
||||
timeout { perror "Jump to start() failed (timeout)"; return }
|
||||
}
|
||||
}
|
||||
-re "No symbol.*context.*$prompt $" {}
|
||||
-re "The program is not being run.*$prompt $" {
|
||||
-re "No symbol.*context.*$gdb_prompt $" {}
|
||||
-re "The program is not being run.*$gdb_prompt $" {
|
||||
gdb_load "";
|
||||
}
|
||||
timeout { perror "Jump to start() failed (timeout)"; return }
|
||||
@@ -210,7 +210,7 @@ proc gdb_run_cmd {args} {
|
||||
}
|
||||
|
||||
proc gdb_breakpoint { function } {
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global decimal
|
||||
global gdb_spawn_id
|
||||
|
||||
@@ -219,10 +219,10 @@ proc gdb_breakpoint { function } {
|
||||
send_gdb "break $function\n"
|
||||
# The first two regexps are what we get with -g, the third is without -g.
|
||||
expect {
|
||||
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$prompt $" {}
|
||||
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$prompt $" {}
|
||||
-re "Breakpoint \[0-9\]* at .*$prompt $" {}
|
||||
-re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
|
||||
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
|
||||
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
|
||||
-re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {}
|
||||
-re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 }
|
||||
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
|
||||
}
|
||||
return 1;
|
||||
@@ -235,7 +235,7 @@ proc gdb_breakpoint { function } {
|
||||
# single quoted C++ function specifier.
|
||||
|
||||
proc runto { function } {
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global decimal
|
||||
global gdb_spawn_id
|
||||
|
||||
@@ -252,13 +252,13 @@ proc runto { function } {
|
||||
# the "at foo.c:36" output we get with -g.
|
||||
# the "in func" output we get without -g.
|
||||
expect {
|
||||
-re "Break.* at .*:$decimal.*$prompt $" {
|
||||
-re "Break.* at .*:$decimal.*$gdb_prompt $" {
|
||||
return 1
|
||||
}
|
||||
-re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in $function.*$prompt $" {
|
||||
-re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in $function.*$gdb_prompt $" {
|
||||
return 1
|
||||
}
|
||||
-re "$prompt $" {
|
||||
-re "$gdb_prompt $" {
|
||||
fail "running to $function in runto"
|
||||
return 0
|
||||
}
|
||||
@@ -277,7 +277,7 @@ proc runto { function } {
|
||||
# breakpoint() and just step out of the function.
|
||||
#
|
||||
proc runto_main {} {
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global decimal
|
||||
|
||||
if ![target_info exists gdb_stub] {
|
||||
@@ -289,8 +289,8 @@ proc runto_main {} {
|
||||
send_gdb "step\n"
|
||||
# if use stubs step out of the breakpoint() function.
|
||||
expect {
|
||||
-re "main.* at .*$prompt $" {}
|
||||
-re "_start.*$prompt $" {}
|
||||
-re "main.* at .*$gdb_prompt $" {}
|
||||
-re "_start.*$gdb_prompt $" {}
|
||||
timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
|
||||
}
|
||||
return 1
|
||||
@@ -314,7 +314,7 @@ proc runto_main {} {
|
||||
#
|
||||
proc gdb_test { args } {
|
||||
global verbose
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global GDB
|
||||
global expect_out
|
||||
upvar timeout timeout
|
||||
@@ -346,7 +346,7 @@ proc gdb_test { args } {
|
||||
}
|
||||
|
||||
expect {
|
||||
-re ".*Ending remote debugging.*$prompt$" {
|
||||
-re ".*Ending remote debugging.*$gdb_prompt$" {
|
||||
if ![isnative] then {
|
||||
warning "Can`t communicate to remote target."
|
||||
}
|
||||
@@ -354,7 +354,7 @@ proc gdb_test { args } {
|
||||
gdb_start
|
||||
set result -1
|
||||
}
|
||||
-re "\[\r\n\]*$pattern\[\r\n\]+$prompt $" {
|
||||
-re "\[\r\n\]*$pattern\[\r\n\]+$gdb_prompt $" {
|
||||
if ![string match "" $message] then {
|
||||
pass "$message"
|
||||
}
|
||||
@@ -364,15 +364,15 @@ proc gdb_test { args } {
|
||||
send_gdb "$response_string\n";
|
||||
exp_continue;
|
||||
}
|
||||
-re "Undefined command:.*$prompt" {
|
||||
-re "Undefined command:.*$gdb_prompt" {
|
||||
perror "Undefined command \"$command\"."
|
||||
set result 1
|
||||
}
|
||||
-re "Ambiguous command.*$prompt $" {
|
||||
-re "Ambiguous command.*$gdb_prompt $" {
|
||||
perror "\"$command\" is not a unique command name."
|
||||
set result 1
|
||||
}
|
||||
-re ".*Program exited with code \[0-9\]+.*$prompt $" {
|
||||
-re ".*Program exited with code \[0-9\]+.*$gdb_prompt $" {
|
||||
if ![string match "" $message] then {
|
||||
set errmsg "$message: the program exited"
|
||||
} else {
|
||||
@@ -381,7 +381,7 @@ proc gdb_test { args } {
|
||||
fail "$errmsg"
|
||||
return -1
|
||||
}
|
||||
-re "The program is not being run.*$prompt $" {
|
||||
-re "The program is not being run.*$gdb_prompt $" {
|
||||
if ![string match "" $message] then {
|
||||
set errmsg "$message: the program is no longer running"
|
||||
} else {
|
||||
@@ -390,7 +390,7 @@ proc gdb_test { args } {
|
||||
fail "$errmsg"
|
||||
return -1
|
||||
}
|
||||
-re ".*$prompt $" {
|
||||
-re ".*$gdb_prompt $" {
|
||||
if ![string match "" $message] then {
|
||||
fail "$message"
|
||||
}
|
||||
@@ -428,7 +428,7 @@ proc gdb_test { args } {
|
||||
# as well.
|
||||
|
||||
proc test_print_reject { args } {
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global verbose
|
||||
|
||||
if [llength $args]==2 then {
|
||||
@@ -443,39 +443,39 @@ proc test_print_reject { args } {
|
||||
}
|
||||
send_gdb "$sendthis\n"
|
||||
expect {
|
||||
-re ".*A .* in expression.*\\.*$prompt $" {
|
||||
-re ".*A .* in expression.*\\.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*Invalid syntax in expression.*$prompt $" {
|
||||
-re ".*Invalid syntax in expression.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*Junk after end of expression.*$prompt $" {
|
||||
-re ".*Junk after end of expression.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*Invalid number.*$prompt $" {
|
||||
-re ".*Invalid number.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*Invalid character constant.*$prompt $" {
|
||||
-re ".*Invalid character constant.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*No symbol table is loaded.*$prompt $" {
|
||||
-re ".*No symbol table is loaded.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*No symbol .* in current context.*$prompt $" {
|
||||
-re ".*No symbol .* in current context.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*$expectthis.*$prompt $" {
|
||||
-re ".*$expectthis.*$gdb_prompt $" {
|
||||
pass "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
-re ".*$prompt $" {
|
||||
-re ".*$gdb_prompt $" {
|
||||
fail "reject $sendthis"
|
||||
return 1
|
||||
}
|
||||
@@ -504,7 +504,7 @@ proc gdb_test_exact { args } {
|
||||
set command [lindex $args 0]
|
||||
|
||||
# This applies a special meaning to a null string pattern. Without
|
||||
# this, "$pattern\r\n$prompt $" will match anything, including error
|
||||
# this, "$pattern\r\n$gdb_prompt $" will match anything, including error
|
||||
# messages from commands that should have no output except a new
|
||||
# prompt. With this, only results of a null string will match a null
|
||||
# string pattern.
|
||||
@@ -533,7 +533,7 @@ proc gdb_test_exact { args } {
|
||||
}
|
||||
|
||||
proc gdb_reinitialize_dir { subdir } {
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global gdb_spawn_id
|
||||
set spawn_id $gdb_spawn_id
|
||||
|
||||
@@ -545,23 +545,23 @@ proc gdb_reinitialize_dir { subdir } {
|
||||
-re "Reinitialize source path to empty.*y or n. " {
|
||||
send_gdb "y\n"
|
||||
expect {
|
||||
-re "Source directories searched.*$prompt $" {
|
||||
-re "Source directories searched.*$gdb_prompt $" {
|
||||
send_gdb "dir $subdir\n"
|
||||
expect {
|
||||
-re "Source directories searched.*$prompt $" {
|
||||
-re "Source directories searched.*$gdb_prompt $" {
|
||||
verbose "Dir set to $subdir"
|
||||
}
|
||||
-re ".*$prompt $" {
|
||||
-re ".*$gdb_prompt $" {
|
||||
perror "Dir \"$subdir\" failed."
|
||||
}
|
||||
}
|
||||
}
|
||||
-re ".*$prompt $" {
|
||||
-re ".*$gdb_prompt $" {
|
||||
perror "Dir \"$subdir\" failed."
|
||||
}
|
||||
}
|
||||
}
|
||||
-re ".*$prompt $" {
|
||||
-re ".*$gdb_prompt $" {
|
||||
perror "Dir \"$subdir\" failed."
|
||||
}
|
||||
}
|
||||
@@ -618,7 +618,7 @@ proc gdb_file_cmd { arg } {
|
||||
global loadpath
|
||||
global loadfile
|
||||
global GDB
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
upvar timeout timeout
|
||||
global gdb_spawn_id
|
||||
set spawn_id $gdb_spawn_id
|
||||
@@ -633,11 +633,11 @@ proc gdb_file_cmd { arg } {
|
||||
|
||||
send_gdb "file $arg\n"
|
||||
expect {
|
||||
-re "Reading symbols from.*done.*$prompt $" {
|
||||
-re "Reading symbols from.*done.*$gdb_prompt $" {
|
||||
verbose "\t\tLoaded $arg into the $GDB"
|
||||
return 0
|
||||
}
|
||||
-re "has no symbol-table.*$prompt $" {
|
||||
-re "has no symbol-table.*$gdb_prompt $" {
|
||||
perror "$arg wasn't compiled with \"-g\""
|
||||
return -1
|
||||
}
|
||||
@@ -649,7 +649,7 @@ proc gdb_file_cmd { arg } {
|
||||
-re "Load new symbol table from \".*\".*y or n. $" {
|
||||
send_gdb "y\n"
|
||||
expect {
|
||||
-re "Reading symbols from.*done.*$prompt $" {
|
||||
-re "Reading symbols from.*done.*$gdb_prompt $" {
|
||||
verbose "\t\tLoaded $arg with new symbol table into $GDB"
|
||||
return 0
|
||||
}
|
||||
@@ -659,11 +659,11 @@ proc gdb_file_cmd { arg } {
|
||||
}
|
||||
}
|
||||
}
|
||||
-re ".*No such file or directory.*$prompt $" {
|
||||
-re ".*No such file or directory.*$gdb_prompt $" {
|
||||
perror "($arg) No such file or directory\n"
|
||||
return -1
|
||||
}
|
||||
-re "$prompt $" {
|
||||
-re "$gdb_prompt $" {
|
||||
perror "couldn't load $arg into $GDB."
|
||||
return -1
|
||||
}
|
||||
@@ -692,7 +692,7 @@ proc default_gdb_start { } {
|
||||
global verbose
|
||||
global GDB
|
||||
global GDBFLAGS
|
||||
global prompt
|
||||
global gdb_prompt
|
||||
global timeout
|
||||
global gdb_spawn_id
|
||||
global spawn_id
|
||||
@@ -717,10 +717,10 @@ proc default_gdb_start { } {
|
||||
verbose $shell_id
|
||||
set timeout 10
|
||||
expect {
|
||||
-i $shell_id -re ".*\[\r\n\]$prompt $" {
|
||||
-i $shell_id -re ".*\[\r\n\]$gdb_prompt $" {
|
||||
verbose "GDB initialized."
|
||||
}
|
||||
-i $shell_id -re "$prompt $" {
|
||||
-i $shell_id -re "$gdb_prompt $" {
|
||||
perror "GDB never initialized."
|
||||
set timeout $oldtimeout
|
||||
verbose "Timeout restored to $timeout seconds" 2
|
||||
@@ -740,7 +740,7 @@ proc default_gdb_start { } {
|
||||
# force the height to "unlimited", so no pagers get used
|
||||
send_gdb "set height 0\n"
|
||||
expect {
|
||||
-i $shell_id -re ".*$prompt $" {
|
||||
-i $shell_id -re ".*$gdb_prompt $" {
|
||||
verbose "Setting height to 0." 2
|
||||
}
|
||||
-i $shell_id timeout {
|
||||
@@ -750,7 +750,7 @@ proc default_gdb_start { } {
|
||||
# force the width to "unlimited", so no wraparound occurs
|
||||
send_gdb "set width 0\n"
|
||||
expect {
|
||||
-i $shell_id -re ".*$prompt $" {
|
||||
-i $shell_id -re ".*$gdb_prompt $" {
|
||||
verbose "Setting width to 0." 2
|
||||
}
|
||||
-i $shell_id timeout {
|
||||
|
||||
Reference in New Issue
Block a user