core files should include DWARF
At present, when a user process dumps core the kernel copies the symbol table and any CTF information from the object files of the executing process into the core file. In this way, debuggers like MDB have access to the correct debugging information for a core file, without needed to retain and correlate with the executable or libraries, or any ancillary debug information files.
If an executable, or any dependent library, includes DWARF or any other debugging information, we should copy it to the core file as we do with the symbols and CTF.
For example, these sections are included in a Rust program built with debug information:
$ elfdump -c target/debug/sample-server |grep '\.debug' Section Header: sh_name: .debug_gdb_scripts Section Header: sh_name: .debug_abbrev Section Header: sh_name: .debug_info Section Header: sh_name: .debug_aranges Section Header: sh_name: .debug_str Section Header: sh_name: .debug_pubnames Section Header: sh_name: .debug_pubtypes Section Header: sh_name: .debug_line Section Header: sh_name: .debug_ranges Section Header: sh_name: .debug_loc Section Header: sh_name: .debug_frame