Re: [PATCH 14/25] perf symbols: Save DSO loading errno to better report errors

From: Arnaldo Carvalho de Melo
Date: Fri Mar 27 2015 - 10:37:27 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/