aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-09-01 16:02:18 -0500
committerTom Tromey <tromey@adacore.com>2023-09-20 10:59:38 -0600
commitd2266b2305c18538eddeb22fd89496910c8c4377 (patch)
tree9e76da532d716ed5e8e26cc1c446e1d40edcf278 /gdb/python
parent155f5df517c962f1317e119a6a5ca317e1202996 (diff)
downloadgdb-d2266b2305c18538eddeb22fd89496910c8c4377.zip
gdb-d2266b2305c18538eddeb22fd89496910c8c4377.tar.gz
gdb-d2266b2305c18538eddeb22fd89496910c8c4377.tar.bz2
gdb/dap: ignore unused keyword args in step_out
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. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/lib/gdb/dap/next.py2
-rw-r--r--gdb/python/lib/gdb/dap/server.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/gdb/python/lib/gdb/dap/next.py b/gdb/python/lib/gdb/dap/next.py
index 5046963..e5bb8d6 100644
--- a/gdb/python/lib/gdb/dap/next.py
+++ b/gdb/python/lib/gdb/dap/next.py
@@ -74,7 +74,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, True))
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 db7893a..d84bca5 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 <http://www.gnu.org/licenses/>.
+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))