The DWARF3 documentation had inconsistency concerning the reserved range for unit length values. The issue was fixed in DWARF4.
See http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2008-June/003343.html
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This magic number appears in many places; it should have a symbolic name in llvm/include/llvm/BinaryFormat/Dwarf.h, in the LLVMConstants enumeration.
A quick grep suggests there are not very many more places that you would have to change. You can limit this patch to DebugInfo/DWARF if you like; I expect there are more places in CodeGen/AsmPrinter, which could be done separately.
I mean, the purposes for the patches are different. This one fixes an existing flaw while your suggestion improves code quality. It is usually better not to intermix such different aims in one patch, no?
There is no hard-and-fast rule about this; the project does prefer incremental changes, but the determination of what "size" increment to perform is not strictly defined. Personally I would do it all at once, with the stated purpose being to clean up the use of magic numbers (some of which happen to be incorrect). If you want to work in smaller increments, that's okay too.
I see that there are no tests verifying that DWARFDebugLine handles the invalid length correctly (assuming you ran the tests and none failed), so please add one.
There were three tests in unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp which failed, so they are also updated in this patch. Or do you mean something different?
If you found the unittests cases because they failed, that's good enough for me.
LGTM