Messages in this thread | | | Date | Fri, 27 Mar 2015 11:37:14 -0300 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [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
| |