Skip to contentSkip to conversation

perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()

PATCH In review Namhyung Kim 3 participants 3 messages Apr 7, 2014 – Apr 14, 2014 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()

The dwarf_getcfi() only checks .debug_frame section for CFI, but as most binaries only have .eh_frame it'd return NULL and it makes some variables inaccessible.

Using dwarf_getcfi_elf (along with dwarf_getelf()) allows to show and add probe to more variables.

Cc Masami Hiramatsu <[email protected]>
---
 tools/perf/util/probe-finder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-finder.c +1 -1
index 3bf0c8cdccb7..d58da0672736 100644
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
 
 #if _ELFUTILS_PREREQ(0, 142)
 	/* Get the call frame information from this dwarf */
-	pf->cfi = dwarf_getcfi(dbg->dbg);
+	pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg));
 #endif
 
 	off = 0;
Signature · 1 line
1.7.11.7
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Namhyung Kim

The dwarf_getcfi() only checks .debug_frame section for CFI, but as most binaries only have .eh_frame it'd return NULL and it makes some variables inaccessible.

Using dwarf_getcfi_elf (along with dwarf_getelf()) allows to show and add probe to more variables.

Cc Masami Hiramatsu <[email protected]>

Thank you for fixing :)

Quoted 18 lines
---
 tools/perf/util/probe-finder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-finder.c +1 -1
index 3bf0c8cdccb7..d58da0672736 100644
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
 
 #if _ELFUTILS_PREREQ(0, 142)
 	/* Get the call frame information from this dwarf */
-	pf->cfi = dwarf_getcfi(dbg->dbg);
+	pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg));
 #endif
 
 	off = 0;
Signature · 4 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]
#2 lore raw
In reply to Namhyung Kim
perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()
Commit-ID:  03d89412981a7681971bc77edba1669595763030
Gitweb:     http://git.kernel.org/tip/03d89412981a7681971bc77edba1669595763030
Author:     Namhyung Kim <[email protected]>
AuthorDate: Mon, 7 Apr 2014 16:05:48 +0900
Committer:  Jiri Olsa <[email protected]>
CommitDate: Mon, 14 Apr 2014 12:55:40 +0200

perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()

The dwarf_getcfi() only checks .debug_frame section for CFI, but as most binaries only have .eh_frame it'd return NULL and it makes some variables inaccessible.

Using dwarf_getcfi_elf (along with dwarf_getelf()) allows to show and add probe to more variables.

---
 tools/perf/util/probe-finder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-finder.c +1 -1
index fae274e..5627621 100644
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
 
 #if _ELFUTILS_PREREQ(0, 142)
 	/* Get the call frame information from this dwarf */
-	pf->cfi = dwarf_getcfi(dbg->dbg);
+	pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg));
 #endif
 
 	off = 0;