]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
perf tools: Handle print concatenations in event format file
authorSteven Rostedt <srostedt@redhat.com>
Wed, 14 Oct 2009 19:43:32 +0000 (15:43 -0400)
committerIngo Molnar <mingo@elte.hu>
Thu, 15 Oct 2009 08:42:34 +0000 (10:42 +0200)
kmem_alloc ftrace event format had a string that was broken up
by two tokens. "string 1" "string 2". This patch lets the parser
be able to handle the concatenation.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <20091014194357.253818714@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/util/trace-event-parse.c

index eef60df7a5bf4c4d3f44a3117bc9b62c62e89647..a05c7144aded93a1a7103a11e81eb790bbd14772 100644 (file)
@@ -1734,6 +1734,7 @@ static int event_read_print(struct event *event)
        if (read_expect_type(EVENT_DQUOTE, &token) < 0)
                goto fail;
 
+ concat:
        event->print_fmt.format = token;
        event->print_fmt.args = NULL;
 
@@ -1743,6 +1744,21 @@ static int event_read_print(struct event *event)
        if (type == EVENT_NONE)
                return 0;
 
+       /* Handle concatination of print lines */
+       if (type == EVENT_DQUOTE) {
+               char *cat;
+
+               cat = malloc_or_die(strlen(event->print_fmt.format) +
+                                   strlen(token) + 1);
+               strcpy(cat, event->print_fmt.format);
+               strcat(cat, token);
+               free_token(token);
+               free_token(event->print_fmt.format);
+               event->print_fmt.format = NULL;
+               token = cat;
+               goto concat;
+       }
+                            
        if (test_type_token(type, token, EVENT_DELIM, (char *)","))
                goto fail;