die_find_child(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… die_find_child(9) β€” the kernel API manual, but make it make sense

okay bestie, welcome to the die_find_child(9) page, straight out of the Kernel API Manual. this one is literally the generic DIE search function in a DIE tree πŸ¦‹ and it's way less scary than it sounds, i promise. come walk the tree with me ✨


🌸 NAME 🌸

die_find_child β€” the generic DIE search function in the DIE tree. that's it, that's the whole vibe check πŸ’–


✨ SYNOPSIS ✨

Dwarf_Die * die_find_child (Dwarf_Die *rt_die , int
(*callback)(Dwarf_Die *, void *) , void *data , Dwarf_Die *die_mem );

like, four things go in, and a Dwarf_Die * comes out. slay πŸŽ€


🫢 ARGUMENTS 🫢

  • rt_die β€” a root DIE. this is where the whole thing starts, your main character DIE πŸ‘‘
  • callback β€” a callback function. yes, a function pointer, and yes, you have to bring your own
  • data β€” a user data passed to the callback function. your little care package to the callback 🎁
  • die_mem β€” a buffer for result DIE. where the winner gets stored πŸ’…

πŸ”₯ DESCRIPTION πŸ”₯

so here's what happens. it traces the DIE tree from rt_die and calls callback for each child DIE. no cap, every single child 🧚

now, the callback gets to make choices, and its return value is basically the plot twist:

  • if callback returns DIE_FIND_CB_END, this stores the DIE into die_mem and returns it. found it, we're done, iconic ⭐
  • if callback returns DIE_FIND_CB_CONTINUE, this continues to trace the tree. keep going bestie 🌈
  • optionally, callback can return DIE_FIND_CB_CHILD and DIE_FIND_CB_SIBLING β€” those mean trace only the children and trace only the siblings respectively. okay that's lowkey specific but the manual says it so i'm saying it 🫑

and if callback can't find any appropriate DIE, it returns NULL. sad girl hours 😭

ngl, DIE_FIND_CB_CHILD and DIE_FIND_CB_SIBLING are tagged as optional behaviour in the source text, so don't go assuming your callback can always get away with them πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

bestie the friend group is huge, buckle up. all of these live in the kernel file ./tools/perf/util/dwarf-aux.c:

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_get_decl_file(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) πŸ’œ

like. that's the whole group chat. go say hi πŸŽ€


and that's the page, babes πŸ¦‹ this little number came from ./tools/perf/util and it's dated October 2026 β€” so yeah, it's giving future-fresh. go trace that tree, you absolute icon πŸ’…βœ¨

πŸ“¦ where this page comes from