even after installing libdwarf-dev on my debian box here, make in tools/perf/
still complains that it cannot find libdwarf:
Makefile:491: No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231
The problem is that the include path on debian is not
/usr/include/libdwarf/ but simply /usr/include because the debian
package libdwarf-dev puts the headers straight into /usr/include.
Now, fixing this in the build system could get ugly and too much (see
below), IMHO, so how about adding a README file in <tools/perf/>
which explains that on Debian-like systems, one should mkdir
/usr/include/libdwarf/ and symlink libdwarf.h and dwarf.h into it?
There could be a better solution though...?
---
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 4069996..5b48ce2 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -161,6 +161,7 @@ uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
+uname_D := $(shell sh -c "lsb_release -a 2>/dev/null | awk '/ID/ { print \$$3 }'")
# CFLAGS and LDFLAGS are for the users to override from the command line.
@@ -475,6 +476,14 @@ ifeq ($(uname_S),Darwin)
PTHREAD_LIBS =
endif
+ifeq ($(uname_D),Debian)
+ LIBDWARF_PREFIX =
+ BASIC_CFLAGS += -DDEBIAN
+else
+ LIBDWARF_PREFIX = libdwarf/
+endif
+
+
ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
@@ -487,7 +496,7 @@ else
msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
endif
-ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#include <$(LIBDWARF_PREFIX)dwarf.h>'; echo '\#include <$(LIBDWARF_PREFIX)libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
BASIC_CFLAGS += -DNO_LIBDWARF
else
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index bdebca6..3be22f1 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -32,8 +32,13 @@ struct probe_point {
#ifndef NO_LIBDWARF
extern int find_probepoint(int fd, struct probe_point *pp);
+#ifndef DEBIAN
#include <libdwarf/dwarf.h>
#include <libdwarf/libdwarf.h>
+#else
+#include <dwarf.h>
+#include <libdwarf.h>
+#endif
struct probe_finder {
struct probe_point *pp; /* Target probe point */
--
Regards/Gruss,
Boris.
Operating | Advanced Micro Devices GmbH
System | Karl-Hammerschmidt-Str. 34, 85609 Dornach b. M�nchen, Germany
Research | Gesch�ftsf�hrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Center | Sitz: Dornach, Gemeinde Aschheim, Landkreis M�nchen
(OSRC) | Registergericht M�nchen, HRB Nr. 43632
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Borislav Petkov wrote:
> Hi,
>
> even after installing libdwarf-dev on my debian box here, make in tools/perf/
> still complains that it cannot find libdwarf:
>
> Makefile:491: No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231
>
> The problem is that the include path on debian is not
> /usr/include/libdwarf/ but simply /usr/include because the debian
> package libdwarf-dev puts the headers straight into /usr/include.
Thank you for reporting that :-)
>
> Now, fixing this in the build system could get ugly and too much (see
> below), IMHO, so how about adding a README file in <tools/perf/>
> which explains that on Debian-like systems, one should mkdir
> /usr/include/libdwarf/ and symlink libdwarf.h and dwarf.h into it?
>
> There could be a better solution though...?
Yeah, I'd like to update Makefile rather than updating document...
>
> ---
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 4069996..5b48ce2 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
> @@ -161,6 +161,7 @@ uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
> uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
> uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
> uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
> +uname_D := $(shell sh -c "lsb_release -a 2>/dev/null | awk '/ID/ { print \$$3 }'")
>
> # CFLAGS and LDFLAGS are for the users to override from the command line.
>
> @@ -475,6 +476,14 @@ ifeq ($(uname_S),Darwin)
> PTHREAD_LIBS =
> endif
>
> +ifeq ($(uname_D),Debian)
> + LIBDWARF_PREFIX =
> + BASIC_CFLAGS += -DDEBIAN
> +else
> + LIBDWARF_PREFIX = libdwarf/
> +endif
Hmm, I think such Distro-checking code is ugly and very specific.
Instead of that, it would be better to use -I option to search
libdwarf.
e.g.
ifeq ($(shell sh -c "(test -d /usr/include/libdwarf/ && echo y)", y)
BASIC_CFLAGS += -I /usr/include/libdwarf
endif
And including just libdwarf.h and dwarf.h.
Thank you again,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhir...@redhat.com
Yeah, like file a bug with RH for placing them in such an utterly stupid
location.
Also, I'd not bother with testing debian, just do
#include <dwarf.h>
and simply add -I/usr/include/libdwarf to CPPFLAGS or something like
that.
Then again, its not like debian would ever ship something recent enough
to actually build perf with, even my karmic machine comes with
libdwarf-20080409 which to me reads like ancient and not befitting a
distro released a month or so ago.
> Then again, its not like debian would ever ship something recent enough
> to actually build perf with, even my karmic machine comes with
> libdwarf-20080409 which to me reads like ancient and not befitting a
> distro released a month or so ago.
"karmic" sounds Ubuntu, not Debian. In Debian:
$ apt-cache policy libdwarf-dev
libdwarf-dev:
Installed: (none)
Candidate: 20091012-1
Version table:
20091012-1 0
990 http://ftp.hu.debian.org sid/main Packages
500 http://ftp.hu.debian.org squeeze/main Packages
20080409-2 0
500 http://ftp.hu.debian.org lenny/main Packages
Gabor
--
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------
> Now, fixing this in the build system could get ugly and too much (see
> below), IMHO, so how about adding a README file in <tools/perf/>
> which explains that on Debian-like systems, one should mkdir
> /usr/include/libdwarf/ and symlink libdwarf.h and dwarf.h into it?
>
> There could be a better solution though...?
Bug the libdwarf developers to ship a .pc file for pkg-config that
distros can customize as needed.
Gabor
--
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------
Peter Zijlstra wrote:
> On Wed, 2009-12-16 at 14:54 +0100, Borislav Petkov wrote:
>> Hi,
>>
>> even after installing libdwarf-dev on my debian box here, make in tools/perf/
>> still complains that it cannot find libdwarf:
>>
>> Makefile:491: No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231
>>
>> The problem is that the include path on debian is not
>> /usr/include/libdwarf/ but simply /usr/include because the debian
>> package libdwarf-dev puts the headers straight into /usr/include.
>>
>> Now, fixing this in the build system could get ugly and too much (see
>> below), IMHO, so how about adding a README file in <tools/perf/>
>> which explains that on Debian-like systems, one should mkdir
>> /usr/include/libdwarf/ and symlink libdwarf.h and dwarf.h into it?
>>
>> There could be a better solution though...?
>
> Yeah, like file a bug with RH for placing them in such an utterly stupid
> location.
>
> Also, I'd not bother with testing debian, just do
>
> #include <dwarf.h>
>
> and simply add -I/usr/include/libdwarf to CPPFLAGS or something like
> that.
Ah, right, I was stupid!
Masami Hiramatsu wrote:
> e.g.
>
> ifeq ($(shell sh -c "(test -d /usr/include/libdwarf/ && echo y)", y)
> BASIC_CFLAGS += -I /usr/include/libdwarf
> endif
So, it just need;
BASIC_CFLAGS += -I/usr/include/libdwarf
And including just libdwarf.h and dwarf.h.
Thank you,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhir...@redhat.com
--
> > and simply add -I/usr/include/libdwarf to CPPFLAGS or something like
> > that.
>
> Ah, right, I was stupid!
>
> Masami Hiramatsu wrote:
> > e.g.
> >
> > ifeq ($(shell sh -c "(test -d /usr/include/libdwarf/ && echo y)", y)
> > BASIC_CFLAGS += -I /usr/include/libdwarf
> > endif
>
> So, it just need;
>
> BASIC_CFLAGS += -I/usr/include/libdwarf
>
> And including just libdwarf.h and dwarf.h.
Well, I'm not 100% sure -I/foo will actually work if foo doesn't exist,
but I'd sure try it first since its less typing :-)
If it doesn't your suggestion is a good alternative.
Borislav Petkov said:
> even after installing libdwarf-dev on my debian box here, make in
> tools/perf/
> still complains that it cannot find libdwarf:
>
> Makefile:491: No libdwarf.h found or old libdwarf.h found, disables dwarf
> support. Please install libdwarf-dev/libdwarf-devel >= 20081231
>
> The problem is that the include path on debian is not
> /usr/include/libdwarf/ but simply /usr/include because the debian
> package libdwarf-dev puts the headers straight into /usr/include.
This patch adds -I/usr/include/libdwarf to BASIC_CFLAGS
and fix probe-finder.h to include just libdwarf.h/dwarf.h.
This patch also add a workaround for undefined _MIPS_SZLONG bug
in libdwarf.h.
Reported-by: Borislav Petkov <borisla...@amd.com>
Signed-off-by: Masami Hiramatsu <mhir...@redhat.com>
Cc: Ingo Molnar <mi...@elte.hu>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Arnaldo Carvalho de Melo <ac...@redhat.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Srikar Dronamraju <sri...@linux.vnet.ibm.com>
Cc: Gabor Gombas <gom...@sztaki.hu>
Cc: Borislav Petkov <borisla...@amd.com>
---
tools/perf/Makefile | 3 ++-
tools/perf/util/probe-finder.h | 9 +++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7814dbb..4390d22 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -487,10 +487,11 @@ else
msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
endif
-ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
BASIC_CFLAGS += -DNO_LIBDWARF
else
+ BASIC_CFLAGS += -I/usr/include/libdwarf
EXTLIBS += -lelf -ldwarf
LIB_OBJS += util/probe-finder.o
endif
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 5e4050c..b6858f4 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -35,8 +35,13 @@ struct probe_point {
#ifndef NO_LIBDWARF
extern int find_probepoint(int fd, struct probe_point *pp);
-#include <libdwarf/dwarf.h>
-#include <libdwarf/libdwarf.h>
+/* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h */
+#ifndef _MIPS_SZLONG
+#define _MIPS_SZLONG 0
+#endif
+
+#include <dwarf.h>
+#include <libdwarf.h>
struct probe_finder {
struct probe_point *pp; /* Target probe point */
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhir...@redhat.com
Yes, it does :) Here's a much simpler fix:
--
From: Borislav Petkov <petk...@gmail.com>
Date: Wed, 16 Dec 2009 23:07:10 +0100
Subject: [PATCH] perf: fix libdwarf include paths
even after installing libdwarf-dev on debian make in tools/perf/ still
complains that it cannot find libdwarf:
Makefile:491: No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231
The problem is that the libdwarf headers on debian are not placed in
/usr/include/libdwarf/ but simply in /usr/include.
Fix by adding the non-standard path to BASIC_CFLAGS and truncating the
include directives.
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Masami Hiramatsu <mhir...@redhat.com>
Cc: Ingo Molnar <mi...@elte.hu>
Signed-off-by: Borislav Petkov <petk...@gmail.com>
---
tools/perf/Makefile | 4 ++--
tools/perf/util/probe-finder.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7814dbb..23ce10d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -260,7 +260,7 @@ endif
# Those must not be GNU-specific; they are shared with perl/ which may
# be built by a different compiler. (Note that this is an artifact now
# but it still might be nice to keep that distinction.)
-BASIC_CFLAGS = -Iutil/include
+BASIC_CFLAGS = -Iutil/include -I/usr/include/libdwarf
BASIC_LDFLAGS =
# Guard against environment variables
@@ -487,7 +487,7 @@ else
msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
endif
-ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
BASIC_CFLAGS += -DNO_LIBDWARF
else
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 5e4050c..adf7949 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -35,8 +35,8 @@ struct probe_point {
#ifndef NO_LIBDWARF
extern int find_probepoint(int fd, struct probe_point *pp);
-#include <libdwarf/dwarf.h>
-#include <libdwarf/libdwarf.h>
+#include <dwarf.h>
+#include <libdwarf.h>
struct probe_finder {
struct probe_point *pp; /* Target probe point */
--
1.6.5
--
Regards/Gruss,
Boris.
Oops, I also posted another version X(
Actually, from unknown reason, #include <libdwarf.h>
causes "_MIPS_SZLONG is not defined" error on my
Fedora11 (curiously, even #include <libdwarf/libdwarf.h>
didn't cause the bug!).
So I added a workaround for the bug on my patch.
Anyway, Thank you very much for reporting the bug and making a fix!!
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhir...@redhat.com
--
Only at the moment they mirrored the Sid repo for the new release. After
that things freeze.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in the body of a message to majo...@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Thomas Fjellstrom
tfjel...@shaw.ca
perf probe: Fix libdwarf include path for Debian
Fix libdwarf include path to fit debian-like systems too.
Borislav Petkov reported:
> even after installing libdwarf-dev on my debian box here,
> make in tools/perf/ still complains that it cannot find libdwarf:
>
> Makefile:491: No libdwarf.h found or old libdwarf.h found, disables dwarf
> support. Please install libdwarf-dev/libdwarf-devel >= 20081231
>
> The problem is that the include path on debian is not
> /usr/include/libdwarf/ but simply /usr/include because the debian
> package libdwarf-dev puts the headers straight into
> /usr/include.
This patch adds -I/usr/include/libdwarf to BASIC_CFLAGS
and fix probe-finder.h to include just libdwarf.h/dwarf.h.
This patch also adds a workaround for the undefined _MIPS_SZLONG
bug in libdwarf.h.
Reported-by: Borislav Petkov <borisla...@amd.com>
Signed-off-by: Masami Hiramatsu <mhir...@redhat.com>
Cc: Frederic Weisbecker <fwei...@gmail.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Arnaldo Carvalho de Melo <ac...@redhat.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Srikar Dronamraju <sri...@linux.vnet.ibm.com>
Cc: Gabor Gombas <gom...@sztaki.hu>
Cc: systemtap <syst...@sources.redhat.com>
Cc: DLE <dle-d...@lists.sourceforge.net>
LKML-Reference: <20091216221618.1...@dhcp-100-2-132.bos.redhat.com>
[ v2: small stylistic fixlets to probe-finder.h ]
Signed-off-by: Ingo Molnar <mi...@elte.hu>
---
tools/perf/Makefile | 3 +-
tools/perf/util/probe-finder.h | 59 +++++++++++++++++++++------------------
2 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 7814dbb..4390d22 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -487,10 +487,11 @@ else
msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
endif
-ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
+ifneq ($(shell sh -c "(echo '\#ifndef _MIPS_SZLONG'; echo '\#define _MIPS_SZLONG 0'; echo '\#endif'; echo '\#include <dwarf.h>'; echo '\#include <libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/libdwarf -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) $(EXTLIBS) "$(QUIET_STDERR)" && echo y"), y)
msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
BASIC_CFLAGS += -DNO_LIBDWARF
else
+ BASIC_CFLAGS += -I/usr/include/libdwarf
EXTLIBS += -lelf -ldwarf
LIB_OBJS += util/probe-finder.o
endif
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 5e4050c..a4086aa 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -1,9 +1,9 @@
#ifndef _PROBE_FINDER_H
#define _PROBE_FINDER_H
-#define MAX_PATH_LEN 256
-#define MAX_PROBE_BUFFER 1024
-#define MAX_PROBES 128
+#define MAX_PATH_LEN 256
+#define MAX_PROBE_BUFFER 1024
+#define MAX_PROBES 128
static inline int is_c_varname(const char *name)
{
@@ -12,48 +12,53 @@ static inline int is_c_varname(const char *name)
}
struct probe_point {
- char *event; /* Event name */
- char *group; /* Event group */
+ char *event; /* Event name */
+ char *group; /* Event group */
/* Inputs */
- char *file; /* File name */
- int line; /* Line number */
+ char *file; /* File name */
+ int line; /* Line number */
- char *function; /* Function name */
- int offset; /* Offset bytes */
+ char *function; /* Function name */
+ int offset; /* Offset bytes */
- int nr_args; /* Number of arguments */
- char **args; /* Arguments */
+ int nr_args; /* Number of arguments */
+ char **args; /* Arguments */
- int retprobe; /* Return probe */
+ int retprobe; /* Return probe */
/* Output */
- int found; /* Number of found probe points */
- char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
+ int found; /* Number of found probe points */
+ char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
};
#ifndef NO_LIBDWARF
extern int find_probepoint(int fd, struct probe_point *pp);
-#include <libdwarf/dwarf.h>
-#include <libdwarf/libdwarf.h>
+/* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */
+#ifndef _MIPS_SZLONG
+# define _MIPS_SZLONG 0
+#endif
+
+#include <dwarf.h>
+#include <libdwarf.h>
struct probe_finder {
- struct probe_point *pp; /* Target probe point */
+ struct probe_point *pp; /* Target probe point */
/* For function searching */
- Dwarf_Addr addr; /* Address */
- Dwarf_Unsigned fno; /* File number */
- Dwarf_Unsigned lno; /* Line number */
- Dwarf_Off inl_offs; /* Inline offset */
- Dwarf_Die cu_die; /* Current CU */
+ Dwarf_Addr addr; /* Address */
+ Dwarf_Unsigned fno; /* File number */
+ Dwarf_Unsigned lno; /* Line number */
+ Dwarf_Off inl_offs; /* Inline offset */
+ Dwarf_Die cu_die; /* Current CU */
/* For variable searching */
- Dwarf_Addr cu_base; /* Current CU base address */
- Dwarf_Locdesc fbloc; /* Location of Current Frame Base */
- const char *var; /* Current variable name */
- char *buf; /* Current output buffer */
- int len; /* Length of output buffer */
+ Dwarf_Addr cu_base; /* Current CU base address */
+ Dwarf_Locdesc fbloc; /* Location of Current Frame Base */
+ const char *var; /* Current variable name */
+ char *buf; /* Current output buffer */
+ int len; /* Length of output buffer */
};
#endif /* NO_LIBDWARF */