[Dwarf-Discuss] How to map [[no_unique_address]] into DWARF

Jan Kratochvil jan.kratochvil@redhat.com
Mon Jun 7 18:36:21 GMT 2021


On Mon, 07 Jun 2021 20:27:39 +0200, David Blaikie via Dwarf-Discuss wrote:
> Ah, in the sense that you want to be able to derive new types based on
> the DWARF?
> Fair enough.

The real reason is that when using the derived class C LLDB+LLVM layout engine
will assert because FieldOffsets from DWARF say C::c is at offset 0 but
inherited class B makes such layout impossible (without [[no_unique_address]]
which LLDB does not see from DWARF).

One could workaround that assert some way but the underlying reason of the
assert is that LLDB does not see full definition of class B from DWARF.

Which itself can be shown on the reproducer below which should be fixed anyway.


Jan


> On Mon, Jun 7, 2021 at 11:20 AM Jan Kratochvil <jan.kratochvil at redhat.com> wrote:
> > $ echo 'struct A {}; struct B { [[no_unique_address]] A a; } b;'|clang -Wall -g -c -o a.o -x c++ -;lldb ./a.o
> > (lldb) expr -- struct C:B{char c;};&((C *)nullptr)->c);
> > (lldb) expr -- struct C:B{char c;};sizeof(C);
> >
> > Actual:
> > (char *) $0 = 0x0000000000000001 ""
> > (unsigned long) $1 = 2
> >
> > Expected:
> > (char *) $0 = 0x0000000000000000
> > (unsigned long) $1 = 1




More information about the Dwarf-discuss mailing list