This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Better MI memory commands
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: Daniel Jacobowitz <dan at codesourcery dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Fri, 9 Jul 2010 22:54:07 +0400
- Subject: Re: Better MI memory commands
- References: <201006251232.55281.vladimir@codesourcery.com> <20100707162952.GA6530@caradoc.them.org>
On Wednesday 07 July 2010 20:29:55 Daniel Jacobowitz wrote:
> > - if (xfer == 0)
> > - return xfered;
> > - if (xfer < 0)
> > - {
> > - remaining = half;
> > - }
> > - else
> > - {
> > - /* We have successfully read the first half. So, the
> > - error must be in the second half. Adjust start and
> > - remaining to point at the second half. */
> > - xfered += xfer;
> > - start += xfer;
> > - remaining -= xfer;
> > - }
> > - half = remaining/2;
> > + xfree (buffer);
> > + xfered += to_read;
> > }
>
> Why do we skip to_read bytes if we succeed at reading zero bytes?
> For that matter, what does a return value of zero mean? It seems like
> this would mean the same as -1.
I am not really sure. Per documentation of target_read:
Return the number of bytes actually transfered, or -1 if the
transfer is not supported or otherwise fails. Return of a positive
value less than LEN indicates that no further transfer is possible.
So, value of 0 seems to mean 'there are no more bytes that that, honest',
and that we probably don't need to try further. Documentation for
to_xfer_partial seem to give such meaning to return of 0. On the
other hand, it's not clear what return value of <LEN might mean,
and whether we should try to read remaining chunk. What would you suggest?
Thanks,
--
Vladimir Prus
CodeSourcery
vladimir@codesourcery.com
(650) 331-3385 x722