[PATCH v2 0/4] Support for llvm-addr2line

Ian Rogers posted 4 patches 2 years, 10 months ago
tools/lib/api/io.h        |  45 ++++++++++
tools/perf/tests/api-io.c |  36 ++++++++
tools/perf/util/srcline.c | 171 +++++++++++++++++++++++---------------
3 files changed, 184 insertions(+), 68 deletions(-)
[PATCH v2 0/4] Support for llvm-addr2line
Posted by Ian Rogers 2 years, 10 months ago
The addr2line command is started and then addresses piped to it. In
order to determine the end of a addr2lines output a ',' it output with
an expectation to get '??\n??:0\n' as a reply. llvm-addr2line differs
in that ',' generates a reply of ','.

The approach detects and then caches the addr2line style. When records
are read the sentinel is detected appropriately.

Comparing the output there is a little more inline data on my machine
with llvm-addr2line:
$ sudo perf record -a -g sleep 1
$ sudo perf report --addr2line=addr2line > a.txt
$ sudo perf report --addr2line=llvm-addr2line > b.txt
$ wc -l a.txt b.txt
  12386 a.txt
  12477 b.txt

Some other small changes, switching to the api/io code to avoid file
streams wrapping the command's stdin/stdout. Ignore SIGPIPE for when
addr2line exits and writes fail.

v2. Address review comments from Arnaldo and Namhyung, fixing a
    realloc error path, argument ordering and a comment.

Ian Rogers (4):
  tools api: Add io__getline
  perf srcline: Simplify addr2line subprocess
  perf srcline: Support for llvm-addr2line
  perf srcline: Avoid addr2line SIGPIPEs

 tools/lib/api/io.h        |  45 ++++++++++
 tools/perf/tests/api-io.c |  36 ++++++++
 tools/perf/util/srcline.c | 171 +++++++++++++++++++++++---------------
 3 files changed, 184 insertions(+), 68 deletions(-)

-- 
2.40.0.348.gf938b09366-goog
Re: [PATCH v2 0/4] Support for llvm-addr2line
Posted by Arnaldo Carvalho de Melo 2 years, 10 months ago
Em Mon, Apr 03, 2023 at 11:40:29AM -0700, Ian Rogers escreveu:
> The addr2line command is started and then addresses piped to it. In
> order to determine the end of a addr2lines output a ',' it output with
> an expectation to get '??\n??:0\n' as a reply. llvm-addr2line differs
> in that ',' generates a reply of ','.
> 
> The approach detects and then caches the addr2line style. When records
> are read the sentinel is detected appropriately.
> 
> Comparing the output there is a little more inline data on my machine
> with llvm-addr2line:
> $ sudo perf record -a -g sleep 1
> $ sudo perf report --addr2line=addr2line > a.txt
> $ sudo perf report --addr2line=llvm-addr2line > b.txt
> $ wc -l a.txt b.txt
>   12386 a.txt
>   12477 b.txt
> 
> Some other small changes, switching to the api/io code to avoid file
> streams wrapping the command's stdin/stdout. Ignore SIGPIPE for when
> addr2line exits and writes fail.
> 
> v2. Address review comments from Arnaldo and Namhyung, fixing a
>     realloc error path, argument ordering and a comment.

Added to local repo, build testing, will be in tmp.perf-tools-next soon.

- Arnaldo
 
> Ian Rogers (4):
>   tools api: Add io__getline
>   perf srcline: Simplify addr2line subprocess
>   perf srcline: Support for llvm-addr2line
>   perf srcline: Avoid addr2line SIGPIPEs
> 
>  tools/lib/api/io.h        |  45 ++++++++++
>  tools/perf/tests/api-io.c |  36 ++++++++
>  tools/perf/util/srcline.c | 171 +++++++++++++++++++++++---------------
>  3 files changed, 184 insertions(+), 68 deletions(-)
> 
> -- 
> 2.40.0.348.gf938b09366-goog
> 

-- 

- Arnaldo
Re: [PATCH v2 0/4] Support for llvm-addr2line
Posted by Namhyung Kim 2 years, 10 months ago
Hi,

