-
Notifications
You must be signed in to change notification settings - Fork 478
/
Copy pathdwarf.h
81 lines (72 loc) · 2.5 KB
/
dwarf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef UFTRACE_DWARF_H
#define UFTRACE_DWARF_H
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "utils/filter.h"
#include "utils/rbtree.h"
struct uftrace_sym_info;
struct uftrace_module;
#ifdef HAVE_LIBDW
#include <elfutils/libdwfl.h>
extern Dwfl_Callbacks dwfl_callbacks;
#endif
struct uftrace_dbg_file {
/* saved in uftrace_dbg_info.files */
struct rb_node node;
/* source file name */
char *name;
};
/* we only keep the start location of symbol */
struct uftrace_dbg_loc {
/* symbol for this location */
struct uftrace_symbol *sym;
/* filename info */
struct uftrace_dbg_file *file;
/* line number info */
int line;
};
struct uftrace_dbg_info {
/* opaque DWARF info pointer */
void *dw;
/* opaque pointer for DWARF frontend library */
void *dwfl;
/* start address in memory for this module */
uint64_t offset;
/* rb tree of arguments */
struct rb_root args;
/* rb tree of return values */
struct rb_root rets;
/* rb tree of enum tags/values */
struct rb_root enums;
/* rb tree of file info */
struct rb_root files;
/* array of location - same order as symbol */
struct uftrace_dbg_loc *locs;
/* number of debug location info */
size_t nr_locs;
/* number of actually used debug location info */
size_t nr_locs_used;
/* ELF file type - EXEC, REL, DYN */
int file_type;
/* whether it needs to parse argument info */
bool needs_args;
/* whether it's loaded already */
bool loaded;
/* name of common directory path for source files (can be %NULL) */
char *base_dir;
};
extern void prepare_debug_info(struct uftrace_sym_info *sinfo, enum uftrace_pattern_type ptype,
char *argspec, char *retspec, bool auto_args, bool force);
extern void finish_debug_info(struct uftrace_sym_info *sinfo);
extern bool debug_info_has_argspec(struct uftrace_dbg_info *dinfo);
extern bool debug_info_has_location(struct uftrace_dbg_info *dinfo);
extern char *get_dwarf_argspec(struct uftrace_dbg_info *dinfo, char *name, unsigned long addr);
extern char *get_dwarf_retspec(struct uftrace_dbg_info *dinfo, char *name, unsigned long addr);
struct uftrace_dbg_loc *find_file_line(struct uftrace_sym_info *sinfo, uint64_t addr);
extern void save_debug_info(struct uftrace_sym_info *sinfo, const char *dirname);
extern void load_debug_info(struct uftrace_sym_info *sinfo, bool needs_srcline);
extern void save_debug_file(FILE *fp, char code, char *str, unsigned long val);
extern void load_module_debug_info(struct uftrace_module *mod, const char *dirname,
bool needs_srcline);
#endif /* UFTRACE_DWARF_H */