gdb/python: add gdb.RemoteTargetConnection.send_packet
authorAndrew Burgess <aburgess@redhat.com>
Tue, 31 Aug 2021 13:04:36 +0000 (14:04 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 30 Nov 2021 12:10:40 +0000 (12:10 +0000)
commit24b2de7b776f8f23788d855b1eec290c6e208821
tree9a2d7b705087364d8e4ce6585bf6f7ad39664004
parente5b176f25ff51f6811b82f549b7524618d5c2f6b
gdb/python: add gdb.RemoteTargetConnection.send_packet

This commits adds a new sub-class of gdb.TargetConnection,
gdb.RemoteTargetConnection.  This sub-class is created for all
'remote' and 'extended-remote' targets.

This new sub-class has one additional method over its base class,
'send_packet'.  This new method is equivalent to the 'maint
packet' CLI command, it allows a custom packet to be sent to a remote
target.

The outgoing packet can either be a bytes object, or a Unicode string,
so long as the Unicode string contains only ASCII characters.

The result of calling RemoteTargetConnection.send_packet is a bytes
object containing the reply that came from the remote.
gdb/NEWS
gdb/doc/gdb.texinfo
gdb/doc/python.texi
gdb/python/py-connection.c
gdb/remote.c
gdb/remote.h
gdb/testsuite/gdb.python/py-connection.exp
gdb/testsuite/gdb.python/py-send-packet.c [new file with mode: 0644]
gdb/testsuite/gdb.python/py-send-packet.exp [new file with mode: 0644]
gdb/testsuite/gdb.python/py-send-packet.py [new file with mode: 0644]