mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
Fix early return in foreach_with_prefix
I noticed that an early return in a foreach_with_prefix block does not cause the outer scope to return, like: foreach_with_prefix var {"foo" "bar"} { return } # Control continues here, but it should not. The problem is that we're missing the usual "return -code" treatment. This commit fixes it. gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * lib/gdb.exp (foreach_with_prefix): Use "catch" and "return -code".
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2019-07-03 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* lib/gdb.exp (foreach_with_prefix): Use "catch" and
|
||||||
|
"return -code".
|
||||||
|
|
||||||
2019-07-03 Pedro Alves <palves@redhat.com>
|
2019-07-03 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
PR cli/24732
|
PR cli/24732
|
||||||
|
@ -2025,7 +2025,14 @@ proc foreach_with_prefix {var list body} {
|
|||||||
upvar 1 $var myvar
|
upvar 1 $var myvar
|
||||||
foreach myvar $list {
|
foreach myvar $list {
|
||||||
with_test_prefix "$var=$myvar" {
|
with_test_prefix "$var=$myvar" {
|
||||||
uplevel 1 $body
|
set code [catch {uplevel 1 $body} result]
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$code == 1} {
|
||||||
|
global errorInfo errorCode
|
||||||
|
return -code $code -errorinfo $errorInfo -errorcode $errorCode $result
|
||||||
|
} else {
|
||||||
|
return -code $code $result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user