summaryrefslogtreecommitdiffstats
path: root/llvm/test/DebugInfo/PDB
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-12-05 23:58:18 +0000
committerZachary Turner <zturner@google.com>2017-12-05 23:58:18 +0000
commit376d437776fc5c6a8f3d0923f9b5a061708a422f (patch)
tree042e022791070a61c192f339322b65700226c5d6 /llvm/test/DebugInfo/PDB
parent251720194f7897f8dfa7f97dbb6d7ba49592d8de (diff)
downloadbcm5719-llvm-376d437776fc5c6a8f3d0923f9b5a061708a422f.tar.gz
bcm5719-llvm-376d437776fc5c6a8f3d0923f9b5a061708a422f.zip
Teach llvm-pdbutil to dump types from object files.
llvm-svn: 319859
Diffstat (limited to 'llvm/test/DebugInfo/PDB')
-rw-r--r--llvm/test/DebugInfo/PDB/Inputs/obj-hashes-1.yaml50
-rw-r--r--llvm/test/DebugInfo/PDB/Inputs/obj-hashes-2.yaml55
-rw-r--r--llvm/test/DebugInfo/PDB/obj-globalhash.test54
3 files changed, 159 insertions, 0 deletions
diff --git a/llvm/test/DebugInfo/PDB/Inputs/obj-hashes-1.yaml b/llvm/test/DebugInfo/PDB/Inputs/obj-hashes-1.yaml
new file mode 100644
index 00000000000..80d7b3c87b6
--- /dev/null
+++ b/llvm/test/DebugInfo/PDB/Inputs/obj-hashes-1.yaml
@@ -0,0 +1,50 @@
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: [ ]
+sections:
+ - Name: '.debug$T'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ Types:
+ # char**
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 272
+ Attrs: 32778
+ # int**
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 372
+ Attrs: 32778
+ # int***
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 4097
+ Attrs: 32778
+ # (char**, int***)
+ - Kind: LF_ARGLIST
+ ArgList:
+ ArgIndices: [ 4096, 4098 ]
+ # int** (char**, int***)
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 4097
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 2
+ ArgumentList: 4099
+symbols:
+ - Name: '.debug$T'
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 68
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 2189213922
+ Number: 6
+...
diff --git a/llvm/test/DebugInfo/PDB/Inputs/obj-hashes-2.yaml b/llvm/test/DebugInfo/PDB/Inputs/obj-hashes-2.yaml
new file mode 100644
index 00000000000..1c0aa2cc175
--- /dev/null
+++ b/llvm/test/DebugInfo/PDB/Inputs/obj-hashes-2.yaml
@@ -0,0 +1,55 @@
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: [ ]
+sections:
+ - Name: '.debug$T'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ Alignment: 4
+ Types:
+ # int**
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 372
+ Attrs: 32778
+ # int***
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 4096
+ Attrs: 32778
+ # char**
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 272
+ Attrs: 32778
+ # double**
+ - Kind: LF_POINTER
+ Pointer:
+ ReferentType: 321
+ Attrs: 32778
+ # (char**, int***)
+ - Kind: LF_ARGLIST
+ ArgList:
+ ArgIndices: [ 4098, 4097 ]
+ # int** (char**, int***)
+ - Kind: LF_PROCEDURE
+ Procedure:
+ ReturnType: 4096
+ CallConv: NearC
+ Options: [ None ]
+ ParameterCount: 2
+ ArgumentList: 4100
+symbols:
+ - Name: '.debug$T'
+ Value: 0
+ SectionNumber: 6
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 68
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 2189213922
+ Number: 6
+...
diff --git a/llvm/test/DebugInfo/PDB/obj-globalhash.test b/llvm/test/DebugInfo/PDB/obj-globalhash.test
new file mode 100644
index 00000000000..629192905a4
--- /dev/null
+++ b/llvm/test/DebugInfo/PDB/obj-globalhash.test
@@ -0,0 +1,54 @@
+RUN: yaml2obj %p/Inputs/obj-hashes-1.yaml > %T/obj-hashes-1.obj
+RUN: yaml2obj %p/Inputs/obj-hashes-2.yaml > %T/obj-hashes-2.obj
+RUN: echo obj-hashes-1 > %T/hashes-combined.out
+RUN: llvm-pdbutil dump -type-extras %T/obj-hashes-1.obj >> %T/hashes-combined.out
+RUN: echo obj-hashes-2 >> %T/hashes-combined.out
+RUN: llvm-pdbutil dump -type-extras %T/obj-hashes-2.obj >> %T/hashes-combined.out
+RUN: cat %T/hashes-combined.out | FileCheck --check-prefix=CHECK-ONE %s
+RUN: cat %T/hashes-combined.out | FileCheck --check-prefix=CHECK-TWO %s
+RUN: cat %T/hashes-combined.out | FileCheck --check-prefix=CHECK-THREE %s
+RUN: cat %T/hashes-combined.out | FileCheck --check-prefix=CHECK-FOUR %s
+RUN: cat %T/hashes-combined.out | FileCheck --check-prefix=CHECK-FIVE %s
+RUN: cat %T/hashes-combined.out | FileCheck --check-prefix=CHECK-SIX %s
+
+; char**. Both the local and global hashes should be the same, since the only
+; back-references are for simple types which have fixed indices.
+CHECK-ONE: obj-hashes-1
+CHECK-ONE: TI: 0x1001, LocalHash: 8C051421, GlobalHash: 8B2BA87CC27BF9D290A31A6070FA296AAA577E53
+CHECK-ONE: obj-hashes-2
+CHECK-ONE: TI: 0x1000, LocalHash: 8C051421, GlobalHash: 8B2BA87CC27BF9D290A31A6070FA296AAA577E53
+
+; int**. Same as char**, both the local and global hashes should be the same.
+CHECK-TWO: obj-hashes-1
+CHECK-TWO: TI: 0x1000, LocalHash: 8A50855E, GlobalHash: 1522A98D88FAF71B618D97BCAC2B89A424EC4805
+CHECK-TWO: obj-hashes-2
+CHECK-TWO: TI: 0x1002, LocalHash: 8A50855E, GlobalHash: 1522A98D88FAF71B618D97BCAC2B89A424EC4805
+
+; int***. Different local hashes, since the referent type (int**) is not at the
+; same TypeIndex in both streams. Same global hash, since they represent the
+; same record.
+CHECK-THREE: obj-hashes-1
+CHECK-THREE: TI: 0x1002, LocalHash: C1B0E34B, GlobalHash: EC11CE9F78D6BF61F8D913A9E2C98293782A7EB4
+CHECK-THREE: obj-hashes-2
+CHECK-THREE: TI: 0x1001, LocalHash: 813E462C, GlobalHash: EC11CE9F78D6BF61F8D913A9E2C98293782A7EB4
+
+; arg list (char**, int***). Different local hashes, since the parameter types
+; both occur at different TypeIndices in their respective input streams. Same
+; global hash, since the global hash of all referenced types is the same in
+; both streams.
+CHECK-FOUR: obj-hashes-1
+CHECK-FOUR: TI: 0x1003, LocalHash: F9B7D117, GlobalHash: 1088AD64CEBC88D9E015058A159516AF20B79286
+CHECK-FOUR: obj-hashes-2
+CHECK-FOUR: TI: 0x1004, LocalHash: 29800A81, GlobalHash: 1088AD64CEBC88D9E015058A159516AF20B79286
+
+; double**. This is only in stream 2, as a means to throw off the indexing.
+CHECK-FIVE: obj-hashes-1
+CHECK-FIVE: obj-hashes-2
+CHECK-FIVE: TI: 0x1003, LocalHash: A8EEF56D, GlobalHash: 7803BBDB2947EF46BEA2310D102BD08F68315506
+
+; int** (char**, int***). For the same logic as described in previous records,
+; these two records have the same global hash but different local hashes.
+CHECK-SIX: obj-hashes-1
+CHECK-SIX: TI: 0x1004, LocalHash: 25FFC8CB, GlobalHash: 457ABCB8AB70407594B5D72BF471B6BDECC99BC9
+CHECK-SIX: obj-hashes-2
+CHECK-SIX: TI: 0x1005, LocalHash: F34B0F86, GlobalHash: 457ABCB8AB70407594B5D72BF471B6BDECC99BC9
OpenPOWER on IntegriCloud