This patch prevents dsymutil from resolving a reference to a NULL DIE
when a bogus reference happens to be coincidentally referencing a NULL
DIE. Now this is detected as an invalid reference and a warning is
printed.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/tools/dsymutil/X86/null-die.s | ||
---|---|---|
10 | Do you need the final binary file? My guess is that you only need the .o file and a debug map which can be YAML. You can use 'llvm-dsymutil -dump-debug-map' on null_die to extract it. | |
tools/dsymutil/DwarfLinker.cpp | ||
1499 | I would add a comment here. There is no valid reason for the DIE to be NULL. Something along the lines of "In a file with broken references, an attribute might point to a NULL DIE". |
test/tools/dsymutil/X86/null-die.s | ||
---|---|---|
4–10 | This seems like a rather large test case for this small issue? |
- Address review comments from Fred and David.
- Convert test to YAML with instruction on how to reproduce the binary.
test/tools/dsymutil/X86/null-die.test | ||
---|---|---|
10–19 ↗ | (On Diff #116018) | This DWARF could be a bit simpler by skipping argc and argv and having foo be void() rather than int(int), have foo call some other function & compile without optimizations: void f1() {} __attribute__((always_inline)) void f2() { f1(); } int main() { f2(); } (marginally simpler if 'int main' were just 'void f3' - though then I guess you'd need a stub object (which wouldn't need debug info anyway) to link in main, not sure, which might be more hassle than necessary - if you did that you could also put f1 out of line in that object file so there would be no DWARF for f1 either, again simplifying the test case a bit) Also potentially simpler if this is in C++ and f2 is marked 'inline' as well, that way there's no out of line definition of f2. |
I think the test can go in the generic test directory. If you're not generating any output, it shouldn't need the X86 backend.
Otherwise, LGTM
Do you need the final binary file? My guess is that you only need the .o file and a debug map which can be YAML. You can use 'llvm-dsymutil -dump-debug-map' on null_die to extract it.