File Index
Files and directories
Sign in
FILE

probe-finder.h

File preview with syntax highlighting.

linux-6.19.14/tools/perf/util/probe-finder.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef _PROBE_FINDER_H
  3#define _PROBE_FINDER_H
  4
  5#include <stdbool.h>
  6#include "intlist.h"
  7#include "build-id.h"
  8#include "probe-event.h"
  9#include <linux/ctype.h>
 10
 11#define MAX_PROBE_BUFFER	1024
 12#define MAX_PROBES		 128
 13#define MAX_PROBE_ARGS		 128
 14
 15#define PROBE_ARG_VARS		"$vars"
 16#define PROBE_ARG_PARAMS	"$params"
 17
 18static inline int is_c_varname(const char *name)
 19{
 20	/* TODO */
 21	return isalpha(name[0]) || name[0] == '_';
 22}
 23
 24#ifdef HAVE_LIBDW_SUPPORT
 25
 26#include "dwarf-aux.h"
 27#include "debuginfo.h"
 28
 29/* Check the language code is known C */
 30bool is_known_C_lang(int lang);
 31
 32/* Find probe_trace_events specified by perf_probe_event from debuginfo */
 33int debuginfo__find_trace_events(struct debuginfo *dbg,
 34				 struct perf_probe_event *pev,
 35				 struct probe_trace_event **tevs);
 36
 37/* Find a perf_probe_point from debuginfo */
 38int debuginfo__find_probe_point(struct debuginfo *dbg, u64 addr,
 39				struct perf_probe_point *ppt);
 40
 41/* Find a line range */
 42int debuginfo__find_line_range(struct debuginfo *dbg, struct line_range *lr);
 43
 44/* Find available variables */
 45int debuginfo__find_available_vars_at(struct debuginfo *dbg,
 46				      struct perf_probe_event *pev,
 47				      struct variable_list **vls);
 48
 49/* Find a src file from a DWARF tag path */
 50int find_source_path(const char *raw_path, const char *sbuild_id,
 51		     const char *comp_dir, char **new_path);
 52
 53struct probe_finder {
 54	struct perf_probe_event	*pev;		/* Target probe event */
 55	struct debuginfo	*dbg;
 56
 57	/* Callback when a probe point is found */
 58	int (*callback)(Dwarf_Die *sc_die, struct probe_finder *pf);
 59
 60	/* For function searching */
 61	int			lno;		/* Line number */
 62	Dwarf_Addr		addr;		/* Address */
 63	const char		*fname;		/* Real file name */
 64	Dwarf_Die		cu_die;		/* Current CU */
 65	Dwarf_Die		sp_die;
 66	Dwarf_Off		abstrace_dieoffset;
 67	struct intlist		*lcache;	/* Line cache for lazy match */
 68
 69	/* For variable searching */
 70	/* Call Frame Information from .eh_frame. Owned by this struct. */
 71	Dwarf_CFI		*cfi_eh;
 72	/* Call Frame Information from .debug_frame. Not owned. */
 73	Dwarf_CFI		*cfi_dbg;
 74	Dwarf_Op		*fb_ops;	/* Frame base attribute */
 75	unsigned int		e_machine;	/* ELF target machine arch */
 76	unsigned int		e_flags;	/* ELF target machine flags */
 77	struct perf_probe_arg	*pvar;		/* Current target variable */
 78	struct probe_trace_arg	*tvar;		/* Current result variable */
 79	bool			skip_empty_arg;	/* Skip non-exist args */
 80};
 81
 82struct trace_event_finder {
 83	struct probe_finder	pf;
 84	Dwfl_Module		*mod;		/* For solving symbols */
 85	struct probe_trace_event *tevs;		/* Found trace events */
 86	int			ntevs;		/* Number of trace events */
 87	int			max_tevs;	/* Max number of trace events */
 88};
 89
 90struct available_var_finder {
 91	struct probe_finder	pf;
 92	Dwfl_Module		*mod;		/* For solving symbols */
 93	struct variable_list	*vls;		/* Found variable lists */
 94	int			nvls;		/* Number of variable lists */
 95	int			max_vls;	/* Max no. of variable lists */
 96	bool			child;		/* Search child scopes */
 97};
 98
 99struct line_finder {
100	struct line_range	*lr;		/* Target line range */
101
102	const char		*fname;		/* File name */
103	int			lno_s;		/* Start line number */
104	int			lno_e;		/* End line number */
105	Dwarf_Die		cu_die;		/* Current CU */
106	Dwarf_Die		sp_die;
107	int			found;
108};
109
110#else
111#define is_known_C_lang(lang) (false)
112#endif /* HAVE_LIBDW_SUPPORT */
113
114#endif /*_PROBE_FINDER_H */
~/ Read-only file preview.