llvm/test/DebugInfo/precomp.test
Alexandre Ganea 2031cf6be1 [Debuginfo][COFF] Minimal serialization support for precompiled types records
This change adds support for the LF_PRECOMP and LF_ENDPRECOMP records required
to read/write Microsoft precompiled types .objs.
See https://en.wikipedia.org/wiki/Precompiled_header#Microsoft_Visual_C_and_C++

This also adds handling for the .debug$P section, which is actually a .debug$T
section in disguise, found only in precompiled .objs.

Differential Revision: https://reviews.llvm.org/D45283

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329613 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-09 20:17:56 +00:00

58 lines
2.1 KiB
Plaintext

RUN: rm -rf %t1/
RUN: mkdir %t1
RUN: obj2yaml %S/Inputs/precomp-a.obj > %t1/precomp-a.yaml
RUN: obj2yaml %S/Inputs/precomp.obj > %t1/precomp.yaml
RUN: yaml2obj %t1/precomp-a.yaml > %t1/a.obj
RUN: yaml2obj %t1/precomp.yaml > %t1/precomp.obj
RUN: llvm-readobj -codeview %t1/a.obj | FileCheck %s -check-prefix PRECOMP
RUN: llvm-readobj -codeview %t1/precomp.obj | FileCheck %s -check-prefix ENDPRECOMP
RUN: llvm-pdbutil dump -types %t1/a.obj | FileCheck %s -check-prefix PDB-PRECOMP
RUN: llvm-pdbutil dump -types %t1/precomp.obj | FileCheck %s -check-prefix PDB-ENDPRECOMP
ENDPRECOMP: CodeViewTypes [
ENDPRECOMP-NEXT: Section: .debug$P (3)
ENDPRECOMP: EndPrecomp (0x1407) {
ENDPRECOMP-NEXT: TypeLeafKind: LF_ENDPRECOMP (0x14)
ENDPRECOMP-NEXT: Signature: 0x1116980E
ENDPRECOMP-NEXT: }
PRECOMP: CodeViewTypes [
PRECOMP-NEXT: Section: .debug$T (3)
PRECOMP-NEXT: Magic: 0x4
PRECOMP-NEXT: Precomp (0x1000) {
PRECOMP-NEXT: TypeLeafKind: LF_PRECOMP (0x1509)
PRECOMP-NEXT: StartIndex: 0x1000
PRECOMP-NEXT: Count: 0x407
PRECOMP-NEXT: Signature: 0x1116980E
PDB-PRECOMP: Types (.debug$T)
PDB-PRECOMP-NEXT: ============================================================
PDB-PRECOMP-NEXT: Showing 0 records
PDB-PRECOMP-NEXT: 0x1000 | LF_PRECOMP [size = 60] start index = 0x1000, types count = 0x407, signature = 0x1116980E, precomp path = f:\svn\lld\test\coff\precomp\precomp.obj
PDB-ENDPRECOMP: Precompiled Types (.debug$P)
PDB-ENDPRECOMP-NEXT: ============================================================
PDB-ENDPRECOMP-NEXT: Showing 0 records
PDB-ENDPRECOMP: 0x1407 | LF_ENDPRECOMP [size = 8] signature = 0x1116980E
# // precomp.h
# #pragma once
# int Function(char A);
#
# // precomp.cpp
# // cl.exe precomp.cpp /Z7 /Ycprecomp.h /c
# #include "precomp.h"
#
# // a.cpp
# #include "precomp.h"
# int main(void) {
# Function('a');
# return 0;
# }
#
# // cl.exe a.cpp /Z7 /Yuprecomp.h /c
#
# // obj2yaml precomp.obj >precomp-precomp.yaml
# // obj2yaml a.obj >precomp-a.yaml