xref: /linux/tools/perf/util/srcline.h (revision 55ecd6310f9fe48cf7e435be408862da1e0e6baa)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2632a5cabSArnaldo Carvalho de Melo #ifndef PERF_SRCLINE_H
3632a5cabSArnaldo Carvalho de Melo #define PERF_SRCLINE_H
4632a5cabSArnaldo Carvalho de Melo 
5632a5cabSArnaldo Carvalho de Melo #include <linux/list.h>
611ea2515SMilian Wolff #include <linux/rbtree.h>
7632a5cabSArnaldo Carvalho de Melo #include <linux/types.h>
8632a5cabSArnaldo Carvalho de Melo 
9632a5cabSArnaldo Carvalho de Melo struct dso;
10632a5cabSArnaldo Carvalho de Melo struct symbol;
11632a5cabSArnaldo Carvalho de Melo 
12632a5cabSArnaldo Carvalho de Melo extern bool srcline_full_filename;
13632a5cabSArnaldo Carvalho de Melo char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
14935f5a9dSJin Yao 		  bool show_sym, bool show_addr, u64 ip);
15632a5cabSArnaldo Carvalho de Melo char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
16935f5a9dSJin Yao 		  bool show_sym, bool show_addr, bool unwind_inlines,
17935f5a9dSJin Yao 		  u64 ip);
18632a5cabSArnaldo Carvalho de Melo void free_srcline(char *srcline);
19dd2e18e9SAndi Kleen char *get_srcline_split(struct dso *dso, u64 addr, unsigned *line);
20632a5cabSArnaldo Carvalho de Melo 
2121ac9d54SMilian Wolff /* insert the srcline into the DSO, which will take ownership */
22*55ecd631SDavidlohr Bueso void srcline__tree_insert(struct rb_root_cached *tree, u64 addr, char *srcline);
2321ac9d54SMilian Wolff /* find previously inserted srcline */
24*55ecd631SDavidlohr Bueso char *srcline__tree_find(struct rb_root_cached *tree, u64 addr);
2521ac9d54SMilian Wolff /* delete all srclines within the tree */
26*55ecd631SDavidlohr Bueso void srcline__tree_delete(struct rb_root_cached *tree);
2721ac9d54SMilian Wolff 
28632a5cabSArnaldo Carvalho de Melo #define SRCLINE_UNKNOWN  ((char *) "??:0")
29632a5cabSArnaldo Carvalho de Melo 
30632a5cabSArnaldo Carvalho de Melo struct inline_list {
31fea0cf84SMilian Wolff 	struct symbol		*symbol;
322be8832fSMilian Wolff 	char			*srcline;
33632a5cabSArnaldo Carvalho de Melo 	struct list_head	list;
34632a5cabSArnaldo Carvalho de Melo };
35632a5cabSArnaldo Carvalho de Melo 
36632a5cabSArnaldo Carvalho de Melo struct inline_node {
37632a5cabSArnaldo Carvalho de Melo 	u64			addr;
38632a5cabSArnaldo Carvalho de Melo 	struct list_head	val;
3911ea2515SMilian Wolff 	struct rb_node		rb_node;
40632a5cabSArnaldo Carvalho de Melo };
41632a5cabSArnaldo Carvalho de Melo 
42fea0cf84SMilian Wolff /* parse inlined frames for the given address */
43fea0cf84SMilian Wolff struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
44fea0cf84SMilian Wolff 					    struct symbol *sym);
45fea0cf84SMilian Wolff /* free resources associated to the inline node list */
46632a5cabSArnaldo Carvalho de Melo void inline_node__delete(struct inline_node *node);
47632a5cabSArnaldo Carvalho de Melo 
4811ea2515SMilian Wolff /* insert the inline node list into the DSO, which will take ownership */
49*55ecd631SDavidlohr Bueso void inlines__tree_insert(struct rb_root_cached *tree,
50*55ecd631SDavidlohr Bueso 			  struct inline_node *inlines);
5111ea2515SMilian Wolff /* find previously inserted inline node list */
52*55ecd631SDavidlohr Bueso struct inline_node *inlines__tree_find(struct rb_root_cached *tree, u64 addr);
5311ea2515SMilian Wolff /* delete all nodes within the tree of inline_node s */
54*55ecd631SDavidlohr Bueso void inlines__tree_delete(struct rb_root_cached *tree);
5511ea2515SMilian Wolff 
56632a5cabSArnaldo Carvalho de Melo #endif /* PERF_SRCLINE_H */
57