binutils-gdb/gdb/python
Tom Tromey 510586589e Add type-checking to DAP requests
It occurred to me recently that gdb's DAP implementation should
probably check the types of objects coming from the client.  This
patch implements this idea by reusing Python's existing type
annotations, and supplying a decorator that verifies these at runtime.

Python doesn't make it very easy to do runtime type-checking, so the
core of the checker is written by hand.  I haven't tried to make a
fully generic runtime type checker.  Instead, this only checks the
subset that is needed by DAP.  For example, only keyword-only
functions are handled.

Furthermore, in a few spots, it wasn't convenient to spell out the
type that is accepted.  I've added a couple of comments to this effect
in breakpoint.py.

I've tried to make this code compatible with older versions of Python,
but I've only been able to try it with 3.9 and 3.10.
2023-06-12 12:09:28 -06:00
..
lib/gdb Add type-checking to DAP requests 2023-06-12 12:09:28 -06:00
py-all-events.def Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-arch.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-auto-load.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-block.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-bpevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-breakpoint.c gdb: remove breakpoint_pointer_iterator 2023-05-25 09:52:22 -04:00
py-cmd.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-connection.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-continueevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-dap.c gdb: move struct ui and related things to ui.{c,h} 2023-05-01 15:40:54 -04:00
py-disasm.c [gdb] Fix more typos 2023-06-05 12:53:15 +02:00
py-event-types.def Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-event.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-event.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-events.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-evtregistry.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-evts.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-exitedevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-finishbreakpoint.c gdb: remove breakpoint_pointer_iterator 2023-05-25 09:52:22 -04:00
py-frame.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-framefilter.c Don't treat references to compound values as "simple". 2023-05-04 08:58:18 -06:00
py-function.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-gdb-readline.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-inferior.c Add attributes and methods to gdb.Inferior 2023-05-24 06:16:10 -06:00
py-infevents.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-infthread.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-instruction.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-instruction.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-lazy-string.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-linetable.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-membuf.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-mi.c Implement gdb.execute_mi 2023-05-23 10:09:28 -06:00
py-micmd.c Change mi_parse_argv to a method 2023-05-23 10:09:27 -06:00
py-newobjfileevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-objfile.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-param.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-prettyprint.c Fix value chain use-after-free 2023-02-27 15:46:31 -07:00
py-progspace.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-record-btrace.c python, btrace: Fix some small formatting issues. 2023-05-31 09:27:17 +02:00
py-record-btrace.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-record-full.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-record-full.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-record.c python, btrace: Fix some small formatting issues. 2023-05-31 09:27:17 +02:00
py-record.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-ref.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-registers.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-signalevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-stopevent.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-stopevent.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-symbol.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-symtab.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-threadevent.c gdb: make find_thread_ptid an inferior method 2023-04-04 21:05:30 -04:00
py-tui.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-type.c Add dynamic_prop::is_constant 2023-05-12 12:30:28 -06:00
py-unwind.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
py-utils.c Python QUIT processing updates 2023-02-27 16:20:39 -07:00
py-value.c gdb: building inferior strings from within GDB 2023-06-05 13:25:08 +01:00
py-varobj.c Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00
py-xmethods.c gdb/python: add mechanism to manage Python initialization functions 2023-05-05 18:24:42 +01:00
python-config.py gdb/python-config: replace deprecated distutils.sysconfig 2022-09-01 04:51:33 -04:00
python-internal.h Implement gdb.execute_mi 2023-05-23 10:09:28 -06:00
python.c [gdb] Fix typos 2023-06-03 22:43:57 +02:00
python.h Update copyright year range in header of all files managed by GDB 2023-01-01 17:01:16 +04:00