[PATCH] D82881: [DEBUGINFO]Fix debug info for packed bitfields.

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 06:44:09 PDT 2020


ABataev added a comment.

In D82881#2137938 <https://reviews.llvm.org/D82881#2137938>, @dblaikie wrote:

> In D82881#2135641 <https://reviews.llvm.org/D82881#2135641>, @ABataev wrote:
>
> > In D82881#2134913 <https://reviews.llvm.org/D82881#2134913>, @dblaikie wrote:
> >
> > > In D82881#2133548 <https://reviews.llvm.org/D82881#2133548>, @ABataev wrote:
> > >
> > > > In D82881#2133511 <https://reviews.llvm.org/D82881#2133511>, @aprantl wrote:
> > > >
> > > > > And conversely, with this patch applied, do GDB and LLDB still produce the expected result?
> > > >
> > > >
> > > > GDB works correctly. Did not check with lldb, but it also should work. The result is similar to the debug info, produced for the next code:
> > > >
> > > >   struct {
> > > >   short : 3;
> > > >   short : 6;
> > > >   } a;
> > > >
> > >
> > >
> > > Similar, but seems different in a critical way - in that code, the type of the field is short, which has size 2. Which matches the size of the field.
> > >
> > > I think it would be pretty surprising to handle DWARF where the size of a field is different from the size of the type of that field?
> >
> >
> > The standard clearly says:
> >  A base type entry has a DW_AT_byte_size attribute, whose value is a constant, describing the size in bytes of the storage unit used to represent an object of the given type.
> >  In our example, the storage size is the same, just like for short.
>
>
> The storage size is the same as what?
>
> It looks like/my understanding is this patch produces a field of type 'char' with size 2 bytes - which seems surprisingly inconsistent, at least. If there are other pre-existing examples of fields having larger sizes than their types, that might be useful to draw analogy and confidence from.


Found a discussion in the dwarf-discuss mailing list http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2011-September/003881.html. Looks like signed offsets are allowed in DWARF2.
The bug I'm trying to fix is the incompatibility with NVPTX ptxas compiler. It does not allow signed integers in debug sections. Would it be good to emit bit_offset as `DW_FORM_udata` for NVPTX target to fix incompatibility? Checked that it works with ptxas.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82881/new/

https://reviews.llvm.org/D82881





More information about the llvm-commits mailing list