From a54b7ddb25bda65696b7c2af8b5edab6ca85445c Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sun, 22 Feb 2015 06:47:32 +0000 Subject: [llvm-pdbdump] Resubmit "Add some tests for llvm-pdbdump". NOTE: This patch intentionally breaks the build. It attempts to resubmit r230083, but with some debug logging in the CMake and lit config files to determine why certain bots do not correctly disable the DIA tests when DIA is not available. After a sufficient number of bots fail, this patch will either be reverted or, if the cause of the failure becomes obvious, a fix submitted with the log statements removed. llvm-svn: 230161 --- llvm/cmake/config-ix.cmake | 2 ++ llvm/test/DebugInfo/PDB/Inputs/empty.cpp | 7 ++++++ llvm/test/DebugInfo/PDB/Inputs/empty.pdb | Bin 0 -> 102400 bytes .../test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp | 6 ++++++ llvm/test/DebugInfo/PDB/Inputs/symbolformat.cpp | 24 +++++++++++++++++++++ llvm/test/DebugInfo/PDB/Inputs/symbolformat.pdb | Bin 0 -> 110592 bytes llvm/test/DebugInfo/PDB/lit.local.cfg | 2 ++ llvm/test/DebugInfo/PDB/pdbdump-flags.test | 14 ++++++++++++ llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test | 14 ++++++++++++ llvm/test/lit.site.cfg.in | 3 +++ 10 files changed, 72 insertions(+) create mode 100644 llvm/test/DebugInfo/PDB/Inputs/empty.cpp create mode 100644 llvm/test/DebugInfo/PDB/Inputs/empty.pdb create mode 100644 llvm/test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp create mode 100644 llvm/test/DebugInfo/PDB/Inputs/symbolformat.cpp create mode 100644 llvm/test/DebugInfo/PDB/Inputs/symbolformat.pdb create mode 100644 llvm/test/DebugInfo/PDB/lit.local.cfg create mode 100644 llvm/test/DebugInfo/PDB/pdbdump-flags.test create mode 100644 llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test (limited to 'llvm') diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 8b04d087d44..337a5a7da8f 100755 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -448,6 +448,8 @@ if( MSVC ) endif() endif( MSVC ) +message("CMake set HAVE_DIA_SDK to ${HAVE_DIA_SDK}") + if( PURE_WINDOWS ) CHECK_CXX_SOURCE_COMPILES(" #include diff --git a/llvm/test/DebugInfo/PDB/Inputs/empty.cpp b/llvm/test/DebugInfo/PDB/Inputs/empty.cpp new file mode 100644 index 00000000000..6021aca7bfc --- /dev/null +++ b/llvm/test/DebugInfo/PDB/Inputs/empty.cpp @@ -0,0 +1,7 @@ +// Build with "cl.exe /Zi empty.cpp /link /debug /nodefaultlib /entry:main" + +void *__purecall = 0; + +int main() { + return 42; +} diff --git a/llvm/test/DebugInfo/PDB/Inputs/empty.pdb b/llvm/test/DebugInfo/PDB/Inputs/empty.pdb new file mode 100644 index 00000000000..ae65c3a885c Binary files /dev/null and b/llvm/test/DebugInfo/PDB/Inputs/empty.pdb differ diff --git a/llvm/test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp b/llvm/test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp new file mode 100644 index 00000000000..56a5b26f2ca --- /dev/null +++ b/llvm/test/DebugInfo/PDB/Inputs/symbolformat-fpo.cpp @@ -0,0 +1,6 @@ +// Compile with "cl /GR- /Zi /c /Ox /Oy symbolformat-fpo.cpp" +// Refer to symbolformat.cpp for linking instructions. + +unsigned fpo_func(unsigned n) { + return n * 2; +} diff --git a/llvm/test/DebugInfo/PDB/Inputs/symbolformat.cpp b/llvm/test/DebugInfo/PDB/Inputs/symbolformat.cpp new file mode 100644 index 00000000000..1aa865214fb --- /dev/null +++ b/llvm/test/DebugInfo/PDB/Inputs/symbolformat.cpp @@ -0,0 +1,24 @@ +// Compile with "cl /c /Zi /GR- symbolformat.cpp" +// Compile symbolformat-fpo.cpp (see file for instructions) +// Link with "link symbolformat.obj symbolformat-fpo.obj /debug /nodefaultlib +// /entry:main /out:symbolformat.exe" + +int __cdecl _purecall(void) { return 0; } + +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; + return 0; +} diff --git a/llvm/test/DebugInfo/PDB/Inputs/symbolformat.pdb b/llvm/test/DebugInfo/PDB/Inputs/symbolformat.pdb new file mode 100644 index 00000000000..3bbc7bb1389 Binary files /dev/null and b/llvm/test/DebugInfo/PDB/Inputs/symbolformat.pdb differ diff --git a/llvm/test/DebugInfo/PDB/lit.local.cfg b/llvm/test/DebugInfo/PDB/lit.local.cfg new file mode 100644 index 00000000000..456fc71b895 --- /dev/null +++ b/llvm/test/DebugInfo/PDB/lit.local.cfg @@ -0,0 +1,2 @@ +config.unsupported = not config.have_dia_sdk +print("lit.local.cfg: config.unsupported set to %s" % config.unsupported) diff --git a/llvm/test/DebugInfo/PDB/pdbdump-flags.test b/llvm/test/DebugInfo/PDB/pdbdump-flags.test new file mode 100644 index 00000000000..fd14e8a2a98 --- /dev/null +++ b/llvm/test/DebugInfo/PDB/pdbdump-flags.test @@ -0,0 +1,14 @@ +; 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 + +; Check PDB file summary information +; SUMMARY_CHECK: empty.pdb +; SUMMARY_CHECK: Guid: {0B355641-86A0-A249-896F-9988FAE52FF0} +; 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: diff --git a/llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test b/llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test new file mode 100644 index 00000000000..64753df16b9 --- /dev/null +++ b/llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test @@ -0,0 +1,14 @@ +; 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 - 0x001137-1] (VFrame) uint32_t __cdecl fpo_func(uint32_t) +; FORMAT: d:\src\llvm\test\DebugInfo\PDB\Inputs\symbolformat.obj +; FORMAT-DAG: func [0x001060+3 - 0x001067-2] (EBP) int32_t __cdecl _purecall() +; FORMAT-DAG: func [0x001070+6 - 0x001099-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() diff --git a/llvm/test/lit.site.cfg.in b/llvm/test/lit.site.cfg.in index 9336c76369a..98544289d42 100644 --- a/llvm/test/lit.site.cfg.in +++ b/llvm/test/lit.site.cfg.in @@ -31,8 +31,11 @@ config.host_ldflags = "@HOST_LDFLAGS@" 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@" +print("lit.site.cfg.in: config.have_dia_sdk set to %s" % config.have_dia_sdk) + # Support substitution of the tools_dir with user parameters. This is # used when we can't determine the tool dir at configuration time. try: -- cgit v1.2.3