From aa5cef35e0308b1b4a4dc7b4d818f6c1b05bc904 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 15 Nov 2023 07:50:19 -0700 Subject: 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) --- gdb/testsuite/gdb.dap/ada-nested.exp | 14 +++++++++----- 1 file 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" -- cgit v1.1