This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] remote protocol cleanups


On Wed, Feb 09, 2005 at 11:53:50AM +0000, Nathan Sidwell wrote:
> Hi,
> This patch fixes a couple of problems with the remote protcol handling
> 
> 1) remote_fetch_registers checks to see things have not got out of
> sync, but it does not deal with upper case hex characters and so can get
> confused
> 
> 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.
> 
> built & tested on i686-pc-linux-gnu and an unreleased architecture. ok?

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.

>       case PACKET_DISABLE:
>         *p++ = 'M';
>         /* Num bytes that will fit.  */
>         todo = min (len, payload_size / 2);
> +       payload_size -= hexnumlen (todo);
> +       todo = min (todo, payload_size / 2);
> +       todo = max (todo, 1);
>         break;
>       case PACKET_SUPPORT_UNKNOWN:
>         internal_error (__FILE__, __LINE__,


-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]