summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-05 21:40:33 +0000
committerZachary Turner <zturner@google.com>2017-06-05 21:40:33 +0000
commit349c18f8377aa46af024e0ba7d312304ad2ac28a (patch)
tree1bbd719c419cb69fa87cd037de57ab206216741e /llvm/test
parent5b0bf2ff0d80998804871ab151ec2f00ff2dee8b (diff)
downloadbcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.tar.gz
bcm5719-llvm-349c18f8377aa46af024e0ba7d312304ad2ac28a.zip
[CodeView] Handle Cross Module Imports and Exports.
While it's not entirely clear why a compiler or linker might put this information into an object or PDB file, one has been spotted in the wild which was causing llvm-pdbdump to crash. This patch adds support for reading-writing these sections. Since I don't know how to get one of the native tools to generate this kind of debug info, the only test here is one in which we feed YAML into the tool to produce a PDB and then spit out YAML from the resulting PDB and make sure that it matches. llvm-svn: 304738
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml24
-rw-r--r--llvm/test/DebugInfo/PDB/cross-module-import-export.test60
2 files changed, 84 insertions, 0 deletions
diff --git a/llvm/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml b/llvm/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml
new file mode 100644
index 00000000000..4c3f28c3102
--- /dev/null
+++ b/llvm/test/DebugInfo/PDB/Inputs/cross-module-import-export.yaml
@@ -0,0 +1,24 @@
+DbiStream:
+ Modules:
+ - Module: 'Foo.obj'
+ ObjFile: 'Foo.obj'
+ Subsections:
+ - !CrossModuleExports
+ Exports:
+ - LocalId: 4852
+ GlobalId: 9283
+ - LocalId: 2147487875
+ GlobalId: 9123
+ - Module: 'Bar.obj'
+ ObjFile: 'Bar.obj'
+ Subsections:
+ - !CrossModuleExports
+ Exports:
+ - LocalId: 4265
+ GlobalId: 6097
+ - LocalId: 4297
+ GlobalId: 4677
+ - !CrossModuleImports
+ Imports:
+ - Module: 'Foo.obj'
+ Imports: [ 4852, 2147487875 ]
diff --git a/llvm/test/DebugInfo/PDB/cross-module-import-export.test b/llvm/test/DebugInfo/PDB/cross-module-import-export.test
new file mode 100644
index 00000000000..fda7495dd87
--- /dev/null
+++ b/llvm/test/DebugInfo/PDB/cross-module-import-export.test
@@ -0,0 +1,60 @@
+; RUN: llvm-pdbdump yaml2pdb -pdb=%t.pdb %p/Inputs/cross-module-import-export.yaml
+
+; RUN: llvm-pdbdump pdb2yaml -all -no-file-headers %t.pdb | FileCheck --check-prefix=YAML %s
+; RUN: llvm-pdbdump raw -all %t.pdb | FileCheck --check-prefix=RAW %s
+
+YAML: Modules:
+YAML-NEXT: - Module: Foo.obj
+YAML-NEXT: ObjFile: Foo.obj
+YAML-NEXT: Subsections:
+YAML-NEXT: - !CrossModuleExports
+YAML-NEXT: Exports:
+YAML-NEXT: - LocalId: 4852
+YAML-NEXT: GlobalId: 9283
+YAML-NEXT: - LocalId: 2147487875
+YAML-NEXT: GlobalId: 9123
+YAML: - Module: Bar.obj
+YAML-NEXT: ObjFile: Bar.obj
+YAML-NEXT: Subsections:
+YAML-NEXT: - !CrossModuleExports
+YAML-NEXT: Exports:
+YAML-NEXT: - LocalId: 4265
+YAML-NEXT: GlobalId: 6097
+YAML-NEXT: - LocalId: 4297
+YAML-NEXT: GlobalId: 4677
+YAML-NEXT: - !CrossModuleImports
+YAML-NEXT: Imports:
+YAML-NEXT: - Module: Foo.obj
+YAML-NEXT: Imports: [ 4852, 2147487875 ]
+
+
+RAW: DBI Stream {
+RAW: Modules [
+RAW-NEXT: {
+RAW-NEXT: Name: Foo.obj
+RAW: LineInfo [
+RAW-NEXT: CrossModuleExports {
+RAW-NEXT: Local: 0x12F4
+RAW-NEXT: Global: 0x2443
+RAW-NEXT: Local: 0x80001083
+RAW-NEXT: Global: 0x23A3
+RAW-NEXT: }
+RAW-NEXT: ]
+RAW-NEXT: }
+RAW-NEXT: {
+RAW-NEXT: Name: Bar.obj
+RAW: LineInfo [
+RAW-NEXT: CrossModuleExports {
+RAW-NEXT: Local: 0x10A9
+RAW-NEXT: Global: 0x17D1
+RAW-NEXT: Local: 0x10C9
+RAW-NEXT: Global: 0x1245
+RAW-NEXT: }
+RAW-NEXT: CrossModuleImports {
+RAW-NEXT: Module: Foo.obj
+RAW-NEXT: Imports: [0x12F4, 0x80001083]
+RAW-NEXT: }
+RAW-NEXT: ]
+RAW-NEXT: }
+RAW-NEXT: ]
+RAW-NEXT: } \ No newline at end of file
OpenPOWER on IntegriCloud