[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-3ktgyg83fwpqyfpoj0t2ezp0@git.kernel.org>
Date: Thu, 24 Jan 2013 10:55:38 -0800
From: tip-bot for Arnaldo Carvalho de Melo <acme@...hat.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, paulus@...ba.org,
acme@...hat.com, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, efault@....de, namhyung@...il.com,
jolsa@...hat.com, robert.richter@....com, fweisbec@...il.com,
dsahern@...il.com, tglx@...utronix.de
Subject: [tip:perf/core] perf buildid-list:
We need to check if a file is ELF first
Commit-ID: f0bf9107679f3670e5fbd52a934b7816256007f7
Gitweb: http://git.kernel.org/tip/f0bf9107679f3670e5fbd52a934b7816256007f7
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Wed, 5 Dec 2012 16:24:05 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Sun, 9 Dec 2012 08:46:07 -0300
perf buildid-list: We need to check if a file is ELF first
I.e. before we try to use it as a perf.data file by calling
perf_session__new, otherwise we lose the feature that shows the
build id for the given ELF file, this one:
[root@...dy redhat-perfdata-mtech-15]# perf buildid-list -i /root/.debug/.build-id/97/54896de655b6ac088ec2bf5113b35c06f72709
9754896de655b6ac088ec2bf5113b35c06f72709
[root@...dy redhat-perfdata-mtech-15]# perf buildid-list -i /lib/libc-2.12.so
38adaeff4f7c21899b13b28c1a2e6c199ca4c744
[root@...dy redhat-perfdata-mtech-15]#
Regression introduced in:
efad1415 "perf report: Accept fifos as input file"
Cc: David Ahern <dsahern@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Mike Galbraith <efault@....de>
Cc: Namhyung Kim <namhyung@...il.com>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Robert Richter <robert.richter@....com>
Cc: Stephane Eranian <eranian@...gle.com>
Link: http://lkml.kernel.org/n/tip-3ktgyg83fwpqyfpoj0t2ezp0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/builtin-buildid-list.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/tools/perf/builtin-buildid-list.c b/tools/perf/builtin-buildid-list.c
index a82d99f..4c770d2 100644
--- a/tools/perf/builtin-buildid-list.c
+++ b/tools/perf/builtin-buildid-list.c
@@ -49,18 +49,16 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
struct perf_session *session;
symbol__elf_init();
-
- session = perf_session__new(input_name, O_RDONLY, force, false,
- &build_id__mark_dso_hit_ops);
- if (session == NULL)
- return -1;
-
/*
* See if this is an ELF file first:
*/
- if (filename__fprintf_build_id(session->filename, stdout))
+ if (filename__fprintf_build_id(input_name, stdout))
goto out;
+ session = perf_session__new(input_name, O_RDONLY, force, false,
+ &build_id__mark_dso_hit_ops);
+ if (session == NULL)
+ return -1;
/*
* in pipe-mode, the only way to get the buildids is to parse
* the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID
@@ -69,8 +67,8 @@ static int perf_session__list_build_ids(bool force, bool with_hits)
perf_session__process_events(session, &build_id__mark_dso_hit_ops);
perf_session__fprintf_dsos_buildid(session, stdout, with_hits);
-out:
perf_session__delete(session);
+out:
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists