[PATCH] remote protocol cleanups

Nathan Sidwell nathan@codesourcery.com
Tue Mar 8 11:09:00 GMT 2005


Daniel Jacobowitz wrote:
> On Wed, Feb 09, 2005 at 11:53:50AM +0000, Nathan Sidwell wrote:

>>2) remote_write_bytes attempts to honour get_memory_write_packet_size's
>>limit, but fails in two ways when that is a very small number.  a) it can
>>end up with a negative byte count. b) it deducts the number of chars in
>>the *maximal* length count, not the number of chars in the actual length
>>count.  This can result in packets sending 1 or 2 bytes fewer than they
>>are limited to.

> 
> Mostly OK, but one question.  I don't get the "max (todo, 1)".  If no
> bytes fit, aren't we hosed?  It seems like an error condition; we
> shouldn't be violating the size limit.

It appears the minimum size setting is somewhat arbitrary, and incorrect.
/* NOTE: 16 is just chosen at random.  */
#ifndef MIN_REMOTE_PACKET_SIZE
#define MIN_REMOTE_PACKET_SIZE 16
#endif

the minumum packet size is actually
7 - strlen ("$M,:#NN")
8 - hexnumlen (memaddr) (32 bit host)
1 - hexnumlen (len)
2 - data
= 18 characters

This patch fixes that size calculation. ok?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: remote-2.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20050308/9920090f/attachment.ksh>


More information about the Gdb-patches mailing list