^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef PERF_SRCLINE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define PERF_SRCLINE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #include <linux/rbtree.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct dso;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct symbol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) extern bool srcline_full_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) bool show_sym, bool show_addr, u64 ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) bool show_sym, bool show_addr, bool unwind_inlines,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) u64 ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) void free_srcline(char *srcline);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) char *get_srcline_split(struct dso *dso, u64 addr, unsigned *line);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* insert the srcline into the DSO, which will take ownership */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) void srcline__tree_insert(struct rb_root_cached *tree, u64 addr, char *srcline);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /* find previously inserted srcline */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) char *srcline__tree_find(struct rb_root_cached *tree, u64 addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* delete all srclines within the tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) void srcline__tree_delete(struct rb_root_cached *tree);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define SRCLINE_UNKNOWN ((char *) "??:0")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct inline_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct symbol *symbol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) char *srcline;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) struct inline_node {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u64 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct list_head val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct rb_node rb_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /* parse inlined frames for the given address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct symbol *sym);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) /* free resources associated to the inline node list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void inline_node__delete(struct inline_node *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /* insert the inline node list into the DSO, which will take ownership */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void inlines__tree_insert(struct rb_root_cached *tree,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) struct inline_node *inlines);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /* find previously inserted inline node list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) struct inline_node *inlines__tree_find(struct rb_root_cached *tree, u64 addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* delete all nodes within the tree of inline_node s */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) void inlines__tree_delete(struct rb_root_cached *tree);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #endif /* PERF_SRCLINE_H */