This is the mail archive of the gdb-patches@sourceware.org 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 v4 14/24] record-btrace: provide xfer_partial target method


> -----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


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