lkml.org 
[lkml]   [2009]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 09/13] [PATCH 09/13] perf tools: fix bprintk reading in trace output
From: Steven Rostedt <srostedt@redhat.com>

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 64bit machines.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
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 f970d75..5f64644 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:
--
1.6.3.3



\
 
 \ /
  Last update: 2009-10-14 21:55    [W:0.097 / U:0.040 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site