Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217405 > unrolled thread

[PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match

Started byJan Stancek <jstancek@redhat.com>
First post2015-09-02 10:20 +0200
Last post2015-09-03 11:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match Jan Stancek <jstancek@redhat.com> - 2015-09-02 10:20 +0200
    Re: [PATCH v2 4/4] perf tests: print objdump/dso buffers if they  don't match Adrian Hunter <adrian.hunter@intel.com> - 2015-09-03 11:20 +0200

#1217405 — [PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match

FromJan Stancek <jstancek@redhat.com>
Date2015-09-02 10:20 +0200
Subject[PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match
Message-ID<q4bqW-7Rc-21@gated-at.bofh.it>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 tools/perf/tests/code-reading.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index e6bf47ff7e91..53a04f899d18 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -163,6 +163,18 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
 	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,
 			    struct thread *thread, struct state *state)
 {
@@ -265,6 +277,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
 	/* The results should be identical */
 	if (memcmp(buf1, buf2, len)) {
 		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;
 	}
 	pr_debug("Bytes read match those read by objdump\n");
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1218111 — Re: [PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match

FromAdrian Hunter <adrian.hunter@intel.com>
Date2015-09-03 11:20 +0200
SubjectRe: [PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match
Message-ID<q4yQx-7Gl-5@gated-at.bofh.it>
In reply to#1217405
On 02/09/15 11:19, Jan Stancek wrote:
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>


Acked-by: Adrian Hunter <adrian.hunter@intel.com>


> ---
>  tools/perf/tests/code-reading.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index e6bf47ff7e91..53a04f899d18 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -163,6 +163,18 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
>  	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,
>  			    struct thread *thread, struct state *state)
>  {
> @@ -265,6 +277,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
>  	/* The results should be identical */
>  	if (memcmp(buf1, buf2, len)) {
>  		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;
>  	}
>  	pr_debug("Bytes read match those read by objdump\n");
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web