aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-05-10 13:12:07 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-17 21:13:51 -0400
commit7752f1b096e13991f20b59fd11ba73da3809d93c (patch)
tree9a30ef1d2a8f665bc0d1d00d2011e5036b21ef73 /tools
parent94f3ca95787ada3d64339a4ecb2754236ab563f6 (diff)
perf probe: Don't compile CFI related code if elfutils is old
Check elfutils version, and if it is old don't compile CFI analysis code. This allows to compile perf with old elfutils. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Tested-by: Stephane Eranian <eranian@google.com> Reported-by: Robert Richter <robert.richter@amd.com> Cc: Ingo Molnar <mingo@elte.hu> LKML-Reference: <20100510171207.26029.97604.stgit@localhost6.localdomain6> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/probe-finder.c4
-rw-r--r--tools/perf/util/probe-finder.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 562b1443e785..93583eb19cd6 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -668,6 +668,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
668 ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1); 668 ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
669 if (ret <= 0 || nops == 0) { 669 if (ret <= 0 || nops == 0) {
670 pf->fb_ops = NULL; 670 pf->fb_ops = NULL;
671#if _ELFUTILS_PREREQ(0, 142)
671 } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && 672 } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
672 pf->cfi != NULL) { 673 pf->cfi != NULL) {
673 Dwarf_Frame *frame; 674 Dwarf_Frame *frame;
@@ -677,6 +678,7 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
677 (uintmax_t)pf->addr); 678 (uintmax_t)pf->addr);
678 return -ENOENT; 679 return -ENOENT;
679 } 680 }
681#endif
680 } 682 }
681 683
682 /* Find each argument */ 684 /* Find each argument */
@@ -956,8 +958,10 @@ int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
956 return -EBADF; 958 return -EBADF;
957 } 959 }
958 960
961#if _ELFUTILS_PREREQ(0, 142)
959 /* Get the call frame information from this dwarf */ 962 /* Get the call frame information from this dwarf */
960 pf.cfi = dwarf_getcfi(dbg); 963 pf.cfi = dwarf_getcfi(dbg);
964#endif
961 965
962 off = 0; 966 off = 0;
963 line_list__init(&pf.lcache); 967 line_list__init(&pf.lcache);
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 66f1980e3855..e1f61dcd18ff 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -29,6 +29,7 @@ extern int find_line_range(int fd, struct line_range *lr);
29 29
30#include <dwarf.h> 30#include <dwarf.h>
31#include <libdw.h> 31#include <libdw.h>
32#include <version.h>
32 33
33struct probe_finder { 34struct probe_finder {
34 struct perf_probe_event *pev; /* Target probe event */ 35 struct perf_probe_event *pev; /* Target probe event */
@@ -44,7 +45,9 @@ struct probe_finder {
44 struct list_head lcache; /* Line cache for lazy match */ 45 struct list_head lcache; /* Line cache for lazy match */
45 46
46 /* For variable searching */ 47 /* For variable searching */
48#if _ELFUTILS_PREREQ(0, 142)
47 Dwarf_CFI *cfi; /* Call Frame Information */ 49 Dwarf_CFI *cfi; /* Call Frame Information */
50#endif
48 Dwarf_Op *fb_ops; /* Frame base attribute */ 51 Dwarf_Op *fb_ops; /* Frame base attribute */
49 struct perf_probe_arg *pvar; /* Current target variable */ 52 struct perf_probe_arg *pvar; /* Current target variable */
50 struct kprobe_trace_arg *tvar; /* Current result variable */ 53 struct kprobe_trace_arg *tvar; /* Current result variable */