On Mon, Apr 3, 2023 at 1:24 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> Em Mon, Apr 03, 2023 at 11:40:29AM -0700, Ian Rogers escreveu:
> > The addr2line command is started and then addresses piped to it. In
> > order to determine the end of a addr2lines output a ',' it output with
> > an expectation to get '??\n??:0\n' as a reply. llvm-addr2line differs
> > in that ',' generates a reply of ','.
> >
> > The approach detects and then caches the addr2line style. When records
> > are read the sentinel is detected appropriately.
> >
> > Comparing the output there is a little more inline data on my machine
> > with llvm-addr2line:
> > $ sudo perf record -a -g sleep 1
> > $ sudo perf report --addr2line=addr2line > a.txt
> > $ sudo perf report --addr2line=llvm-addr2line > b.txt
> > $ wc -l a.txt b.txt
> >   12386 a.txt
> >   12477 b.txt
> >
> > Some other small changes, switching to the api/io code to avoid file
> > streams wrapping the command's stdin/stdout. Ignore SIGPIPE for when
> > addr2line exits and writes fail.
> >
> > v2. Address review comments from Arnaldo and Namhyung, fixing a
> >     realloc error path, argument ordering and a comment.
>
> Added to local repo, build testing, will be in tmp.perf-tools-next soon.
>
> - Arnaldo
>
> > Ian Rogers (4):
> >   tools api: Add io__getline
> >   perf srcline: Simplify addr2line subprocess
> >   perf srcline: Support for llvm-addr2line
> >   perf srcline: Avoid addr2line SIGPIPEs

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> >
> >  tools/lib/api/io.h        |  45 ++++++++++
> >  tools/perf/tests/api-io.c |  36 ++++++++
> >  tools/perf/util/srcline.c | 171 +++++++++++++++++++++++---------------
> >  3 files changed, 184 insertions(+), 68 deletions(-)
> >
> > --
> > 2.40.0.348.gf938b09366-goog
> >
>
> --
>
> - Arnaldo
Re: [PATCH v2 0/4] Support for llvm-addr2line
Posted by Arnaldo Carvalho de Melo 2 years, 10 months ago
Em Mon, Apr 03, 2023 at 10:18:47PM -0700, Namhyung Kim escreveu:
> Hi,
> 
> On Mon, Apr 3, 2023 at 1:24 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >
> > Em Mon, Apr 03, 2023 at 11:40:29AM -0700, Ian Rogers escreveu:
> > > The addr2line command is started and then addresses piped to it. In
> > > order to determine the end of a addr2lines output a ',' it output with
> > > an expectation to get '??\n??:0\n' as a reply. llvm-addr2line differs
> > > in that ',' generates a reply of ','.
> > >
> > > The approach detects and then caches the addr2line style. When records
> > > are read the sentinel is detected appropriately.
> > >
> > > Comparing the output there is a little more inline data on my machine
> > > with llvm-addr2line:
> > > $ sudo perf record -a -g sleep 1
> > > $ sudo perf report --addr2line=addr2line > a.txt
> > > $ sudo perf report --addr2line=llvm-addr2line > b.txt
> > > $ wc -l a.txt b.txt
> > >   12386 a.txt
> > >   12477 b.txt
> > >
> > > Some other small changes, switching to the api/io code to avoid file
> > > streams wrapping the command's stdin/stdout. Ignore SIGPIPE for when
> > > addr2line exits and writes fail.
> > >
> > > v2. Address review comments from Arnaldo and Namhyung, fixing a
> > >     realloc error path, argument ordering and a comment.
> >
> > Added to local repo, build testing, will be in tmp.perf-tools-next soon.
> >
> > - Arnaldo
> >
> > > Ian Rogers (4):
> > >   tools api: Add io__getline
> > >   perf srcline: Simplify addr2line subprocess
> > >   perf srcline: Support for llvm-addr2line
> > >   perf srcline: Avoid addr2line SIGPIPEs
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks, added to those patches.

- Arnaldo