2009-09-24 16:02:18 +00:00
|
|
|
#ifndef __PERF_SYMBOL
|
|
|
|
#define __PERF_SYMBOL 1
|
2009-05-28 17:55:04 +00:00
|
|
|
|
|
|
|
#include <linux/types.h>
|
2009-10-20 16:25:40 +00:00
|
|
|
#include <stdbool.h>
|
2009-06-25 15:05:54 +00:00
|
|
|
#include "types.h"
|
2009-07-01 17:46:08 +00:00
|
|
|
#include <linux/list.h>
|
2009-07-01 15:28:37 +00:00
|
|
|
#include <linux/rbtree.h>
|
2009-08-12 09:07:25 +00:00
|
|
|
#include "event.h"
|
2009-05-28 17:55:04 +00:00
|
|
|
|
2009-08-11 19:22:11 +00:00
|
|
|
#ifdef HAVE_CPLUS_DEMANGLE
|
|
|
|
extern char *cplus_demangle(const char *, int);
|
|
|
|
|
|
|
|
static inline char *bfd_demangle(void __used *v, const char *c, int i)
|
|
|
|
{
|
|
|
|
return cplus_demangle(c, i);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#ifdef NO_DEMANGLE
|
|
|
|
static inline char *bfd_demangle(void __used *v, const char __used *c,
|
|
|
|
int __used i)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#include <bfd.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2009-10-24 16:10:36 +00:00
|
|
|
/*
|
|
|
|
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
|
|
|
|
* for newer versions we can use mmap to reduce memory usage:
|
|
|
|
*/
|
|
|
|
#ifdef LIBELF_NO_MMAP
|
|
|
|
# define PERF_ELF_C_READ_MMAP ELF_C_READ
|
|
|
|
#else
|
|
|
|
# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
|
|
|
|
#endif
|
|
|
|
|
2009-08-11 19:22:11 +00:00
|
|
|
#ifndef DMGL_PARAMS
|
|
|
|
#define DMGL_PARAMS (1 << 0) /* Include function args */
|
|
|
|
#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */
|
|
|
|
#endif
|
|
|
|
|
2009-05-28 17:55:04 +00:00
|
|
|
struct symbol {
|
|
|
|
struct rb_node rb_node;
|
perf_counter tools: Define and use our own u64, s64 etc. definitions
On 64-bit powerpc, __u64 is defined to be unsigned long rather than
unsigned long long. This causes compiler warnings every time we
print a __u64 value with %Lx.
Rather than changing __u64, we define our own u64 to be unsigned long
long on all architectures, and similarly s64 as signed long long.
For consistency we also define u32, s32, u16, s16, u8 and s8. These
definitions are put in a new header, types.h, because these definitions
are needed in util/string.h and util/symbol.h.
The main change here is the mechanical change of __[us]{64,32,16,8}
to remove the "__". The other changes are:
* Create types.h
* Include types.h in perf.h, util/string.h and util/symbol.h
* Add types.h to the LIB_H definition in Makefile
* Added (u64) casts in process_overflow_event() and print_sym_table()
to kill two remaining warnings.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: benh@kernel.crashing.org
LKML-Reference: <19003.33494.495844.956580@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-06-19 12:21:42 +00:00
|
|
|
u64 start;
|
|
|
|
u64 end;
|
2009-05-28 17:55:04 +00:00
|
|
|
char name[0];
|
|
|
|
};
|
|
|
|
|
2009-10-30 18:28:24 +00:00
|
|
|
extern unsigned int symbol__priv_size;
|
|
|
|
|
|
|
|
static inline void *symbol__priv(struct symbol *self)
|
|
|
|
{
|
|
|
|
return ((void *)self) - symbol__priv_size;
|
|
|
|
}
|
|
|
|
|
2009-05-28 17:55:04 +00:00
|
|
|
struct dso {
|
|
|
|
struct list_head node;
|
|
|
|
struct rb_root syms;
|
perf_counter tools: Define and use our own u64, s64 etc. definitions
On 64-bit powerpc, __u64 is defined to be unsigned long rather than
unsigned long long. This causes compiler warnings every time we
print a __u64 value with %Lx.
Rather than changing __u64, we define our own u64 to be unsigned long
long on all architectures, and similarly s64 as signed long long.
For consistency we also define u32, s32, u16, s16, u8 and s8. These
definitions are put in a new header, types.h, because these definitions
are needed in util/string.h and util/symbol.h.
The main change here is the mechanical change of __[us]{64,32,16,8}
to remove the "__". The other changes are:
* Create types.h
* Include types.h in perf.h, util/string.h and util/symbol.h
* Add types.h to the LIB_H definition in Makefile
* Added (u64) casts in process_overflow_event() and print_sym_table()
to kill two remaining warnings.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: benh@kernel.crashing.org
LKML-Reference: <19003.33494.495844.956580@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-06-19 12:21:42 +00:00
|
|
|
struct symbol *(*find_symbol)(struct dso *, u64 ip);
|
2009-07-03 00:24:14 +00:00
|
|
|
unsigned char adjust_symbols;
|
2009-07-11 01:47:28 +00:00
|
|
|
unsigned char slen_calculated;
|
2009-10-28 23:51:21 +00:00
|
|
|
bool loaded;
|
2009-08-06 17:43:17 +00:00
|
|
|
unsigned char origin;
|
2009-10-02 06:29:58 +00:00
|
|
|
const char *short_name;
|
|
|
|
char *long_name;
|
2009-05-28 17:55:04 +00:00
|
|
|
char name[0];
|
|
|
|
};
|
|
|
|
|
2009-10-30 18:28:24 +00:00
|
|
|
struct dso *dso__new(const char *name);
|
2009-05-28 17:55:04 +00:00
|
|
|
void dso__delete(struct dso *self);
|
|
|
|
|
perf_counter tools: Define and use our own u64, s64 etc. definitions
On 64-bit powerpc, __u64 is defined to be unsigned long rather than
unsigned long long. This causes compiler warnings every time we
print a __u64 value with %Lx.
Rather than changing __u64, we define our own u64 to be unsigned long
long on all architectures, and similarly s64 as signed long long.
For consistency we also define u32, s32, u16, s16, u8 and s8. These
definitions are put in a new header, types.h, because these definitions
are needed in util/string.h and util/symbol.h.
The main change here is the mechanical change of __[us]{64,32,16,8}
to remove the "__". The other changes are:
* Create types.h
* Include types.h in perf.h, util/string.h and util/symbol.h
* Add types.h to the LIB_H definition in Makefile
* Added (u64) casts in process_overflow_event() and print_sym_table()
to kill two remaining warnings.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: benh@kernel.crashing.org
LKML-Reference: <19003.33494.495844.956580@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-06-19 12:21:42 +00:00
|
|
|
struct symbol *dso__find_symbol(struct dso *self, u64 ip);
|
2009-05-28 17:55:04 +00:00
|
|
|
|
2009-10-30 18:28:24 +00:00
|
|
|
int dsos__load_kernel(const char *vmlinux, symbol_filter_t filter, int modules);
|
|
|
|
struct dso *dsos__findnew(const char *name);
|
2009-10-21 19:34:06 +00:00
|
|
|
int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
|
2009-08-12 08:03:49 +00:00
|
|
|
void dsos__fprintf(FILE *fp);
|
2009-05-28 17:55:04 +00:00
|
|
|
|
|
|
|
size_t dso__fprintf(struct dso *self, FILE *fp);
|
2009-08-06 17:43:17 +00:00
|
|
|
char dso__symtab_origin(const struct dso *self);
|
2009-05-28 17:55:04 +00:00
|
|
|
|
2009-11-03 23:46:10 +00:00
|
|
|
int filename__read_build_id(const char *filename, void *bf, size_t size);
|
|
|
|
|
2009-10-30 18:28:24 +00:00
|
|
|
int load_kernel(symbol_filter_t filter);
|
2009-08-12 08:03:49 +00:00
|
|
|
|
2009-10-30 18:28:24 +00:00
|
|
|
void symbol__init(unsigned int priv_size);
|
2009-08-12 08:03:49 +00:00
|
|
|
|
|
|
|
extern struct list_head dsos;
|
2009-10-02 06:29:58 +00:00
|
|
|
extern struct map *kernel_map;
|
2009-08-12 08:03:49 +00:00
|
|
|
extern struct dso *vdso;
|
2009-08-15 10:26:57 +00:00
|
|
|
extern const char *vmlinux_name;
|
2009-08-12 08:03:49 +00:00
|
|
|
extern int modules;
|
2009-09-24 16:02:18 +00:00
|
|
|
#endif /* __PERF_SYMBOL */
|