I've just committed a fix for PR24169, which makes dwz generate an error for a certain type of invalid dwarf, in this case an invalid DW_FORM_ref_addr reference. The fix follows the just-in-time style of the implementation in the sense that it generates the error when and where it encounters it, in this case in write_die. There are a number of problem with this approach: - errors are not detected reliably: if dwz decides that it's not a good idea to optimize the file, it will not report an error, because we never get to write_die. - the error may have to be handled in more than one location. - it may take relatively long before the error is detected. The fix for this is to have a verify phase (before or in combination with read_debug_info). Such a phase would obviously add more processing time, so it would be good to have the user to be able to switch that on or off.
Patch in attachment 11587 [details] has a type of verification phase.