Currently we have: ... value = read_16 (ptr); if (value < 2 || value > 4) { error (0, 0, "%s: DWARF version %d unhandled", dso->filename, value); return 1; } ...
A first step could be to improve an error message like this: ... dwz: /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/nonvar-access/nonvar-access: Unknown DWARF DW_OP_160 ... to use "DW_OP_implicit_pointer" instead, by updating dwarf2.def and friends.
Yeah. Next step teaching it to read the DWARF 5 section headers, understand new forms etc., still shouldn't be that hard. The hardest part is actually optimizing it, switching between DW_FORM_implicit_const and the old forms as needed in order to have smallest possible output.
Created attachment 12564 [details] Support few DWARF-5 DW_AT_*+DW_OP_* This patch adds a minimal set of DW_AT_*+DW_OP_* to successfully pass LLVM-11 testsuite with its DWZ support (off-trunk so far).
Some initial patches and an outline of some of the work needed: https://sourceware.org/pipermail/dwz/2020q3/000668.html
The normal DWARF5 as generated by GCC is supported now. Some additional improvements to support more variants: - Handle DW_UT_type (in .debug_info variant of DWARF4 .debug_types) - Handle DW_FORM_strx[1234] (and .debug_str_offsets, DW_AT_str_offsets_base) - Handle DW_FORM_addrx[1234] (and .debug_addr section, DW_OP_addrx, DW_OP_constx, DW_AT_addr_base) - Handle DW_FORM_rnglistx and DW_FORM_loclistsx (DW_AT_rnglists_base, DW_AT_loclists_base) - Handle .debug_names (standardized variant of .gdb_index) - Use DW_FORM_ref_sup[48] and DW_FORM_strp_sup instead of DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt (Probably behind --dwarf5 flag) - Generate .debug_sup section (standardized variant of .gnu_debugaltlink) (Probably behind --dwarf5 flag)
> - Handle DW_FORM_addrx[1234] > (and .debug_addr section, DW_OP_addrx, DW_OP_constx, DW_AT_addr_base) I have a test-case where these are present. It's well known MozillaFirefox package: https://splichal.eu/tmp/libxul.so-86.0.1-1.1.x86_64.debug.zst It's rejected currently in: $ dwz libxul.so-86.0.1-1.1.x86_64.debug -L 200000000 -l 40000000 dwz: ./usr/lib/debug/usr/lib64/firefox/libxul.so-86.0.1-1.1.x86_64.debug: Unknown DWARF DW_OP_addrx