diff options
author | Jan Stancek <jstancek@redhat.com> | 2015-09-02 04:19:17 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-09-14 11:50:13 -0400 |
commit | fd405cf6cfddd300377bd5fd9b93d2ff66fbc32d (patch) | |
tree | 939fc643d75b2c5c8b535641c9df0f7fa22183ea /tools/perf/tests/code-reading.c | |
parent | edfdb7eab0fe5f98f2951598dc679b71bdb3e16b (diff) |
perf tests: Print objdump/dso buffers if they don't match
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/d0f42f786bc0e965918e0f422df25617a12a4021.1441181335.git.jstancek@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/code-reading.c')
-rw-r--r-- | tools/perf/tests/code-reading.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 8145c67fb43a..2d21183bd661 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -162,6 +162,18 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf, | |||
162 | return ret; | 162 | return ret; |
163 | } | 163 | } |
164 | 164 | ||
165 | static void dump_buf(unsigned char *buf, size_t len) | ||
166 | { | ||
167 | size_t i; | ||
168 | |||
169 | for (i = 0; i < len; i++) { | ||
170 | pr_debug("0x%02x ", buf[i]); | ||
171 | if (i % 16 == 15) | ||
172 | pr_debug("\n"); | ||
173 | } | ||
174 | pr_debug("\n"); | ||
175 | } | ||
176 | |||
165 | static int read_object_code(u64 addr, size_t len, u8 cpumode, | 177 | static int read_object_code(u64 addr, size_t len, u8 cpumode, |
166 | struct thread *thread, struct state *state) | 178 | struct thread *thread, struct state *state) |
167 | { | 179 | { |
@@ -264,6 +276,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, | |||
264 | /* The results should be identical */ | 276 | /* The results should be identical */ |
265 | if (memcmp(buf1, buf2, len)) { | 277 | if (memcmp(buf1, buf2, len)) { |
266 | pr_debug("Bytes read differ from those read by objdump\n"); | 278 | pr_debug("Bytes read differ from those read by objdump\n"); |
279 | pr_debug("buf1 (dso):\n"); | ||
280 | dump_buf(buf1, len); | ||
281 | pr_debug("buf2 (objdump):\n"); | ||
282 | dump_buf(buf2, len); | ||
267 | return -1; | 283 | return -1; |
268 | } | 284 | } |
269 | pr_debug("Bytes read match those read by objdump\n"); | 285 | pr_debug("Bytes read match those read by objdump\n"); |