Linux Perf
probe-finder.c File Reference
#include <inttypes.h>
#include <sys/utsname.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <dwarf-regs.h>
#include <linux/bitops.h>
#include "event.h"
#include "dso.h"
#include "debug.h"
#include "intlist.h"
#include "util.h"
#include "strlist.h"
#include "symbol.h"
#include "probe-finder.h"
#include "probe-file.h"
#include "string2.h"
Include dependency graph for probe-finder.c:

Go to the source code of this file.

Classes

struct  find_scope_param
 
struct  dwarf_callback_param
 
struct  pubname_callback_param
 
struct  local_vars_finder
 

Macros

#define MAX_BASIC_TYPE_BITS   64
 
#define BYTES_TO_BITS(nb)   ((nb) * BITS_PER_LONG / sizeof(long))
 

Functions

static int debuginfo__init_offline_dwarf (struct debuginfo *dbg, const char *path)
 
static struct debuginfo * __debuginfo__new (const char *path)
 
struct debuginfo * debuginfo__new (const char *path)
 
void debuginfo__delete (struct debuginfo *dbg)
 
static struct probe_trace_arg_refalloc_trace_arg_ref (long offs)
 
static int convert_variable_location (Dwarf_Die *vr_die, Dwarf_Addr addr, Dwarf_Op *fb_ops, Dwarf_Die *sp_die, unsigned int machine, struct probe_trace_arg *tvar)
 
static int convert_variable_type (Dwarf_Die *vr_die, struct probe_trace_arg *tvar, const char *cast)
 
static int convert_variable_fields (Dwarf_Die *vr_die, const char *varname, struct perf_probe_arg_field *field, struct probe_trace_arg_ref **ref_ptr, Dwarf_Die *die_mem)
 
static int convert_variable (Dwarf_Die *vr_die, struct probe_finder *pf)
 
static int find_variable (Dwarf_Die *sc_die, struct probe_finder *pf)
 
static int convert_to_trace_point (Dwarf_Die *sp_die, Dwfl_Module *mod, Dwarf_Addr paddr, bool retprobe, const char *function, struct probe_trace_point *tp)
 
static int call_probe_finder (Dwarf_Die *sc_die, struct probe_finder *pf)
 
static int find_best_scope_cb (Dwarf_Die *fn_die, void *data)
 
static Dwarf_Die * find_best_scope (struct probe_finder *pf, Dwarf_Die *die_mem)
 
static int probe_point_line_walker (const char *fname, int lineno, Dwarf_Addr addr, void *data)
 
static int find_probe_point_by_line (struct probe_finder *pf)
 
static int find_lazy_match_lines (struct intlist *list, const char *fname, const char *pat)
 
static int probe_point_lazy_walker (const char *fname, int lineno, Dwarf_Addr addr, void *data)
 
static int find_probe_point_lazy (Dwarf_Die *sp_die, struct probe_finder *pf)
 
static void skip_prologue (Dwarf_Die *sp_die, struct probe_finder *pf)
 
static int probe_point_inline_cb (Dwarf_Die *in_die, void *data)
 
static int probe_point_search_cb (Dwarf_Die *sp_die, void *data)
 
static int find_probe_point_by_func (struct probe_finder *pf)
 
static int pubname_search_cb (Dwarf *dbg, Dwarf_Global *gl, void *data)
 
static int debuginfo__find_probe_location (struct debuginfo *dbg, struct probe_finder *pf)
 
static int debuginfo__find_probes (struct debuginfo *dbg, struct probe_finder *pf)
 
static int copy_variables_cb (Dwarf_Die *die_mem, void *data)
 
static int expand_probe_args (Dwarf_Die *sc_die, struct probe_finder *pf, struct perf_probe_arg *args)
 
static int add_probe_trace_event (Dwarf_Die *sc_die, struct probe_finder *pf)
 
int debuginfo__find_trace_events (struct debuginfo *dbg, struct perf_probe_event *pev, struct probe_trace_event **tevs)
 
static int collect_variables_cb (Dwarf_Die *die_mem, void *data)
 
static int add_available_vars (Dwarf_Die *sc_die, struct probe_finder *pf)
 
int debuginfo__find_available_vars_at (struct debuginfo *dbg, struct perf_probe_event *pev, struct variable_list **vls)
 
int debuginfo__get_text_offset (struct debuginfo *dbg, Dwarf_Addr *offs, bool adjust_offset)
 
int debuginfo__find_probe_point (struct debuginfo *dbg, unsigned long addr, struct perf_probe_point *ppt)
 
static int line_range_add_line (const char *src, unsigned int lineno, struct line_range *lr)
 
static int line_range_walk_cb (const char *fname, int lineno, Dwarf_Addr addr __maybe_unused, void *data)
 
static int find_line_range_by_line (Dwarf_Die *sp_die, struct line_finder *lf)
 
static int line_range_inline_cb (Dwarf_Die *in_die, void *data)
 
static int line_range_search_cb (Dwarf_Die *sp_die, void *data)
 
static int find_line_range_by_func (struct line_finder *lf)
 
int debuginfo__find_line_range (struct debuginfo *dbg, struct line_range *lr)
 
int get_real_path (const char *raw_path, const char *comp_dir, char **new_path)
 

Variables

static char * debuginfo_path
 
static const Dwfl_Callbacks offline_callbacks
 
enum dso_binary_type distro_dwarf_types []
 

Macro Definition Documentation

◆ BYTES_TO_BITS

#define BYTES_TO_BITS (   nb)    ((nb) * BITS_PER_LONG / sizeof(long))

Definition at line 293 of file probe-finder.c.

◆ MAX_BASIC_TYPE_BITS

#define MAX_BASIC_TYPE_BITS   64

Definition at line 48 of file probe-finder.c.

Function Documentation

◆ __debuginfo__new()

static struct debuginfo* __debuginfo__new ( const char *  path)
static

Definition at line 99 of file probe-finder.c.

Here is the call graph for this function:

◆ add_available_vars()

static int add_available_vars ( Dwarf_Die *  sc_die,
struct probe_finder *  pf 
)
static

Definition at line 1418 of file probe-finder.c.

Here is the call graph for this function:

◆ add_probe_trace_event()

static int add_probe_trace_event ( Dwarf_Die *  sc_die,
struct probe_finder *  pf 
)
static

Definition at line 1257 of file probe-finder.c.

Here is the call graph for this function:

◆ alloc_trace_arg_ref()

static struct probe_trace_arg_ref* alloc_trace_arg_ref ( long  offs)
static

Definition at line 160 of file probe-finder.c.

Here is the call graph for this function:

◆ call_probe_finder()

static int call_probe_finder ( Dwarf_Die *  sc_die,
struct probe_finder *  pf 
)
static

Definition at line 669 of file probe-finder.c.

Here is the call graph for this function:

◆ collect_variables_cb()

static int collect_variables_cb ( Dwarf_Die *  die_mem,
void *  data 
)
static

Definition at line 1356 of file probe-finder.c.

Here is the call graph for this function:

◆ convert_to_trace_point()

static int convert_to_trace_point ( Dwarf_Die *  sp_die,
Dwfl_Module *  mod,
Dwarf_Addr  paddr,
bool  retprobe,
const char *  function,
struct probe_trace_point tp 
)
static

Definition at line 610 of file probe-finder.c.

Here is the call graph for this function:

◆ convert_variable()

static int convert_variable ( Dwarf_Die *  vr_die,
struct probe_finder *  pf 
)
static

Definition at line 538 of file probe-finder.c.

Here is the call graph for this function:

◆ convert_variable_fields()

static int convert_variable_fields ( Dwarf_Die *  vr_die,
const char *  varname,
struct perf_probe_arg_field field,
struct probe_trace_arg_ref **  ref_ptr,
Dwarf_Die *  die_mem 
)
static

Definition at line 411 of file probe-finder.c.

Here is the call graph for this function:

◆ convert_variable_location()

static int convert_variable_location ( Dwarf_Die *  vr_die,
Dwarf_Addr  addr,
Dwarf_Op *  fb_ops,
Dwarf_Die *  sp_die,
unsigned int  machine,
struct probe_trace_arg tvar 
)
static

Definition at line 175 of file probe-finder.c.

Here is the call graph for this function:

◆ convert_variable_type()

static int convert_variable_type ( Dwarf_Die *  vr_die,
struct probe_trace_arg tvar,
const char *  cast 
)
static

Definition at line 295 of file probe-finder.c.

Here is the call graph for this function:

◆ copy_variables_cb()

static int copy_variables_cb ( Dwarf_Die *  die_mem,
void *  data 
)
static

Definition at line 1196 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__delete()

void debuginfo__delete ( struct debuginfo *  dbg)

Definition at line 147 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__find_available_vars_at()

int debuginfo__find_available_vars_at ( struct debuginfo *  dbg,
struct perf_probe_event pev,
struct variable_list **  vls 
)

Definition at line 1471 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__find_line_range()

int debuginfo__find_line_range ( struct debuginfo *  dbg,
struct line_range lr 
)

Definition at line 1754 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__find_probe_location()

static int debuginfo__find_probe_location ( struct debuginfo *  dbg,
struct probe_finder *  pf 
)
static

Definition at line 1078 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__find_probe_point()

int debuginfo__find_probe_point ( struct debuginfo *  dbg,
unsigned long  addr,
struct perf_probe_point ppt 
)

Definition at line 1542 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__find_probes()

static int debuginfo__find_probes ( struct debuginfo *  dbg,
struct probe_finder *  pf 
)
static

Definition at line 1150 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__find_trace_events()

int debuginfo__find_trace_events ( struct debuginfo *  dbg,
struct perf_probe_event pev,
struct probe_trace_event **  tevs 
)

Definition at line 1327 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__get_text_offset()

int debuginfo__get_text_offset ( struct debuginfo *  dbg,
Dwarf_Addr *  offs,
bool  adjust_offset 
)

Definition at line 1504 of file probe-finder.c.

◆ debuginfo__init_offline_dwarf()

static int debuginfo__init_offline_dwarf ( struct debuginfo *  dbg,
const char *  path 
)
static

Definition at line 64 of file probe-finder.c.

Here is the call graph for this function:

◆ debuginfo__new()

struct debuginfo* debuginfo__new ( const char *  path)

Definition at line 120 of file probe-finder.c.

Here is the call graph for this function:

◆ expand_probe_args()

static int expand_probe_args ( Dwarf_Die *  sc_die,
struct probe_finder *  pf,
struct perf_probe_arg args 
)
static

Definition at line 1224 of file probe-finder.c.

Here is the call graph for this function:

◆ find_best_scope()

static Dwarf_Die* find_best_scope ( struct probe_finder *  pf,
Dwarf_Die *  die_mem 
)
static

Definition at line 768 of file probe-finder.c.

Here is the call graph for this function:

◆ find_best_scope_cb()

static int find_best_scope_cb ( Dwarf_Die *  fn_die,
void *  data 
)
static

Definition at line 735 of file probe-finder.c.

Here is the call graph for this function:

◆ find_lazy_match_lines()

static int find_lazy_match_lines ( struct intlist list,
const char *  fname,
const char *  pat 
)
static

Definition at line 814 of file probe-finder.c.

Here is the call graph for this function:

◆ find_line_range_by_func()

static int find_line_range_by_func ( struct line_finder *  lf)
static

Definition at line 1747 of file probe-finder.c.

Here is the call graph for this function:

◆ find_line_range_by_line()

static int find_line_range_by_line ( Dwarf_Die *  sp_die,
struct line_finder *  lf 
)
static

Definition at line 1681 of file probe-finder.c.

