aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-11-15 07:50:19 -0700
committerTom Tromey <tromey@adacore.com>2023-11-15 09:23:53 -0700
commitaa5cef35e0308b1b4a4dc7b4d818f6c1b05bc904 (patch)
tree701f74304fc66963eb31afba40ddfd85e3729540
parent5458a19397c84a3f5eec5d3d9733184e6d876eeb (diff)
downloadbinutils-aa5cef35e0308b1b4a4dc7b4d818f6c1b05bc904.zip
binutils-aa5cef35e0308b1b4a4dc7b4d818f6c1b05bc904.tar.gz
binutils-aa5cef35e0308b1b4a4dc7b4d818f6c1b05bc904.tar.bz2
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". (cherry picked from commit e1ccbfffb5e0121c084898ac63f042187621d4ec)
-rw-r--r--gdb/testsuite/gdb.dap/ada-nested.exp14
1 files changed, 9 insertions, 5 deletions
diff --git a/gdb/testsuite/gdb.dap/ada-nested.exp b/gdb/testsuite/gdb.dap/ada-nested.exp
index 1a02f4f..9974140 100644
--- a/gdb/testsuite/gdb.dap/ada-nested.exp
+++ b/gdb/testsuite/gdb.dap/ada-nested.exp
@@ -60,13 +60,15 @@ lassign $scopes args locals _ignore
gdb_assert {[dict get $args name] == "Arguments"} "argument 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 refs [lindex [dap_check_request_and_response "fetch variables" \
"variables" \
- [format {o variablesReference [i %d] count [i 3]} \
- $num]] \
+ [format {o variablesReference [i %d] count [i %d]} \
+ $num $num_vars]] \
0]
foreach var [dict get $refs body variables] {
@@ -76,8 +78,10 @@ foreach var [dict get $refs body variables] {
"i" {
gdb_assert {[dict get $var value] == "1"} "check value of i"
}
- "x" {
- gdb_assert {[dict get $var value] == "12"} "check value of x"
+ "x" - "x #2" {
+ # 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" {
gdb_assert {[dict get $var value] == "1"} "check value of outer_arg"