This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.
pubfngetSymbolName(di: *constDwarf, address: u64) ?[]constu8 {
// Iterate the function list backwards so that we see child DIEs before their parents. This is
// important because `DW_TAG_inlined_subroutine` DIEs will have a range which is a sub-range of
// their caller, and we want to return the callee's name, not the caller's.
vari: usize = di.func_list.items.len;
while (i > 0) {
i -= 1;
constfunc = &di.func_list.items[i];
if (func.pc_range) |range| {
if (address >= range.startandaddress < range.end) {
returnfunc.name;
}
}
}
returnnull;
}