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


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


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