diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-02-25 08:35:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-02-25 11:49:29 -0500 |
commit | 804b36068eccd8163ccea420c662fb5d1a21b141 (patch) | |
tree | 08837b6d7be24d56c30af2932e59fa1c23420396 /tools/perf/util/probe-finder.h | |
parent | 81cb8aa327b5923b38eccc795c8b7170be20b9ff (diff) |
perf probe: Use elfutils-libdw for analyzing debuginfo
Newer gcc introduces newer & richer debuginfo, and only libdw
in elfutils project can support it. So perf probe moves onto
elfutils-libdw from libdwarf.
Changes in v3:
- Cast Dwarf_Addr/Dwarf_Word to uintmax_t for printf-formats.
- Recover a sign-prefix which was removed in v2 by mistake.
Changes in v2:
- Fix a type-casting bug in Makefile.
- Cast Dwarf_Addr/Dwarf_Word to unsigned long long for printf-formats.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
LKML-Reference: <20100225133542.6725.34724.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/probe-finder.h')
-rw-r--r-- | tools/perf/util/probe-finder.h | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index b2a25241135a..9dd4a884d0e6 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _PROBE_FINDER_H | 1 | #ifndef _PROBE_FINDER_H |
2 | #define _PROBE_FINDER_H | 2 | #define _PROBE_FINDER_H |
3 | 3 | ||
4 | #include <stdbool.h> | ||
4 | #include "util.h" | 5 | #include "util.h" |
5 | 6 | ||
6 | #define MAX_PATH_LEN 256 | 7 | #define MAX_PATH_LEN 256 |
@@ -46,53 +47,48 @@ struct line_range { | |||
46 | char *function; /* Function name */ | 47 | char *function; /* Function name */ |
47 | unsigned int start; /* Start line number */ | 48 | unsigned int start; /* Start line number */ |
48 | unsigned int end; /* End line number */ | 49 | unsigned int end; /* End line number */ |
49 | unsigned int offset; /* Start line offset */ | 50 | int offset; /* Start line offset */ |
50 | char *path; /* Real path name */ | 51 | char *path; /* Real path name */ |
51 | struct list_head line_list; /* Visible lines */ | 52 | struct list_head line_list; /* Visible lines */ |
52 | }; | 53 | }; |
53 | 54 | ||
54 | #ifndef NO_LIBDWARF | 55 | #ifndef NO_DWARF_SUPPORT |
55 | extern int find_probe_point(int fd, struct probe_point *pp); | 56 | extern int find_probe_point(int fd, struct probe_point *pp); |
56 | extern int find_line_range(int fd, struct line_range *lr); | 57 | extern int find_line_range(int fd, struct line_range *lr); |
57 | 58 | ||
58 | /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */ | ||
59 | #ifndef _MIPS_SZLONG | ||
60 | # define _MIPS_SZLONG 0 | ||
61 | #endif | ||
62 | |||
63 | #include <dwarf.h> | 59 | #include <dwarf.h> |
64 | #include <libdwarf.h> | 60 | #include <libdw.h> |
65 | 61 | ||
66 | struct probe_finder { | 62 | struct probe_finder { |
67 | struct probe_point *pp; /* Target probe point */ | 63 | struct probe_point *pp; /* Target probe point */ |
68 | 64 | ||
69 | /* For function searching */ | 65 | /* For function searching */ |
70 | Dwarf_Addr addr; /* Address */ | 66 | Dwarf_Addr addr; /* Address */ |
71 | Dwarf_Unsigned fno; /* File number */ | 67 | const char *fname; /* File name */ |
72 | Dwarf_Unsigned lno; /* Line number */ | 68 | int lno; /* Line number */ |
73 | Dwarf_Off inl_offs; /* Inline offset */ | 69 | void *origin; /* Inline origin addr */ |
74 | Dwarf_Die cu_die; /* Current CU */ | 70 | Dwarf_Die cu_die; /* Current CU */ |
75 | 71 | ||
76 | /* For variable searching */ | 72 | /* For variable searching */ |
77 | Dwarf_Addr cu_base; /* Current CU base address */ | 73 | Dwarf_Op *fb_ops; /* Frame base attribute */ |
78 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ | 74 | Dwarf_Addr cu_base; /* Current CU base address */ |
79 | const char *var; /* Current variable name */ | 75 | const char *var; /* Current variable name */ |
80 | char *buf; /* Current output buffer */ | 76 | char *buf; /* Current output buffer */ |
81 | int len; /* Length of output buffer */ | 77 | int len; /* Length of output buffer */ |
82 | }; | 78 | }; |
83 | 79 | ||
84 | struct line_finder { | 80 | struct line_finder { |
85 | struct line_range *lr; /* Target line range */ | 81 | struct line_range *lr; /* Target line range */ |
86 | 82 | ||
87 | Dwarf_Unsigned fno; /* File number */ | 83 | const char *fname; /* File name */ |
88 | Dwarf_Unsigned lno_s; /* Start line number */ | 84 | int lno_s; /* Start line number */ |
89 | Dwarf_Unsigned lno_e; /* End line number */ | 85 | int lno_e; /* End line number */ |
90 | Dwarf_Addr addr_s; /* Start address */ | 86 | Dwarf_Addr addr_s; /* Start address */ |
91 | Dwarf_Addr addr_e; /* End address */ | 87 | Dwarf_Addr addr_e; /* End address */ |
92 | Dwarf_Die cu_die; /* Current CU */ | 88 | Dwarf_Die cu_die; /* Current CU */ |
93 | int found; | 89 | int found; |
94 | }; | 90 | }; |
95 | 91 | ||
96 | #endif /* NO_LIBDWARF */ | 92 | #endif /* NO_DWARF_SUPPORT */ |
97 | 93 | ||
98 | #endif /*_PROBE_FINDER_H */ | 94 | #endif /*_PROBE_FINDER_H */ |