18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef PERF_SRCLINE_H
38c2ecf20Sopenharmony_ci#define PERF_SRCLINE_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/list.h>
68c2ecf20Sopenharmony_ci#include <linux/rbtree.h>
78c2ecf20Sopenharmony_ci#include <linux/types.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct dso;
108c2ecf20Sopenharmony_cistruct symbol;
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciextern bool srcline_full_filename;
138c2ecf20Sopenharmony_cichar *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
148c2ecf20Sopenharmony_ci		  bool show_sym, bool show_addr, u64 ip);
158c2ecf20Sopenharmony_cichar *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
168c2ecf20Sopenharmony_ci		  bool show_sym, bool show_addr, bool unwind_inlines,
178c2ecf20Sopenharmony_ci		  u64 ip);
188c2ecf20Sopenharmony_civoid free_srcline(char *srcline);
198c2ecf20Sopenharmony_cichar *get_srcline_split(struct dso *dso, u64 addr, unsigned *line);
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* insert the srcline into the DSO, which will take ownership */
228c2ecf20Sopenharmony_civoid srcline__tree_insert(struct rb_root_cached *tree, u64 addr, char *srcline);
238c2ecf20Sopenharmony_ci/* find previously inserted srcline */
248c2ecf20Sopenharmony_cichar *srcline__tree_find(struct rb_root_cached *tree, u64 addr);
258c2ecf20Sopenharmony_ci/* delete all srclines within the tree */
268c2ecf20Sopenharmony_civoid srcline__tree_delete(struct rb_root_cached *tree);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define SRCLINE_UNKNOWN  ((char *) "??:0")
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct inline_list {
318c2ecf20Sopenharmony_ci	struct symbol		*symbol;
328c2ecf20Sopenharmony_ci	char			*srcline;
338c2ecf20Sopenharmony_ci	struct list_head	list;
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistruct inline_node {
378c2ecf20Sopenharmony_ci	u64			addr;
388c2ecf20Sopenharmony_ci	struct list_head	val;
398c2ecf20Sopenharmony_ci	struct rb_node		rb_node;
408c2ecf20Sopenharmony_ci};
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* parse inlined frames for the given address */
438c2ecf20Sopenharmony_cistruct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
448c2ecf20Sopenharmony_ci					    struct symbol *sym);
458c2ecf20Sopenharmony_ci/* free resources associated to the inline node list */
468c2ecf20Sopenharmony_civoid inline_node__delete(struct inline_node *node);
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* insert the inline node list into the DSO, which will take ownership */
498c2ecf20Sopenharmony_civoid inlines__tree_insert(struct rb_root_cached *tree,
508c2ecf20Sopenharmony_ci			  struct inline_node *inlines);
518c2ecf20Sopenharmony_ci/* find previously inserted inline node list */
528c2ecf20Sopenharmony_cistruct inline_node *inlines__tree_find(struct rb_root_cached *tree, u64 addr);
538c2ecf20Sopenharmony_ci/* delete all nodes within the tree of inline_node s */
548c2ecf20Sopenharmony_civoid inlines__tree_delete(struct rb_root_cached *tree);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#endif /* PERF_SRCLINE_H */
57