Re: [PATCH] perf/script: remove extraneous newline in perf_sample__fprintf_regs()

From: Stephane Eranian
Date: Wed Apr 29 2020 - 15:32:52 EST


On Mon, Apr 27, 2020 at 7:47 PM Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:
>
> On Sat, Apr 18, 2020 at 04:19:08PM -0700, Stephane Eranian wrote:
> > When printing iregs, there was a double newline printed because
> > perf_sample__fprintf_regs() was printing its own and then at the
> > end of all fields, perf script was adding one.
> > This was causing blank line in the output:
>
> I don't think the patch is quite correct because there could be
> other fields after it, and they need to be separated by a
> new line too.
>
> e.g. i suspect if someone prints iregs,uregs or iregs,brstack
> or something else that is printed in process_event after *regs
> you would get garbled output.
>
I was under the impression that perf script was generating one line
per sample. Otherwise, seems hard to parse.
Could you give me the cmdline options of perf script that justify the newline.
Thanks.

> So you have to track if the newline is needed or not.
>
> -Andi