diff options
author | Tom Tromey <tromey@adacore.com> | 2024-05-16 07:58:07 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-06-04 11:12:42 -0600 |
commit | d856ef4fc2b09d88bf66e59badde9b4c884de811 (patch) | |
tree | a01cf0aa80ba5cf7c91f4af8a7dc83904917c05e /gdb/testsuite/gdb.dap | |
parent | 4dd38c398331c2fdb8bfc7ffd78d836bae0d9303 (diff) | |
download | gdb-d856ef4fc2b09d88bf66e59badde9b4c884de811.zip gdb-d856ef4fc2b09d88bf66e59badde9b4c884de811.tar.gz gdb-d856ef4fc2b09d88bf66e59badde9b4c884de811.tar.bz2 |
Return global scope from DAP scopes request
A co-worker requested that the DAP code emit a scope for global
variables. It's not really practical to do this for all globals, but
it seemed reasonable to do this for globals coming from the frame's
compilation unit. For Ada in particular, this is convenient as it
exposes package-scoped variables.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb/testsuite/gdb.dap')
-rw-r--r-- | gdb/testsuite/gdb.dap/ptrref.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dap/rust-slices.exp | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.dap/ptrref.exp b/gdb/testsuite/gdb.dap/ptrref.exp index 0552c3b..236ffae 100644 --- a/gdb/testsuite/gdb.dap/ptrref.exp +++ b/gdb/testsuite/gdb.dap/ptrref.exp @@ -54,12 +54,14 @@ set scopes [dap_check_request_and_response "get scopes" scopes \ [format {o frameId [i %d]} $frame_id]] set scopes [dict get [lindex $scopes 0] body scopes] -gdb_assert {[llength $scopes] == 2} "two scopes" +gdb_assert {[llength $scopes] == 3} "three scopes" -lassign $scopes scope reg_scope +lassign $scopes scope reg_scope global_scope gdb_assert {[dict get $scope name] == "Locals"} "scope is locals" +gdb_assert {[dict get $global_scope name] == "Globals"} "scope is globals" -gdb_assert {[dict get $scope namedVariables] == 4} "three vars in scope" +gdb_assert {[dict get $scope namedVariables] == 4} "four vars in locals" +gdb_assert {[dict get $global_scope namedVariables] == 1} "one var in globals" set num [dict get $scope variablesReference] set refs [lindex [dap_check_request_and_response "fetch variables" \ diff --git a/gdb/testsuite/gdb.dap/rust-slices.exp b/gdb/testsuite/gdb.dap/rust-slices.exp index c85568d..d3bd305 100644 --- a/gdb/testsuite/gdb.dap/rust-slices.exp +++ b/gdb/testsuite/gdb.dap/rust-slices.exp @@ -59,7 +59,9 @@ set scopes [dap_check_request_and_response "get scopes" scopes \ [format {o frameId [i %d]} $frame_id]] set scopes [dict get [lindex $scopes 0] body scopes] -gdb_assert {[llength $scopes] == 2} "two scopes" +# There are three scopes because an artificial symbol ends up in the +# DWARF. See https://github.com/rust-lang/rust/issues/125126. +gdb_assert {[llength $scopes] == 3} "three scopes" lassign $scopes scope ignore gdb_assert {[dict get $scope name] == "Locals"} "scope is locals" |