forked from Imagelibrary/binutils-gdb
Minor cleanups in ada-nested.exp
This changes ada-nested.exp to fix a test name (the test expects three variables but is named "two"), and to iterate over all the variables that are found. It also adds a workaround to a problem Tom de Vries found with an older version of GNAT -- it emits a duplicate "x".
This commit is contained in:
@@ -60,13 +60,15 @@ lassign $scopes args locals _ignore
|
|||||||
gdb_assert {[dict get $args name] == "Arguments"} "argument scope"
|
gdb_assert {[dict get $args name] == "Arguments"} "argument scope"
|
||||||
gdb_assert {[dict get $locals name] == "Locals"} "local scope"
|
gdb_assert {[dict get $locals name] == "Locals"} "local scope"
|
||||||
|
|
||||||
gdb_assert {[dict get $locals namedVariables] == 3} "two locals"
|
set num_vars [dict get $locals namedVariables]
|
||||||
|
# Some versions of GNAT emit an extra 'x' in scope.
|
||||||
|
gdb_assert {$num_vars == 3 || $num_vars == 4} "correct number of locals"
|
||||||
|
|
||||||
set num [dict get $locals variablesReference]
|
set num [dict get $locals variablesReference]
|
||||||
set refs [lindex [dap_check_request_and_response "fetch variables" \
|
set refs [lindex [dap_check_request_and_response "fetch variables" \
|
||||||
"variables" \
|
"variables" \
|
||||||
[format {o variablesReference [i %d] count [i 3]} \
|
[format {o variablesReference [i %d] count [i %d]} \
|
||||||
$num]] \
|
$num $num_vars]] \
|
||||||
0]
|
0]
|
||||||
|
|
||||||
foreach var [dict get $refs body variables] {
|
foreach var [dict get $refs body variables] {
|
||||||
@@ -76,8 +78,10 @@ foreach var [dict get $refs body variables] {
|
|||||||
"i" {
|
"i" {
|
||||||
gdb_assert {[dict get $var value] == "1"} "check value of i"
|
gdb_assert {[dict get $var value] == "1"} "check value of i"
|
||||||
}
|
}
|
||||||
"x" {
|
"x" - "x #2" {
|
||||||
gdb_assert {[dict get $var value] == "12"} "check value of x"
|
# Some versions of GNAT erroneously emit a duplicate 'x'.
|
||||||
|
# Work around it here.
|
||||||
|
gdb_assert {[dict get $var value] == "12"} "check value of $name"
|
||||||
}
|
}
|
||||||
"outer_arg" {
|
"outer_arg" {
|
||||||
gdb_assert {[dict get $var value] == "1"} "check value of outer_arg"
|
gdb_assert {[dict get $var value] == "1"} "check value of outer_arg"
|
||||||
|
|||||||
Reference in New Issue
Block a user