Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf probe: Convert to check dwarf_getcfi feature

Now it has a feature check for the dwarf_getcfi(), use it and convert
the code to check HAVE_DWARF_CFI_SUPPORT definition.

Suggested-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: linux-toolchains@vger.kernel.org
Cc: linux-trace-devel@vger.kernel.org
Link: https://lore.kernel.org/r/20231110000012.3538610-10-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
c06547d0 f67f2fda

+9 -4
+5
tools/perf/Makefile.config
··· 476 476 else 477 477 CFLAGS += -DHAVE_DWARF_GETLOCATIONS_SUPPORT 478 478 endif # dwarf_getlocations 479 + ifneq ($(feature-dwarf_getcfi), 1) 480 + msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.142); 481 + else 482 + CFLAGS += -DHAVE_DWARF_CFI_SUPPORT 483 + endif # dwarf_getcfi 479 484 endif # Dwarf support 480 485 endif # libelf support 481 486 endif # NO_LIBELF
+4 -4
tools/perf/util/probe-finder.c
··· 604 604 ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1); 605 605 if (ret <= 0 || nops == 0) { 606 606 pf->fb_ops = NULL; 607 - #if _ELFUTILS_PREREQ(0, 142) 607 + #ifdef HAVE_DWARF_CFI_SUPPORT 608 608 } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && 609 609 (pf->cfi_eh != NULL || pf->cfi_dbg != NULL)) { 610 610 if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 && ··· 615 615 free(frame); 616 616 return -ENOENT; 617 617 } 618 - #endif 618 + #endif /* HAVE_DWARF_CFI_SUPPORT */ 619 619 } 620 620 621 621 /* Call finder's callback handler */ ··· 1140 1140 1141 1141 pf->machine = ehdr.e_machine; 1142 1142 1143 - #if _ELFUTILS_PREREQ(0, 142) 1143 + #ifdef HAVE_DWARF_CFI_SUPPORT 1144 1144 do { 1145 1145 GElf_Shdr shdr; 1146 1146 ··· 1150 1150 1151 1151 pf->cfi_dbg = dwarf_getcfi(dbg->dbg); 1152 1152 } while (0); 1153 - #endif 1153 + #endif /* HAVE_DWARF_CFI_SUPPORT */ 1154 1154 1155 1155 ret = debuginfo__find_probe_location(dbg, pf); 1156 1156 return ret;