Here is the call graph for this function:

◆ find_probe_point_by_func()

static int find_probe_point_by_func ( struct probe_finder *  pf)
static

Definition at line 1038 of file probe-finder.c.

Here is the call graph for this function:

◆ find_probe_point_by_line()

static int find_probe_point_by_line ( struct probe_finder *  pf)
static

Definition at line 808 of file probe-finder.c.

Here is the call graph for this function:

◆ find_probe_point_lazy()

static int find_probe_point_lazy ( Dwarf_Die *  sp_die,
struct probe_finder *  pf 
)
static

Definition at line 884 of file probe-finder.c.

Here is the call graph for this function:

◆ find_variable()

static int find_variable ( Dwarf_Die *  sc_die,
struct probe_finder *  pf 
)
static

Definition at line 568 of file probe-finder.c.

Here is the call graph for this function:

◆ get_real_path()

int get_real_path ( const char *  raw_path,
const char *  comp_dir,
char **  new_path 
)

Definition at line 1830 of file probe-finder.c.

Here is the call graph for this function:

◆ line_range_add_line()

static int line_range_add_line ( const char *  src,
unsigned int  lineno,
struct line_range lr 
)
static

Definition at line 1650 of file probe-finder.c.

Here is the call graph for this function:

◆ line_range_inline_cb()

static int line_range_inline_cb ( Dwarf_Die *  in_die,
void *  data 
)
static

Definition at line 1699 of file probe-finder.c.

Here is the call graph for this function:

◆ line_range_search_cb()

static int line_range_search_cb ( Dwarf_Die *  sp_die,
void *  data 
)
static

Definition at line 1713 of file probe-finder.c.

Here is the call graph for this function:

◆ line_range_walk_cb()

static int line_range_walk_cb ( const char *  fname,
int  lineno,
Dwarf_Addr addr  __maybe_unused,
void *  data 
)
static

Definition at line 1662 of file probe-finder.c.

Here is the call graph for this function:

◆ probe_point_inline_cb()

static int probe_point_inline_cb ( Dwarf_Die *  in_die,
void *  data 
)
static

Definition at line 942 of file probe-finder.c.

Here is the call graph for this function:

◆ probe_point_lazy_walker()

static int probe_point_lazy_walker ( const char *  fname,
int  lineno,
Dwarf_Addr  addr,
void *  data 
)
static

Definition at line 853 of file probe-finder.c.

Here is the call graph for this function:

◆ probe_point_line_walker()

static int probe_point_line_walker ( const char *  fname,
int  lineno,
Dwarf_Addr  addr,
void *  data 
)
static

Definition at line 784 of file probe-finder.c.

Here is the call graph for this function:

◆ probe_point_search_cb()

static int probe_point_search_cb ( Dwarf_Die *  sp_die,
void *  data 
)
static

Definition at line 981 of file probe-finder.c.

Here is the call graph for this function:

◆ pubname_search_cb()

static int pubname_search_cb ( Dwarf *  dbg,
Dwarf_Global *  gl,
void *  data 
)
static

Definition at line 1054 of file probe-finder.c.

Here is the call graph for this function:

◆ skip_prologue()

static void skip_prologue ( Dwarf_Die *  sp_die,
struct probe_finder *  pf 
)
static

Definition at line 910 of file probe-finder.c.

Here is the call graph for this function:

Variable Documentation

◆ debuginfo_path

char* debuginfo_path
static

Definition at line 51 of file probe-finder.c.

◆ distro_dwarf_types

◆ offline_callbacks

const Dwfl_Callbacks offline_callbacks
static
Initial value:
= {
.find_debuginfo = dwfl_standard_find_debuginfo,
.debuginfo_path = &debuginfo_path,
.section_address = dwfl_offline_section_address,
.find_elf = dwfl_build_id_find_elf,
}
static char * debuginfo_path
Definition: probe-finder.c:51

Definition at line 53 of file probe-finder.c.