提交 7a675de4 编写于 作者: I Ian Rogers 提交者: Arnaldo Carvalho de Melo

perf annotate: Don't pipe objdump output through 'grep' command

Simplify the objdump command by not piping the output of objdump through
grep. Instead, drop lines that match the grep pattern during the reading
loop.
Signed-off-by: NIan Rogers <irogers@google.com>
Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: clang-built-linux@googlegroups.com
Link: http://lore.kernel.org/lkml/20191010183649.23768-4-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 42359499
...@@ -1916,7 +1916,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) ...@@ -1916,7 +1916,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
err = asprintf(&command, err = asprintf(&command,
"%s %s%s --start-address=0x%016" PRIx64 "%s %s%s --start-address=0x%016" PRIx64
" --stop-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64
" -l -d %s %s -C \"$1\" 2>/dev/null|grep -v \"$1:\"|expand", " -l -d %s %s -C \"$1\" 2>/dev/null|expand",
opts->objdump_path ?: "objdump", opts->objdump_path ?: "objdump",
opts->disassembler_style ? "-M " : "", opts->disassembler_style ? "-M " : "",
opts->disassembler_style ?: "", opts->disassembler_style ?: "",
...@@ -1962,9 +1962,16 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args) ...@@ -1962,9 +1962,16 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
nline = 0; nline = 0;
while (!feof(file)) { while (!feof(file)) {
const char *match;
if (getline(&line, &line_len, file) < 0 || !line) if (getline(&line, &line_len, file) < 0 || !line)
break; break;
/* Skip lines containing "filename:" */
match = strstr(line, symfs_filename);
if (match && match[strlen(symfs_filename)] == ':')
continue;
/* /*
* The source code line number (lineno) needs to be kept in * The source code line number (lineno) needs to be kept in
* across calls to symbol__parse_objdump_line(), so that it * across calls to symbol__parse_objdump_line(), so that it
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册