From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by sourceware.org (Postfix) with ESMTPS id 1E94A3858C39 for ; Mon, 12 Jun 2023 19:36:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1E94A3858C39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-777a4926555so174429339f.0 for ; Mon, 12 Jun 2023 12:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1686598593; x=1689190593; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JeRgQ8j/PoZhch7tEhzZBgNWHkJYGnf2Al66ePd5wRA=; b=KnYH/dvwIG+c4j1E2ADZ7H4fal3FetYkSa3tY8mfyP8ZdtvMDg7r9CqH88uNKGfNkS aStmKXJmRHFbe4i5SAqd57deel4CZxrDG64vHOdxKxF9qGhiQiFRV7M5y+9OmITIl+7o RDbaKrfevLKylgU8E4Wz9Wk/eIaGR0ujC1VjuU3N7GHtTxdK43gVpJPbj9IV4LeODIhn q4fx5Q1oefXXt1STckVdXW5Vza5KUdllR2qiy8I8NOrnccw3vRceUkNw6dG6yO562RQN xJdCxD48GsfsPagGpABuND8nSPYxnxxzxHkPrBOL9h7B+wIAghiDbzrRJo6JklF9DMm4 4F2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686598593; x=1689190593; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JeRgQ8j/PoZhch7tEhzZBgNWHkJYGnf2Al66ePd5wRA=; b=F99ofWkWkwfy89r3dMdVK1dg4ch/4WD+lfrS43MnyQR5CLPMFlIvdvv+YXcn1m3KQU 4CSqnCTAD2zJlRWqZ87ihwAOEMq2TPLwYYRC9kYrui5MTx8Txp+FN3ueGESfqR46nHPB hTXAXfgX7NQkyq2ohXr98e19DYvM9GWjmBKmrLYG8Xvh8BJCS0BPuc3ZO8IGQIipEy1r 7YnTk350kWWX3MjWSg2VzzPT061iTlZpvvl9abhUEEM0bC2haiTZpXChZ/d7G1S9ZFk8 bh/1wEXj8q+FDXM/GTzGecpbB+RU+h1TFcznNZ4QSEDz40xO42SWbOkffkppP5sFpGTg OtyQ== X-Gm-Message-State: AC+VfDx/dIFwZ6L6SK2wdEurUvfkR5jBACtdkpY7VAhhmzdUQWSR0qPa MoX8kc12igUXBDpoa0jsFgYa4Gq5iUbU/83GY3SKfw== X-Google-Smtp-Source: ACHHUZ5olmRz1N9ooGhtwTXwbLXOw8mCKeZkqYzTeO68vPjcc3XUrMZ5mpeiT3hrdffCeyl8NEph+w== X-Received: by 2002:a05:6602:2d01:b0:777:a4d2:8871 with SMTP id c1-20020a0566022d0100b00777a4d28871mr12468981iow.5.1686598593321; Mon, 12 Jun 2023 12:36:33 -0700 (PDT) Received: from localhost.localdomain (75-166-136-83.hlrn.qwest.net. [75.166.136.83]) by smtp.gmail.com with ESMTPSA id m12-20020a056638224c00b00418a5e0e93esm2938091jas.162.2023.06.12.12.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 12:36:33 -0700 (PDT) From: Tom Tromey Date: Mon, 12 Jun 2023 13:36:32 -0600 Subject: [PATCH 5/7] Handle supportsVariablePaging in DAP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230612-more-dap-v1-5-ad868f1a4cc0@adacore.com> References: <20230612-more-dap-v1-0-ad868f1a4cc0@adacore.com> In-Reply-To: <20230612-more-dap-v1-0-ad868f1a4cc0@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: A bug report about the supportsVariablePaging capability in DAP resulted in a clarification: when this capability is not present, DAP implementations should ignore the paging parameters to the "variables" request. This patch implements this clarification. --- gdb/python/lib/gdb/dap/evaluate.py | 7 ++++++- gdb/testsuite/gdb.dap/scopes.exp | 24 +++++++++++++++++------- gdb/testsuite/lib/dap-support.exp | 3 ++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/gdb/python/lib/gdb/dap/evaluate.py b/gdb/python/lib/gdb/dap/evaluate.py index af7bf43afd0..a0b199a1ed4 100644 --- a/gdb/python/lib/gdb/dap/evaluate.py +++ b/gdb/python/lib/gdb/dap/evaluate.py @@ -20,7 +20,7 @@ import gdb.printing from typing import Optional from .frames import frame_for_id -from .server import capability, request +from .server import capability, request, client_bool_capability from .startup import send_gdb_with_response, in_gdb_thread from .varref import find_variable, VariableReference @@ -98,6 +98,11 @@ def _variables(ref, start, count): # Note that we ignore the 'filter' field. That seems to be # specific to javascript. def variables(*, variablesReference: int, start: int = 0, count: int = 0, **args): + # This behavior was clarified here: + # https://github.com/microsoft/debug-adapter-protocol/pull/394 + if not client_bool_capability("supportsVariablePaging"): + start = 0 + count = 0 result = send_gdb_with_response( lambda: _variables(variablesReference, start, count) ) diff --git a/gdb/testsuite/gdb.dap/scopes.exp b/gdb/testsuite/gdb.dap/scopes.exp index cf9174f06a2..6937badcca0 100644 --- a/gdb/testsuite/gdb.dap/scopes.exp +++ b/gdb/testsuite/gdb.dap/scopes.exp @@ -67,13 +67,23 @@ gdb_assert {[dict get $reg_scope presentationHint] == "registers"} \ gdb_assert {[dict get $reg_scope namedVariables] > 0} "at least one register" set num [dict get $scope variablesReference] -set refs [lindex [dap_check_request_and_response "fetch variables" \ - "variables" \ - [format {o variablesReference [i %d] count [i 3]} \ - $num]] \ - 0] - -foreach var [dict get $refs body variables] { +# Send two requests and combine them, to verify that using a range +# works. +set refs1 [lindex [dap_check_request_and_response "fetch variables 0,1" \ + "variables" \ + [format {o variablesReference [i %d] count [i 2]} \ + $num]] \ + 0] +set refs2 [lindex [dap_check_request_and_response "fetch variables 2" \ + "variables" \ + [format {o variablesReference [i %d] \ + start [i 2] count [i 1]} \ + $num]] \ + 0] + +set vars [concat [dict get $refs1 body variables] \ + [dict get $refs2 body variables]] +foreach var $vars { set name [dict get $var name] if {$name != "dei"} { diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp index 92484bfdb8d..e3750e1d016 100644 --- a/gdb/testsuite/lib/dap-support.exp +++ b/gdb/testsuite/lib/dap-support.exp @@ -232,7 +232,8 @@ proc _dap_initialize {name} { } return [dap_check_request_and_response $name initialize \ {o clientID [s "gdb testsuite"] \ - supportsVariableType [l true]}] + supportsVariableType [l true] \ + supportsVariablePaging [l true]}] } # Start gdb, send a DAP initialize request, and then a launch request -- 2.40.1