From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753217AbdLYWVf (ORCPT ); Mon, 25 Dec 2017 17:21:35 -0500 Received: from mga01.intel.com ([192.55.52.88]:9749 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752885AbdLYWVc (ORCPT ); Mon, 25 Dec 2017 17:21:32 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,457,1508828400"; d="scan'208";a="16498712" Subject: Re: [PATCH] perf report: Fix a no annotate browser displayed issue To: Jiri Olsa 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 References: <1513603588-9954-1-git-send-email-yao.jin@linux.intel.com> <20171225214400.GB25478@krava> From: "Jin, Yao" Message-ID: <66c14c7d-e8ed-3fb2-03d4-83728efde136@linux.intel.com> Date: Tue, 26 Dec 2017 06:21:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171225214400.GB25478@krava> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/26/2017 5:44 AM, Jiri Olsa wrote: > 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 > Sorry about that. My fault, I will debug this issue. Thanks Jin Yao >> >> 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 >>> --- >>> 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, >>>