perf probe: Move kernel_get_module_dso() to be built only with DWARF support
Namhyung Kim
maintainerPATCH 1/1 perf probe: Move kernel_get_module_dso() to be built only with DWARF support
The kernel_get_module_dso() is called only from open_debugginfo() and the latter is defined only if HAVE_DWARF_SUPPORT is defined. So build without dwarf failed like below:
CC util/probe-event.o
util/probe-event.c:203:12: error: ‘kernel_get_module_dso’ defined but not used
[-Werror=unused-function]
static int kernel_get_module_dso(const char *module, struct dso **pdso)
^
cc1: all warnings being treated as errors /home/namhyung/project/linux/tools/build/Makefile.build:68:
recipe for target 'util/probe-event.o' failed
make[5]: *** [util/probe-event.o] Error 1
--- tools/perf/util/probe-event.c | 65 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 33 deletions(-)
tools/perf/util/probe-event.c +32 -33
@@ -199,39 +199,6 @@ static void put_target_map(struct map *map, bool user) } } - -static int kernel_get_module_dso (const char *module,struct dso **pdso) -{ -struct dso *dso; -struct map *map; -const char *vmlinux_name; -int ret =0 ; - -if (module) { -list_for_each_entry (dso, &host_machine->kernel_dsos.head, - node) { -if (strncmp (dso->short_name +1 , module, - dso->short_name_len -2 ) ==0 ) - goto found; - } -pr_debug ("Failed to find module %s.\n" , module); -return -ENOENT ; - } - - map = host_machine->vmlinux_maps[MAP__FUNCTION ]; - dso = map->dso; - - vmlinux_name = symbol_conf.vmlinux_name; - dso->load_errno =0 ; -if (vmlinux_name) - ret =dso__load_vmlinux (dso, map, vmlinux_name, false,NULL ); -else - ret =dso__load_vmlinux_path (dso, map,NULL ); -found: - *pdso = dso; -return ret; -} -static int convert_exec_to_group (const char *exec,char **result) {char *ptr1, *ptr2, *exec_copy;
@@ -377,6 +344,38 @@ static int get_alternative_line_range(struct debuginfo *dinfo,return ret; } +static int kernel_get_module_dso (const char *module,struct dso **pdso) +{ +struct dso *dso; +struct map *map; +const char *vmlinux_name; +int ret =0 ; + +if (module) { +list_for_each_entry (dso, &host_machine->kernel_dsos.head, + node) { +if (strncmp (dso->short_name +1 , module, + dso->short_name_len -2 ) ==0 ) + goto found; + } +pr_debug ("Failed to find module %s.\n" , module); +return -ENOENT ; + } + + map = host_machine->vmlinux_maps[MAP__FUNCTION ]; + dso = map->dso; + + vmlinux_name = symbol_conf.vmlinux_name; + dso->load_errno =0 ; +if (vmlinux_name) + ret =dso__load_vmlinux (dso, map, vmlinux_name, false,NULL ); +else + ret =dso__load_vmlinux_path (dso, map,NULL ); +found: + *pdso = dso; +return ret; +} +/* Open new debuginfo of given module */ static struct debuginfo *open_debuginfo (const char *module,bool silent) {
Signature · 1 line
2.4.1
Hi,
Wang has already sent the patch (and I acked). Please check this
https://lkml.org/lkml/2015/5/27/1013
Thank you!
Quoted 104 lines · Namhyung Kim
The
kernel_get_module_dso()is called only fromopen_debugginfo()and the latter is defined only ifHAVE_DWARF_SUPPORTis defined. So build without dwarf failed like below:CC
util/probe-event.o
util/probe-event.c:203:12: error: ‘kernel_get_module_dso’ defined but not used
[-Werror=unused-function]
static intkernel_get_module_dso(const char *module, struct dso **pdso)^cc1: all warnings being treated as errors
/home/namhyung/project/linux/tools/build/Makefile.build:68:
recipe for target 'util/probe-event.o' failed
make[5]: *** [util/probe-event.o] Error 1Cc Masami Hiramatsu <[email protected]>Signed-off-by Namhyung Kim <[email protected]>--- tools/perf/util/probe-event.c | 65 +++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 33 deletions(-)tools/perf/util/probe-event.c +32
-33@@ -199,39 +199,6 @@ static void put_target_map(struct map *map, bool user) } } - -static int kernel_get_module_dso (const char *module,struct dso **pdso) -{ -struct dso *dso; -struct map *map; -const char *vmlinux_name; -int ret =0 ; - -if (module) { -list_for_each_entry (dso, &host_machine->kernel_dsos.head, - node) { -if (strncmp (dso->short_name +1 , module, - dso->short_name_len -2 ) ==0 ) - goto found; - } -pr_debug ("Failed to find module %s.\n" , module); -return -ENOENT ; - } - - map = host_machine->vmlinux_maps[MAP__FUNCTION ]; - dso = map->dso; - - vmlinux_name = symbol_conf.vmlinux_name; - dso->load_errno =0 ; -if (vmlinux_name) - ret =dso__load_vmlinux (dso, map, vmlinux_name, false,NULL ); -else - ret =dso__load_vmlinux_path (dso, map,NULL ); -found: - *pdso = dso; -return ret; -} -static int convert_exec_to_group (const char *exec,char **result) {char *ptr1, *ptr2, *exec_copy;@@ -377,6 +344,38 @@ static int get_alternative_line_range(struct debuginfo *dinfo,return ret; } +static int kernel_get_module_dso (const char *module,struct dso **pdso) +{ +struct dso *dso; +struct map *map; +const char *vmlinux_name; +int ret =0 ; + +if (module) { +list_for_each_entry (dso, &host_machine->kernel_dsos.head, + node) { +if (strncmp (dso->short_name +1 , module, + dso->short_name_len -2 ) ==0 ) + goto found; + } +pr_debug ("Failed to find module %s.\n" , module); +return -ENOENT ; + } + + map = host_machine->vmlinux_maps[MAP__FUNCTION ]; + dso = map->dso; + + vmlinux_name = symbol_conf.vmlinux_name; + dso->load_errno =0 ; +if (vmlinux_name) + ret =dso__load_vmlinux (dso, map, vmlinux_name, false,NULL ); +else + ret =dso__load_vmlinux_path (dso, map,NULL ); +found: + *pdso = dso; +return ret; +} +/* Open new debuginfo of given module */ static struct debuginfo *open_debuginfo (const char *module,bool silent) {
Signature · 5 lines
Masami HIRAMATSU Linux Technology Research Center, System Productivity Research Dept. Center for Technology Innovation - Systems Engineering Hitachi, Ltd., Research & Development Group E-mail: [email protected]
Namhyung Kim
maintainerHi Masami,
Quoted 4 lines · Masami Hiramatsu
Hi,
Wang has already sent the patch (and I acked). Please check this
https://lkml.org/lkml/2015/5/27/1013
Ah, ok then. Please ignore this.. :)
Thanks,
Namhyung