Oops! this will disable support for multiple functions from single
binary. (-x binary -V fun1 -V fun2)

Sorry for the noise. Please ignore the patch. Will revise it.

Thanks,
Ravi

On Thursday 26 October 2017 01:21 PM, Ravi Bangoria wrote:
If multiple executables (-x) are specified with 'perf probe',
listing variables only considers first executable. Ex,

   $ perf probe -V do_sys_open -x ./test -V fun
     Failed to find debug information for address 40
     Debuginfo analysis failed.
       Error: Failed to show vars.
     Available variables at do_sys_open
             @<do_sys_open+0>
                     char*   filename
                     int     dfd
                     int     flags
                     struct open_flags       op
                     umode_t mode

Here, first executable is kernel and second is 'test'. Instead
of finding 'fun()' from 'test', perf is looking for 'fun()' in
kernel. Fix this by restricting user to use only one executable
with -V.

   $ perf probe -V do_sys_open -x ./test -V fun
     Error: Multiple executables are not allowed.

   $ perf probe -V do_sys_open
     Available variables at do_sys_open
             @<do_sys_open+0>
                     char*   filename
                     int     dfd
                     int     flags
                     struct open_flags       op
                     umode_t mode

   $ perf probe -x ./test -V fun
     Available variables at fun
             @<fun+0>
                     int     arg

Signed-off-by: Ravi Bangoria <[email protected]>
---
  tools/perf/util/probe-event.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index b7aaf9b..0e04015 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1128,6 +1128,11 @@ int show_available_vars(struct perf_probe_event *pevs, 
int npevs,
        int i, ret = 0;
        struct debuginfo *dinfo;

+       if (npevs > 1) {
+               pr_err("Error: Multiple executables are not allowed.\n");
+               return 0;
+       }
+
        ret = init_probe_symbol_maps(pevs->uprobes);
        if (ret < 0)
                return ret;

Reply via email to