perf probe: Show the error reason comes from invalid DSO
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Wed, 27 May 2015 08:37:18 +0000 (17:37 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 27 May 2015 15:21:45 +0000 (12:21 -0300)
commit419e87382873b11b17cb31e2f21859570a32e0d1
treeb9dd3061fb8f3633d295f5cef9978c40bc478a9b
parent9b5d1c29556989aa9dc1240566e78806ddefd160
perf probe: Show the error reason comes from invalid DSO

Show the reason of error when dso__load* fails. This shows when user
gives wrong kernel image or wrong path.

Without this, perf probe shows an obscure message:

  ----
  $ perf probe -k ~/kbin/linux-3.x86_64/vmlinux -L vfs_read
  Failed to find path of kernel module.
    Error: Failed to show lines.
  ----

With this, perf shows appropriate error message:

  ----
  $ perf probe -k ~/kbin/linux-3.x86_64/vmlinux -L vfs_read
  Failed to find the path for kernel: Mismatching build id
    Error: Failed to show lines.
  ----

And:

  ----
  $ perf probe -k /non-exist/kernel/vmlinux -L vfs_read
  Failed to find the path for kernel: No such file or directory
    Error: Failed to show lines.
  ----

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Link: http://lkml.kernel.org/r/20150527083718.23880.84100.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/probe-event.c
tools/perf/util/probe-event.h