public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: "Jin, Yao" <yao.jin@linux.intel.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH] perf report: Fix a no annotate browser displayed issue
Date: Mon, 25 Dec 2017 22:44:00 +0100	[thread overview]
Message-ID: <20171225214400.GB25478@krava> (raw)
In-Reply-To: <a6e6bc55-13fe-7e53-d040-d27f72fa1258@linux.intel.com>

On Mon, Dec 25, 2017 at 11:58:39AM +0800, Jin, Yao wrote:
> Hi,
> 
> Any comments for this bug fix?

getting segfault with this

[jolsa@krava perf]$ sudo ./perf record -b ls

[jolsa@krava perf]$ sudo ./perf report --stdio
Segmentation fault (core dumped)

jirka

> 
> Thanks
> Jin Yao
> 
> On 12/18/2017 9:26 PM, Jin Yao wrote:
> > When enabling '-b' option in perf record, for example,
> > 
> > perf record -b ...
> > perf report
> > 
> > and then browsing the annotate browser from perf report, it would
> > be failed (annotate browser can't be displayed).
> > 
> > It's because the '.add_entry_cb' op of struct report is overwritten
> > by hist_iter__branch_callback() in builtin-report.c. But this function
> > doesn't do something like mapping symbols and sources. So next,
> > do_annotate() will return directly.
> > 
> > 	notes = symbol__annotation(act->ms.sym);
> > 	if (!notes->src)
> > 		return 0;
> > 
> > This patch adds the lost code to hist_iter__branch_callback (
> > refer to hist_iter__report_callback).
> > 
> > Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> > ---
> >   tools/perf/builtin-report.c | 15 ++++++++++++++-
> >   1 file changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> > index eb9ce63..0bd0aef 100644
> > --- a/tools/perf/builtin-report.c
> > +++ b/tools/perf/builtin-report.c
> > @@ -162,12 +162,25 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
> >   	struct hist_entry *he = iter->he;
> >   	struct report *rep = arg;
> >   	struct branch_info *bi;
> > +	struct perf_sample *sample = iter->sample;
> > +	struct perf_evsel *evsel = iter->evsel;
> > +	int err;
> > +
> > +	hist__account_cycles(sample->branch_stack, al, sample,
> > +			     rep->nonany_branch_mode);
> >   	bi = he->branch_info;
> > +	err = addr_map_symbol__inc_samples(&bi->from, sample, evsel->idx);
> > +	if (err)
> > +		goto out;
> > +
> > +	err = addr_map_symbol__inc_samples(&bi->to, sample, evsel->idx);
> > +
> >   	branch_type_count(&rep->brtype_stat, &bi->flags,
> >   			  bi->from.addr, bi->to.addr);
> > -	return 0;
> > +out:
> > +	return err;
> >   }
> >   static int process_sample_event(struct perf_tool *tool,
> > 

  reply	other threads:[~2017-12-25 21:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 13:26 [PATCH] perf report: Fix a no annotate browser displayed issue Jin Yao
2017-12-25  3:58 ` Jin, Yao
2017-12-25 21:44   ` Jiri Olsa [this message]
2017-12-25 22:21     ` Jin, Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171225214400.GB25478@krava \
    --to=jolsa@redhat.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox