Commit fd405cf6 authored by Jan Stancek's avatar Jan Stancek Committed by Arnaldo Carvalho de Melo

perf tests: Print objdump/dso buffers if they don't match

Signed-off-by: default avatarJan Stancek <jstancek@redhat.com>
Acked-by: default avatarAdrian 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent edfdb7ea
...@@ -162,6 +162,18 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf, ...@@ -162,6 +162,18 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
return ret; return ret;
} }
static void dump_buf(unsigned char *buf, size_t len)
{
size_t i;
for (i = 0; i < len; i++) {
pr_debug("0x%02x ", buf[i]);
if (i % 16 == 15)
pr_debug("\n");
}
pr_debug("\n");
}
static int read_object_code(u64 addr, size_t len, u8 cpumode, static int read_object_code(u64 addr, size_t len, u8 cpumode,
struct thread *thread, struct state *state) struct thread *thread, struct state *state)
{ {
...@@ -264,6 +276,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, ...@@ -264,6 +276,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
/* The results should be identical */ /* The results should be identical */
if (memcmp(buf1, buf2, len)) { if (memcmp(buf1, buf2, len)) {
pr_debug("Bytes read differ from those read by objdump\n"); pr_debug("Bytes read differ from those read by objdump\n");
pr_debug("buf1 (dso):\n");
dump_buf(buf1, len);
pr_debug("buf2 (objdump):\n");
dump_buf(buf2, len);
return -1; return -1;
} }
pr_debug("Bytes read match those read by objdump\n"); pr_debug("Bytes read match those read by objdump\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment