I have these:

  bpftrace              0.20.2-1      amd64
  libbpfcc:amd64        0.29.1+ds-1.1 amd64
  libbpfcc-dev:amd64    0.29.1+ds-1.1 amd64


I'm seeing this problem as well, but my error message is slightly
different.

I have a tst.c:

  #include <stdio.h>
  #include <unistd.h>
  void f(int x)
  {
      printf("%d\n",x);
      sleep(1);
  }
  int main(void)
  {
      for(int i=0; i<3; i++)
          f(i);
      return 0;
  }

I build it:

  gcc -o tst tst.c

And this happens:

  dima@shorty:/tmp$ sudo bpftrace -e 'u:tst:f {print(arg0)}' -c './tst' 

  Attaching 1 probe...
  ERROR: Could not resolve symbol: tst:f

Same as with this bug, specifying a wildcard makes it work. It also
works if the path to the ELF file being instrumented is given with a
directory, not just as a bare file. These both work:

  sudo bpftrace -e 'u:./tst:f {print(arg0)}' -c './tst'

  sudo bpftrace -e 'u:tst:f* {print(arg0)}' -c './tst'

I debugged it a little bit. The different-behavior-with-a-directory
happens because of this branch:

  https://sources.debian.org/src/bpfcc/0.29.1%2Bds-1.1/src/cc/bcc_syms.cc/#L798

For whatever reason using a wildcard doesn't go through this chunk of
code at all.

This looks like a bug that should be filed upstream. Can one of you
please do that, if that's appropriate?

Thanks!

Reply via email to