This patch adds prologue verification, which is already present in Apple's dwarfdump. It checks for invalid directory indices and warns about duplicate file paths.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/DebugInfo/DWARF/DWARFVerifier.cpp | ||
---|---|---|
455 ↗ | (On Diff #113991) | Don't branch-to-unreachable. Use an assert instead. Is the false return from getFileNameByIndex really impossible? (has the FileIndex been checked for validity? What other error paths does getFileNameByIndex have, if any?) |
lib/DebugInfo/DWARF/DWARFVerifier.cpp | ||
---|---|---|
455 ↗ | (On Diff #113991) | Thanks, an assert definitely better expresses the intent. The only path that returns false is this: if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex)) return false; The FileLineInfoKind is hard-coded so that can't trigger it. The index can't really be invalid either as we're iterating over the list of indices. If this returns false here it must be a programmer error. |
lib/DebugInfo/DWARF/DWARFVerifier.cpp | ||
---|---|---|
455 ↗ | (On Diff #113991) | What about the unused variable though? I need the function call to populate the string, so I'd have to assign it to a bool that's only used in the assert. |
Why assert and not emit an error???
lib/DebugInfo/DWARF/DWARFVerifier.cpp | ||
---|---|---|
455 ↗ | (On Diff #113991) | This is a verifier that is trying to validate that the DWARF is valid. A bad file index is quite possible. Why not emit an appropriate error message here? |
llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp | ||
---|---|---|
2072 | Porlogue? :-) |
Porlogue? :-)