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: "Metzger, Markus T" <markus dot t dot metzger at intel dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 16 Sep 2013 09:30:48 +0000
- 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>
> -----Original Message-----
> From: Jan Kratochvil [mailto:jan.kratochvil@redhat.com]
> Sent: Sunday, August 18, 2013 9:08 PM
Thanks for your review.
> > +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?
It looks like all implementations in target.c assume LEN to be positive without
checking. I'm doing the same.
Regards,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052