aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-event.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-03-17 07:13:28 -0400
committerIngo Molnar <mingo@elte.hu>2010-03-17 07:13:28 -0400
commit3b0d516463f8deb897a55cb81e9dbbe58a2490ed (patch)
treebc62418aa7da53595d76413466aab3bc1fcb2d32 /tools/perf/util/probe-event.c
parent7df2f32956cf0f1a45df38cd0e0fe0c3467580e8 (diff)
perf probe: Fix !dwarf build
Fix the !drawf build. This uses the existing NO_DWARF_SUPPORT mechanism we use for that, but it's really fragile and needs a cleanup. (in a separate patch) 1) Such uses: #ifndef NO_DWARF_SUPPORT are double inverted logic a'la 'not not'. Instead the flag should be called DWARF_SUPPORT. 2) Furthermore, assymetric #ifdef polluted code flow like: if (need_dwarf) #ifdef NO_DWARF_SUPPORT die("Debuginfo-analysis is not supported"); #else /* !NO_DWARF_SUPPORT */ pr_debug("Some probes require debuginfo.\n"); fd = open_vmlinux(); is very fragile and not acceptable. Instead of that helper functions should be created and the dwarf/no-dwarf logic should be separated more cleanly. 3) Local variable #ifdefs like this: #ifndef NO_DWARF_SUPPORT int fd; #endif Are fragile as well and should be eliminated. Helper functions achieve that too. Cc: Masami Hiramatsu <mhiramat@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <20100316220612.32050.33806.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r--tools/perf/util/probe-event.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 64dea6c3d58a..f33326980583 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1012,8 +1012,10 @@ end_dwarf:
1012 if (!sym) 1012 if (!sym)
1013 die("Kernel symbol \'%s\' not found - probe not added.", 1013 die("Kernel symbol \'%s\' not found - probe not added.",
1014 tev->point.symbol); 1014 tev->point.symbol);
1015#ifndef NO_DWARF_SUPPORT
1015found: 1016found:
1016 close(fd); 1017 close(fd);
1018#endif
1017 return ntevs; 1019 return ntevs;
1018} 1020}
1019 1021
@@ -1172,10 +1174,13 @@ void show_line_range(struct line_range *lr)
1172 unsigned int l = 1; 1174 unsigned int l = 1;
1173 struct line_node *ln; 1175 struct line_node *ln;
1174 FILE *fp; 1176 FILE *fp;
1177#ifndef NO_DWARF_SUPPORT
1175 int fd, ret; 1178 int fd, ret;
1179#endif
1176 1180
1177 /* Search a line range */ 1181 /* Search a line range */
1178 init_vmlinux(); 1182 init_vmlinux();
1183#ifndef NO_DWARF_SUPPORT
1179 fd = open_vmlinux(); 1184 fd = open_vmlinux();
1180 if (fd < 0) 1185 if (fd < 0)
1181 die("Could not open debuginfo file."); 1186 die("Could not open debuginfo file.");
@@ -1183,6 +1188,7 @@ void show_line_range(struct line_range *lr)
1183 if (ret <= 0) 1188 if (ret <= 0)
1184 die("Source line is not found.\n"); 1189 die("Source line is not found.\n");
1185 close(fd); 1190 close(fd);
1191#endif
1186 1192
1187 setup_pager(); 1193 setup_pager();
1188 1194