From: tip-bot for Ingo Molnar <mingo@elte.hu>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, acme@redhat.com,
hpa@zytor.com, mingo@redhat.com, a.p.zijlstra@chello.nl,
efault@gmx.de, fweisbec@gmail.com, tglx@linutronix.de,
mhiramat@redhat.com, mingo@elte.hu
Subject: [tip:perf/core] perf probe: Fix !dwarf build
Date: Wed, 17 Mar 2010 11:30:29 GMT [thread overview]
Message-ID: <tip-3b0d516463f8deb897a55cb81e9dbbe58a2490ed@git.kernel.org> (raw)
In-Reply-To: <20100316220612.32050.33806.stgit@localhost6.localdomain6>
Commit-ID: 3b0d516463f8deb897a55cb81e9dbbe58a2490ed
Gitweb: http://git.kernel.org/tip/3b0d516463f8deb897a55cb81e9dbbe58a2490ed
Author: Ingo Molnar <mingo@elte.hu>
AuthorDate: Wed, 17 Mar 2010 12:13:28 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 17 Mar 2010 12:13:28 +0100
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>
---
tools/perf/util/probe-event.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 64dea6c..f333269 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1012,8 +1012,10 @@ end_dwarf:
if (!sym)
die("Kernel symbol \'%s\' not found - probe not added.",
tev->point.symbol);
+#ifndef NO_DWARF_SUPPORT
found:
close(fd);
+#endif
return ntevs;
}
@@ -1172,10 +1174,13 @@ void show_line_range(struct line_range *lr)
unsigned int l = 1;
struct line_node *ln;
FILE *fp;
+#ifndef NO_DWARF_SUPPORT
int fd, ret;
+#endif
/* Search a line range */
init_vmlinux();
+#ifndef NO_DWARF_SUPPORT
fd = open_vmlinux();
if (fd < 0)
die("Could not open debuginfo file.");
@@ -1183,6 +1188,7 @@ void show_line_range(struct line_range *lr)
if (ret <= 0)
die("Source line is not found.\n");
close(fd);
+#endif
setup_pager();
next prev parent reply other threads:[~2010-03-17 11:31 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 22:05 [PATCH -tip 00/10] perf-probe updates - data-structure support, etc Masami Hiramatsu
2010-03-16 22:05 ` [PATCH -tip 01/10] perf tools: Introduce xzalloc() for detecting out of memory Masami Hiramatsu
2010-03-17 11:27 ` [tip:perf/core] perf tools: Introduce xzalloc() for detecting out of memory conditions tip-bot for Masami Hiramatsu
2010-03-16 22:05 ` [PATCH -tip 02/10] perf probe: Use wrapper functions Masami Hiramatsu
2010-03-17 11:27 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-03-16 22:05 ` [PATCH -tip 03/10] perf probe: Move add-probe routine under util/ Masami Hiramatsu
2010-03-17 11:28 ` [tip:perf/core] perf probe: Move add-probe routine to util/ tip-bot for Masami Hiramatsu
2010-03-16 22:05 ` [PATCH -tip 04/10] perf probe: Rename session to param Masami Hiramatsu
2010-03-17 11:28 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-03-16 22:05 ` [PATCH -tip 05/10] perf probe: Rename some die_get_* functions Masami Hiramatsu
2010-03-17 11:28 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-03-16 22:05 ` [PATCH -tip 06/10] perf probe: Introduce die_find_child() function Masami Hiramatsu
2010-03-17 11:29 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-03-16 22:06 ` [PATCH -tip 07/10] perf probe: Add --dry-run option Masami Hiramatsu
2010-03-17 11:29 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-03-16 22:06 ` [PATCH -tip 08/10] perf probe: Introduce kprobe_trace_event and perf_probe_event Masami Hiramatsu
2010-03-17 11:29 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-03-17 11:30 ` tip-bot for Ingo Molnar [this message]
2010-03-17 14:14 ` [tip:perf/core] perf probe: Fix !dwarf build Masami Hiramatsu
2010-03-18 17:38 ` [tip:perf/core] perf events: Fix false positive build warning with older GCC's tip-bot for Ingo Molnar
2010-03-18 20:03 ` Masami Hiramatsu
2010-03-16 22:06 ` [PATCH -tip 09/10] perf probe: List probes with line number and file name Masami Hiramatsu
2010-03-17 11:29 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-03-16 22:06 ` [PATCH -tip 10/10] perf probe: Accessing members in data structures Masami Hiramatsu
2010-03-17 10:25 ` Mark Wielaard
2010-03-17 19:14 ` Masami Hiramatsu
2010-03-18 3:28 ` Frederic Weisbecker
2010-03-20 4:20 ` Masami Hiramatsu
2010-03-23 15:55 ` Peter Zijlstra
2010-03-23 16:27 ` Arnaldo Carvalho de Melo
2010-03-17 11:30 ` [tip:perf/core] perf probe: Add data structure member access support tip-bot for Masami Hiramatsu
2010-03-17 10:34 ` [PATCH -tip 00/10] perf-probe updates - data-structure support, etc Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-3b0d516463f8deb897a55cb81e9dbbe58a2490ed@git.kernel.org \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=efault@gmx.de \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox