lkml.org 
[lkml]   [2015]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 14/25] perf symbols: Save DSO loading errno to better report errors
Em Fri, Mar 27, 2015 at 11:32:43AM +0100, Borislav Petkov escreveu:
> On Tue, Mar 24, 2015 at 01:19:29PM -0300, Arnaldo Carvalho de Melo wrote:
> > + /*
> > + * This must have a same ordering as the enum dso_load_errno.
> > + */
> > + static const char *dso_load__error_str[] = {
> > + "Internal tools/perf/ library error",
> > + "Invalid ELF file",
> > + "Can not read build id",
> > + "Mismatching build id",
> > + "Decompression failure",
> > + };
>
> You could define this str array by using the dso_load_errno defines so
> that they're always in sync:
>
> static const char *dso_load__error_str[] = {
> [DSO_LOAD_ERRNO__INTERNAL_ERROR - __DSO_LOAD_ERRNO__START] = "Internal tools/perf/ library error",
> [DSO_LOAD_ERRNO__INVALID_ELF - __DSO_LOAD_ERRNO__START] = "Invalid ELF file",
> ...
>
> and even use a small macro to hide the __DSO_LOAD_ERRNO__START thing.

Right, good idea, I'll change both this and the code that was used as a
template.

- Arnaldo


\
 
 \ /
  Last update: 2015-03-27 16:01    [W:0.062 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site