Re: [PATCHv3 00/12] perf tools: Display eBPF code in intel_pt trace

From: Jiri Olsa
Date: Fri May 24 2019 - 06:09:32 EST


On Thu, May 23, 2019 at 09:27:21PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, May 08, 2019 at 03:19:58PM +0200, Jiri Olsa escreveu:
> > hi,
> > this patchset adds dso support to read and display
> > bpf code in intel_pt trace output. I had to change
> > some of the kernel maps processing code, so hopefully
> > I did not break too many things ;-)
>
> One of these patches need some uintptr_t (IIRC) somewhere:
>
> CC /tmp/build/perf/util/color_config.o
> util/dso.c: In function 'bpf_read':
> util/dso.c:725:8: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> buf = (u8 *) node->info_linear->info.jited_prog_insns;
> ^

would something like below help? we already do that
in the annotation code

thanks,
jirka


---
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 6b8ef5b427f5..f0d9ca5805a6 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -722,7 +722,7 @@ static ssize_t bpf_read(struct dso *dso, u64 offset, char *data)
}

len = node->info_linear->info.jited_prog_len;
- buf = (u8 *) node->info_linear->info.jited_prog_insns;
+ buf = (u8 *)(uintptr_t) node->info_linear->info.jited_prog_insns;

if (offset >= len)
return -1;