lkml.org 
[lkml]   [2012]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] perf tools: Concatenate strings in expressions
Date
The tracepoint event kvm_userspace_exit uses string snippet the C
compiler concatenates to a big string, e.g. "KVM_EXIT_" "UNKNOWN". The
parser of the data must do the same and join successive strings.

print fmt: "reason %s (%d)", … __print_symbolic(REC->reason, { 0, "KVM_EXIT_" "UNKNOWN" }, { 1, "KVM_EXIT_" "EXCEPTION" } …
Signed-off-by: Jörg Sommer <joerg@alea.gnuu.de>
---
tools/perf/util/trace-event-parse.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 1a8d4dc..185e284 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1726,6 +1726,21 @@ process_arg_token(struct event *event, struct print_arg *arg,
}
break;
case EVENT_DQUOTE:
+ atom = token;
+ type = read_token_item(&token);
+
+ /* merge with following strings */
+ while (type == EVENT_DQUOTE) {
+ atom = realloc(atom, strlen(atom) + strlen(token) + 1);
+ strcat(atom, token);
+ free_token(token);
+ type = read_token_item(&token);
+ }
+
+ arg->type = PRINT_ATOM;
+ arg->atom.atom = atom;
+
+ break;
case EVENT_SQUOTE:
arg->type = PRINT_ATOM;
arg->atom.atom = token;
--
1.7.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-03-25 23:15    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site