[patch v4 14/24] record-btrace: provide xfer_partial target method

Jan Kratochvil jan.kratochvil@redhat.com
Sun Sep 22 14:18:00 GMT 2013


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



More information about the Gdb-patches mailing list