Re: [PATCH v2 2/2] perf uprobe: Skip prologue if program compiled without optimization

From: Ravi Bangoria
Date: Mon Aug 29 2016 - 04:08:32 EST




On Saturday 27 August 2016 01:00 AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Aug 03, 2016 at 02:28:45PM +0530, Ravi Bangoria escreveu:
>> +++ b/tools/perf/util/probe-finder.c
>> @@ -892,6 +892,169 @@ static int find_probe_point_lazy(Dwarf_Die *sp_die, struct probe_finder *pf)
>> return die_walk_lines(sp_die, probe_point_lazy_walker, pf);
>> }
>
>> +static bool var_has_loclist(Dwarf_Die *die)
> So, the variable 'die' cause the build to fail in multiple systems, I'm
> renaming it to 'cu_die', there are some more problems when cross compiling it
> to some arches, I'm trying to fix them all now:

Sorry for this. I started using "make -C tools/perf build-test" but I don't have
infrastructure handy to test for cross arch.

If possible, can you please provide that to me. Otherwise I've to create it from
scratch.

-Ravi

> [root@jouet ~]# dm
> 1 65.668882867 alpine:3.4: Ok
> 2 24.327143744 android-ndk:r12b-arm: Ok
> 3 76.000455817 archlinux:latest: Ok
> 4 40.905282317 centos:5: Ok
> 5 28.799284950 centos:6: FAIL
> cc1: warnings being treated as errors
> util/probe-finder.c: In function 'var_has_loclist':
> util/probe-finder.c:904: error: declaration of 'die' shadows a global declaration
> util/util.h:137: error: shadowed declaration is here
> util/probe-finder.c: In function 'optimized_target':
> util/probe-finder.c:921: error: declaration of 'die' shadows a global declaration
> util/util.h:137: error: shadowed declaration is here
> -----------------------------------------------------------------------------
> 6 68.157498673 centos:7: Ok
> 7 32.814597820 debian:7: FAIL
> util/probe-finder.c: In function 'var_has_loclist':
> util/probe-finder.c:904:40: error: declaration of 'die' shadows a global declaration [-Werror=shadow]
> In file included from util/probe-finder.c:39:0:
> util/util.h:137:6: error: shadowed declaration is here [-Werror=shadow]
> util/probe-finder.c: In function 'optimized_target':
> util/probe-finder.c:921:41: error: declaration of 'die' shadows a global declaration [-Werror=shadow]
> In file included from util/probe-finder.c:39:0:
> util/util.h:137:6: error: shadowed declaration is here [-Werror=shadow]
> -----------------------------------------------------------------------------
> 8 69.535114125 debian:8: Ok
> 9 71.524733936 debian:experimental: Ok
> 10 66.956671932 fedora:20: Ok
> 11 72.127804972 fedora:21: Ok
> 12 75.767022465 fedora:22: Ok
> 13 72.244964710 fedora:23: Ok
> 14 75.556712624 fedora:24: Ok
> 15 30.825802615 fedora:24-x-ARC-uClibc: Ok
> 16 76.874903316 fedora:rawhide: Ok
> 17 76.756388879 mageia:5: Ok
> 18 71.700493646 opensuse:13.2: Ok
> 19 69.974649379 opensuse:42.1: Ok
> 20 75.265305896 opensuse:tumbleweed: Ok
> 21 28.800283739 ubuntu:12.04.5: FAIL
> util/probe-finder.c: In function 'var_has_loclist':
> util/probe-finder.c:904:40: error: declaration of 'die' shadows a global declaration [-Werror=shadow]
> util/util.h:137:6: error: shadowed declaration is here [-Werror=shadow]
> util/probe-finder.c: In function 'optimized_target':
> util/probe-finder.c:921:41: error: declaration of 'die' shadows a global declaration [-Werror=shadow]
> util/util.h:137:6: error: shadowed declaration is here [-Werror=shadow]
> -----------------------------------------------------------------------------
> 22 66.514504455 ubuntu:14.04.4: Ok
> 23 69.100413367 ubuntu:15.10: Ok
> 24 64.414190947 ubuntu:16.04: Ok
> 25 29.481652689 ubuntu:16.04-x-arm: FAIL
> util/probe-finder.c: In function '__skip_prologue':
> util/probe-finder.c:1022:45: error: passing argument 3 of 'dwarf_getsrclines' from incompatible pointer type [-Werror=incompatible-pointer-types]
> if (dwarf_getsrclines(&pf->cu_die, &lines, &nr_lines))
> ^
> In file included from util/dwarf-aux.h:23:0,
> from util/probe-finder.h:24,
> from util/probe-finder.c:41:
> /usr/arm-linux-gnueabihf/include/elfutils/libdw.h:592:12: note: expected 'size_t * {aka unsigned int *}' but argument is of type 'long unsigned int *'
> extern int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines,
> ^
> In file included from util/probe-finder.c:37:0:
> util/probe-finder.c: In function 'skip_prologue':
> util/probe-finder.c:1060:10: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'Dwarf_Addr {aka long long unsigned int}' [-Werror=format=]
> pr_info("Target program is compiled without optimization. Skipping prologue.\n"
> ^
> util/debug.h:18:21: note: in definition of macro 'pr_fmt'
> #define pr_fmt(fmt) fmt
> ^
> util/probe-finder.c:1060:2: note: in expansion of macro 'pr_info'
> pr_info("Target program is compiled without optimization. Skipping prologue.\n"
> ^
> -----------------------------------------------------------------------------
> 26 51.979875334 ubuntu:16.04-x-arm64: Ok
> 27 28.808591224 ubuntu:16.04-x-powerpc64: FAIL
> CC /tmp/build/perf/tests/bp_signal.o
> util/probe-finder.c: In function '__skip_prologue':
> util/probe-finder.c:1022:45: error: passing argument 3 of 'dwarf_getsrclines' from incompatible pointer type [-Werror=incompatible-pointer-types]
> if (dwarf_getsrclines(&pf->cu_die, &lines, &nr_lines))
> ^
> In file included from util/dwarf-aux.h:23:0,
> from util/probe-finder.h:24,
> from util/probe-finder.c:41:
> /usr/powerpc-linux-gnu/include/elfutils/libdw.h:592:12: note: expected 'size_t * {aka unsigned int *}' but argument is of type 'long unsigned int *'
> extern int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines,
> ^
> In file included from util/probe-finder.c:37:0:
> util/probe-finder.c: In function 'skip_prologue':
> util/probe-finder.c:1060:10: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'Dwarf_Addr {aka long long unsigned int}' [-Werror=format=]
> pr_info("Target program is compiled without optimization. Skipping prologue.\n"
> ^
> util/debug.h:18:21: note: in definition of macro 'pr_fmt'
> #define pr_fmt(fmt) fmt
> ^
> util/probe-finder.c:1060:2: note: in expansion of macro 'pr_info'
> -----------------------------------------------------------------------------
> 28 53.372615706 ubuntu:16.04-x-powerpc64el: Ok
> 29 71.550573752 ubuntu:16.10: Ok
> 30 52.727886240 ubuntu:16.10-x-s390: Ok
>