Messages in this thread | | | Date | Mon, 23 Mar 2015 12:02:28 +0100 | From | Jiri Olsa <> | Subject | Re: [PATCH 08/14] perf tools: Use kmod_path__parse in map_groups__set_modules_path_dir |
| |
On Mon, Mar 23, 2015 at 08:55:09AM +0900, Namhyung Kim wrote:
SNIP
> > > + */ > > > + if (m->comp && is_kmod_dso(map->dso)) > > > + map->dso->symtab_type++; > > > > Ouch, does this assumes this is a: > > > > DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE > > Nope, it's one of _SYSTEM_PATH_KMODULE or _GUEST_KMODULE. > > > > > > And that, because in the dso_binary_type enum > > DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP comes right after it, and thus > > this cryptic increment is equivalent to: > > > > map->dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP; > > Again, _SYSTEM_PATH_KMODULE_COMP or _GUEST_KMODULE_COMP. >
yep, the code assumes (correctly) that symtab_type is either _SYSTEM_PATH_KMODULE or _GUEST_KMODULE.
Namhyung placed the _COMP enum right behind 'no comp' values:
enum dso_binary_type { ... DSO_BINARY_TYPE__GUEST_KMODULE, DSO_BINARY_TYPE__GUEST_KMODULE_COMP, DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE, DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP, ...
so we could safely just increase the symtab_type in case we detect it's compressed kernel module.
Perhaps the code could be more verbose on this, but since such comment wasn't part of the previous code I did not feel the need to add it now ;-)
jirka
| |