This patch adds verification checks for the unit header chain in the .debug_info section.
Specifically, for each unit in the .debug_info section, the verifier checks that:
- The unit length is valid (i.e. the unit can actually fit in the .debug_info section)
- The dwarf version of the unit is valid
- The address size is valid (4 or 8)
- The unit type (if the unit is in dwarf5) is valid
- The debug_abbrev_offset is valid
I'm still working on test cases, but I wanted to submit the patch here in order to get feedback.
If these static methods are used only by the verifier, maybe they should just be local functions in DWARFVerifier.cpp.