summaryrefslogtreecommitdiffstats
path: root/src/backtrace.h
blob: 1ba10f058ae87b156dbcf396b945c6e68d96b9e2 (plain)
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
#ifndef BACKTRACE_H
#define BACKTRACE_H

#define BIT(x) (1 << x)

enum {
	BT_FLAG_DESTROY = BIT(0),
};

#if defined(__x86_64)
typedef uint64_t bt_word_t;
#else
typedef uint32_t bt_word_t;
#endif

struct bt_symbol;

struct bt_map {
	bt_word_t base;
	bt_word_t start;
	bt_word_t end;
	char *name;
	struct bt_symbol *symbols;
	struct bt_map *next;
};

struct bt_symbol {
	bt_word_t start;
	bt_word_t end;
	char *name;
	struct bt_map *map;
	struct bt_symbol *next;
};

/* backtrace user interface */
void dump_backtrace(struct lt_config_shared *cfg, unsigned long flags);

/* backtrace implementation helpers */
int bt_dump(struct lt_config_shared *cfg, unsigned long flags);
int bt_find_map(struct lt_config_shared *cfg, struct bt_map **map,
		bt_word_t ip);
int bt_find_symbol(struct lt_config_shared *cfg, struct bt_symbol **sym,
		   struct bt_map *map, bt_word_t ip);
void bt_display(struct lt_config_shared *cfg, char *text);

#endif /* BACKTRACE_H*/