pub fn emit_debug_sections(
table: &[(u64, u32)],
text_sym: usize,
) -> Vec<EmittedDwarfSection>Expand description
Emit an address-ordered (arm_addr, line) table as a FULL minimal DWARF unit
(gimli::write) and return EVERY non-empty .debug_* section it produces —
.debug_info, .debug_abbrev, .debug_str, .debug_line (and
.debug_line_str/.debug_ranges etc. when non-empty). The caller composes
the table (one address-sorted, de-duped sequence covering every function);
this produces the section bytes for non-ALLOC ELF PROGBITS sections.
Returns an empty Vec for an empty table (nothing to map ⇒ no sections ⇒
output stays byte-identical).
Crucially this emits a real root DW_TAG_compile_unit DIE with DW_AT_name,
DW_AT_low_pc/DW_AT_high_pc spanning the emitted text, and the line program
attached — so the CU’s DW_AT_stmt_list points at .debug_line. That makes
the line table reachable via the NORMAL debugger walk (.debug_info → CU →
DW_AT_stmt_list → line program), not just a standalone .debug_line parse.
Ports tests/dwarf_emit_roundtrip_step4.rs::emit_dwarf (which emits the same
full unit and round-trips through Dwarf::units()).