public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] create GDB/MI commands using python
@ 2022-01-17 12:44 Jan Vrany
  2022-01-17 12:44 ` [PATCH 1/5] gdb/mi: introduce new class mi_command_builtin Jan Vrany
                   ` (5 more replies)
  0 siblings, 6 replies; 41+ messages in thread
From: Jan Vrany @ 2022-01-17 12:44 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Vrany

This is a restart of an earlier attempts to allow custom
GDB/MI commands written in Python.

I went thought comments made on earlier attempts and changed
code as suggested except in few cases - see my comments below.

====
gdb/python/py-micmd.c

> > +
> > +extern PyTypeObject
> > +  micmdpy_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("micmdpy_object");
>
> Is there a reason this is "extern"?  I don't see this used anywhere
> outside py-micmd.c.

I think it is. micmdpy_object_type is needed in gdbpy_initialize_micommands() and then
it is statically initialized at the bottom of the file when all functions are defined.
The extern allows this. Same thing is done in py-cmd.c for CLI commands.


> > +
> > +/* If the command invoked returns a list, this function parses it and create an
> > +   appropriate MI out output.
> > +
> > +   The returned values must be Python string,
>
> "values ... string" doesn't parse correctly for me.
>
> Did you mean

I have rewritten the comment and renamed the function to emit_py_result()
which seems to me a better name (now).


> > +         }
> > +     }

> There's aspace vs tabs mixup above, and in other parts
> of the file too.  Please fix that throughout.

Changed to use spaces consistenly.


> > +
> > +PyTypeObject micmdpy_object_type = {
>
> Can this be static?

I don't think so, see above.
=====

Jan Vrany (5):
  gdb/mi: introduce new class mi_command_builtin
  gdb/python: create GDB/MI commands using python.
  gdb/python: allow redefinition of python GDB/MI commands
  gdb/testsuite: add tests for python-defined MI commands
  gdb/python: document GDB/MI commands in Python

 gdb/Makefile.in                        |   1 +
 gdb/NEWS                               |   2 +
 gdb/doc/python.texi                    |  80 ++++++-
 gdb/mi/mi-cmds.c                       |  60 +++--
 gdb/mi/mi-cmds.h                       |  32 ++-
 gdb/python/py-micmd.c                  | 312 +++++++++++++++++++++++++
 gdb/python/py-micmd.h                  |  66 ++++++
 gdb/python/python-internal.h           |   2 +
 gdb/python/python.c                    |  13 +-
 gdb/testsuite/gdb.python/py-mi-cmd.exp | 133 +++++++++++
 gdb/testsuite/gdb.python/py-mi-cmd.py  |  68 ++++++
 11 files changed, 733 insertions(+), 36 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.30.2


^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2022-03-18 19:57 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 12:44 [PATCH 0/5] create GDB/MI commands using python Jan Vrany
2022-01-17 12:44 ` [PATCH 1/5] gdb/mi: introduce new class mi_command_builtin Jan Vrany
2022-01-17 12:44 ` [PATCH 2/5] gdb/python: create GDB/MI commands using python Jan Vrany
2022-02-06 16:52   ` Lancelot SIX
2022-01-17 12:44 ` [PATCH 3/5] gdb/python: allow redefinition of python GDB/MI commands Jan Vrany
2022-02-06 17:13   ` Lancelot SIX
2022-02-06 20:33     ` Simon Marchi
2022-02-06 20:44       ` Jan Vrany
2022-02-06 20:46         ` Simon Marchi
2022-02-07  9:46         ` Lancelot SIX
2022-01-17 12:44 ` [PATCH 4/5] gdb/testsuite: add tests for python-defined MI commands Jan Vrany
2022-01-17 12:44 ` [PATCH 5/5] gdb/python: document GDB/MI commands in Python Jan Vrany
2022-01-17 13:15   ` Eli Zaretskii
2022-01-17 13:20   ` Eli Zaretskii
2022-01-18 12:34     ` Jan Vrany
2022-01-18 15:09       ` Eli Zaretskii
2022-01-18 13:55 ` [PATCH 0/5] create GDB/MI commands using python Andrew Burgess
2022-01-18 15:13   ` Jan Vrany
2022-01-21 15:22     ` Andrew Burgess
2022-01-24 12:59       ` Jan Vrany
2022-02-02 16:57         ` Andrew Burgess
2022-02-06 21:16       ` Simon Marchi
2022-02-07 15:56         ` [PATCHv2] gdb/python/mi: create MI " Andrew Burgess
2022-02-08 15:16           ` Simon Marchi
2022-02-09 12:25             ` [PATCHv3] " Andrew Burgess
2022-02-09 14:08               ` Simon Marchi
2022-02-10 18:26                 ` Andrew Burgess
2022-02-13 14:27                   ` Joel Brobecker
2022-02-13 21:46                     ` Jan Vrany
2022-02-24 10:37               ` [PATCHv4] " Andrew Burgess
2022-02-25 19:22                 ` Tom Tromey
2022-02-25 19:31                   ` Jan Vrany
2022-02-28 16:48                 ` [PATCHv5] " Andrew Burgess
2022-02-28 18:40                   ` Tom Tromey
2022-03-13  4:47                   ` Joel Brobecker
2022-03-14 14:13                     ` Andrew Burgess
2022-03-16  8:10                       ` Joel Brobecker
2022-03-16 12:29                       ` Simon Marchi
2022-03-18 15:06                   ` Simon Marchi
2022-03-18 16:12                     ` Andrew Burgess
2022-03-18 19:57                       ` Simon Marchi

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).