Index: test/DebugInfo/PDB/Inputs/empty.cpp =================================================================== --- /dev/null +++ test/DebugInfo/PDB/Inputs/empty.cpp @@ -0,0 +1,4 @@ +// Compile and link with with "cl /Zi empty.cpp" +int main() { + return 42; +} Index: test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp =================================================================== --- /dev/null +++ test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp @@ -0,0 +1,7 @@ +// Compile with "cl /Zi /c /Oy symbolformat-fpo.cpp" +// Link with "link symbolformat.obj symbolformat-fpo.obj /debug /out:symbolformat.exe" +#include + +void fpo_func(int n) { + printf("N = %d", n); +} \ No newline at end of file Index: test/DebugInfo/PDB/Inputs/symbolformat.cpp =================================================================== --- /dev/null +++ test/DebugInfo/PDB/Inputs/symbolformat.cpp @@ -0,0 +1,22 @@ +// Compile with "cl /c /Zi symbolformat.cpp" +// Link with "link symbolformat.obj symbolformat-fpo.obj /debug /out:symbolformat.exe" +#include + +struct A { + virtual void PureFunc() = 0; + virtual void VirtualFunc() {} + void RegularFunc() {} +}; + +struct B : public A { + void PureFunc() override {} +}; + +int main(int argc, char **argv) { + B b; + auto PureAddr = &B::PureFunc; + auto VirtualAddr = &A::PureFunc; + auto RegularAddr = &A::RegularFunc; + printf("%p", PureAddr); + return 0; +} Index: test/DebugInfo/PDB/lit.local.cfg =================================================================== --- /dev/null +++ test/DebugInfo/PDB/lit.local.cfg @@ -0,0 +1 @@ +config.unsupported = not config.have_dia_sdk Index: test/DebugInfo/PDB/pdbdump-flags.test =================================================================== --- /dev/null +++ test/DebugInfo/PDB/pdbdump-flags.test @@ -0,0 +1,22 @@ +; RUN: llvm-pdbdump %p/Inputs/empty.pdb | FileCheck %s -check-prefix SUMMARY_CHECK +; RUN: llvm-pdbdump -functions %p/Inputs/empty.pdb | FileCheck %s -check-prefix MAIN_CHECK +; RUN: llvm-pdbdump -group-by=compiland %p/Inputs/empty.pdb | FileCheck %s -check-prefix GROUP_COMPILAND +; RUN: llvm-pdbdump -group-by=type %p/Inputs/empty.pdb | FileCheck %s -check-prefix GROUP_TYPE + +; Check PDB file summary information +; SUMMARY_CHECK: DebugInfo\pdb\Inputs\empty.pdb +; SUMMARY_CHECK: Guid: {4FE7CE3B-53DC-6E4F-B370-4F90686972BC} +; SUMMARY_CHECK: Attributes: HasPrivateSymbols + +; Check that running with only -compilands doesn't include unwanted symbol types +; MAIN_CHECK: (EBP) int32_t __cdecl main() +; MAIN_CHECK-NOT: vtbl: +; MAIN_CHECK-NOT: enum: +; MAIN_CHECK-NOT: class: +; MAIN_CHECK-NOT: data: + +; Check that running with group-by=compiland always lists compilands using an arbitrary MSVCRT compiland. +; GROUP_COMPILAND: initsect.obj + +; Check that running with group-by=type but not specifying -compilands does NOT list compilands +; GROUP_TYPE-NOT: initsect.obj Index: test/DebugInfo/PDB/pdbdump-symbol-format.test =================================================================== --- /dev/null +++ test/DebugInfo/PDB/pdbdump-symbol-format.test @@ -0,0 +1,13 @@ +; RUN: llvm-pdbdump -all -hidden -group-by=compiland %p/Inputs/symbolformat.pdb | FileCheck --check-prefix=FORMAT %s + +; The format here is func [0x+ - 0x-] +; FORMAT: test\DebugInfo\PDB\Inputs\symbolformat-fpo.obj +; FORMAT-DAG: func [0x001130+0 - 0x001142-1] (VFrame) void __cdecl fpo_func(int32_t) +; FORMAT: d:\src\llvm\test\DebugInfo\PDB\Inputs\symbolformat.obj +; FORMAT-DAG: func [0x001060+6 - 0x00109a-4] (EBP) int32_t __cdecl main(int32_t, char**) +; FORMAT-DAG: func [0x0010b0+7 - 0x0010c7-4] (EBP) void __thiscall A::A() +; FORMAT-DAG: func [0x0010d0+7 - 0x0010ef-4] (EBP) void __thiscall B::B() +; FORMAT-DAG: thunk [0x000010f6 - 0x000010fa] (Pcode) B::`vcall'{0}' +; FORMAT-DAG: func [0x001100+7 - 0x00110b-4] (EBP) virtual void __thiscall B::PureFunc() +; FORMAT-DAG: func [0x001110+7 - 0x00111b-4] (EBP) void __thiscall A::RegularFunc() +; FORMAT-DAG: func [0x001120+7 - 0x00112b-4] (EBP) virtual void __thiscall A::VirtualFunc() Index: test/lit.site.cfg.in =================================================================== --- test/lit.site.cfg.in +++ test/lit.site.cfg.in @@ -31,6 +31,7 @@ config.llvm_use_intel_jitevents = "@LLVM_USE_INTEL_JITEVENTS@" config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.have_zlib = "@HAVE_LIBZ@" +config.have_dia_sdk = "@HAVE_DIA_SDK@" config.enable_ffi = "@LLVM_ENABLE_FFI@" # Support substitution of the tools_dir with user parameters. This is