From: Vladimir Prus <vladimir@codesourcery.com>
To: Daniel Jacobowitz <dan@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Better MI memory commands
Date: Fri, 09 Jul 2010 18:54:00 -0000 [thread overview]
Message-ID: <201007092254.07434.vladimir@codesourcery.com> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2010-07-09 18:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-25 8:33 Vladimir Prus
2010-06-25 16:05 ` Eli Zaretskii
2010-08-11 12:38 ` Vladimir Prus
2010-08-11 18:00 ` Eli Zaretskii
2010-08-12 7:25 ` Vladimir Prus
2010-08-12 17:04 ` Eli Zaretskii
2010-08-13 13:23 ` Vladimir Prus
2010-07-07 16:30 ` Daniel Jacobowitz
2010-07-09 18:54 ` Vladimir Prus [this message]
2010-07-09 18:59 ` Daniel Jacobowitz
2010-08-11 12:38 ` Vladimir Prus
2010-08-11 21:10 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201007092254.07434.vladimir@codesourcery.com \
--to=vladimir@codesourcery.com \
--cc=dan@codesourcery.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).