From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [209.51.188.92]) by sourceware.org (Postfix) with ESMTPS id 2B0E73857C72 for ; Mon, 15 Nov 2021 18:42:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2B0E73857C72 Received: from [2001:470:142:3::e] (port=45160 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmgvr-00068M-KS; Mon, 15 Nov 2021 13:42:19 -0500 Received: from [87.69.77.57] (port=4240 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mmgvq-0007LG-C4; Mon, 15 Nov 2021 13:42:19 -0500 Date: Mon, 15 Nov 2021 20:42:09 +0200 Message-Id: <837dd92rcu.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess Cc: gdb-patches@sourceware.org In-Reply-To: <1ee3ff1661f4e29adb8cf1daf90f88bd7c282a77.1636997240.git.aburgess@redhat.com> (message from Andrew Burgess via Gdb-patches on Mon, 15 Nov 2021 17:40:57 +0000) Subject: Re: [PATCHv6 3/3] gdb/python: add gdb.RemoteTargetConnection.send_packet References: <1ee3ff1661f4e29adb8cf1daf90f88bd7c282a77.1636997240.git.aburgess@redhat.com> X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2021 18:42:21 -0000 > Date: Mon, 15 Nov 2021 17:40:57 +0000 > From: Andrew Burgess via Gdb-patches > Cc: Andrew Burgess > > diff --git a/gdb/NEWS b/gdb/NEWS > index 63e7c118eb1..4fdb2c41121 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -61,7 +61,9 @@ maint packet > integer type given a size and a signed-ness. > > ** New gdb.TargetConnection object type that represents a connection > - (as displayed by the 'info connections' command). > + (as displayed by the 'info connections' command). A sub-class, > + gdb.RemoteTargetConnection, is used to represent 'remote' and > + 'extended-remote' connections. > > ** The gdb.Inferior type now has a 'connection' property which is an > instance of gdb.TargetConnection, the connection used by this > @@ -75,6 +77,10 @@ maint packet > ** New gdb.connections() function that returns a list of all > currently active connections. > > + ** New gdb.RemoteTargetConnection.send_packet(PACKET) method. This > + is equivalent to the existing 'maint packet' CLI command; it > + allows a user specified packet to be sent to the remote target. > + > * New features in the GDB remote stub, GDBserver > > ** GDBserver is now supported on OpenRISC GNU/Linux. This part is OK. > +Currently there is only a single sub-class of > +@code{gdb.TargetConnection}, @code{gdb.RemoteTargetConnection}, > +however, additional sub-classes may be added in future releases of > +@value{GDBN}. As a result you should avoid writing code like: > + > +@smallexample > +conn = gdb.selected_inferior().connection > +if type(conn) is gdb.RemoteTargetConnection: > + print("This is a remote target connection") > +@end smallexample > + > +@noindent > +As this may fail when more connection types are added. Instead, you The "As this may fail" should begin with a lower-case "as", since this is the continuation of the sentence before the example. > +This method sends @var{packet}, which should be a non-empty string or > +bytes array, to the remote target and returns the response. If ^^^^^^^^^^^ You meant "byte array", right? Or "array of bytes", perhaps. > +@var{packet} is not a string, a bytes array, or is empty, then an ^^^^^^^^^^^ Likewise. > +can be decoded from the buffer. For example, if it is known that the > +response is an @code{"ascii"} string: ^^^^^^^^^^^^^^ I'd prefer @sc{ascii} instead (and without the quotes), it will look better in print. Thanks.