die_get_decl_file(9)
π die_get_decl_file (9) β a Kernel API Manual moment π
okay so bestie, welcome to the die_get_decl_file page, straight out of the Kernel API Manual β¨ this one's short and sweet and honestly kind of iconic for how much drama it packs into four lines. let's get into it π
πΈ NAME πΈ
die_get_decl_file β find the declared file name of this DIE π
like, the declared file name. of a DIE. we're doing DWARF archaeology today bestie, no cap.
β¨ SYNOPSIS β¨
const char * die_get_decl_file (Dwarf_Die *dw_die );
that's the whole vibe: takes a Dwarf_Die * and hands you back a const char *. simple. elegant. ate. π₯
π¦ ARGUMENTS π¦
dw_dieβ a DIE for something declared. that's it, that's the argument, she's not complicated π«Ά
π DESCRIPTION π
so what does she do? she gets the declared file name of dw_die. literally that's the whole thing π get declared file name β return it. main character energy, zero filler, we love a function that knows exactly what it is β
β οΈ NOTE β οΈ
okay this is the important part so listen up bestie π’ since some version of clang's DWARF5 implementation incorrectly uses file index 0 for DW_AT_decl_file (yes, a bug, in the wild, bestie ππ), die_get_decl_file will return NULL for such cases.
and the takeaway? use this function instead. she handles the messy clang situation for you so you don't have to ππ
ngl this is exactly the kind of caveat you screenshot and send to the group chat. clang said "file index 0, sounds fine" and everyone else had to cope π
π§ SEE ALSO π§
she does NOT walk alone, okay, she has a whole friend group. all of these live in the kernel file ./tools/perf/util/dwarf-aux.c and honestly? the roster is giving extended universe π
cu_find_realpath(9),cu_get_comp_dir(9),cu_find_lineinfo(9),cu_walk_functions_at(9)die_get_linkage_name(9),die_compare_name(9),die_match_name(9),die_get_call_lineno(9)die_get_type(9),die_get_real_type(9),die_get_pointer_type(9),die_is_signed_type(9)die_is_func_def(9),die_entrypc(9),die_is_func_instance(9),die_get_data_member_location(9)die_get_call_file(9),die_find_child(9),die_find_tailfunc(9),die_find_realfunc(9)die_find_top_inlinefunc(9),die_find_inlinefunc(9),die_find_func_rettype(9),die_walk_instances(9)die_walk_lines(9),die_find_variable_at(9),die_find_member(9),die_get_typename_from_type(9)die_get_typename(9),die_get_varname(9),die_get_var_innermost_scope(9),die_get_var_range(9)is_breg_access_indirect(9),die_find_variable_by_reg(9),die_find_variable_by_addr(9),die_collect_vars(9)die_collect_global_vars(9),die_get_cfa(9),die_get_scopes(9),die_get_member_type(9)die_deref_ptr_type(9)
iykyk π
and that's the page!! π shipped to you from ./tools/perf/util, dated October 2026 β go forth and get those declared file names, bestie, and remember: NULL is a valid answer sometimes and that's clang's fault, not yours πβ¨π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms