From patchwork Wed Feb 7 19:47:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 85442 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 577413858C29 for ; Wed, 7 Feb 2024 19:48:05 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 5A87D3858414 for ; Wed, 7 Feb 2024 19:47:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A87D3858414 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5A87D3858414 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::135 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707335264; cv=none; b=KPG1idkm1VkEhWmrT/HbAEnpxOcS15+faPx+z9dNkUIz2AOvUhLY8oWcJe0bKib+fIiIEyox+53XpW15e5cdT7UTjcQ3/xg9lc79T9Ee+2A83+VDeFx9ZbOjk2jlYb1NqueNfd2k1EML7yVUA81y4fK1wHWigZLHQf2priG+T4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707335264; c=relaxed/simple; bh=gs0d3dc95deOJATPTuuD18EHJkaFb7y6bJMiuDf33Aw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AXLamD0HRBu42HcUZsxbRzqXBmU8wcDY1MbmiGJgi2Z9/YQPAckIc9PqR9OGuh+GK04QpgLr/1o36TS1fVdpvIcs8x7bhRLtBz4cYZbCiaUpERhY7x/Qd3ae0KW78x7F2UDqd6Pj2Pe2pIC+IwR3y/4kk+cWapYKMyLYeyTwf+c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-363bd37434dso3728995ab.1 for ; Wed, 07 Feb 2024 11:47:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1707335262; x=1707940062; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XuNAA+D5Yjs74gFdliAtOKUhGryc4UHJJCICIvBQ3yI=; b=RU/V+8zXFh0IT7DwbnYGV1GZgtKGSF7yMhjc/iYwNfHCL295M/XsFEEJfEZcU0QRc5 uFQnFnVx/B/t1wAv7bRs2NDDw/EgjVNj0OaTKdOkLhPkyblteDjiZzBTB0haBwtWtl7T qffyD99Hna5bYMKWUpQnIgdU9QJ31ogA/dBFpkpD6n36/92o4a59U0NwLp7IPa7uD7mr 1WhZH6WGj6RgPul/L9++AEYZ0PLFceJK3i6wQ3vrVwbImM6y9e5ZjkulFzTH3aHgwAt0 If05U8Jhnt+1V15Q2bY5fowXuEVUnh4KXrnaqImBWvfW2h25EZSyK/ZXDw71cE2cf5Yo qxeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707335262; x=1707940062; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XuNAA+D5Yjs74gFdliAtOKUhGryc4UHJJCICIvBQ3yI=; b=pf62Sy7KeDZ6lzmZ5OxFFXKVvV+aMetHl8Fccp4R5JrWkoNd9969uTrhgnsk+chm2x V/6ezohvisCdNAE5iAsCenCezCekC9NvkY61lnAVkPNqn4Kf7yHW+yELKH9g03ENyV5y PqHZ2qLhlBug7rVTvxllc5vTbZMEW5oVW0GGc5Jbh5m2I3+Z4XbjT2351GcbiT78xFpn RSB4y+mtn3Uv2lC+ljIm1qxezp49WyEgxkjqXXuql1U4P8aotqe86/tXYxpja6UgOLo6 uGQUH5iwXRB8+r+NlEZvEUumQAZEkzoqMjCPciFSWMeN2yj9DnQ9SudIFI96f7CsAJfE l2eA== X-Gm-Message-State: AOJu0YwkT+9CRacrc9jJ3Exk/fiEBtjwzBn+cWCBk9zaAKY9UH3Y9gay GMSirlvxzw4LiiwSpZLpIDjJMhLCfaxihQLPL6O1fgn7eQMaOk0VDRoQyhP9tdPQYXmOP3rNuho = X-Google-Smtp-Source: AGHT+IE6EzM7lgD1Cf/m8Be9sn3cfj4z8Hf/1rIkbtGlcoktiHiqKi1KVyGonbZAvZJ5566euTBsNw== X-Received: by 2002:a05:6e02:20e1:b0:361:a747:a547 with SMTP id q1-20020a056e0220e100b00361a747a547mr8199878ilv.30.1707335262593; Wed, 07 Feb 2024 11:47:42 -0800 (PST) Received: from localhost.localdomain (97-122-68-157.hlrn.qwest.net. [97.122.68.157]) by smtp.gmail.com with ESMTPSA id gm2-20020a0566382b8200b0046ecafac861sm489507jab.153.2024.02.07.11.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 11:47:42 -0800 (PST) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Don't allow multiple request registrations in DAP Date: Wed, 7 Feb 2024 12:47:35 -0700 Message-ID: <20240207194735.3478872-1-tromey@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org This changes the DAP code to check that a given request or capability is only registered a single time. This is just a precaution against accidentally introducing a second definition of a request somewhere. --- gdb/python/lib/gdb/dap/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gdb/python/lib/gdb/dap/server.py b/gdb/python/lib/gdb/dap/server.py index 7cc5a4681ee..ba139412b90 100644 --- a/gdb/python/lib/gdb/dap/server.py +++ b/gdb/python/lib/gdb/dap/server.py @@ -354,6 +354,7 @@ def request( cmd = _check_not_running(cmd) global _commands + assert name not in _commands _commands[name] = cmd return cmd @@ -366,6 +367,7 @@ def capability(name, value=True): def wrap(func): global _capabilities + assert name not in _capabilities _capabilities[name] = value return func