• Arnaldo Carvalho de Melo's avatar
    perf test shell: Add uprobes + backtrace ping test · 8fc375d7
    Arnaldo Carvalho de Melo authored
    Installs a probe on libc's inet_pton function, that will use uprobes,
    then use 'perf trace' on a ping to localhost asking for just one packet
    with the a backtrace 3 levels deep, check that it is what we expect.
    This needs no debuginfo package, all is done using the libc ELF symtab
    and the CFI info in the binaries.
    
    Testing it:
    
      # perf test ping
      61: probe libc's inet_pton & backtrace it with ping       : Ok
    
    In verbose mode:
    
      # perf test -v ping
      61: probe libc's inet_pton & backtrace it with ping       :
      --- start ---
      test child forked, pid 1007
      PING ::1(::1) 56 data bytes
      64 bytes from ::1: icmp_seq=1 ttl=64 time=0.058 ms
      --- ::1 ping statistics ---
      1 packets transmitted, 1 received, 0% packet loss, time 0ms
      rtt min/avg/max/mdev = 0.058/0.058/0.058/0.000 ms
      0.000 probe_libc:inet_pton:(7f75fce12a20))
      __GI___inet_pton (/usr/lib64/libc-2.24.so)
      getaddrinfo (/usr/lib64/libc-2.24.so)
      _init (/usr/bin/ping)
      test child finished with 0
      ---- end ----
      probe libc's inet_pton & backtrace it with ping: Ok
      #
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-idrntt4nbg15aafu8hjmv7sk@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    8fc375d7
trace+probe_libc_inet_pton.sh 1.38 KB