summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorDavid Ahern <david.ahern@oracle.com>2015-04-09 23:15:46 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-10 16:13:58 +0300
commit1060ab857f64f33a9445881fd31fa91470aeb622 (patch)
treeb92fb150dade3a0dcd8f13f309dc8a972ae985ca /tools/perf
parentd998b732599b304c3865e8e5c7ba6250faba6589 (diff)
downloadlinux-1060ab857f64f33a9445881fd31fa91470aeb622.tar.xz
perf tools: Fix cross-endian analysis
Trying to analyze a big endian data file on little endian system fails with the error: 0xa9b40 [0x70]: failed to process type: 9 The problem is that header parsing is not done correctly because the file attributes are not swapped. Make it so. With this patch able to analyze a sparc64 data file on x86_64. Signed-off-by: David Ahern <david.ahern@oracle.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1428610546-178789-1-git-send-email-david.ahern@oracle.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/header.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index fff3b2a455ae..918fd8ae2d80 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2504,8 +2504,11 @@ int perf_session__read_header(struct perf_session *session)
if (read_attr(fd, header, &f_attr) < 0)
goto out_errno;
- if (header->needs_swap)
+ if (header->needs_swap) {
+ f_attr.ids.size = bswap_64(f_attr.ids.size);
+ f_attr.ids.offset = bswap_64(f_attr.ids.offset);
perf_event__attr_swap(&f_attr.attr);
+ }
tmp = lseek(fd, 0, SEEK_CUR);
evsel = perf_evsel__new(&f_attr.attr);