From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: "Jörg Sommer" <joerg@alea.gnuu.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] perf tools: Concatenate strings in expressions
Date: Mon, 26 Mar 2012 15:15:24 -0300 [thread overview]
Message-ID: <20120326181524.GA5195@infradead.org> (raw)
In-Reply-To: <05a6b9ad17375452aedc994c4553137750db0a13.1332709498.git.joerg@alea.gnuu.de>
Em Sun, Mar 25, 2012 at 11:08:39PM +0200, Jörg Sommer escreveu:
> 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);
realloc can fail, please check its result and take appropriate action.
- Arnaldo
> + 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
prev parent reply other threads:[~2012-03-26 18:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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:32 ` Arnaldo Carvalho de Melo
2012-03-26 18:15 ` Arnaldo Carvalho de Melo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120326181524.GA5195@infradead.org \
--to=acme@ghostprotocols.net \
--cc=a.p.zijlstra@chello.nl \
--cc=joerg@alea.gnuu.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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