Skip to content

Commit

Permalink
tools lib traceevent: Fix trace_printk for long integers
Browse files Browse the repository at this point in the history
On 32 bit systems, a conversion of the trace_printk format string
"%lu" -> "%llu" is intended (similar for %lx etc.) when a trace was
taken on a machine with 64 bit long integers. However, the current
code computes the bogus transformation "%lu" -> "%u".  Fix this.

Besides that, the transformation is only required on systems that don't
use 64 bits for long integers natively.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1332411501-8059-3-git-send-email-wolfgang.mauerer@siemens.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
  • Loading branch information
Wolfgang Mauerer authored and Namhyung Kim committed Jul 4, 2012
1 parent aaf05c7 commit c5b35b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3895,14 +3895,15 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
break;
}
}
if (pevent->long_size == 8 && ls) {
if (pevent->long_size == 8 && ls &&
sizeof(long) != 8) {
char *p;

ls = 2;
/* make %l into %ll */
p = strchr(format, 'l');
if (p)
memmove(p, p+1, strlen(p)+1);
memmove(p+1, p, strlen(p)+1);
else if (strcmp(format, "%p") == 0)
strcpy(format, "0x%llx");
}
Expand Down

0 comments on commit c5b35b7

Please sign in to comment.