Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932316AbbDMQFZ (ORCPT ); Mon, 13 Apr 2015 12:05:25 -0400 Received: from mail.kernel.org ([198.145.29.136]:47909 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753826AbbDMQFX (ORCPT ); Mon, 13 Apr 2015 12:05:23 -0400 Date: Mon, 13 Apr 2015 13:05:13 -0300 From: Arnaldo Carvalho de Melo To: Masami Hiramatsu Cc: He Kuang , a.p.zijlstra@chello.nl, mingo@redhat.com, namhyung@kernel.org, wangnan0@huawei.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] perf probe: Make --source avaiable when probe with lazy_line Message-ID: <20150413160513.GJ3200@kernel.org> References: <1428925290-5623-1-git-send-email-hekuang@huawei.com> <1428925290-5623-2-git-send-email-hekuang@huawei.com> <552BE38F.6000203@hitachi.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <552BE38F.6000203@hitachi.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4185 Lines: 125 Em Tue, Apr 14, 2015 at 12:41:03AM +0900, Masami Hiramatsu escreveu: > Hi, > > This one should already be fixed with Naohiro's patch. > > https://lkml.org/lkml/2015/3/13/16 > > Arnaldo, I've already given my ack for that. > > https://lkml.org/lkml/2015/3/13/298 > > Should I resend that? I will check that and apply, thanks! - Arnaldo > > Thank you, > > (2015/04/13 20:41), He Kuang wrote: > > Use get_real_path() to enable --source option when probe with lazy_line > > pattern. > > > > Before this patch: > > > > $ perf probe -s ./kernel_src/ -k ./vmlinux --add='fs/super.c;s->s_count=1;' > > Failed to open fs/super.c: No such file or directory > > Error: Failed to add events. > > > > After this patch: > > > > $ perf probe -s ./kernel_src/ -k ./vmlinux --add='fs/super.c;s->s_count=1;' > > Added new events: > > probe:_stext (on @fs/super.c) > > probe:_stext_1 (on @fs/super.c) > > ... > > > > Signed-off-by: He Kuang > > --- > > tools/perf/util/probe-event.c | 2 +- > > tools/perf/util/probe-event.h | 2 ++ > > tools/perf/util/probe-finder.c | 18 +++++++++++++++--- > > 3 files changed, 18 insertions(+), 4 deletions(-) > > > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c > > index 5483d98..35ee51a 100644 > > --- a/tools/perf/util/probe-event.c > > +++ b/tools/perf/util/probe-event.c > > @@ -661,7 +661,7 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev, > > * a newly allocated path on success. > > * Return 0 if file was found and readable, -errno otherwise. > > */ > > -static int get_real_path(const char *raw_path, const char *comp_dir, > > +int get_real_path(const char *raw_path, const char *comp_dir, > > char **new_path) > > { > > const char *prefix = symbol_conf.source_prefix; > > diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h > > index d6b7834..21809ea 100644 > > --- a/tools/perf/util/probe-event.h > > +++ b/tools/perf/util/probe-event.h > > @@ -135,6 +135,8 @@ extern int show_available_vars(struct perf_probe_event *pevs, int npevs, > > struct strfilter *filter, bool externs); > > extern int show_available_funcs(const char *module, struct strfilter *filter, > > bool user); > > +extern int get_real_path(const char *raw_path, const char *comp_dir, > > + char **new_path); > > > > /* Maximum index number of event-name postfix */ > > #define MAX_EVENT_INDEX 1024 > > diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c > > index 7831e2d..431c12d 100644 > > --- a/tools/perf/util/probe-finder.c > > +++ b/tools/perf/util/probe-finder.c > > @@ -791,11 +791,20 @@ static int find_lazy_match_lines(struct intlist *list, > > ssize_t len; > > int count = 0, linenum = 1; > > char sbuf[STRERR_BUFSIZE]; > > + char *realname = NULL; > > + int ret; > > > > - fp = fopen(fname, "r"); > > + ret = get_real_path(fname, NULL, &realname); > > + if (ret < 0) { > > + pr_warning("Failed to find source file %s.\n", fname); > > + return ret; > > + } > > + > > + fp = fopen(realname, "r"); > > if (!fp) { > > - pr_warning("Failed to open %s: %s\n", fname, > > + pr_warning("Failed to open %s: %s\n", realname, > > strerror_r(errno, sbuf, sizeof(sbuf))); > > + free(realname); > > return -errno; > > } > > > > @@ -817,7 +826,10 @@ static int find_lazy_match_lines(struct intlist *list, > > fclose(fp); > > > > if (count == 0) > > - pr_debug("No matched lines found in %s.\n", fname); > > + pr_debug("No matched lines found in %s.\n", realname); > > + > > + free(realname); > > + > > return count; > > } > > > > > > > -- > Masami HIRAMATSU > Linux Technology Research Center, System Productivity Research Dept. > Center for Technology Innovation - Systems Engineering > Hitachi, Ltd., Research & Development Group > E-mail: masami.hiramatsu.pt@hitachi.com > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/