perf probe: Set retprobe flag when probe in address-based alternative mode
perf probe: Set retprobe flag when probe in address-based alternative mode

When perf probe searched in a debuginfo file and failed, it tried with
an alternative, in function get_alternative_probe_event():

        memcpy(tmp, &pev->point, sizeof(*tmp));
        memset(&pev->point, 0, sizeof(pev->point));

In this case, it drops the retprobe flag and forgets to set it back in
find_alternative_probe_point(), so the problem occurs.

Can be reproduced as following:

  $ perf probe -v -k vmlinux --add='sys_write%return'
  ...
  Added new event:
  Writing event: p:probe/sys_write _stext+1584952
    probe:sys_write      (on sys_write%return)

  $ cat /sys/kernel/debug/tracing/kprobe_events
  p:probe/sys_write _stext+1584952

After this patch:

  $ perf probe -v -k vmlinux --add='sys_write%return'
  Added new event:
  Writing event: r:probe/sys_write SyS_write+0
    probe:sys_write      (on sys_write%return)

  $ cat /sys/kernel/debug/tracing/kprobe_events
  r:probe/sys_write SyS_write

Signed-off-by: He Kuang <01189f839f5c53a9f0c5f5c6cb807be9767d9e1e@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>
Acked-by: Masami Hiramatsu <60fcdccfd958d359debfe6e6e7417cd7f1aaa9e3@hitachi.com>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Cc: Wang Nan <7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com>
Link: http://lkml.kernel.org/r/1428925290-5623-1-git-send-email-01189f839f5c53a9f0c5f5c6cb807be9767d9e1e@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs