mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 09:58:19 +08:00
[gdb/testsuite] Handle with_set arch
I realized that the more irregular output of show arch: ... (gdb) show arch^M The target architecture is set to "auto" (currently "i386").^M ... would be a problem for something like: ... with_set arch powerpc:common64 {} ... and indeed: ... (gdb) set arch powerpc:common64^M The target architecture is set to "powerpc:common64".^M (gdb) FAIL: gdb.base/foo.exp: set arch powerpc:common64 ... and: ... (gdb) set arch set to "auto" (currently "i386")^M Undefined item: "set".^M ... Fix this in with_set by handling this type of output. Tested on x86_64-linux.
This commit is contained in:
@ -5924,18 +5924,36 @@ proc with_set { var val body } {
|
||||
}
|
||||
}
|
||||
|
||||
# Handle 'set to "auto" (currently "i386")'.
|
||||
set save [regsub {^set to} $save ""]
|
||||
set save [regsub {\([^\r\n]+\)$} $save ""]
|
||||
set save [string trim $save]
|
||||
set save [regsub -all {^"|"$} $save ""]
|
||||
|
||||
if { $save == "" } {
|
||||
perror "Did not manage to set $var"
|
||||
} else {
|
||||
# Set var.
|
||||
gdb_test_no_output -nopass "set $var $val"
|
||||
set cmd "set $var $val"
|
||||
gdb_test_multiple $cmd "" {
|
||||
-re -wrap "^$cmd" {
|
||||
}
|
||||
-re -wrap " is set to \"?$val\"?\\." {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set code [catch {uplevel 1 $body} result]
|
||||
|
||||
# Restore saved setting.
|
||||
if { $save != "" } {
|
||||
gdb_test_no_output -nopass "set $var $save"
|
||||
set cmd "set $var $save"
|
||||
gdb_test_multiple $cmd "" {
|
||||
-re -wrap "^$cmd" {
|
||||
}
|
||||
-re -wrap "is set to \"?$save\"?( \\(\[^)\]*\\))?\\." {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {$code == 1} {
|
||||
|
Reference in New Issue
Block a user