[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-ffa1895561645103d8f8059b35d9c06e6eeead2e@git.kernel.org>
Date: Thu, 15 Oct 2009 08:50:09 GMT
From: tip-bot for Steven Rostedt <srostedt@...hat.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, hpa@...or.com,
mingo@...hat.com, peterz@...radead.org, fweisbec@...il.com,
srostedt@...hat.com, tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/core] perf tools: Fix bprintk reading in trace output
Commit-ID: ffa1895561645103d8f8059b35d9c06e6eeead2e
Gitweb: http://git.kernel.org/tip/ffa1895561645103d8f8059b35d9c06e6eeead2e
Author: Steven Rostedt <srostedt@...hat.com>
AuthorDate: Wed, 14 Oct 2009 15:43:40 -0400
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 15 Oct 2009 10:42:38 +0200
perf tools: Fix bprintk reading in trace output
The bprintk parsing was broken in more ways than one.
The file parsing was incorrect, and the words used by the
arguments are always 4 bytes aligned, even on 64-bit machines.
Signed-off-by: Steven Rostedt <srostedt@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
LKML-Reference: <20091014194359.520931637@...dmis.org>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
tools/perf/util/trace-event-parse.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index eda0a24..93a82fe 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -284,18 +284,16 @@ void parse_ftrace_printk(char *file, unsigned int size __unused)
char *line;
char *next = NULL;
char *addr_str;
- int ret;
+ char *fmt;
int i;
line = strtok_r(file, "\n", &next);
while (line) {
item = malloc_or_die(sizeof(*item));
- ret = sscanf(line, "%as : %as",
- (float *)(void *)&addr_str, /* workaround gcc warning */
- (float *)(void *)&item->printk);
+ addr_str = strtok_r(line, ":", &fmt);
item->addr = strtoull(addr_str, NULL, 16);
- free(addr_str);
-
+ /* fmt still has a space, skip it */
+ item->printk = strdup(fmt+1);
item->next = list;
list = item;
line = strtok_r(NULL, "\n", &next);
@@ -2274,8 +2272,9 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
case 'u':
case 'x':
case 'i':
- bptr = (void *)(((unsigned long)bptr + (long_size - 1)) &
- ~(long_size - 1));
+ /* the pointers are always 4 bytes aligned */
+ bptr = (void *)(((unsigned long)bptr + 3) &
+ ~3);
switch (ls) {
case 0:
case 1:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists