Lines Matching +full:non +full:- +full:pc
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * dwarf-aux.c : libdw auxiliary interfaces
11 #include "dwarf-aux.h"
16 * cu_find_realpath - Find the realpath of the target file
47 * cu_get_comp_dir - Get the path of compilation directory
76 l = 0; u = nlines - 1; in cu_getsrc_die()
78 n = u - (u - l) / 2; in cu_getsrc_die()
83 u = n - 1; in cu_getsrc_die()
89 line = dwarf_onesrcline(lines, --l); in cu_getsrc_die()
108 * cu_find_lineinfo - Get a line number and file name for given address
140 return (*lineno && *fname) ? *lineno : -ENOENT; in cu_find_lineinfo()
146 * cu_walk_functions_at - Walk on function DIEs at given address
153 * should be subprogram or inlined-subroutines.
160 int ret = -ENOENT; in cu_walk_functions_at()
177 * die_get_linkage_name - Get the linkage name of the object
193 * die_compare_name - Compare diename and tname
208 * die_match_name - Match diename/linkage name and glob
231 * die_get_call_lineno - Get callsite line number of inline-function instance
234 * Get call-site line number of @in_die. This means from where the inline
243 return -ENOENT; in die_get_call_lineno()
250 * die_get_type - Get type DIE
287 * die_get_real_type - Get a type die, but skip qualifiers and typedef
313 return -ENOENT; in die_get_attr_udata()
319 * die_is_signed_type - Check whether a type DIE is signed or not
337 * die_is_func_def - Ensure that this DIE is a subprogram and definition
368 * die_entrypc - Returns entry PC (the lowest address) of a DIE
370 * @addr: where to store entry PC
372 * Since dwarf_entrypc() does not return entry PC if the DIE has only address
382 return -EINVAL; in die_entrypc()
392 return -ENOENT; in die_entrypc()
394 return dwarf_ranges(dw_die, 0, &base, addr, &end) < 0 ? -ENOENT : 0; in die_entrypc()
398 * die_is_func_instance - Ensure that this DIE is an instance of a subprogram
421 * die_get_data_member_location - Get the data-member offset
436 return -ENOENT; in die_get_data_member_location()
442 return -ENOENT; in die_get_data_member_location()
447 return -ENOTSUP; in die_get_data_member_location()
462 return -ENOENT; in die_get_call_fileno()
473 return -ENOENT; in die_get_decl_fileno()
492 * die_get_call_file - Get callsite file name of inlined function instance
495 * Get call-site file name of @in_die. This means from which file the inline
504 * die_get_decl_file - Find the declared file name of this DIE
518 * die_find_child - Generic DIE search function in DIE tree
571 addr == ad->addr) { in __die_search_func_tail_cb()
572 memcpy(ad->die_mem, fn_die, sizeof(Dwarf_Die)); in __die_search_func_tail_cb()
579 * die_find_tailfunc - Search for a non-inlined function with tail call at
585 * Search for a non-inlined function DIE with tail call at @addr. Stores the
601 /* die_find callback for non-inlined function search */
607 * Since a declaration entry doesn't has given pc, this always returns in __die_search_func_cb()
611 dwarf_haspc(fn_die, ad->addr)) { in __die_search_func_cb()
612 memcpy(ad->die_mem, fn_die, sizeof(Dwarf_Die)); in __die_search_func_cb()
619 * die_find_realfunc - Search a non-inlined function at given address
624 * Search a non-inlined function DIE which includes @addr. Stores the
653 * die_find_top_inlinefunc - Search the top inlined function at given address
670 * die_find_inlinefunc - Search an inlined function at given address
723 if (origin == NULL || origin->addr != iwp->addr) in __die_walk_instances_cb()
736 iwp->retval = iwp->callback(inst, iwp->data); in __die_walk_instances_cb()
738 return (iwp->retval) ? DIE_FIND_CB_END : DIE_FIND_CB_CONTINUE; in __die_walk_instances_cb()
742 * die_walk_instances - Walk on instances of given DIE
749 * non-zero value, or -ENOENT if there is no instance.
757 .addr = or_die->addr, in die_walk_instances()
760 .retval = -ENOENT, in die_walk_instances()
764 return -ENOENT; in die_walk_instances()
790 lw->retval = lw->callback(fname, lineno, addr, lw->data); in __die_walk_funclines_cb()
791 if (lw->retval != 0) in __die_walk_funclines_cb()
794 if (!lw->recursive) in __die_walk_funclines_cb()
801 lw->retval = lw->callback(fname, lineno, addr, lw->data); in __die_walk_funclines_cb()
802 if (lw->retval != 0) in __die_walk_funclines_cb()
807 /* Continue to search nested inlined function call-sites */ in __die_walk_funclines_cb()
847 lw->retval = __die_walk_funclines(sp_die, true, lw->callback, lw->data); in __die_walk_culines_cb()
848 if (lw->retval != 0) in __die_walk_culines_cb()
855 * die_walk_lines - Walk on lines inside given DIE
864 * and inline call-site.
886 return -EINVAL; in die_walk_lines()
892 return -EINVAL; in die_walk_lines()
898 return -ENOENT; in die_walk_lines()
912 /* Skip end-of-sequence */ in die_walk_lines()
915 /* Skip Non statement line-info */ in die_walk_lines()
929 /* Call-site check */ in die_walk_lines()
988 die_compare_name(die_mem, fvp->name) && in __die_find_variable_cb()
997 if (dwarf_haspc(die_mem, fvp->addr)) in __die_find_variable_cb()
1004 * die_find_variable_at - Find a given name variable at given address
1039 * die_find_member - Find a given name member in a data structure
1054 * die_get_typename_from_type - Get the name of given type DIE
1059 * and Return -ENOENT if failed to find type name.
1084 return -ENOENT; in die_get_typename_from_type()
1091 if (tag == DW_TAG_pointer_type && ret == -ENOENT) in die_get_typename_from_type()
1100 * die_get_typename - Get the name of given variable DIE
1105 * and Return -ENOENT if failed to find type name.
1114 return -ENOENT; in die_get_typename()
1120 * die_get_varname - Get the name and type of given variable DIE
1141 * die_get_var_innermost_scope - Get innermost scope range of given variable DIE
1147 * "@<function_name+[NN-NN,NN-NN]>".
1168 return -ENOENT; in die_get_var_innermost_scope()
1174 ret = -EINVAL; in die_get_var_innermost_scope()
1180 start -= entry; in die_get_var_innermost_scope()
1181 end -= entry; in die_get_var_innermost_scope()
1184 ret = strbuf_addf(buf, "@<%s+[%" PRIu64 "-%" PRIu64, in die_get_var_innermost_scope()
1188 ret = strbuf_addf(buf, ",%" PRIu64 "-%" PRIu64, in die_get_var_innermost_scope()
1204 * die_get_var_range - Get byte offset range of given variable DIE
1210 * "@<function_name+[NN-NN,NN-NN]>".
1231 return -ENOENT; in die_get_var_range()
1234 return -EINVAL; in die_get_var_range()
1245 start -= entry; in die_get_var_range()
1246 end -= entry; in die_get_var_range()
1248 ret = strbuf_addf(buf, "@<%s+[%" PRIu64 "-%" PRIu64, in die_get_var_range()
1252 ret = strbuf_addf(buf, ",%" PRIu64 "-%" PRIu64, in die_get_var_range()
1268 Dwarf_Addr pc; member
1299 if (end < data->pc) in __die_find_var_reg_cb()
1301 if (start > data->pc) in __die_find_var_reg_cb()
1305 if (data->reg < DWARF_OP_DIRECT_REGS) { in __die_find_var_reg_cb()
1306 if (ops->atom == (DW_OP_reg0 + data->reg) && nops == 1) in __die_find_var_reg_cb()
1309 if (ops->atom == DW_OP_regx && ops->number == data->reg && in __die_find_var_reg_cb()
1318 * die_find_variable_by_reg - Find a variable saved in a register
1320 * @pc: the program address to find
1326 Dwarf_Die *die_find_variable_by_reg(Dwarf_Die *sc_die, Dwarf_Addr pc, int reg, in die_find_variable_by_reg() argument
1330 .pc = pc, in die_find_variable_by_reg()
1356 if (ops->atom != DW_OP_addr) in __die_find_var_addr_cb()
1359 if (data->addr < ops->number) in __die_find_var_addr_cb()
1362 if (data->addr == ops->number) { in __die_find_var_addr_cb()
1364 data->offset = 0; in __die_find_var_addr_cb()
1374 if (data->addr >= ops->number + size) in __die_find_var_addr_cb()
1378 data->offset = data->addr - ops->number; in __die_find_var_addr_cb()
1385 * die_find_variable_by_addr - Find variable located at given address
1387 * @pc: the program address to find
1392 * Find the variable DIE located at the given address (in PC-relative mode).
1395 Dwarf_Die *die_find_variable_by_addr(Dwarf_Die *sc_die, Dwarf_Addr pc, in die_find_variable_by_addr() argument
1400 .pc = pc, in die_find_variable_by_addr()
1413 * die_has_loclist - Check if DW_AT_location of @vr_die is a location list
1430 * die_is_optimized_target - Check if target program is compiled with
1457 * die_search_idx - Search index of given line address
1487 * die_get_postprologue_addr - Search next address after function prologue
1491 * @hignpc: high PC address of function
1494 * Look for prologue-end marker. If there is no explicit marker, return
1526 /* clang supports prologue-end marker */ in die_get_postprologue_addr()
1548 dwarf_lineaddr(dwarf_onesrcline(lines, i - 1), in die_get_postprologue_addr()
1555 * die_skip_prologue - Use next address after prologue as probe location
1594 Dwarf_Addr pc; member
1605 if (dwarf_haspc(die_mem, data->pc)) { in __die_find_scope_cb()
1608 tmp = realloc(data->scopes, (data->nr + 1) * sizeof(*tmp)); in __die_find_scope_cb()
1612 memcpy(tmp + data->nr, die_mem, sizeof(*die_mem)); in __die_find_scope_cb()
1613 data->scopes = tmp; in __die_find_scope_cb()
1614 data->nr++; in __die_find_scope_cb()
1621 * die_get_scopes - Return a list of scopes including the address
1623 * @pc: the address to find
1629 * the last one is the innermost scope at the @pc.
1631 int die_get_scopes(Dwarf_Die *cu_die, Dwarf_Addr pc, Dwarf_Die **scopes) in die_get_scopes() argument
1634 .pc = pc, in die_get_scopes()