mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] perf tools: Concatenate strings in expressions
@ 2012-03-25 21:08 Jörg Sommer
  2012-03-25 21:11 ` [PATCH 2/2] perf tools: Fix parsing of unary operator in ?: expression Jörg Sommer
  2012-03-26 18:15 ` [PATCH 1/2] perf tools: Concatenate strings in expressions Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 4+ messages in thread
From: Jörg Sommer @ 2012-03-25 21:08 UTC (permalink / raw)
  To: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, linux-kernel
  Cc: Jörg Sommer

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-26 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-25 21:08 [PATCH 1/2] perf tools: Concatenate strings in expressions Jörg Sommer
2012-03-25 21:11 ` [PATCH 2/2] perf tools: Fix parsing of unary operator in ?: expression Jörg Sommer
2012-03-26 18:32   ` Arnaldo Carvalho de Melo
2012-03-26 18:15 ` [PATCH 1/2] perf tools: Concatenate strings in expressions Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome