public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Python API for target connections, and packet sending
@ 2021-09-11 16:03 Andrew Burgess
  2021-09-11 16:03 ` [PATCH 1/3] gdb/python: introduce gdb.TargetConnection object type Andrew Burgess
                   ` (3 more replies)
  0 siblings, 4 replies; 52+ messages in thread
From: Andrew Burgess @ 2021-09-11 16:03 UTC (permalink / raw)
  To: gdb-patches

My goal with the series was to add a Python API for sending packets to
remote targets, similar to the existing 'maint packet' CLI command.

I did consider just adding such a function at the top level, as in
'gdb.send_remote_packet (...)', but in a multi-connection setup this
would require the user to ensure that the correct inferior was
selected, and that didn't feel great.

So then I thought maybe having 'gdb.Inferior.send_remote_packet' would
be better, but that doesn't really feel right, packet sending is not
really a property of the inferior, but of the connection between GDB
and the target.

And so, I've added a whole new object type, gdb.TargetConnection,
which represents the connections between GDB and the target, as seen
in 'info connections'.  This is the first patch in the series.

The second patch refactors 'maint packet' to prepare the code for
being used from multiple locations.

And finally, in the third patch, I add
gdb.TargetConnection.send_remote_packet, which is what I needed.

All feedback welcome,

Thanks,
Andrew

---

Andrew Burgess (3):
  gdb/python: introduce gdb.TargetConnection object type
  gdb: make packet_command function available outside remote.c
  gdb/python: add TargetConnection.send_remote_packet method

 gdb/Makefile.in                               |   1 +
 gdb/NEWS                                      |  22 +
 gdb/doc/gdb.texinfo                           |   1 +
 gdb/doc/python.texi                           | 113 ++++-
 gdb/observable.c                              |   1 +
 gdb/observable.h                              |   3 +
 gdb/python/py-all-events.def                  |   1 +
 gdb/python/py-connection.c                    | 455 ++++++++++++++++++
 gdb/python/py-event-types.def                 |   5 +
 gdb/python/py-inferior.c                      |  16 +
 gdb/python/python-internal.h                  |   6 +
 gdb/python/python.c                           |   5 +
 gdb/remote.c                                  |  67 ++-
 gdb/remote.h                                  |  34 ++
 gdb/target-connection.c                       |   4 +
 .../gdb.multi/multi-target-info-inferiors.exp |  38 ++
 .../gdb.multi/multi-target-info-inferiors.py  |  63 +++
 gdb/testsuite/gdb.python/py-connection.c      |  22 +
 gdb/testsuite/gdb.python/py-connection.exp    |  63 +++
 gdb/testsuite/gdb.python/py-inferior.exp      |  20 +-
 gdb/testsuite/gdb.python/py-send-packet.c     |  22 +
 gdb/testsuite/gdb.python/py-send-packet.exp   |  55 +++
 gdb/testsuite/gdb.python/py-send-packet.py    |  82 ++++
 23 files changed, 1073 insertions(+), 26 deletions(-)
 create mode 100644 gdb/python/py-connection.c
 create mode 100644 gdb/testsuite/gdb.multi/multi-target-info-inferiors.py
 create mode 100644 gdb/testsuite/gdb.python/py-connection.c
 create mode 100644 gdb/testsuite/gdb.python/py-connection.exp
 create mode 100644 gdb/testsuite/gdb.python/py-send-packet.c
 create mode 100644 gdb/testsuite/gdb.python/py-send-packet.exp
 create mode 100644 gdb/testsuite/gdb.python/py-send-packet.py

-- 
2.25.4


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

