[PATCH v3 0/5] Create MI commands using python.

Jan Vrany jan.vrany@fit.cvut.cz
Thu May 30 13:49:00 GMT 2019


This version mainly addresses comments raised by Simon. Tested with both
Python 2.7 and Python 3(.7).

Changes v2 -> v3

* addressed Simon's comments:
  - https://sourceware.org/ml/gdb-patches/2019-05/msg00406.html
  - https://sourceware.org/ml/gdb-patches/2019-05/msg00407.html
* checked that it compiles with both Python 2.7 and Python 3(.7)
* add tests for MI command returning dictionary with non-string
  keys
* add tests for creating MI commands with invalid names

Changes v1 -> v2

* squashed following commits into one:
  - 8e65585bdab0 Create MI commands using python.
  - 9e2afadd2d4d03 mi/python: C++ify python MI command handling code
  - 0491a0634f7de4 mi/python: Polish MI output of python commands
* moved class mi_command_py to python code
* use gdbpy_ref<> instead of void* to hold on Python object
  in mi_command_py
* release python objects held on by mi_command_py objects
  when finalizing Python
* merged py_mi_invoke() into mi_command_py::invoke()
* added missing copyright headers
* dropped micmdpy_parse_command_name()
* prefixed error messages by MI command name except for
  "Problem parsing arguments:" since old C-implemented MI
  commands do not prefix command name.
* make do_suppress_notification() to return gdb::optional
* split invoke to invoke and do_invoke, making invoke to perform
  common initialization
* add test redefining Python MI command while the very same command
  is running
* documented the fact that in mi_command_py::do_invoke() `this` pointer cannot
  be used after invoking python code since it may got stale.


Didier Nadeau (3):
  Use std::map for MI commands in mi-cmds.c
  Use classes to represent MI Command instead of structures
  Create MI commands using python.

Jan Vrany (2):
  mi/python: Allow redefinition of python MI commands
  mi/python: Add tests for python-defined MI commands

 gdb/ChangeLog                          |  88 +++++
 gdb/Makefile.in                        |   1 +
 gdb/mi/mi-cmd-info.c                   |   4 +-
 gdb/mi/mi-cmds.c                       | 510 +++++++++++++------------
 gdb/mi/mi-cmds.h                       |  87 ++++-
 gdb/mi/mi-main.c                       |  22 +-
 gdb/mi/mi-main.h                       |   1 +
 gdb/mi/mi-parse.c                      |  20 +-
 gdb/mi/mi-parse.h                      |   6 +-
 gdb/python/py-micmd.c                  | 307 +++++++++++++++
 gdb/python/py-micmd.h                  |  60 +++
 gdb/python/python-internal.h           |   2 +
 gdb/python/python.c                    |  13 +-
 gdb/testsuite/ChangeLog                |   5 +
 gdb/testsuite/gdb.python/py-mi-cmd.exp | 132 +++++++
 gdb/testsuite/gdb.python/py-mi-cmd.py  |  54 +++
 16 files changed, 1007 insertions(+), 305 deletions(-)
 create mode 100644 gdb/python/py-micmd.c
 create mode 100644 gdb/python/py-micmd.h
 create mode 100644 gdb/testsuite/gdb.python/py-mi-cmd.exp
 create mode 100644 gdb/testsuite/gdb.python/py-mi-cmd.py

-- 
2.20.1



More information about the Gdb-patches mailing list