[llvm] [DebugInfo] DWARF Units without DIEs are okay (PR #88840)

Will Hawkins via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 14:57:09 PDT 2024


hawkinsw wrote:

> Really appreciate your usage and feedback, though...
> 
> > Nothing prevents a DWARF Unit from having no DIEs.
> 
> I think the DWARF spec does?
> 
> > For each compilation unit compiled with a DWARF producer, a contribution is made to the .debug_info section of the object file. Each such contribution consists of a compilation unit header (see Section 7.5.1.1 on page 200) followed by a single DW_TAG_compile_unit or DW_TAG_partial_unit debugging information entry, together with its children.
> 
> (bit out of date/incomplete - doesn't mention all the other valid top level tags (it does mention type units in the next sentence, but doesn't mention skeleton units until a fair bit later))
> 

As I read on, I come to unit_length defined in 7.5.1.1.1 which implies, to me, that the unit_length is determinitive in whether or not there are any children DIEs. That being said, I am really just the messenger. The person who originally added the code that is causing these warnings, had a very specific reason for adding them and I am just trying to help (see below).

> So I'm not sure it's super helpful to more seamlessly support this situation?
> 
> What's the use case you have in mind here?

In the gdb test suite, each of the compiled binaries generated for testing has "dummy CUs" at the beginning and end of the .debug_info sections to test certain code paths. For more information on why they were added, see https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5ef670d81fd222ae5edfa1428ad48710f5e10d35. 

Thank you for the response. I am just trying to help and certainly don't want to cause any additional work for anyone.



https://github.com/llvm/llvm-project/pull/88840


More information about the llvm-commits mailing list