0

I would like to create a memory flamegraph of a process using bcc/eBPF as seen here and using:

sudo ./stackcount-bpfcc -p <pid> -U -r ".*malloc.*" -v -d

Doesn't seem to write anything interesting in stdout, just have this:

cannot attach kprobe, Invalid argument
cannot attach kprobe, Invalid argument
cannot attach kprobe, Invalid argument
cannot attach kprobe, Invalid argument
cannot attach kprobe, Invalid argument
Tracing 86 functions for ".*malloc.*"...
Hit Ctrl-C to end.

My executable is written in Rust and was build with .cargo/config:

[build]
rustflags = "-C force-frame-pointers=yes"
elmattic
  • 12,046
  • 5
  • 43
  • 79
  • 1
    Note that Rust doesn't use `malloc` for memory management. The Rust standard library accesses lower level APIs to get memory from the kernel directly. So the libc uprobes have no reason to be triggered. – Jmb Jun 28 '22 at 10:01
  • @Jmb thanks, indeed that was the problem, using a simple C program doing simple `malloc`s works. – elmattic Jun 28 '22 at 11:36
  • @Jmb Could you make your comment into an answer? – pchaigno Jun 28 '22 at 20:43

0 Answers0