end of thread, other threads:[~2021-11-30 12:15 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-11 16:03 [PATCH 0/3] Python API for target connections, and packet sending Andrew Burgess
2021-09-11 16:03 ` [PATCH 1/3] gdb/python: introduce gdb.TargetConnection object type Andrew Burgess
2021-09-11 16:19   ` Eli Zaretskii
2021-09-11 16:03 ` [PATCH 2/3] gdb: make packet_command function available outside remote.c Andrew Burgess
2021-09-11 16:03 ` [PATCH 3/3] gdb/python: add TargetConnection.send_remote_packet method Andrew Burgess
2021-09-11 16:10   ` Eli Zaretskii
2021-10-18  9:45 ` [PATCHv2 0/3] Python API for target connections, and packet sending Andrew Burgess
2021-10-18  9:45   ` [PATCHv2 1/3] gdb/python: introduce gdb.TargetConnection object type Andrew Burgess
2021-10-18 12:44     ` Eli Zaretskii
2021-10-18 15:53     ` Simon Marchi
2021-10-18  9:45   ` [PATCHv2 2/3] gdb: make packet_command function available outside remote.c Andrew Burgess
2021-10-18  9:45   ` [PATCHv2 3/3] gdb/python: add TargetConnection.send_remote_packet method Andrew Burgess
2021-10-18 12:57     ` Eli Zaretskii
2021-10-18 15:46     ` Simon Marchi
2021-10-19 10:17   ` [PATCHv3 0/3] Python API for target connections, and packet sending Andrew Burgess
2021-10-19 10:17     ` [PATCHv3 1/3] gdb/python: introduce gdb.TargetConnection object type Andrew Burgess
2021-10-19 12:26       ` Eli Zaretskii
2021-10-20 22:33       ` Lancelot SIX
2021-10-21  2:00       ` Simon Marchi
2021-10-19 10:17     ` [PATCHv3 2/3] gdb: make packet_command function available outside remote.c Andrew Burgess
2021-10-21  2:23       ` Simon Marchi
2021-10-19 10:17     ` [PATCHv3 3/3] gdb/python: add gdb.RemoteTargetConnection.send_packet Andrew Burgess
2021-10-19 12:28       ` Eli Zaretskii
2021-10-21  2:43       ` Simon Marchi
2021-10-22 11:08         ` Andrew Burgess
2021-10-22 11:18           ` Simon Marchi
2021-10-22 17:11             ` Andrew Burgess
2021-10-22 10:58     ` [PATCHv4 0/4] Python API for target connections, and packet sending Andrew Burgess
2021-10-22 10:58       ` [PATCHv4 1/4] gdb/python: introduce gdb.TargetConnection object type Andrew Burgess
2021-10-22 10:58       ` [PATCHv4 2/4] gdb: make packet_command function available outside remote.c Andrew Burgess
2021-10-22 10:58       ` [PATCHv4 3/4] gdb/python: add gdb.RemoteTargetConnection.send_packet Andrew Burgess
2021-10-22 10:58       ` [PATCHv4 4/4] gdb: handle binary data in 'maint packet' and RemoteTargetConnection.send_packet Andrew Burgess
2021-10-22 17:10       ` [PATCHv5 0/4] Python API for target connections, and packet sending Andrew Burgess
2021-10-22 17:10         ` [PATCHv5 1/4] gdb/python: introduce gdb.TargetConnection object type Andrew Burgess
2021-10-22 17:10         ` [PATCHv5 2/4] gdb: make packet_command function available outside remote.c Andrew Burgess
2021-10-22 17:10         ` [PATCHv5 3/4] gdb/python: add gdb.RemoteTargetConnection.send_packet Andrew Burgess
2021-11-15  2:08           ` Simon Marchi
2021-11-15  9:25             ` Andrew Burgess
2021-11-15 13:16               ` Simon Marchi
2021-10-22 17:10         ` [PATCHv5 4/4] gdb: handle binary data in 'maint packet' and RemoteTargetConnection.send_packet Andrew Burgess
2021-11-15  2:44           ` Simon Marchi
2021-11-09 10:04         ` [PATCHv5 0/4] Python API for target connections, and packet sending Andrew Burgess
2021-11-15 17:40         ` [PATCHv6 0/3] " Andrew Burgess
2021-11-15 17:40           ` [PATCHv6 1/3] gdb/python: introduce gdb.TargetConnection object type Andrew Burgess
2021-11-15 17:40           ` [PATCHv6 2/3] gdb: make packet_command function available outside remote.c Andrew Burgess
2021-11-15 17:40           ` [PATCHv6 3/3] gdb/python: add gdb.RemoteTargetConnection.send_packet Andrew Burgess
2021-11-15 18:42             ` Eli Zaretskii
2021-11-15 19:38               ` Simon Marchi
2021-11-15 19:29             ` Simon Marchi
2021-11-16 12:48             ` Andrew Burgess
2021-11-16 15:10               ` Simon Marchi
2021-11-30 12:15                 ` Andrew Burgess

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