Skip to content

Commit

Permalink
ftrace: fix hex output mode of ftrace
Browse files Browse the repository at this point in the history
Fix the output of ftrace in hex mode as the hi/lo nibbles are output in
reverse order. Without this patch, the output of ftrace is:

raw mode : 6474 0 141531612444 0 140 + 6402 120 S
hex mode : 000091a 00000000 000000023f1f50c1 00000000 c8 000000b2 00009120 87 ffff00c8 00000035

There is an inversion on ouput hex(6474) is 194a

[based on a patch by Philippe Reynes <[email protected]>]
Signed-off-by: Harvey Harrison <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
hharrison authored and Ingo Molnar committed Oct 14, 2008
1 parent ddc7a01 commit 2fbc474
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,12 @@ trace_seq_putmem(struct trace_seq *s, void *mem, size_t len)
}

#define HEX_CHARS 17
static const char hex2asc[] = "0123456789abcdef";

static int
trace_seq_putmem_hex(struct trace_seq *s, void *mem, size_t len)
{
unsigned char hex[HEX_CHARS];
unsigned char *data = mem;
unsigned char byte;
int i, j;

BUG_ON(len >= HEX_CHARS);
Expand All @@ -353,10 +351,8 @@ trace_seq_putmem_hex(struct trace_seq *s, void *mem, size_t len)
#else
for (i = len-1, j = 0; i >= 0; i--) {
#endif
byte = data[i];

hex[j++] = hex2asc[byte & 0x0f];
hex[j++] = hex2asc[byte >> 4];
hex[j++] = hex_asc_hi(data[i]);
hex[j++] = hex_asc_lo(data[i]);
}
hex[j++] = ' ';

Expand Down

0 comments on commit 2fbc474

Please sign in to comment.