]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't allow multiple request registrations in DAP
authorTom Tromey <tromey@adacore.com>
Wed, 7 Feb 2024 19:46:22 +0000 (12:46 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 21 Feb 2024 21:55:22 +0000 (14:55 -0700)
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

index e711066074131116edcf5e6b0ad3088bddeada0c..6757f2921bf5d2a9a10de80cf337ec46beca969c 100644 (file)
@@ -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