[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190118094919.GA28346@krava>
Date: Fri, 18 Jan 2019 10:49:19 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH] perf, script: Fix crash with printing mixed trace point
and other events
On Thu, Jan 17, 2019 at 11:48:34AM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> perf script crashes currently when printing mixed trace points and other
> events because the trace format does not handle events without trace
> meta data. Add a simple check to avoid that.
>
> % cat > test.c
> main()
> {
> printf("Hello world\n");
> }
> ^D
> % gcc -g -o test test.c
> % sudo perf probe -x test 'test.c:3'
> % perf record -e '{cpu/cpu-cycles,period=10000/,probe_test:main}:S' ./test
> % perf script
> <segfault>
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
Acked-by: Jiri Olsa <jolsa@...nel.org>
thanks,
jirka
> ---
> tools/perf/builtin-script.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 3728b50e52e2..ea2396b33a57 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -1779,7 +1779,7 @@ static void process_event(struct perf_script *script,
> return;
> }
>
> - if (PRINT_FIELD(TRACE)) {
> + if (PRINT_FIELD(TRACE) && sample->raw_data) {
> event_format__fprintf(evsel->tp_format, sample->cpu,
> sample->raw_data, sample->raw_size, fp);
> }
> --
> 2.17.2
>
Powered by blists - more mailing lists