Files
llvm-project/lldb/test/Shell/SymbolFile/PDB/udt-layout.test
nerix e08d8e3d16 [LLDB][PDB] Run UDT layout test with native PDB too (#159769)
This test was failing with the native plugin due to two reasons:

1. The static `C::abc` was printed as `(int) ::C::abc = 123`
2. The order of the base classes of [`C`
(`List::Value`)](b7e4edca3d/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp (L30))
is different between DIA and the native plugin. I don't know how the
order in the DIA plugin is determined - it prints `B<0>`, `B<1>`,
`B<2>`, `B<3>`, `A`. The native plugin follows the order of the bases in
memory and prints `B<2>`, `B<3>`, `A`, `B<0>`, `B<1>` (last three are
the virtual bases).
    <details><summary>Class layout of C</summary>
    
    ```
    class C size(88):
            +---
    0       | +--- (base class B<2>)
    0       | | {vbptr}
    8       | | _a
    9.      | | _b (bitstart=3,nbits=6)
    11      | | _c
            | +---
    15      | +--- (base class B<3>)
    15      | | {vbptr}
    23      | | _a
    24.     | | _b (bitstart=3,nbits=6)
    26      | | _c
            | +---
            | <alignment member> (size=2)
    32      | _x
    36      | _y
    38      | _z
            | <alignment member> (size=1)
            | <alignment member> (size=2)
            +---
            +--- (virtual base A)
    40      | {vfptr}
    48      | U _u
            | <alignment member> (size=4)
            +---
            +--- (virtual base B<0>)
    56      | {vbptr}
    64      | _a
    65.     | _b (bitstart=3,nbits=6)
    67      | _c
            +---
            +--- (virtual base B<1>)
    71      | {vbptr}
    79      | _a
    80.     | _b (bitstart=3,nbits=6)
    82      | _c
            +---
    ```
    </details>

I split the tests for the plugins for better readability.
2025-09-23 11:34:48 +02:00

52 lines
1.2 KiB
Plaintext

REQUIRES: target-windows, lld, diasdk
RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/UdtLayoutTest.cpp
RUN: %lldb -b -s %S/Inputs/UdtLayoutTest.script -- %t.exe | FileCheck %s
CHECK:(int) C::abc = 123
CHECK:(List[16]) ls = {
CHECK: [15] = {
CHECK: Prev = nullptr
CHECK: Next = nullptr
CHECK: Value = {
CHECK: B<0> = {
CHECK: A = {
CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2)
CHECK: }
CHECK: _a = '\x01'
CHECK: _b = 2
CHECK: _c = 3
CHECK: }
CHECK: B<1> = {
CHECK: A = {
CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2)
CHECK: }
CHECK: _a = '\x02'
CHECK: _b = 4
CHECK: _c = 6
CHECK: }
CHECK: B<2> = {
CHECK: A = {
CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2)
CHECK: }
CHECK: _a = '\x03'
CHECK: _b = 6
CHECK: _c = 9
CHECK: }
CHECK: B<3> = {
CHECK: A = {
CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2)
CHECK: }
CHECK: _a = '\x04'
CHECK: _b = 8
CHECK: _c = 12
CHECK: }
CHECK: A = {
CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2)
CHECK: }
CHECK: _x = 5
CHECK: _y = 10
CHECK: _z = '\x0f'
CHECK: }
CHECK: }
CHECK:}