diff options
author | Andy Isaacson <adi@hexapodia.org> | 2010-06-11 22:44:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-06-17 12:20:50 -0400 |
commit | 84c104ad429c8a474b93dd374815d1c238032fa8 (patch) | |
tree | 15727f86d7b135ea01fbc7008e62416f5767904f /tools/perf/util/debug.c | |
parent | 9ed7e1b85cd55dc46cb9410a23086bdaa2ff3eb9 (diff) |
perf debug: fix hex dump partial final line
The loop counter math in trace_event was much more complicated than
necessary, resulting in incorrectly decoding the human-readable
portion of the partial last line of hexdump in "perf trace -D" output:
. 0020: 00 00 00 00 00 00 00 00 2f 73 62 69 6e 2f 69 6e ......../sbin/i
. 0030: 69 74 00 00 00 00 00 00 /sbin/i
With this fixed (and simpler!) code, we get the correct output:
. 0020: 00 00 00 00 00 00 00 00 2f 73 62 69 6e 2f 69 6e ......../sbin/in
. 0030: 69 74 00 00 00 00 00 00 it......
Cc: Ingo Molnar <mingo@elte.hu>
LPU-Reference: <20100612024404.GA24469@hexapodia.org>
Signed-off-by: Andy Isaacson <adi@hexapodia.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/debug.c')
-rw-r--r-- | tools/perf/util/debug.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 6cddff2bc970..318dab15d177 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -86,12 +86,10 @@ void trace_event(event_t *event) | |||
86 | dump_printf_color(" ", color); | 86 | dump_printf_color(" ", color); |
87 | for (j = 0; j < 15-(i & 15); j++) | 87 | for (j = 0; j < 15-(i & 15); j++) |
88 | dump_printf_color(" ", color); | 88 | dump_printf_color(" ", color); |
89 | for (j = 0; j < (i & 15); j++) { | 89 | for (j = i & ~15; j <= i; j++) { |
90 | if (isprint(raw_event[i-15+j])) | 90 | dump_printf_color("%c", color, |
91 | dump_printf_color("%c", color, | 91 | isprint(raw_event[j]) ? |
92 | raw_event[i-15+j]); | 92 | raw_event[j] : '.'); |
93 | else | ||
94 | dump_printf_color(".", color); | ||
95 | } | 93 | } |
96 | dump_printf_color("\n", color); | 94 | dump_printf_color("\n", color); |
97 | } | 95 | } |