2014-01-22 19:58:58

by Avi Kivity

[permalink] [raw]
Subject: [PATCH] perf tools: demangle kernel and kernel module symbols too

Some kernels contain C++ code, and thus their symbols need to be demangled.
This allows 'perf kvm top' to generate readable output.

Signed-off-by: Avi Kivity <[email protected]>
---
tools/perf/util/symbol-elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 7594567..8f12f0f 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -922,6 +922,7 @@ int dso__load_sym(struct dso *dso, struct map *map,
(u64)shdr.sh_offset);
sym.st_value -= shdr.sh_addr - shdr.sh_offset;
}
+new_symbol:
/*
* We need to figure out if the object was created from C++ sources
* DWARF DW_compile_unit has this, but we don't always have access
@@ -933,7 +934,6 @@ int dso__load_sym(struct dso *dso, struct map *map,
if (demangled != NULL)
elf_name = demangled;
}
-new_symbol:
f = symbol__new(sym.st_value, sym.st_size,
GELF_ST_BIND(sym.st_info), elf_name);
free(demangled);
--
1.8.4.2


2014-01-27 14:14:30

by Avi Kivity

[permalink] [raw]
Subject: Re: [PATCH] perf tools: demangle kernel and kernel module symbols too

On 01/22/2014 09:58 PM, Avi Kivity wrote:
> Some kernels contain C++ code, and thus their symbols need to be demangled.
> This allows 'perf kvm top' to generate readable output.

Ping?

> Signed-off-by: Avi Kivity <[email protected]>
> ---
> tools/perf/util/symbol-elf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index 7594567..8f12f0f 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -922,6 +922,7 @@ int dso__load_sym(struct dso *dso, struct map *map,
> (u64)shdr.sh_offset);
> sym.st_value -= shdr.sh_addr - shdr.sh_offset;
> }
> +new_symbol:
> /*
> * We need to figure out if the object was created from C++ sources
> * DWARF DW_compile_unit has this, but we don't always have access
> @@ -933,7 +934,6 @@ int dso__load_sym(struct dso *dso, struct map *map,
> if (demangled != NULL)
> elf_name = demangled;
> }
> -new_symbol:
> f = symbol__new(sym.st_value, sym.st_size,
> GELF_ST_BIND(sym.st_info), elf_name);
> free(demangled);

2014-01-27 14:48:19

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf tools: demangle kernel and kernel module symbols too

Em Mon, Jan 27, 2014 at 04:14:24PM +0200, Avi Kivity escreveu:
> On 01/22/2014 09:58 PM, Avi Kivity wrote:
> >Some kernels contain C++ code, and thus their symbols need to be demangled.
> >This allows 'perf kvm top' to generate readable output.
>
> Ping?

Applied, should be on my next pull req to Ingo,

- Arnaldo

> >Signed-off-by: Avi Kivity <[email protected]>
> >---
> > tools/perf/util/symbol-elf.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> >index 7594567..8f12f0f 100644
> >--- a/tools/perf/util/symbol-elf.c
> >+++ b/tools/perf/util/symbol-elf.c
> >@@ -922,6 +922,7 @@ int dso__load_sym(struct dso *dso, struct map *map,
> > (u64)shdr.sh_offset);
> > sym.st_value -= shdr.sh_addr - shdr.sh_offset;
> > }
> >+new_symbol:
> > /*
> > * We need to figure out if the object was created from C++ sources
> > * DWARF DW_compile_unit has this, but we don't always have access
> >@@ -933,7 +934,6 @@ int dso__load_sym(struct dso *dso, struct map *map,
> > if (demangled != NULL)
> > elf_name = demangled;
> > }
> >-new_symbol:
> > f = symbol__new(sym.st_value, sym.st_size,
> > GELF_ST_BIND(sym.st_info), elf_name);
> > free(demangled);

Subject: [tip:perf/urgent] perf tools: Demangle kernel and kernel module symbols too

Commit-ID: 950b8354716eb1f9c0b39777d379efa5f4125c04
Gitweb: http://git.kernel.org/tip/950b8354716eb1f9c0b39777d379efa5f4125c04
Author: Avi Kivity <[email protected]>
AuthorDate: Wed, 22 Jan 2014 21:58:46 +0200
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 27 Jan 2014 11:47:27 -0300

perf tools: Demangle kernel and kernel module symbols too

Some kernels contain C++ code, and thus their symbols need to be
demangled. This allows 'perf kvm top' to generate readable output.

Signed-off-by: Avi Kivity <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/26f71bf5bf7ee1408e3f1a803556d5df18223ef1.1390420726.git.avi@cloudius-systems.com
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/symbol-elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 7594567..8f12f0f 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -922,6 +922,7 @@ int dso__load_sym(struct dso *dso, struct map *map,
(u64)shdr.sh_offset);
sym.st_value -= shdr.sh_addr - shdr.sh_offset;
}
+new_symbol:
/*
* We need to figure out if the object was created from C++ sources
* DWARF DW_compile_unit has this, but we don't always have access
@@ -933,7 +934,6 @@ int dso__load_sym(struct dso *dso, struct map *map,
if (demangled != NULL)
elf_name = demangled;
}
-new_symbol:
f = symbol__new(sym.st_value, sym.st_size,
GELF_ST_BIND(sym.st_info), elf_name);
free(demangled);