From c51fb386792206f12459b22bf7eec8345c4886a6 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 2 Jul 2024 10:43:51 -0600 Subject: Add returnValue scope to DAP The DAP spec recently changed to add a new scope for the return value from a "stepOut" request. This new scope uses the "returnValue" presentation hint. See: https://github.com/microsoft/debug-adapter-protocol/issues/458 This patch implements this for gdb. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31945 Reviewed-By: Eli Zaretskii --- gdb/testsuite/gdb.dap/step-out.exp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'gdb/testsuite/gdb.dap') diff --git a/gdb/testsuite/gdb.dap/step-out.exp b/gdb/testsuite/gdb.dap/step-out.exp index 31c50bb..193264f 100644 --- a/gdb/testsuite/gdb.dap/step-out.exp +++ b/gdb/testsuite/gdb.dap/step-out.exp @@ -59,15 +59,21 @@ 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 return_scope gdb_assert {[dict get $scope name] == "Locals"} "scope is locals" gdb_assert {[dict get $scope presentationHint] == "locals"} \ "locals presentation hint" -gdb_assert {[dict get $scope namedVariables] == 2} "two vars in scope" +gdb_assert {[dict get $scope namedVariables] == 1} "one var in scope" -set num [dict get $scope variablesReference] +gdb_assert {[dict get $return_scope name] == "Return"} "scope is return" +gdb_assert {[dict get $return_scope presentationHint] == "returnValue"} \ + "returnValue presentation hint" +gdb_assert {[dict get $return_scope namedVariables] == 1} \ + "one var in return scope" + +set num [dict get $return_scope variablesReference] set refs [lindex [dap_check_request_and_response "fetch arguments" \ "variables" \ [format {o variablesReference [i %d]} $num]] \ -- cgit v1.1