Linux Perf
|
#include <dwarf.h>
#include <elfutils/libdw.h>
#include <elfutils/libdwfl.h>
#include <elfutils/version.h>
Go to the source code of this file.
Typedefs | |
typedef int(* | line_walk_callback_t) (const char *fname, int lineno, Dwarf_Addr addr, void *data) |
Enumerations | |
enum | { DIE_FIND_CB_END = 0, DIE_FIND_CB_CHILD = 1, DIE_FIND_CB_SIBLING = 2, DIE_FIND_CB_CONTINUE = 3 } |
Functions | |
const char * | cu_find_realpath (Dwarf_Die *cu_die, const char *fname) |
const char * | cu_get_comp_dir (Dwarf_Die *cu_die) |
int | cu_find_lineinfo (Dwarf_Die *cudie, unsigned long addr, const char **fname, int *lineno) |
int | cu_walk_functions_at (Dwarf_Die *cu_die, Dwarf_Addr addr, int(*callback)(Dwarf_Die *, void *), void *data) |
const char * | die_get_linkage_name (Dwarf_Die *dw_die) |
bool | die_is_func_def (Dwarf_Die *dw_die) |
bool | die_is_func_instance (Dwarf_Die *dw_die) |
bool | die_compare_name (Dwarf_Die *dw_die, const char *tname) |
bool | die_match_name (Dwarf_Die *dw_die, const char *glob) |
int | die_get_call_lineno (Dwarf_Die *in_die) |
const char * | die_get_call_file (Dwarf_Die *in_die) |
Dwarf_Die * | die_get_type (Dwarf_Die *vr_die, Dwarf_Die *die_mem) |
Dwarf_Die * | die_get_real_type (Dwarf_Die *vr_die, Dwarf_Die *die_mem) |
bool | die_is_signed_type (Dwarf_Die *tp_die) |
int | die_get_data_member_location (Dwarf_Die *mb_die, Dwarf_Word *offs) |
Dwarf_Die * | die_find_child (Dwarf_Die *rt_die, int(*callback)(Dwarf_Die *, void *), void *data, Dwarf_Die *die_mem) |
Dwarf_Die * | die_find_realfunc (Dwarf_Die *cu_die, Dwarf_Addr addr, Dwarf_Die *die_mem) |
Dwarf_Die * | die_find_tailfunc (Dwarf_Die *cu_die, Dwarf_Addr addr, Dwarf_Die *die_mem) |
Dwarf_Die * | die_find_top_inlinefunc (Dwarf_Die *sp_die, Dwarf_Addr addr, Dwarf_Die *die_mem) |
Dwarf_Die * | die_find_inlinefunc (Dwarf_Die *sp_die, Dwarf_Addr addr, Dwarf_Die *die_mem) |
int | die_walk_instances (Dwarf_Die *in_die, int(*callback)(Dwarf_Die *, void *), void *data) |
int | die_walk_lines (Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) |
Dwarf_Die * | die_find_variable_at (Dwarf_Die *sp_die, const char *name, Dwarf_Addr addr, Dwarf_Die *die_mem) |
Dwarf_Die * | die_find_member (Dwarf_Die *st_die, const char *name, Dwarf_Die *die_mem) |
int | die_get_typename (Dwarf_Die *vr_die, struct strbuf *buf) |
int | die_get_varname (Dwarf_Die *vr_die, struct strbuf *buf) |
int | die_get_var_range (Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf) |
bool | die_is_optimized_target (Dwarf_Die *cu_die) |
void | die_skip_prologue (Dwarf_Die *sp_die, Dwarf_Die *cu_die, Dwarf_Addr *entrypc) |
typedef int(* line_walk_callback_t) (const char *fname, int lineno, Dwarf_Addr addr, void *data) |
Definition at line 108 of file dwarf-aux.h.
anonymous enum |
Enumerator | |
---|---|
DIE_FIND_CB_END | |
DIE_FIND_CB_CHILD | |
DIE_FIND_CB_SIBLING | |
DIE_FIND_CB_CONTINUE |
Definition at line 75 of file dwarf-aux.h.
int cu_find_lineinfo | ( | Dwarf_Die * | cu_die, |
unsigned long | addr, | ||
const char ** | fname, | ||
int * | lineno | ||
) |
cu_find_lineinfo - Get a line number and file name for given address : a CU DIE : An address : a pointer which returns the file name string : a pointer which returns the line number
Find a line number and file name for in .
Definition at line 84 of file dwarf-aux.c.
const char* cu_find_realpath | ( | Dwarf_Die * | cu_die, |
const char * | fname | ||
) |
cu_find_realpath - Find the realpath of the target file : A DIE(dwarf information entry) of CU(compilation Unit) : The tail filename of the target file
Find the real(long) path of in .
Definition at line 35 of file dwarf-aux.c.
const char* cu_get_comp_dir | ( | Dwarf_Die * | cu_die | ) |
cu_get_comp_dir - Get the path of compilation directory : a CU DIE
Get the path of compilation directory of given . Since this depends on DW_AT_comp_dir, older gcc will not embedded it. In that case, this returns NULL.
Definition at line 67 of file dwarf-aux.c.
int cu_walk_functions_at | ( | Dwarf_Die * | cu_die, |
Dwarf_Addr | addr, | ||
int(*)(Dwarf_Die *, void *) | callback, | ||
void * | data | ||
) |
cu_walk_functions_at - Walk on function DIEs at given address : A CU DIE : An address : A callback which called with found DIEs : A user data
Walk on function DIEs at given in . Passed DIEs should be subprogram or inlined-subroutines.
Definition at line 114 of file dwarf-aux.c.
bool die_compare_name | ( | Dwarf_Die * | dw_die, |
const char * | tname | ||
) |
die_compare_name - Compare diename and tname : a DIE : a string of target name
Compare the name of and . Return false if has no name.
Definition at line 158 of file dwarf-aux.c.
Dwarf_Die* die_find_child | ( | Dwarf_Die * | rt_die, |
int(*)(Dwarf_Die *, void *) | callback, | ||
void * | data, | ||
Dwarf_Die * | die_mem | ||
) |
die_find_child - Generic DIE search function in DIE tree : a root DIE : a callback function : a user data passed to the callback function : a buffer for result DIE
Trace DIE tree from and call for each child DIE. If returns DIE_FIND_CB_END, this stores the DIE into and returns it. If returns DIE_FIND_CB_CONTINUE, this continues to trace the tree. Optionally, can return DIE_FIND_CB_CHILD and DIE_FIND_CB_SIBLING, those means trace only the children and trace only the siblings respectively. Returns NULL if can't find any appropriate DIE.
Definition at line 431 of file dwarf-aux.c.
Dwarf_Die* die_find_inlinefunc | ( | Dwarf_Die * | sp_die, |
Dwarf_Addr | addr, | ||
Dwarf_Die * | die_mem | ||
) |
die_find_inlinefunc - Search an inlined function at given address : a subprogram DIE which including : target address : a buffer for result DIE
Search an inlined function DIE which includes . Stores the DIE to and returns it if found. Returns NULL if failed. If several inlined functions are expanded recursively, this trace it down and returns deepest one.
Definition at line 579 of file dwarf-aux.c.
Dwarf_Die* die_find_member | ( | Dwarf_Die * | st_die, |
const char * | name, | ||
Dwarf_Die * | die_mem | ||
) |
Dwarf_Die* die_find_realfunc | ( | Dwarf_Die * | cu_die, |
Dwarf_Addr | addr, | ||
Dwarf_Die * | die_mem | ||
) |
die_find_realfunc - Search a non-inlined function at given address : a CU DIE which including : target address : a buffer for result DIE
Search a non-inlined function DIE which includes . Stores the DIE to and returns it if found. Returns NULL if failed.
Definition at line 526 of file dwarf-aux.c.
Dwarf_Die* die_find_tailfunc | ( | Dwarf_Die * | cu_die, |
Dwarf_Addr | addr, | ||
Dwarf_Die * | die_mem | ||
) |
die_find_tailfunc - Search for a non-inlined function with tail call at given address : a CU DIE which including : target address : a buffer for result DIE
Search for a non-inlined function DIE with tail call at . Stores the DIE to and returns it if found. Returns NULL if failed.
Definition at line 487 of file dwarf-aux.c.
Dwarf_Die* die_find_top_inlinefunc | ( | Dwarf_Die * | sp_die, |
Dwarf_Addr | addr, | ||
Dwarf_Die * | die_mem | ||
) |
die_find_top_inlinefunc - Search the top inlined function at given address : a subprogram DIE which including : target address : a buffer for result DIE
Search an inlined function DIE which includes . Stores the DIE to and returns it if found. Returns NULL if failed. Even if several inlined functions are expanded recursively, this doesn't trace it down, and returns the topmost one.
Definition at line 562 of file dwarf-aux.c.
Dwarf_Die* die_find_variable_at | ( | Dwarf_Die * | sp_die, |
const char * | name, | ||
Dwarf_Addr | addr, | ||
Dwarf_Die * | die_mem | ||
) |
const char* die_get_call_file | ( | Dwarf_Die * | in_die | ) |
die_get_call_file - Get callsite file name of inlined function instance : a DIE of an inlined function instance
Get call-site file name of . This means from which file the inline function is called.
Definition at line 401 of file dwarf-aux.c.
int die_get_call_lineno | ( | Dwarf_Die * | in_die | ) |
die_get_call_lineno - Get callsite line number of inline-function instance : a DIE of an inlined function instance
Get call-site line number of . This means from where the inline function is called.
Definition at line 196 of file dwarf-aux.c.
int die_get_data_member_location | ( | Dwarf_Die * | mb_die, |
Dwarf_Word * | offs | ||
) |
die_get_data_member_location - Get the data-member offset : a DIE of a member of a data structure : The offset of the member in the data structure
Get the offset of in the data structure including , and stores result offset to . If any error occurs this returns errno.
Definition at line 346 of file dwarf-aux.c.
const char* die_get_linkage_name | ( | Dwarf_Die * | dw_die | ) |
die_get_linkage_name - Get the linkage name of the object : A DIE of the object
Get the linkage name attiribute of given . For C++ binary, the linkage name will be the mangled symbol.
Definition at line 142 of file dwarf-aux.c.
Dwarf_Die* die_get_real_type | ( | Dwarf_Die * | vr_die, |
Dwarf_Die * | die_mem | ||
) |
die_get_real_type - Get a type die, but skip qualifiers and typedef : a DIE of a variable : where to store a type DIE
Get a DIE of the type of given variable (), and store it to die_mem. Return NULL if fails to get a type DIE. If the type is qualifiers (e.g. const) or typedef, this skips it and tries to find real type (structure or basic types, e.g. int).
Definition at line 255 of file dwarf-aux.c.
Dwarf_Die* die_get_type | ( | Dwarf_Die * | vr_die, |
Dwarf_Die * | die_mem | ||
) |
die_get_type - Get type DIE : a DIE of a variable : where to store a type DIE
Get a DIE of the type of given variable (), and store it to die_mem. Return NULL if fails to get a type DIE.
Definition at line 216 of file dwarf-aux.c.
int die_get_typename | ( | Dwarf_Die * | vr_die, |
struct strbuf * | buf | ||
) |
die_get_typename - Get the name of given variable DIE : a variable DIE : a strbuf for result type name
Get the name of and stores it to . Return 0 if succeeded. and Return -ENOENT if failed to find type name. Note that the result will stores typedef name if possible, and stores "*(function_type)" if the type is a function pointer.
Definition at line 931 of file dwarf-aux.c.
int die_get_var_range | ( | Dwarf_Die * | sp_die, |
Dwarf_Die * | vr_die, | ||
struct strbuf * | buf | ||
) |
int die_get_varname | ( | Dwarf_Die * | vr_die, |
struct strbuf * | buf | ||
) |
die_get_varname - Get the name and type of given variable DIE : a variable DIE : a strbuf for type and variable name
Get the name and type of and stores it in as "type\tname".
Definition at line 969 of file dwarf-aux.c.
bool die_is_func_def | ( | Dwarf_Die * | dw_die | ) |
die_is_func_def - Ensure that this DIE is a subprogram and definition : a DIE
Ensure that this DIE is a subprogram and NOT a declaration. This returns true if is a function definition.
Definition at line 315 of file dwarf-aux.c.
bool die_is_func_instance | ( | Dwarf_Die * | dw_die | ) |
die_is_func_instance - Ensure that this DIE is an instance of a subprogram : a DIE
Ensure that this DIE is an instance (which has an entry address). This returns true if is a function instance. If not, you need to call die_walk_instances() to find actual instances.
Definition at line 331 of file dwarf-aux.c.
bool die_is_optimized_target | ( | Dwarf_Die * | cu_die | ) |
bool die_is_signed_type | ( | Dwarf_Die * | tp_die | ) |
die_is_signed_type - Check whether a type DIE is signed or not : a DIE of a type
Get the encoding of and return true if the encoding is signed.
Definition at line 297 of file dwarf-aux.c.
bool die_match_name | ( | Dwarf_Die * | dw_die, |
const char * | glob | ||
) |
die_match_name - Match diename/linkage name and glob : a DIE : a string of target glob pattern
Glob matching the name of and . Return false if matching fail. This also match linkage name.
Definition at line 174 of file dwarf-aux.c.
void die_skip_prologue | ( | Dwarf_Die * | sp_die, |
Dwarf_Die * | cu_die, | ||
Dwarf_Addr * | entrypc | ||
) |
int die_walk_instances | ( | Dwarf_Die * | or_die, |
int(*)(Dwarf_Die *, void *) | callback, | ||
void * | data | ||
) |
die_walk_instances - Walk on instances of given DIE : an abstract original DIE : a callback function which is called with instance DIE : user data
Walk on the instances of give . must be an inlined function declartion. This returns the return value of if it returns non-zero value, or -ENOENT if there is no instance.
Definition at line 647 of file dwarf-aux.c.
int die_walk_lines | ( | Dwarf_Die * | rt_die, |
line_walk_callback_t | callback, | ||
void * | data | ||
) |
die_walk_lines - Walk on lines inside given DIE : a root DIE (CU, subprogram or inlined_subroutine) : callback routine : user data
Walk on all lines inside given and call on each line. If the is a function, walk only on the lines inside the function, otherwise must be a CU DIE. Note that this walks not only dwarf line list, but also function entries and inline call-site.
Definition at line 759 of file dwarf-aux.c.