This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch v4 14/24] record-btrace: provide xfer_partial target method
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sun, 22 Sep 2013 16:18:04 +0200
- Subject: Re: [patch v4 14/24] record-btrace: provide xfer_partial target method
- Authentication-results: sourceware.org; auth=none
- References: <1372842874-28951-1-git-send-email-markus dot t dot metzger at intel dot com> <1372842874-28951-15-git-send-email-markus dot t dot metzger at intel dot com> <20130818190753 dot GK24153 at host2 dot jankratochvil dot net> <A78C989F6D9628469189715575E55B230A9CE9D9 at IRSMSX104 dot ger dot corp dot intel dot com>
On Mon, 16 Sep 2013 11:30:48 +0200, Metzger, Markus T wrote:
> > > +static LONGEST
> > > +record_btrace_xfer_partial (struct target_ops *ops, enum target_object
> > object,
> > > + const char *annex, gdb_byte *readbuf,
> > > + const gdb_byte *writebuf, ULONGEST offset,
> > > + LONGEST len)
> > > +{
> > > + struct target_ops *t;
> > > +
> > > + /* Normalize the request so len is positive. */ if (len < 0)
> > > + {
> > > + offset += len;
> > > + len = - len;
> > > + }
> >
> > I do not see LEN could be < 0, do you? Use just:
> > gdb_assetr (len >= 0);
> > (It even should never be LEN == 0 but that may not be guaranteed.)
>
> Hmm, why didn't we use ULONGEST, then?
Nobody says the current GDB codebase / API is perfect.
Feel free to submit a patch changing len LONGEST->ULONGEST.
> It looks like all implementations in target.c assume LEN to be positive without
> checking. I'm doing the same.
I see you have just removed the "normalization" so btrace code is now like
other GDB code, that is also fine.
Thanks,
Jan