The code incorrectly assumed that full-sized bitfields are located at a
byte boundary.
This fixes https://bugs.llvm.org/show_bug.cgi?id=44601
Paths
| Differential D96334
Correctly recognize bitfields when emitting dwarf ClosedPublic Authored by mahkoh on Feb 9 2021, 5:56 AM.
Details Summary The code incorrectly assumed that full-sized bitfields are located at a This fixes https://bugs.llvm.org/show_bug.cgi?id=44601
Diff Detail
Event TimelineComment Actions @aprantl / @JDevlieghere you folks might want to check this out from a backwards compatibility/validation perspective. Comment Actions Let's watch the LLDB / GDB bots carefully after landing this, but it seems to make sense to me.
This revision is now accepted and ready to land.Feb 12 2021, 9:08 AM Comment Actions This makes sense, I was surprised we did not catch this on the lldb side but it looks like we do ok with this case because it appears like a regular field. Comment Actions This has come up on my radar, still applies cleanly, and passes all the debug-info tests. I'm out of time in my timezone, but without objection will commit next week (unless someone else gets there first). Closed by commit rG059d1f84d2d5: [DebugInfo] Correctly recognize bitfields when emitting dwarf (authored by jmorse). · Explain WhyApr 4 2022, 3:14 AM This revision was automatically updated to reflect the committed changes. Comment Actions Green dragon mailed me a test failure: https://green.lab.llvm.org/green/job/lldb-cmake/42719/testReport/junit/lldb-api/lang_objc_bitfield_ivars/TestBitfieldIvars_py/ Which I can't replicate locally due to lack of objc sdk stuff. Fiddling with the input though, it looks like "field1" and "field2" of "@interface HasBitfield" don't get the DIFlagBitField flag, and thus don't get recognised as being bitfields as a result of this patch (and were before?). That suggests there's more work to do / something exciting happening with flags in the frontend, however that's way out of my comfort zone. I'll revert later today if no-one has any other suggestions. A potential hacky workaround would be bool IsBitfield = DT->isBitField() || (FieldSize && Size != FieldSize); jmorse added a reverting change: rG920de9c94caf: Revert "[DebugInfo] Correctly recognize bitfields when emitting dwarf".Apr 4 2022, 9:16 AM Comment Actions I opened https://reviews.llvm.org/D140195 which adds the DIFlagBitField to objective-c members. This should fix the problem in LLDB and we should be able to bring back this patch.
Revision Contents
Diff 420127 llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/test/DebugInfo/AArch64/bitfields.ll
llvm/test/DebugInfo/ARM/big-endian-bitfield.ll
llvm/test/DebugInfo/ARM/bitfield.ll
llvm/test/DebugInfo/X86/bitfields-dwarf4.ll
llvm/test/DebugInfo/X86/bitfields.ll
llvm/test/DebugInfo/X86/debug-info-packed-struct.ll
llvm/test/DebugInfo/X86/packed_bitfields2.ll
|
This line definitely looks good.