The parsing method did not check reading errors and might easily fall into an infinite loop on an invalid input because of that.
Details
Diff Detail
Unit Tests
Event Timeline
lld/ELF/DWARF.h | ||
---|---|---|
59 | Why did the types here need to change? | |
lld/ELF/SyntheticSections.cpp | ||
2713 | Could you put a comment here saying what the 0 means (i.e. /*Something=*/0), please? | |
lld/test/ELF/gdb-index-invalid-pubnames.s | ||
5 | It might make sense to extend this test to show that LLD doesn't use the warned-for pubnames section, if there's a way for that to make sense. | |
llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames-invalid.s | ||
1 | I guess the pubnames section is fairly straightforward, but I personally feel like it would be best to write the testing for this and D83050 as gtest unit tests. That being said, a single test that shows how llvm-dwarfdump handles errors for malformed pubnames sections might make sense, although in that case I'd put it alongside the debug_line_invalid.test in the llvm-dwarfdump directory. I would probably add basic coverage for the .debug_pubtypes and the GNU variant sections too, since they go through different code paths to get there. |
lld/ELF/DWARF.h | ||
---|---|---|
59 | This helps to have access to the sec field without casing. That is used in readPubNamesAndTypes(). | |
lld/ELF/SyntheticSections.cpp | ||
2713 | OK, changed to config->wordsize to avoid uncertainties. | |
lld/test/ELF/gdb-index-invalid-pubnames.s | ||
5 | This test is solely about avoiding hanging in LLD; it should be as short and simple as possible. There are other tests for LLD to check that the information from .debug_gnu_pub* sections is passed to the index. And there are (or will be) tests for llvm-dwarfdump to check what is read from valid or malformed sections. | |
llvm/test/DebugInfo/X86/dwarfdump-debug-pubnames-invalid.s | ||
1 | I usually prefer lit tests, because they are much handier and easier to maintain, especially in cases like that, with just two line of source code and a few RUN/CHECK commands. I'll move the test to the directory of llvm-dwarfdump tests and extend it to cover all four tables. |
llvm/test/tools/llvm-dwarfdump/X86/debug_pub_tables_invalid.s | ||
---|---|---|
2–7 ↗ | (On Diff #275403) | Might be nice if you could test all these in one go? (so it's one invocation of llvm-dwarfdump rather than 4 - save on process overhead, etc) |
Why did the types here need to change?