aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/trace-event-parse.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-10-14 15:43:32 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-15 04:42:34 -0400
commit924a79af2cdee26a034b9bdce8c9c76995b5c901 (patch)
treefece1194adfdd10b5e888ce469aaf511fc41268d /tools/perf/util/trace-event-parse.c
parentb226f744d40b052ac126c4cb16c76f66e5185128 (diff)
perf tools: Handle print concatenations in event format file
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>
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
-rw-r--r--tools/perf/util/trace-event-parse.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index eef60df7a5bf..a05c7144aded 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1734,6 +1734,7 @@ static int event_read_print(struct event *event)
1734 if (read_expect_type(EVENT_DQUOTE, &token) < 0) 1734 if (read_expect_type(EVENT_DQUOTE, &token) < 0)
1735 goto fail; 1735 goto fail;
1736 1736
1737 concat:
1737 event->print_fmt.format = token; 1738 event->print_fmt.format = token;
1738 event->print_fmt.args = NULL; 1739 event->print_fmt.args = NULL;
1739 1740
@@ -1743,6 +1744,21 @@ static int event_read_print(struct event *event)
1743 if (type == EVENT_NONE) 1744 if (type == EVENT_NONE)
1744 return 0; 1745 return 0;
1745 1746
1747 /* Handle concatination of print lines */
1748 if (type == EVENT_DQUOTE) {
1749 char *cat;
1750
1751 cat = malloc_or_die(strlen(event->print_fmt.format) +
1752 strlen(token) + 1);
1753 strcpy(cat, event->print_fmt.format);
1754 strcat(cat, token);
1755 free_token(token);
1756 free_token(event->print_fmt.format);
1757 event->print_fmt.format = NULL;
1758 token = cat;
1759 goto concat;
1760 }
1761
1746 if (test_type_token(type, token, EVENT_DELIM, (char *)",")) 1762 if (test_type_token(type, token, EVENT_DELIM, (char *)","))
1747 goto fail; 1763 goto fail;
1748 1764