27f3b24de0
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 <borislav.petkov@amd.com> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Gabor Gombas <gombasg@sztaki.hu> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> LKML-Reference: <20091216221618.13816.83296.stgit@dhcp-100-2-132.bos.redhat.com> [ v2: small stylistic fixlets to probe-finder.h ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
65 lines
1.6 KiB
C
65 lines
1.6 KiB
C
#ifndef _PROBE_FINDER_H
|
|
#define _PROBE_FINDER_H
|
|
|
|
#define MAX_PATH_LEN 256
|
|
#define MAX_PROBE_BUFFER 1024
|
|
#define MAX_PROBES 128
|
|
|
|
static inline int is_c_varname(const char *name)
|
|
{
|
|
/* TODO */
|
|
return isalpha(name[0]) || name[0] == '_';
|
|
}
|
|
|
|
struct probe_point {
|
|
char *event; /* Event name */
|
|
char *group; /* Event group */
|
|
|
|
/* Inputs */
|
|
char *file; /* File name */
|
|
int line; /* Line number */
|
|
|
|
char *function; /* Function name */
|
|
int offset; /* Offset bytes */
|
|
|
|
int nr_args; /* Number of arguments */
|
|
char **args; /* Arguments */
|
|
|
|
int retprobe; /* Return probe */
|
|
|
|
/* Output */
|
|
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);
|
|
|
|
/* 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 */
|
|
|
|
/* 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 */
|
|
|
|
/* 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 */
|
|
};
|
|
#endif /* NO_LIBDWARF */
|
|
|
|
#endif /*_PROBE_FINDER_H */
|