From: Taeung Song <treeze.taeung@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Wang Nan <wangnan0@huawei.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Taeung Song <treeze.taeung@gmail.com>,
Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH v3 5/7] perf annotate: Get correct line numbers matched with addr
Date: Fri, 10 Mar 2017 02:35:39 +0900 [thread overview]
Message-ID: <1489080941-3965-6-git-send-email-treeze.taeung@gmail.com> (raw)
In-Reply-To: <1489080941-3965-1-git-send-email-treeze.taeung@gmail.com>
Currently perf-annotate show wrong line numbers.
For example,
Actual source code is as below
...
21 };
22
23 unsigned int limited_wgt;
24
25 unsigned int get_cond_maxprice(int wgt)
26 {
...
However, the output of perf-annotate is as below.
4 Disassembly of section .text:
6 0000000000400966 <get_cond_maxprice>:
7 get_cond_maxprice():
26 };
28 unsigned int limited_wgt;
30 unsigned int get_cond_maxprice(int wgt)
31 {
So remove the wrong way counting line numbers
and match correct line numbers to each addr of asm lines
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
tools/perf/util/annotate.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index e49eb7e..a50d949 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -823,11 +823,11 @@ static struct disasm_line *disasm_line__new(s64 offset, char *line,
if (dl != NULL) {
dl->offset = offset;
dl->line = strdup(line);
- dl->line_nr = line_nr;
if (dl->line == NULL)
goto out_delete;
if (offset != -1) {
+ dl->line_nr = line_nr;
if (disasm_line__parse(dl->line, &dl->ins.name, &dl->ops.raw) < 0)
goto out_free_line;
@@ -1207,7 +1207,6 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
dl = disasm_line__new(offset, parsed_line, privsize, *line_nr, arch, map);
free(line);
- (*line_nr)++;
if (dl == NULL)
return -1;
--
2.7.4
next prev parent reply other threads:[~2017-03-09 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-09 17:35 [PATCH v3 0/7] perf annotate: Fixes & Introduce --source-only and new source code view Taeung Song
2017-03-09 17:35 ` [PATCH v3 1/7] perf annotate: Use build-id dir when reading link name Taeung Song
2017-03-09 17:35 ` [PATCH v3 2/7] perf annotate: Avoid division by zero when calculating percent Taeung Song
2017-03-09 17:35 ` [PATCH v3 3/7] perf annotate: Fix missing setting nr samples on source_line Taeung Song
2017-03-09 17:35 ` [PATCH v3 4/7] perf annotate: More exactly grep -v in symbol__disassemble() Taeung Song
2017-03-09 17:35 ` Taeung Song [this message]
2017-03-09 17:35 ` [PATCH v3 6/7] perf annotate: Introduce --source-only option Taeung Song
2017-03-09 17:35 ` [PATCH v3 7/7] perf annotate: Support the new source code view for TUI Taeung Song
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=1489080941-3965-6-git-send-email-treeze.taeung@gmail.com \
--to=treeze.taeung@gmail.com \
--cc=acme@kernel.org \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=wangnan0@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.