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 20/24] btrace, gdbserver: read branch trace incrementally


On Mon, 16 Sep 2013 14:48:42 +0200, Metzger, Markus T wrote:
> 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.

Then linux_read_btrace function comment should document this as -EOVERFLOW is
specific to its API.  But I would find some enum more clear, see below.


> The -ENOSYS return signals that the feature is not available.  This error is
> passed on to the user.
+
> > 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.

Then use enum.  There is for example:
enum return_reason
  {
    /* User interrupt.  */
    RETURN_QUIT = -2,
    /* Any other error.  */
    RETURN_ERROR
  };

One could even throw and catch specific exceptions (enum errors) but I find
that needlessly overcomplicated when we just return to the immediate caller.


Thanks,
Jan


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