This repository was archived by the owner on Nov 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 503
This repository was archived by the owner on Nov 1, 2020. It is now read-only.
c++ linker drops UserDefinedTypes information. #3538
Copy link
Copy link
Closed
Labels
Description
static void TestClassWithClass() {
MyClassA a = new MyClassA();
a.b = new MyClassB();
a.b.b = 100;
//MyClassB b = a.b;
}
class MyClassA {
public MyClassB b;
}
class MyClassB {
public int b;
}
For this test the debugger doesn't show MyClassB fields, because there is no complete UDT in the pdb. There is only a forward declaration.
The complete UDT exists in the obj, but it is dropped in the C++ linker.
Obj dump:
0x1235 : Length = 30, Leaf = 0x1504 LF_CLASS
# members = 0, field list type 0x0000, FORWARD REF,
Derivation list type 0x0000, VT shape type 0x0000
Size = 0, class name = MyClassA
0x1236 : Length = 10, Leaf = 0x1002 LF_POINTER
Pointer (__near), Size: 0
Element type : 0x1235
0x1237 : Length = 30, Leaf = 0x1504 LF_CLASS
# members = 0, field list type 0x0000, FORWARD REF,
Derivation list type 0x0000, VT shape type 0x0000
Size = 0, class name = MyClassB
0x1238 : Length = 10, Leaf = 0x1002 LF_POINTER
Pointer (__near), Size: 0
Element type : 0x1237
0x1239 : Length = 26, Leaf = 0x1203 LF_FIELDLIST
list[0] = LF_BCLASS, none, type = 0x1001, offset = 0
list[1] = LF_MEMBER, public, type = T_INT4(0074), offset = 8
member name = 'b'
0x123a : Length = 30, Leaf = 0x1504 LF_CLASS
# members = 1, field list type 0x1239,
Derivation list type 0x0000, VT shape type 0x0000
Size = 8, class name = MyClassB
0x123b : Length = 10, Leaf = 0x1002 LF_POINTER
Pointer (__near), Size: 0
Element type : 0x123A
0x123c : Length = 26, Leaf = 0x1203 LF_FIELDLIST
list[0] = LF_BCLASS, none, type = 0x1001, offset = 0
list[1] = LF_MEMBER, public, type = 0x1238, offset = 8
member name = 'b'
0x123d : Length = 30, Leaf = 0x1504 LF_CLASS
# members = 1, field list type 0x123c,
Derivation list type 0x0000, VT shape type 0x0000
Size = 8, class name = MyClassA
0x123e : Length = 10, Leaf = 0x1002 LF_POINTER
Pointer (__near), Size: 0
Element type : 0x123D
Pdb dump:
0x1745 : Length = 30, Leaf = 0x1504 LF_CLASS
# members = 0, field list type 0x0000, FORWARD REF,
Derivation list type 0x0000, VT shape type 0x0000
Size = 0, class name = MyClassB
0x1746 : Length = 10, Leaf = 0x1002 LF_POINTER
Pointer (__near), Size: 0
Element type : 0x1745
0x1747 : Length = 26, Leaf = 0x1203 LF_FIELDLIST
list[0] = LF_BCLASS, none, type = 0x15EF, offset = 0
list[1] = LF_MEMBER, public, type = 0x1746, offset = 8
member name = 'b'
0x1748 : Length = 30, Leaf = 0x1504 LF_CLASS
# members = 1, field list type 0x1747,
Derivation list type 0x0000, VT shape type 0x0000
Size = 8, class name = MyClassA, UDT(0x00001748)
0x1749 : Length = 10, Leaf = 0x1002 LF_POINTER
Pointer (__near), Size: 0
Element type : 0x1748
Reactions are currently unavailable