diff options
Diffstat (limited to 'llvm/test/DebugInfo/PDB')
-rw-r--r-- | llvm/test/DebugInfo/PDB/Inputs/merge-ids-1.yaml | 36 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/Inputs/merge-ids-2.yaml | 31 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-1.yaml | 113 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-2.yaml | 143 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/Inputs/merge-types-1.yaml (renamed from llvm/test/DebugInfo/PDB/Inputs/merge1.yaml) | 0 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/Inputs/merge-types-2.yaml (renamed from llvm/test/DebugInfo/PDB/Inputs/merge2.yaml) | 0 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test | 65 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/pdbdump-mergeids.test | 31 | ||||
-rw-r--r-- | llvm/test/DebugInfo/PDB/pdbdump-mergetypes.test | 4 |
9 files changed, 421 insertions, 2 deletions
diff --git a/llvm/test/DebugInfo/PDB/Inputs/merge-ids-1.yaml b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-1.yaml new file mode 100644 index 00000000000..3b5e8b5e761 --- /dev/null +++ b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-1.yaml @@ -0,0 +1,36 @@ +IpiStream: + Records: + # 'One' [TypeIndex: 0x1000 (4096)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'One' + # 'Two' [TypeIndex: 0x1001 (4097)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'Two' + # 'OnlyInFirst' [TypeIndex: 0x1002 (4098)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'OnlyInFirst' + # 'SubOne' [TypeIndex: 0x1003 (4099)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'SubOne' + # 'SubTwo' [TypeIndex: 0x1004 (4100)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'SubTwo' + # 'SubOne', 'SubTwo' [TypeIndex: 0x1005 (4101)] + - Kind: LF_SUBSTR_LIST + StringList: + StringIndices: [ 4099, 4100 ] + # 'Main' {'SubOne', 'SubTwo'} [TypeIndex: 0x1006 (4102)] + - Kind: LF_STRING_ID + StringId: + Id: 4101 + String: 'Main' diff --git a/llvm/test/DebugInfo/PDB/Inputs/merge-ids-2.yaml b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-2.yaml new file mode 100644 index 00000000000..74f6ee50224 --- /dev/null +++ b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-2.yaml @@ -0,0 +1,31 @@ +IpiStream: + Records: + # 'SubTwo' [TypeIndex: 0x1000 (4096)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'SubTwo' + # 'OnlyInSecond' [TypeIndex: 0x1001 (4097)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'OnlyInSecond' + # 'SubOne' [TypeIndex: 0x1002 (4098)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'SubOne' + # 'SubOne', 'SubTwo' [TypeIndex: 0x1003 (4099)] + - Kind: LF_SUBSTR_LIST + StringList: + StringIndices: [ 4098, 4096 ] + # 'One' [TypeIndex: 0x1004 (4100)] + - Kind: LF_STRING_ID + StringId: + Id: 0 + String: 'One' + # 'Main' {'SubOne', 'SubTwo'} [TypeIndex: 0x1005 (4101)] + - Kind: LF_STRING_ID + StringId: + Id: 4099 + String: 'Main' diff --git a/llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-1.yaml b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-1.yaml new file mode 100644 index 00000000000..30ff563d7fc --- /dev/null +++ b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-1.yaml @@ -0,0 +1,113 @@ +# The idea is to set up some types in the TPI stream, and then have records in +# the IPI stream that refer to them. There are three types of IPI records that +# can refer to TPI records. They are: +# 1) LF_PROCEDURE - Referred to by LF_FUNC_ID +# 2) LF_STRUCTURE - Referred to by LF_UDT_MOD_SRC_LINE +# Referred to by LF_UDT_SRC_LINE +# 3) LF_MFUNCTION - Referred to by LF_MFUNC_ID +# We will set up one of each of these, and then create IPI records that refer to +# them. We intentionally choose an unintuitive ordering of the records in both +# streams (while still maintaining the topological sorting required by CodeView +# type streams), to make sure the merging algorithm is sufficiently exercised. +# For easy understanding, a semantic representation of the types we will set up +# is as follows: +# - int main(int, char**) +# +# - struct FooBar { +# public: +# void *FooMember; +# void FooMethod(int); +# }; +TpiStream: + Records: + # TypeIndex: 4096 (0x1000) + # char** + - Kind: LF_POINTER + Pointer: + ReferentType: 1136 + Attrs: 32778 + # TypeIndex: 4097 (0x1001) + # public void *FooMember + - Kind: LF_FIELDLIST + FieldList: + - Kind: LF_MEMBER + DataMember: + Attrs: 3 # public + Type: 1027 # void* + FieldOffset: 0 + Name: FooMember # FooMember + # TypeIndex: 4098 (0x1002) + # (int, char**) + - Kind: LF_ARGLIST + ArgList: + ArgIndices: [ 116, 4096 ] + # TypeIndex: 4099 (0x1003) + # struct FooBar { + # public: + # void *FooMember; + # }; + - Kind: LF_STRUCTURE + Class: + MemberCount: 1 + Options: [ None, HasUniqueName ] + FieldList: 4097 + Name: FooBar + UniqueName: 'FooBar' + DerivationList: 0 + VTableShape: 0 + Size: 4 + # TypeIndex: 4100 (0x1004) + # FooBar * + - Kind: LF_POINTER + Pointer: + ReferentType: 4099 # FooBar + Attrs: 32778 + # TypeIndex: 4101 (0x1005) + # (int) + - Kind: LF_ARGLIST + ArgList: + ArgIndices: [ 116 ] + # TypeIndex: 4102 (0x1006) + - Kind: LF_MFUNCTION + MemberFunction: + ReturnType: 3 # void + ClassType: 4099 # struct FooBar + ThisType: 4100 # FooBar * + CallConv: ThisCall + Options: [ None, Constructor ] + ParameterCount: 1 + ArgumentList: 4101 # (int) + ThisPointerAdjustment: 0 + # TypeIndex: 4103 (0x1007) + # int (int, char**) + - Kind: LF_PROCEDURE + Procedure: + ReturnType: 116 # int + CallConv: NearC + Options: [ None ] + ParameterCount: 2 + ArgumentList: 4098 # (int, char**) +IpiStream: + Records: + # TypeIndex: 4096 (0x1000) + # int main(int, char **) + - Kind: LF_FUNC_ID + FuncId: + ParentScope: 0 + FunctionType: 4103 # int main(int, char**) + Name: main + # TypeIndex: 4097 (0x1001) + # void FooBar::FooMethod(int) + - Kind: LF_MFUNC_ID + MemberFuncId: + ClassType: 4099 # struct FooBar + FunctionType: 4102 # void FooMethod(int) + Name: FooMethod + # TypeIndex: 4098 (0x1002) + # struct FooBar + - Kind: LF_UDT_MOD_SRC_LINE + UdtModSourceLine: + UDT: 4099 # struct FooBar + SourceFile: 0 # We don't support this yet + LineNumber: 0 + Module: 0 # We don't support this yet diff --git a/llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-2.yaml b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-2.yaml new file mode 100644 index 00000000000..1bd54deebff --- /dev/null +++ b/llvm/test/DebugInfo/PDB/Inputs/merge-ids-and-types-2.yaml @@ -0,0 +1,143 @@ +# In file 1 we set up some basic types and IDs to refer to them. In this file +# we will set up the same types. For some of them we will make them identical +# but re-order the records in the file to make sure they have different type +# indices and appear in different orders. In other cases we will make slight +# adjustments to the types, to ensure that they do not get merged in. +# +# For easy understanding, a semantic representation of the types we will set up +# is as follows: +# - int main(int, char**) // This record should share an LF_PROCEDURE and id +# // record with corresponding function from the +# // first file. +# - int main2(int, char**) // This record should share the LF_PROCEDURE +# // record but have a unique id record. +# - void foo(int, char**) // This record should have a unique LF_PROCEDURE +# // record, but the LF_ARGLIST record internally +# // should be shared. +# +# - struct FooBar { // Because the type of this record exactly matches +# // the corresponding file, its entire type record +# // hierarchy should be shared. +# public: +# void *FooMember; +# void FooMethod2(int); // Note that the *type* of this member should be +# // the same as the type of the record from the +# // first stream. But since it has a different +# // name, it will not share an id record. +# }; +TpiStream: + Records: + # TypeIndex: 4096 (0x1000) + # (int) + - Kind: LF_ARGLIST + ArgList: + ArgIndices: [ 116 ] + # TypeIndex: 4097 (0x1001) + # public void *FooMember + - Kind: LF_FIELDLIST + FieldList: + - Kind: LF_MEMBER + DataMember: + Attrs: 3 # public + Type: 1027 # void* + FieldOffset: 0 + Name: FooMember # FooMember + # TypeIndex: 4098 (0x1002) + # char** + - Kind: LF_POINTER + Pointer: + ReferentType: 1136 + Attrs: 32778 + # TypeIndex: 4099 (0x1003) + # (int, char**) + - Kind: LF_ARGLIST + ArgList: + ArgIndices: [ 116, 4098 ] + # TypeIndex: 4100 (0x1004) + # struct FooBar { + # public: + # void *FooMember; + # }; + - Kind: LF_STRUCTURE + Class: + MemberCount: 1 + Options: [ None, HasUniqueName ] + FieldList: 4097 + Name: FooBar + UniqueName: 'FooBar' + DerivationList: 0 + VTableShape: 0 + Size: 4 + # TypeIndex: 4101 (0x1005) + # void (int, char**) + - Kind: LF_PROCEDURE + Procedure: + ReturnType: 3 # void + CallConv: NearC + Options: [ None ] + ParameterCount: 2 + ArgumentList: 4099 # (int, char**) + # TypeIndex: 4102 (0x1006) + # FooBar * + - Kind: LF_POINTER + Pointer: + ReferentType: 4100 # FooBar + Attrs: 32778 + # TypeIndex: 4103 (0x1007) + # int (int, char**) + - Kind: LF_PROCEDURE + Procedure: + ReturnType: 116 # int + CallConv: NearC + Options: [ None ] + ParameterCount: 2 + ArgumentList: 4099 # (int, char**) + # TypeIndex: 4104 (0x1008) + - Kind: LF_MFUNCTION + MemberFunction: + ReturnType: 3 # void + ClassType: 4100 # struct FooBar + ThisType: 4102 # FooBar * + CallConv: ThisCall + Options: [ None, Constructor ] + ParameterCount: 1 + ArgumentList: 4096 # (int) + ThisPointerAdjustment: 0 +IpiStream: + Records: + # TypeIndex: 4096 (0x1000) + # struct FooBar + - Kind: LF_UDT_MOD_SRC_LINE + UdtModSourceLine: + UDT: 4100 # struct FooBar + SourceFile: 0 # We don't support this yet + LineNumber: 0 + Module: 0 # We don't support this yet + # TypeIndex: 4097 (0x1001) + # int main2(int, char **) + - Kind: LF_FUNC_ID + FuncId: + ParentScope: 0 + FunctionType: 4103 # int main2(int, char**) + Name: main2 + # TypeIndex: 4098 (0x1002) + # void foo(int, char **) + - Kind: LF_FUNC_ID + FuncId: + ParentScope: 0 + FunctionType: 4101 # void main2(int, char**) + Name: foo + # TypeIndex: 4099 (0x1003) + # void FooBar::FooMethod2(int) + - Kind: LF_MFUNC_ID + MemberFuncId: + ClassType: 4100 # struct FooBar + FunctionType: 4104 # void FooBar::FooMethod2(int) + Name: FooMethod2 + # TypeIndex: 4100 (0x1004) + # int main(int, char **) + - Kind: LF_FUNC_ID + FuncId: + ParentScope: 0 + FunctionType: 4103 # int main(int, char**) + Name: main diff --git a/llvm/test/DebugInfo/PDB/Inputs/merge1.yaml b/llvm/test/DebugInfo/PDB/Inputs/merge-types-1.yaml index 89d471e3343..89d471e3343 100644 --- a/llvm/test/DebugInfo/PDB/Inputs/merge1.yaml +++ b/llvm/test/DebugInfo/PDB/Inputs/merge-types-1.yaml diff --git a/llvm/test/DebugInfo/PDB/Inputs/merge2.yaml b/llvm/test/DebugInfo/PDB/Inputs/merge-types-2.yaml index b6cbdb98f0c..b6cbdb98f0c 100644 --- a/llvm/test/DebugInfo/PDB/Inputs/merge2.yaml +++ b/llvm/test/DebugInfo/PDB/Inputs/merge-types-2.yaml diff --git a/llvm/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test b/llvm/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test new file mode 100644 index 00000000000..ac32ce040b9 --- /dev/null +++ b/llvm/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test @@ -0,0 +1,65 @@ +; RUN: llvm-pdbdump yaml2pdb -pdb=%t.1.pdb %p/Inputs/merge-ids-and-types-1.yaml +; RUN: llvm-pdbdump yaml2pdb -pdb=%t.2.pdb %p/Inputs/merge-ids-and-types-2.yaml +; RUN: llvm-pdbdump merge -pdb=%t.3.pdb %t.1.pdb %t.2.pdb +; RUN: llvm-pdbdump raw -tpi-records %t.3.pdb | FileCheck -check-prefix=TPI-TYPES %s +; RUN: llvm-pdbdump raw -tpi-records %t.3.pdb | FileCheck -check-prefix=INTMAIN %s +; RUN: llvm-pdbdump raw -tpi-records %t.3.pdb | FileCheck -check-prefix=VOIDMAIN %s +; RUN: llvm-pdbdump raw -ipi-records %t.3.pdb | FileCheck -check-prefix=IPI-TYPES %s +; RUN: llvm-pdbdump raw -ipi-records %t.3.pdb | FileCheck -check-prefix=IPI-NAMES %s +; RUN: llvm-pdbdump raw -ipi-records %t.3.pdb | FileCheck -check-prefix=IPI-UDT %s + +TPI-TYPES: Type Info Stream (TPI) +TPI-TYPES: Record count: 9 +TPI-TYPES-DAG: TypeLeafKind: LF_POINTER +TPI-TYPES-DAG: TypeLeafKind: LF_FIELDLIST +TPI-TYPES-DAG: TypeLeafKind: LF_ARGLIST +TPI-TYPES-DAG: TypeLeafKind: LF_STRUCTURE +TPI-TYPES-DAG: TypeLeafKind: LF_MEMBER +TPI-TYPES-DAG: TypeLeafKind: LF_POINTER +TPI-TYPES-DAG: TypeLeafKind: LF_ARGLIST +TPI-TYPES-DAG: TypeLeafKind: LF_MFUNCTION +TPI-TYPES-DAG: TypeLeafKind: LF_PROCEDURE +TPI-TYPES-DAG: TypeLeafKind: LF_PROCEDURE +TPI-TYPES-DAG: TypeLeafKind: LF_ARGLIST + +; Both procedures should use the same arglist even though they have a different +; return type. +INTMAIN: ArgList ([[ID:.*]]) +INTMAIN-NEXT: TypeLeafKind: LF_ARGLIST +INTMAIN-NEXT: NumArgs: 2 +INTMAIN-NEXT: Arguments [ +INTMAIN-NEXT: ArgType: int +INTMAIN-NEXT: ArgType: char** +INTMAIN: TypeLeafKind: LF_PROCEDURE +INTMAIN: ReturnType: int +INTMAIN: NumParameters: 2 +INTMAIN-NEXT: ArgListType: (int, char**) ([[ID]]) + +VOIDMAIN: ArgList ([[ID:.*]]) +VOIDMAIN-NEXT: TypeLeafKind: LF_ARGLIST +VOIDMAIN-NEXT: NumArgs: 2 +VOIDMAIN-NEXT: Arguments [ +VOIDMAIN-NEXT: ArgType: int +VOIDMAIN-NEXT: ArgType: char** +VOIDMAIN: TypeLeafKind: LF_PROCEDURE +VOIDMAIN: ReturnType: void +VOIDMAIN: NumParameters: 2 +VOIDMAIN-NEXT: ArgListType: (int, char**) ([[ID]]) + +IPI-TYPES: Type Info Stream (IPI) +IPI-TYPES: Record count: 6 +IPI-TYPES-DAG: TypeLeafKind: LF_FUNC_ID +IPI-TYPES-DAG: TypeLeafKind: LF_MFUNC_ID +IPI-TYPES-DAG: TypeLeafKind: LF_UDT_MOD_SRC_LINE +IPI-TYPES-DAG: TypeLeafKind: LF_FUNC_ID +IPI-TYPES-DAG: TypeLeafKind: LF_FUNC_ID +IPI-TYPES-DAG: TypeLeafKind: LF_MFUNC_ID + +IPI-NAMES-DAG: Name: main +IPI-NAMES-DAG: Name: FooMethod +IPI-NAMES-DAG: Name: main2 +IPI-NAMES-DAG: Name: foo +IPI-NAMES-DAG: Name: FooMethod2 + +IPI-UDT: TypeLeafKind: LF_UDT_MOD_SRC_LINE +IPI-UDT-NEXT: UDT: FooBar diff --git a/llvm/test/DebugInfo/PDB/pdbdump-mergeids.test b/llvm/test/DebugInfo/PDB/pdbdump-mergeids.test new file mode 100644 index 00000000000..6a4d19eba04 --- /dev/null +++ b/llvm/test/DebugInfo/PDB/pdbdump-mergeids.test @@ -0,0 +1,31 @@ +; RUN: llvm-pdbdump yaml2pdb -pdb=%t.1.pdb %p/Inputs/merge-ids-1.yaml +; RUN: llvm-pdbdump yaml2pdb -pdb=%t.2.pdb %p/Inputs/merge-ids-2.yaml +; RUN: llvm-pdbdump merge -pdb=%t.3.pdb %t.1.pdb %t.2.pdb +; RUN: llvm-pdbdump raw -ipi-records %t.3.pdb | FileCheck -check-prefix=MERGED %s +; RUN: llvm-pdbdump raw -ipi-records %t.3.pdb | FileCheck -check-prefix=SUBSTRS %s +; RUN: llvm-pdbdump raw -tpi-records %t.3.pdb | FileCheck -check-prefix=TPI-EMPTY %s + + +MERGED: Type Info Stream (IPI) +MERGED: Record count: 8 +MERGED-DAG: StringData: One +MERGED-DAG: StringData: Two +MERGED-DAG: StringData: SubOne +MERGED-DAG: StringData: SubTwo +MERGED-DAG: StringData: Main +MERGED-DAG: TypeLeafKind: LF_SUBSTR_LIST +MERGED-DAG: StringData: OnlyInFirst +MERGED-DAG: StringData: OnlyInSecond + +SUBSTRS: StringList +SUBSTRS: TypeLeafKind: LF_SUBSTR_LIST +SUBSTRS-NEXT: NumStrings: 2 +SUBSTRS-NEXT: Strings [ +SUBSTRS-NEXT: SubOne +SUBSTRS-NEXT: SubTwo +SUBSTRS: StringId +SUBSTRS-NEXT: TypeLeafKind: LF_STRING_ID +SUBSTRS-NEXT: Id: "SubOne" "SubTwo" +SUBSTRS-NEXT: StringData: Main + +TPI-EMPTY: Record count: 0 diff --git a/llvm/test/DebugInfo/PDB/pdbdump-mergetypes.test b/llvm/test/DebugInfo/PDB/pdbdump-mergetypes.test index 96f6316d476..a26b9263182 100644 --- a/llvm/test/DebugInfo/PDB/pdbdump-mergetypes.test +++ b/llvm/test/DebugInfo/PDB/pdbdump-mergetypes.test @@ -1,5 +1,5 @@ -; RUN: llvm-pdbdump yaml2pdb -pdb=%t.1.pdb %p/Inputs/merge1.yaml
-; RUN: llvm-pdbdump yaml2pdb -pdb=%t.2.pdb %p/Inputs/merge2.yaml
+; RUN: llvm-pdbdump yaml2pdb -pdb=%t.1.pdb %p/Inputs/merge-types-1.yaml
+; RUN: llvm-pdbdump yaml2pdb -pdb=%t.2.pdb %p/Inputs/merge-types-2.yaml
; RUN: llvm-pdbdump merge -pdb=%t.3.pdb %t.1.pdb %t.2.pdb
; RUN: llvm-pdbdump raw -tpi-records %t.3.pdb | FileCheck -check-prefix=MERGED %s
; RUN: llvm-pdbdump raw -tpi-records %t.3.pdb | FileCheck -check-prefix=ARGLIST %s
|