aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-09-27 11:48:24 -0600
committerTom Tromey <tromey@adacore.com>2023-10-16 08:40:18 -0600
commited5504c7b6f53ee3343ddd44ad2c8d28b00f7641 (patch)
treebb61e2286de3dcadae023e31693e2ba8347117b3 /gdb/testsuite
parent1d45d90934b10862c00a22bcf4075815a785001b (diff)
downloadgdb-ed5504c7b6f53ee3343ddd44ad2c8d28b00f7641.zip
gdb-ed5504c7b6f53ee3343ddd44ad2c8d28b00f7641.tar.gz
gdb-ed5504c7b6f53ee3343ddd44ad2c8d28b00f7641.tar.bz2
Add DAP scope cache
Andry Ogorodnik, a co-worker, noticed that multiple "scopes" requests with the same frame would yield different variableReference values in the response. This patch adds a regression test for this, and adds a scope cache in scopes.py, ensuring that multiple identical requests will get the same response. Tested-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.dap/scopes.exp7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dap/scopes.exp b/gdb/testsuite/gdb.dap/scopes.exp
index 6937bad..003557c 100644
--- a/gdb/testsuite/gdb.dap/scopes.exp
+++ b/gdb/testsuite/gdb.dap/scopes.exp
@@ -52,6 +52,13 @@ 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]
+# Request the scopes twice, and verify that the results are identical.
+# GDB previously had a bug where it would return new scopes each time.
+set scopes2 [dap_check_request_and_response "get scopes again" scopes \
+ [format {o frameId [i %d]} $frame_id]]
+set scopes2 [dict get [lindex $scopes2 0] body scopes]
+gdb_assert {$scopes2 == $scopes} "identical scopes requests yield same body"
+
gdb_assert {[llength $scopes] == 2} "two scopes"
lassign $scopes scope reg_scope