public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Don't allow multiple request registrations in DAP
Date: Wed, 21 Feb 2024 21:56:09 +0000 (GMT)	[thread overview]
Message-ID: <20240221215609.496683858D20@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a4af05ca661f8feb1cbb671d4e4e5e8902892f45

commit a4af05ca661f8feb1cbb671d4e4e5e8902892f45
Author: Tom Tromey <tromey@adacore.com>
Date:   Wed Feb 7 12:46:22 2024 -0700

    Don't allow multiple request registrations in DAP
    
    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.

Diff:
---
 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 e7110660741..6757f2921bf 100644
--- a/gdb/python/lib/gdb/dap/server.py
+++ b/gdb/python/lib/gdb/dap/server.py
@@ -355,6 +355,7 @@ def request(
             cmd = _check_not_running(cmd)
 
         global _commands
+        assert name not in _commands
         _commands[name] = cmd
         return cmd
 
@@ -367,6 +368,7 @@ def capability(name, value=True):
 
     def wrap(func):
         global _capabilities
+        assert name not in _capabilities
         _capabilities[name] = value
         return func

                 reply	other threads:[~2024-02-21 21:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240221215609.496683858D20@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).