[patch v4 20/24] btrace, gdbserver: read branch trace incrementally
Metzger, Markus T
markus.t.metzger@intel.com
Mon Sep 16 12:48:00 GMT 2013
> -----Original Message-----
> From: Jan Kratochvil [mailto:jan.kratochvil@redhat.com]
> Sent: Sunday, August 18, 2013 9:09 PM
Thanks for your review.
> > -VEC (btrace_block_s) *
> > -linux_read_btrace (struct btrace_target_info *tinfo,
> > +int
> > +linux_read_btrace (VEC (btrace_block_s) **btrace,
> > + struct btrace_target_info *tinfo,
> > enum btrace_read_type type)
> > {
> > - return NULL;
> > + return ENOSYS;
>
> You return -EOVERFLOW in its real implementation while ENOSYS here, its
> sign does not match (+it is not documented). linux_low_read_btrace checks
> for -EOVERFLOW.
The -EOVERFLOW return signals a buffer overflow which indicates that
delta trace is not available. GDB then switches to a full read after discarding
the existing trace.
The -ENOSYS return signals that the feature is not available. This error is
passed on to the user.
> > - /* Read branch trace data. */
> > - VEC (btrace_block_s) *(*to_read_btrace) (struct btrace_target_info *,
> > - enum btrace_read_type);
> > + /* Read branch trace data into DATA. The vector is cleared before any
> > + new data is added.
> > + Returns 0 on success; a negative error code, otherwise. */
>
> "a negative errno code" (error code seems too ambiguous to me)
>
> But target_read_btrace several lines above returns positive errno code.
That was a bug. Fixed.
> TBH returning all these errno codes are not common in GDB, returning -1
> would make it easier but I do not insist on it.
I need to distinguish different types of errors, e.g. overflow and not supported.
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
More information about the Gdb-patches
mailing list