From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out-238.mta0.migadu.com (out-238.mta0.migadu.com [IPv6:2001:41d0:1004:224b::ee]) by sourceware.org (Postfix) with ESMTPS id B6CEA3858D20 for ; Fri, 1 Sep 2023 21:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6CEA3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=gpanders.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gpanders.com X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpanders.com; s=key1; t=1693602271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BhkjDwO1k30JVmEeuKiaqn/6xT3rPNPPS0K5lni2wr4=; b=ZKx/BryWO4spXUwMMCvQXek9uuZVaeE3R7QbBPKlEHlol44aRfiBDHr7DvxzLVUsJaDI/c wFAMS5hgKYr1Ng56adlSA9/TetuPW9xqIL4x7PAZZ3v8uJ+hF7GrX19XUSg0UbD2bbmCmo eVmPtEBetBCTiH0oJpFWh8Bg94VhbJ/p8vOs/1RnVTfcQLyyDc4qPJ672iPfwRTacKzJ+q 0kyBijXPLNZ+OkSNr3Lj5/+JfY26eShki5jMZteqQyk3uTtHr7jFLEQckefaEhzB2NCnhy GsOYhlans45EpJnL6VPq1dRfMQVkhFKaVPRSm1utRH/og0a4DVe0rI2lDGEr5Q== From: Gregory Anders To: gdb-patches@sourceware.org Cc: Gregory Anders Subject: [PATCH v2 2/4] gdb/dap: ignore unused keyword args in step_out Date: Fri, 1 Sep 2023 16:02:18 -0500 Message-ID: <20230901210422.58003-3-greg@gpanders.com> In-Reply-To: <20230901210422.58003-1-greg@gpanders.com> References: <20230901210422.58003-1-greg@gpanders.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,SPF_HELO_NONE,SPF_PASS,TXREP 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: Some DAP clients may send additional parameters in the stepOut command (e.g. "granularity") which are not used by GDB, but should nonetheless be accepted without error. --- gdb/python/lib/gdb/dap/next.py | 2 +- gdb/python/lib/gdb/dap/server.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/python/lib/gdb/dap/next.py b/gdb/python/lib/gdb/dap/next.py index 8b112770..5d49c871 100644 --- a/gdb/python/lib/gdb/dap/next.py +++ b/gdb/python/lib/gdb/dap/next.py @@ -69,7 +69,7 @@ def step_in( @request("stepOut") -def step_out(*, threadId: int, singleThread: bool = False): +def step_out(*, threadId: int, singleThread: bool = False, **args): send_gdb(lambda: _handle_thread_step(threadId, singleThread)) send_gdb(ExecutionInvoker("finish", StopKinds.STEP)) diff --git a/gdb/python/lib/gdb/dap/server.py b/gdb/python/lib/gdb/dap/server.py index db7893a3..d84bca5d 100644 --- a/gdb/python/lib/gdb/dap/server.py +++ b/gdb/python/lib/gdb/dap/server.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import inspect import json import queue import sys @@ -165,6 +166,12 @@ def request(name): def wrap(func): global _commands + code = func.__code__ + # We don't permit requests to have positional arguments. + assert code.co_posonlyargcount == 0 + assert code.co_argcount == 0 + # A request must have a **args parameter. + assert code.co_flags & inspect.CO_VARKEYWORDS # All requests must run in the DAP thread. # Also type-check the calls. func = in_dap_thread(type_check(func)) -- 2.42.0