diff options
Diffstat (limited to 'lit/SymbolFile/PDB')
30 files changed, 814 insertions, 149 deletions
diff --git a/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp b/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp new file mode 100644 index 000000000000..8c9e26744d5f --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp @@ -0,0 +1,55 @@ +namespace N0 { +namespace N1 { + +namespace { +enum Enum { Enum_0 = 1, Enum_1 = 2, Enum_2 = 4, Enum_3 = 8 }; +} + +Enum Global = Enum_3; + +struct Base { + Enum m_e = Enum_1; +}; + +class Class : public Base { +public: + Class(Enum e) : m_ce(e) {} + + static int StaticFunc(const Class &c) { + return c.PrivateFunc(c.m_inner) + Global + ClassStatic; + } + + const Enum m_ce; + + static int ClassStatic; + +private: + struct Inner { + char x; + short y; + int z; + }; + + int PrivateFunc(const Inner &i) const { return i.z; } + + Inner m_inner{}; +}; +int Class::ClassStatic = 7; + +template<typename T> +struct Template { + template<Enum E> + void TemplateFunc() { + T::StaticFunc(T(E)); + } +}; + +void foo() { Template<Class>().TemplateFunc<Enum_0>(); } + +} // namespace N1 +} // namespace N0 + +int main() { + N0::N1::foo(); + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp b/lit/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp new file mode 100644 index 000000000000..60854c04c60a --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp @@ -0,0 +1,20 @@ +int FuncCCall() { return 0; } +auto FuncCCallPtr = &FuncCCall; + +int __stdcall FuncStdCall() { return 0; } +auto FuncStdCallPtr = &FuncStdCall; + +int __fastcall FuncFastCall() { return 0; } +auto FuncFastCallPtr = &FuncFastCall; + +int __vectorcall FuncVectorCall() { return 0; } +auto FuncVectorCallPtr = &FuncVectorCall; + +struct S { + int FuncThisCall() { return 0; } +}; +auto FuncThisCallPtr = &S::FuncThisCall; + +int main() { + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp b/lit/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp new file mode 100644 index 000000000000..3c4b005cdf1b --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp @@ -0,0 +1,111 @@ +// To avoid linking MSVC specific libs, we don't test virtual/override methods +// that needs vftable support in this file. + +// Enum. +enum Enum { RED, GREEN, BLUE }; +Enum EnumVar; + +// Union. +union Union { + short Row; + unsigned short Col; + int Line : 16; // Test named bitfield. + short : 8; // Unnamed bitfield symbol won't be generated in PDB. + long Table; +}; +Union UnionVar; + +// Struct. +struct Struct; +typedef Struct StructTypedef; + +struct Struct { + bool A; + unsigned char UCharVar; + unsigned int UIntVar; + long long LongLongVar; + Enum EnumVar; // Test struct has UDT member. + int array[10]; +}; +struct Struct StructVar; + +struct _List; // Forward declaration. +struct Complex { + struct _List *array[90]; + struct { // Test unnamed struct. MSVC treats it as `int x` + int x; + }; + union { // Test unnamed union. MSVC treats it as `int a; float b;` + int a; + float b; + }; +}; +struct Complex c; + +struct _List { // Test doubly linked list. + struct _List *current; + struct _List *previous; + struct _List *next; +}; +struct _List ListVar; + +typedef struct { + int a; +} UnnamedStruct; // Test unnamed typedef-ed struct. +UnnamedStruct UnnanmedVar; + +// Class. +namespace MemberTest { +class Base { +public: + Base() {} + ~Base() {} + +public: + int Get() { return 0; } + +protected: + int a; +}; +class Friend { +public: + int f() { return 3; } +}; +class Class : public Base { // Test base class. + friend Friend; + static int m_static; // Test static member variable. +public: + Class() : m_public(), m_private(), m_protected() {} + explicit Class(int a) { m_public = a; } // Test first reference of m_public. + ~Class() {} + + static int StaticMemberFunc(int a, ...) { + return 1; + } // Test static member function. + int Get() { return 1; } + int f(Friend c) { return c.f(); } + inline bool operator==(const Class &rhs) const // Test operator. + { + return (m_public == rhs.m_public); + } + +public: + int m_public; + struct Struct m_struct; + +private: + Union m_union; + int m_private; + +protected: + friend class Friend; + int m_protected; +}; +} // namespace MemberTest + +int main() { + MemberTest::Base B1; + B1.Get(); + MemberTest::Class::StaticMemberFunc(1, 10, 2); + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp b/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp new file mode 100644 index 000000000000..3785cd3c64c7 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest.cpp @@ -0,0 +1,20 @@ +namespace N0 { +namespace N1 { + +char *buf0 = nullptr; +char buf1[] = {0, 1, 2, 3, 4, 5, 6, 7}; + +char sum(char *buf, int size) { + char result = 0; + for (int i = 0; i < size; i++) + result += buf[i]; + return result; +} + +} // namespace N1 +} // namespace N0 + +int main() { + char result = N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1)); + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script b/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script new file mode 100644 index 000000000000..d31a2abb68a2 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest0.script @@ -0,0 +1,7 @@ +breakpoint set --file ExpressionsTest.cpp --line 19 +run +print result +print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1)) +print N1::sum(N1::buf1, sizeof(N1::buf1)) +print sum(buf1, sizeof(buf1)) +print sum(buf1, 1000000000) diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script b/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script new file mode 100644 index 000000000000..dac887faa5bb --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest1.script @@ -0,0 +1 @@ +print sum(buf0, 1) diff --git a/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script b/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script new file mode 100644 index 000000000000..b19240baf99d --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/ExpressionsTest2.script @@ -0,0 +1,2 @@ +print sum(buf0, result - 28) +print sum(buf1 + 3, 3) diff --git a/lit/SymbolFile/PDB/Inputs/PointerTypeTest.cpp b/lit/SymbolFile/PDB/Inputs/PointerTypeTest.cpp new file mode 100644 index 000000000000..6612c30f00df --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/PointerTypeTest.cpp @@ -0,0 +1,23 @@ +int main() { + // Test pointer to array. + int array[2][4]; + int(*array_pointer)[2][4] = &array; + + struct ST { + int a; + int f(int x) { return 1; } + }; + + ST s = {10}; + + // Test pointer to a local. + int *p_int = &s.a; + + // Test pointer to data member. + int ST::*p_member_field = &ST::a; + + // Test pointer to member function. + int (ST::*p_member_method)(int) = &ST::f; + + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp b/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp index 8e516201644c..de13a5b430c1 100644 --- a/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp +++ b/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp @@ -35,6 +35,9 @@ EnumClass EnumClassVar; enum struct EnumStruct { red, blue, black }; EnumStruct EnumStructVar; +typedef signed char SCharTypedef; +SCharTypedef SCVar; + typedef char16_t WChar16Typedef; WChar16Typedef WC16Var; diff --git a/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp new file mode 100644 index 000000000000..59a4fc585d77 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp @@ -0,0 +1,61 @@ +struct A { + explicit A(int u) { _u._u3 = u; } + A(const A &) = default; + virtual ~A() = default; + +private: + union U { + char _u1; + short _u2; + int _u3; + }; + + A::U _u; +}; + +#pragma pack(push, 1) +template <int I> struct B : public virtual A { + B(char a, unsigned short b, int c) : A(a + b + c), _a(a), _b(b), _c(c) {} + +private: + char _a; + unsigned short : 3; + unsigned short _b : 6; + unsigned short : 4; + int _c; +}; +#pragma pack(pop) + +#pragma pack(push, 16) +class C : private virtual B<0>, public virtual B<1>, private B<2>, public B<3> { +public: + C(char x, char y, char z) + : A(x - y + z), B<0>(x, y, z), B<1>(x * 2, y * 2, z * 2), + B<2>(x * 3, y * 3, z * 3), B<3>(x * 4, y * 4, z * 4), _x(x * 5), + _y(y * 5), _z(z * 5) {} + + static int abc; + +private: + int _x; + short _y; + char _z; +}; +int C::abc = 123; +#pragma pack(pop) + +class List { +public: + List() = default; + List(List *p, List *n, C v) : Prev(p), Next(n), Value(v) {} + +private: + List *Prev = nullptr; + List *Next = nullptr; + C Value{1, 2, 3}; +}; + +int main() { + List ls[16]; + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.script b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.script new file mode 100644 index 000000000000..91de55f4ade4 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/UdtLayoutTest.script @@ -0,0 +1,4 @@ +breakpoint set --file UdtLayoutTest.cpp --line 60 +run +target variable +frame variable diff --git a/lit/SymbolFile/PDB/Inputs/VBases.cpp b/lit/SymbolFile/PDB/Inputs/VBases.cpp new file mode 100644 index 000000000000..a5e84bd36571 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/VBases.cpp @@ -0,0 +1,16 @@ +struct A { + char a = 1; +}; + +struct B { + int b = 2; +}; + +struct C : virtual A, virtual B { + short c = 3; +}; + +int main() { + C c{}; + return 0; +} diff --git a/lit/SymbolFile/PDB/Inputs/VBases.script b/lit/SymbolFile/PDB/Inputs/VBases.script new file mode 100644 index 000000000000..8675890b76e1 --- /dev/null +++ b/lit/SymbolFile/PDB/Inputs/VBases.script @@ -0,0 +1,7 @@ +breakpoint set --file VBases.cpp --line 15 + +run + +print c + +frame variable c
\ No newline at end of file diff --git a/lit/SymbolFile/PDB/ast-restore.test b/lit/SymbolFile/PDB/ast-restore.test new file mode 100644 index 000000000000..2158fc1b3d44 --- /dev/null +++ b/lit/SymbolFile/PDB/ast-restore.test @@ -0,0 +1,82 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --nodefaultlib --output=%t.exe %S/Inputs/AstRestoreTest.cpp +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=GLOBAL %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=BASE %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=CLASS %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=INNER %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=TEMPLATE %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=FOO %s +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=MAIN %s + +ENUM: Module: {{.*}} +ENUM: namespace N0 { +ENUM: namespace N1 { +ENUM: namespace { +ENUM: enum Enum { +ENUM: Enum_0, +ENUM: Enum_1, +ENUM: Enum_2, +ENUM: Enum_3 +ENUM: }; +ENUM: } +ENUM: } +ENUM: } + +GLOBAL: Module: {{.*}} +GLOBAL: namespace N0 { +GLOBAL: namespace N1 { +GLOBAL: N0::N1::(anonymous namespace)::Enum Global; +GLOBAL: } +GLOBAL: } + +BASE: Module: {{.*}} +BASE: namespace N0 { +BASE: namespace N1 { +BASE: struct Base { +BASE: N0::N1::(anonymous namespace)::Enum m_e; +BASE: }; +BASE: } +BASE: } + +CLASS: Module: {{.*}} +CLASS: namespace N0 { +CLASS: namespace N1 { +CLASS: class Class : public N0::N1::Base { +CLASS-DAG: const N0::N1::(anonymous namespace)::Enum m_ce; +CLASS-DAG: static int ClassStatic; +CLASS-DAG: N0::N1::Class::Inner m_inner; +CLASS-DAG: {{(inline )?}}Class(N0::N1::(anonymous namespace)::Enum); +CLASS-DAG: static {{(inline )?}}int StaticFunc(const N0::N1::Class &); +CLASS-DAG: {{(inline )?}}int PrivateFunc(const N0::N1::Class::Inner &); +CLASS: }; +CLASS: } +CLASS: } + +INNER: Module: {{.*}} +INNER: namespace N0 { +INNER: namespace N1 { +INNER: class Class : public N0::N1::Base { +INNER: struct Inner { +INNER: char x; +INNER: short y; +INNER: int z; +INNER: }; +INNER: }; +INNER: } +INNER: } + +TEMPLATE: Module: {{.*}} +TEMPLATE: struct Template<N0::N1::Class> { +TEMPLATE: inline void TemplateFunc<1>(); +TEMPLATE: }; + +FOO: Module: {{.*}} +FOO: namespace N0 { +FOO: namespace N1 { +FOO: void foo(); +FOO: } +FOO: } + +MAIN: Module: {{.*}} +MAIN: int main(); diff --git a/lit/SymbolFile/PDB/calling-conventions.test b/lit/SymbolFile/PDB/calling-conventions.test new file mode 100644 index 000000000000..a85dc65ff04d --- /dev/null +++ b/lit/SymbolFile/PDB/calling-conventions.test @@ -0,0 +1,10 @@ +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.exe %S/Inputs/CallingConventionsTest.cpp +RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s + +CHECK: Module: {{.*}} +CHECK-DAG: int (*FuncCCallPtr)(); +CHECK-DAG: int (*FuncStdCallPtr)() __attribute__((stdcall)); +CHECK-DAG: int (*FuncFastCallPtr)() __attribute__((fastcall)); +CHECK-DAG: int (*FuncVectorCallPtr)() __attribute__((vectorcall)); +CHECK-DAG: int (S::*FuncThisCallPtr)() __attribute__((thiscall)); diff --git a/lit/SymbolFile/PDB/class-layout.test b/lit/SymbolFile/PDB/class-layout.test new file mode 100644 index 000000000000..5c0194485d76 --- /dev/null +++ b/lit/SymbolFile/PDB/class-layout.test @@ -0,0 +1,92 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/ClassLayoutTest.cpp.obj %S/Inputs/ClassLayoutTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/ClassLayoutTest.cpp.exe %T/ClassLayoutTest.cpp.obj +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=ENUM %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNION %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=STRUCT %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=COMPLEX %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=LIST %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=UNNAMED-STRUCT %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=BASE %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=FRIEND %s +RUN: lldb-test symbols %T/ClassLayoutTest.cpp.exe | FileCheck --check-prefix=CLASS %s + +CHECK: Module [[MOD:.*]] +CHECK: {{^[0-9A-F]+}}: SymbolVendor pdb ([[MOD]]) +CHECK: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\ClassLayoutTest.cpp' + +ENUM: name = "Enum", size = 4, decl = ClassLayoutTest.cpp:5 +ENUM-SAME: enum Enum { +ENUM: RED, +ENUM: GREEN, +ENUM: BLUE +ENUM:} + +UNION: name = "Union", size = 4, decl = ClassLayoutTest.cpp:9 +UNION-SAME: union Union { +UNION: short Row; +UNION: unsigned short Col; +UNION: int Line : 16; +UNION: long Table; +UNION:} + +STRUCT: name = "Struct", size = 64, decl = ClassLayoutTest.cpp:22 +STRUCT-SAME: struct Struct { +STRUCT: bool A; +STRUCT: unsigned char UCharVar; +STRUCT: unsigned int UIntVar; +STRUCT: long long LongLongVar; +STRUCT: Enum EnumVar; +STRUCT: int array[10]; +STRUCT:} + +COMPLEX: name = "Complex", size = 368, decl = ClassLayoutTest.cpp:33 +COMPLEX-SAME: struct Complex { +COMPLEX: _List *array[90]; +COMPLEX: int x; +COMPLEX: int a; +COMPLEX: float b; +COMPLEX:} + +LIST: name = "_List", size = 12, decl = ClassLayoutTest.cpp:45 +LIST-SAME: struct _List { +LIST: _List *current; +LIST: _List *previous; +LIST: _List *next; +LIST:} + +UNNAMED-STRUCT: name = "UnnamedStruct", size = 4, decl = ClassLayoutTest.cpp:52 +UNNAMED-STRUCT-SAME: struct UnnamedStruct { +UNNAMED-STRUCT: int a; +UNNAMED-STRUCT:} + +BASE: name = "Base", size = 4, decl = ClassLayoutTest.cpp:59 +BASE-SAME: class Base { +BASE: int a; +BASE: Base(); +BASE: ~Base(); +BASE: int Get(); +BASE:} + +FRIEND: name = "Friend", size = 1, decl = ClassLayoutTest.cpp:70 +FRIEND-SAME: class Friend { +FRIEND: int f(); +FRIEND: } + +CLASS: name = "Class", size = 88, decl = ClassLayoutTest.cpp:74 +CLASS-SAME: class Class : public MemberTest::Base { +CLASS: static int m_static; +CLASS: int m_public; +CLASS: Struct m_struct; +CLASS: Union m_union; +CLASS: int m_private; +CLASS: int m_protected; +CLASS: Class(); +CLASS: Class(int); +CLASS: ~Class(); +CLASS: static int {{.*}}StaticMemberFunc(int, ...); +CLASS: int Get(); +CLASS: int f(MemberTest::Friend); +CLASS: bool operator==(const MemberTest::Class &) +CLASS:} diff --git a/lit/SymbolFile/PDB/compilands.test b/lit/SymbolFile/PDB/compilands.test index 2e7b014fe966..d719ab7669d8 100644 --- a/lit/SymbolFile/PDB/compilands.test +++ b/lit/SymbolFile/PDB/compilands.test @@ -1,9 +1,11 @@ -REQUIRES: windows -RUN: clang-cl /Z7 %S/Inputs/CompilandsTest.cpp /o %T/CompilandsTest.cpp.exe -RUN: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/CompilandsTest.cpp.obj %S/Inputs/CompilandsTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/CompilandsTest.cpp.exe %T/CompilandsTest.cpp.obj +RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s +RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s ; Link default libraries CHECK: Module [[CU:.*]] -CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[CU]]) +CHECK: {{^[0-9A-F]+}}: SymbolVendor pdb ([[CU]]) CHECK: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\CompilandsTest.cpp' diff --git a/lit/SymbolFile/PDB/enums-layout.test b/lit/SymbolFile/PDB/enums-layout.test index ce0b23f453be..79efb259663d 100644 --- a/lit/SymbolFile/PDB/enums-layout.test +++ b/lit/SymbolFile/PDB/enums-layout.test @@ -1,45 +1,45 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.enums.obj -RUN: link %T/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.enums.exe -RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --arch=32 --nodefaultlib --output=%T/SimpleTypesTest.cpp.enums.exe %S/Inputs/SimpleTypesTest.cpp +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_CONST %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_EMPTY %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_UCHAR %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_CLASS %s +RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck --check-prefix=ENUM_STRUCT %s ; FIXME: PDB does not have information about scoped enumeration (Enum class) so the ; compiler type used is the same as the one for unscoped enumeration. -CHECK: Module [[CU:.*]] -CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]]) -CHECK: Type{{.*}} , name = "Enum", size = 4, decl = SimpleTypesTest.cpp:19, compiler_type = {{.*}} enum Enum { -CHECK-NEXT: RED, -CHECK-NEXT: GREEN, -CHECK-NEXT: BLUE -CHECK-NEXT:} +ENUM: Type{{.*}} , name = "Enum", size = 4, decl = simpletypestest.cpp:19, compiler_type = {{.*}} enum Enum { +ENUM_NEXT: RED, +ENUM_NEXT: GREEN, +ENUM_NEXT: BLUE +ENUM_NEXT:} -CHECK: Type{{.*}} , name = "EnumConst", size = 4, decl = SimpleTypesTest.cpp:22, compiler_type = {{.*}} enum EnumConst { -CHECK-NEXT: LOW, -CHECK-NEXT: NORMAL, -CHECK-NEXT: HIGH -CHECK-NEXT:} +ENUM_CONST: Type{{.*}} , name = "EnumConst", size = 4, decl = simpletypestest.cpp:22, compiler_type = {{.*}} enum EnumConst { +ENUM_CONST-NEXT: LOW, +ENUM_CONST-NEXT: NORMAL, +ENUM_CONST-NEXT: HIGH +ENUM_CONST-NEXT:} -CHECK: Type{{.*}} , name = "EnumEmpty", size = 4, decl = SimpleTypesTest.cpp:25, compiler_type = {{.*}} enum EnumEmpty { -CHECK-NEXT:} +ENUM_EMPTY: Type{{.*}} , name = "EnumEmpty", size = 4, decl = simpletypestest.cpp:25, compiler_type = {{.*}} enum EnumEmpty { +ENUM_EMPTY-NEXT:} -CHECK: Type{{.*}} , name = "EnumUChar", size = 1, decl = SimpleTypesTest.cpp:28, compiler_type = {{.*}} enum EnumUChar { -CHECK-NEXT: ON, -CHECK-NEXT: OFF, -CHECK-NEXT: AUTO -CHECK-NEXT:} +ENUM_UCHAR: Type{{.*}} , name = "EnumUChar", size = 1, decl = simpletypestest.cpp:28, compiler_type = {{.*}} enum EnumUChar { +ENUM_UCHAR-NEXT: ON, +ENUM_UCHAR-NEXT: OFF, +ENUM_UCHAR-NEXT: AUTO +ENUM_UCHAR-NEXT:} ; Note that `enum EnumClass` is tested instead of `enum class EnumClass` -CHECK: Type{{.*}} , name = "EnumClass", size = 4, decl = SimpleTypesTest.cpp:32, compiler_type = {{.*}} enum EnumClass { -CHECK-NEXT: YES, -CHECK-NEXT: NO, -CHECK-NEXT: DEFAULT -CHECK-NEXT:} - -CHECK: Type{{.*}} , name = "EnumStruct", size = 4, decl = SimpleTypesTest.cpp:35, compiler_type = {{.*}} enum EnumStruct { -CHECK-NEXT: red, -CHECK-NEXT: blue, -CHECK-NEXT: black -CHECK-NEXT:} - -CHECK-DAG: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\SimpleTypesTest.cpp' +ENUM_CLASS: Type{{.*}} , name = "EnumClass", size = 4, decl = simpletypestest.cpp:32, compiler_type = {{.*}} enum EnumClass { +ENUM_CLASS-NEXT: YES, +ENUM_CLASS-NEXT: NO, +ENUM_CLASS-NEXT: DEFAULT +ENUM_CLASS-NEXT:} + +ENUM_STRUCT: Type{{.*}} , name = "EnumStruct", size = 4, decl = simpletypestest.cpp:35, compiler_type = {{.*}} enum EnumStruct { +ENUM_STRUCT-NEXT: red, +ENUM_STRUCT-NEXT: blue, +ENUM_STRUCT-NEXT: black +ENUM_STRUCT-NEXT:} diff --git a/lit/SymbolFile/PDB/expressions.test b/lit/SymbolFile/PDB/expressions.test new file mode 100644 index 000000000000..49016196117e --- /dev/null +++ b/lit/SymbolFile/PDB/expressions.test @@ -0,0 +1,35 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --nodefaultlib --output=%t.exe %S/Inputs/ExpressionsTest.cpp +RUN: %lldb -b -s %S/Inputs/ExpressionsTest0.script -s %S/Inputs/ExpressionsTest1.script -s %S/Inputs/ExpressionsTest2.script -- %t.exe 2>&1 | FileCheck %s + +// Check the variable value through `print` +CHECK: (lldb) print result +CHECK: (char) $0 = '\x1c' + +// Call the function just like in the code +CHECK: (lldb) print N0::N1::sum(N0::N1::buf1, sizeof(N0::N1::buf1)) +CHECK: (char) $1 = '\x1c' + +// Try the relaxed namespaces search +CHECK: (lldb) print N1::sum(N1::buf1, sizeof(N1::buf1)) +CHECK: (char) $2 = '\x1c' + +// Try the relaxed variables and functions search +CHECK: (lldb) print sum(buf1, sizeof(buf1)) +CHECK: (char) $3 = '\x1c' + +// Make a crash during expression calculation +CHECK: (lldb) print sum(buf1, 1000000000) +CHECK: The process has been returned to the state before expression evaluation. + +// Make one more crash +CHECK: (lldb) print sum(buf0, 1) +CHECK: The process has been returned to the state before expression evaluation. + +// Check if the process state was restored succesfully +CHECK: (lldb) print sum(buf0, result - 28) +CHECK: (char) $4 = '\0' + +// Call the function with arbitrary parameters +CHECK: (lldb) print sum(buf1 + 3, 3) +CHECK: (char) $5 = '\f' diff --git a/lit/SymbolFile/PDB/func-symbols.test b/lit/SymbolFile/PDB/func-symbols.test index b13ff7e65bb0..fbbf5ddfb856 100644 --- a/lit/SymbolFile/PDB/func-symbols.test +++ b/lit/SymbolFile/PDB/func-symbols.test @@ -1,7 +1,5 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbolsTestMain.cpp /o %T/FuncSymbolsTestMain.cpp.obj -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/FuncSymbols.cpp /o %T/FuncSymbols.cpp.obj -RUN: link %T/FuncSymbolsTestMain.cpp.obj %T/FuncSymbols.cpp.obj /DEBUG /nodefaultlib /Entry:main /OUT:%T/FuncSymbolsTest.exe +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%T/FuncSymbolsTest.exe %S/Inputs/FuncSymbolsTestMain.cpp %S/Inputs/FuncSymbols.cpp RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-ONE %s RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-TWO %s @@ -9,16 +7,16 @@ RUN: lldb-test symbols %T/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-T ; In this test, We don't check demangled name of a mangled function. CHECK-ONE: Module [[MD:.*]] -CHECK-ONE-DAG: {{.*}}: SymbolVendor ([[MD]]) +CHECK-ONE-DAG: {{.*}}: SymbolVendor pdb ([[MD]]) CHECK-ONE-DAG: [[TY0:.*]]: Type{[[UID0:.*]]} , name = "Func_arg_array", decl = FuncSymbolsTestMain.cpp:3, compiler_type = {{.*}} int (int *) CHECK-ONE-DAG: [[TY1:.*]]: Type{[[UID1:.*]]} , name = "Func_arg_void", decl = FuncSymbolsTestMain.cpp:4, compiler_type = {{.*}} void (void) CHECK-ONE-DAG: [[TY2:.*]]: Type{[[UID2:.*]]} , name = "Func_arg_none", decl = FuncSymbolsTestMain.cpp:5, compiler_type = {{.*}} void (void) CHECK-ONE-DAG: [[TY3:.*]]: Type{[[UID3:.*]]} , name = "Func_varargs", decl = FuncSymbolsTestMain.cpp:6, compiler_type = {{.*}} void (...) -CHECK-ONE-DAG: [[TY4:.*]]: Type{[[UID4:.*]]} , name = "NS::Func", decl = FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (signed char, int) +CHECK-ONE-DAG: [[TY4:.*]]: Type{[[UID4:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:28, compiler_type = {{.*}} void (char, int) CHECK-ONE-DAG: [[TY5:.*]]: Type{[[UID5:.*]]} , name = "main", decl = FuncSymbolsTestMain.cpp:44, compiler_type = {{.*}} int (void) -CHECK-ONE-DAG: [[TY6:.*]]: Type{[[UID6:.*]]} , name = "`anonymous namespace'::Func", decl = FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...) +CHECK-ONE-DAG: [[TY6:.*]]: Type{[[UID6:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:24, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...) CHECK-ONE-DAG: [[TY7:.*]]: Type{[[UID7:.*]]} , name = "StaticFunction", decl = FuncSymbolsTestMain.cpp:35, compiler_type = {{.*}} long (int) -CHECK-ONE-DAG: [[TY8:.*]]: Type{[[UID8:.*]]} , name = "MemberTest::A::Func", decl = FuncSymbolsTestMain.cpp:12, compiler_type = {{.*}} int (int, ...) +CHECK-ONE-DAG: [[TY8:.*]]: Type{[[UID8:.*]]} , name = "Func", decl = FuncSymbolsTestMain.cpp:12, compiler_type = {{.*}} int (int, ...) CHECK-ONE-DAG: [[TY9:.*]]: Type{[[UID9:.*]]} , name = "TemplateFunc<1,int>", decl = FuncSymbolsTestMain.cpp:18, compiler_type = {{.*}} void (int) CHECK-ONE-DAG: [[TY10:.*]]: Type{[[UID10:.*]]} , name = "TemplateFunc<1,int,int,int>", decl = FuncSymbolsTestMain.cpp:18, compiler_type = {{.*}} void (int, int, int) CHECK-ONE-DAG: [[TY11:.*]]: Type{[[UID11:.*]]} , name = "InlinedFunction", decl = FuncSymbolsTestMain.cpp:40, compiler_type = {{.*}} void (long) @@ -39,7 +37,7 @@ CHECK-ONE-DAG: Function{[[UID11]]}, mangled = ?InlinedFunction@@YAXJ@Z, demangle ; We expect new types observed in another compile unit CHECK-TWO-DAG: [[TY30:.*]]: Type{[[UID30:.*]]} , name = "FunctionCall", decl = FuncSymbols.cpp:13, compiler_type = {{.*}} void (void) -CHECK-TWO-DAG: [[TY31:.*]]: Type{[[UID31:.*]]} , name = "`anonymous namespace'::StaticFunction", decl = FuncSymbols.cpp:4, compiler_type = {{.*}} long (int) +CHECK-TWO-DAG: [[TY31:.*]]: Type{[[UID31:.*]]} , name = "StaticFunction", decl = FuncSymbols.cpp:4, compiler_type = {{.*}} long (int) CHECK-TWO-DAG: [[TY32:.*]]: Type{[[UID32:.*]]} , name = "InlinedFunction", decl = FuncSymbols.cpp:10, compiler_type = {{.*}} int (long) CHECK-TWO: {{.*}}: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\FuncSymbols.cpp' diff --git a/lit/SymbolFile/PDB/function-level-linking.test b/lit/SymbolFile/PDB/function-level-linking.test index 9b28ec1ba217..37b2cbc761b8 100644 --- a/lit/SymbolFile/PDB/function-level-linking.test +++ b/lit/SymbolFile/PDB/function-level-linking.test @@ -1,4 +1,5 @@ -REQUIRES: windows, lld -RUN: clang-cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj +REQUIRES: system-windows, lld +RUN: %clang_cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj RUN: lld-link /debug:full /nodefaultlib /entry:main /order:@%S/Inputs/FunctionLevelLinkingTest.ord %t.obj /out:%t.exe -RUN: lldb-test symbols -verify %t.exe +RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -verify %t.exe +RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -verify %t.exe diff --git a/lit/SymbolFile/PDB/function-nested-block.test b/lit/SymbolFile/PDB/function-nested-block.test index 93543c681130..9057d01c2584 100644 --- a/lit/SymbolFile/PDB/function-nested-block.test +++ b/lit/SymbolFile/PDB/function-nested-block.test @@ -1,7 +1,11 @@ -REQUIRES: windows, lld -RUN: clang-cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj -RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe -RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck %s +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --nodefaultlib --output=%t.exe %S/Inputs/FunctionNestedBlockTest.cpp +RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-FUNCTION %s +RUN: lldb-test symbols -find=block -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-BLOCK %s -CHECK: Found 1 functions: -CHECK: name = "{{.*}}", mangled = "{{_?}}main" +CHECK-FUNCTION: Found 1 functions: +CHECK-FUNCTION: name = "{{.*}}", mangled = "{{_?}}main" + +CHECK-BLOCK: Found 1 blocks: +CHECK-BLOCK: Blocks: id = {{.*}}, range = {{.*}} +CHECK-BLOCK: id = {{.*}}, range = {{.*}} diff --git a/lit/SymbolFile/PDB/lit.local.cfg b/lit/SymbolFile/PDB/lit.local.cfg deleted file mode 100644 index df9b335dd131..000000000000 --- a/lit/SymbolFile/PDB/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.test'] diff --git a/lit/SymbolFile/PDB/pointers.test b/lit/SymbolFile/PDB/pointers.test new file mode 100644 index 000000000000..a8f84f14783d --- /dev/null +++ b/lit/SymbolFile/PDB/pointers.test @@ -0,0 +1,38 @@ +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/PointerTypeTest.cpp.obj %S/Inputs/PointerTypeTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/PointerTypeTest.cpp.exe %T/PointerTypeTest.cpp.obj +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-F %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN %s +RUN: lldb-test symbols %T/PointerTypeTest.cpp.exe | FileCheck --check-prefix=F %s + +CHECK: Module [[MOD:.*]] +CHECK: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\PointerTypeTest.cpp' + +MAIN-ST-F: name = "f" +MAIN-ST-F-SAME: decl = PointerTypeTest.cpp:8 +MAIN-ST-F-SAME: compiler_type = {{.*}} int (int) + +MAIN-ST: name = "ST", size = 4, decl = PointerTypeTest.cpp:6, compiler_type = {{.*}} struct ST { +MAIN-ST-NEXT: int a; +MAIN-ST-NEXT: int {{.*}}f(int); +MAIN-ST-NEXT:} + +MAIN: Function{[[FID1:.*]]}, mangled = _main +MAIN-NEXT: Block{[[FID1]]} +MAIN: Variable{{.*}}, name = "array_pointer" +MAIN-SAME: (int (*)[2][4]), scope = local +MAIN: Variable{{.*}}, name = "p_int" +MAIN-SAME: (int *), scope = local +MAIN: Variable{{.*}}, name = "p_member_field" +MAIN-SAME: (int ST::*), scope = local +MAIN: Variable{{.*}}, name = "p_member_method" +MAIN-SAME: (int (ST::*)(int) __attribute__((thiscall))), scope = local + +F: Function{[[FID2:.*]]}, demangled = {{.*}}f(int) +F-NEXT: Block{[[FID2]]} +F: Variable{{.*}}, name = "this" +F-SAME: (ST *), scope = parameter, location = {{.*}}, artificial +F: Variable{{.*}}, name = "x" +F-SAME: (int), scope = parameter, decl = PointerTypeTest.cpp:8 diff --git a/lit/SymbolFile/PDB/type-quals.test b/lit/SymbolFile/PDB/type-quals.test index fbe10c0d8d64..734509f78345 100644 --- a/lit/SymbolFile/PDB/type-quals.test +++ b/lit/SymbolFile/PDB/type-quals.test @@ -1,39 +1,39 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj -RUN: link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/TypeQualsTest.cpp.obj %S/Inputs/TypeQualsTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/TypeQualsTest.cpp.exe %T/TypeQualsTest.cpp.obj RUN: lldb-test symbols %T/TypeQualsTest.cpp.exe | FileCheck %s CHECK: Module [[MOD:.*]] -CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) -CHECK: Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int * -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const * -CHECK: Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *) - -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int * -CHECK: Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *) - -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int * -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int *& -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int & -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} const int & -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int && -CHECK: Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&) +CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor pdb ([[MOD]]) +CHECK-DAG: Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int * +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const * +CHECK-DAG: Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *) + +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int * +CHECK-DAG: Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *) + +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int * +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *& +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int && +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int & +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} const int & +CHECK-DAG: Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &, const int &, int &&) // FIXME: __unaligned is not supported. -CHECK: Type{{.*}} , name = "Func4", {{.*}}, compiler_type = {{.*}} void (int *, int *) +CHECK-DAG: Type{{.*}} , name = "Func4", {{.*}}, compiler_type = {{.*}} void (int *, int *) -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int *__restrict -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} int &__restrict -CHECK: Type{{.*}} , name = "Func5", {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict) +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int *__restrict +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} int &__restrict +CHECK-DAG: Type{{.*}} , name = "Func5", {{.*}}, compiler_type = {{.*}} void (int, int *__restrict, int &__restrict) -CHECK: Type{{.*}} , name = "Func6", {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict) +CHECK-DAG: Type{{.*}} , name = "Func6", {{.*}}, compiler_type = {{.*}} void (const volatile int *__restrict) -CHECK: Type{{.*}} , size = 400, compiler_type = {{.*}} volatile int *[100] -CHECK: Type{{.*}} , size = 4000, compiler_type = {{.*}} volatile int *[10][100] +CHECK-DAG: Type{{.*}} , size = 400, compiler_type = {{.*}} volatile int *[100] +CHECK-DAG: Type{{.*}} , size = 4000, compiler_type = {{.*}} volatile int *[10][100] -CHECK: Type{{.*}} , size = 4, compiler_type = {{.*}} long *__restrict +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} long *__restrict CHECK-DAG: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\TypeQualsTest.cpp' diff --git a/lit/SymbolFile/PDB/typedefs.test b/lit/SymbolFile/PDB/typedefs.test index 659ef6392d1c..caf23a8c1664 100644 --- a/lit/SymbolFile/PDB/typedefs.test +++ b/lit/SymbolFile/PDB/typedefs.test @@ -1,6 +1,5 @@ -REQUIRES: windows -RUN: clang-cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj -RUN: link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe +REQUIRES: system-windows, msvc +RUN: %build --compiler=msvc --arch=32 --nodefaultlib --output=%T/SimpleTypesTest.cpp.typedefs.exe %S/Inputs/SimpleTypesTest.cpp RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s ; Generate 32-bit target @@ -13,7 +12,7 @@ RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s ; both of them is the same. CHECK: Module [[MOD:.*]] -CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) +CHECK: {{^[0-9A-F]+}}: SymbolVendor pdb ([[MOD]]) CHECK-DAG: name = "char32_t", size = 4, compiler_type = {{.*}} char32_t CHECK-DAG: name = "char16_t", size = 2, compiler_type = {{.*}} char16_t CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = {{.*}} unsigned long @@ -46,9 +45,10 @@ CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} void * CHECK-DAG: Type{{.*}} , name = "long", size = 4, compiler_type = {{.*}} long CHECK-DAG: Type{{.*}} , name = "unsigned short", size = 2, compiler_type = {{.*}} unsigned short CHECK-DAG: Type{{.*}} , name = "unsigned int", size = 4, compiler_type = {{.*}} unsigned int +CHECK-DAG: Type{{.*}} , name = "char", size = 1, compiler_type = {{.*}} char CHECK-DAG: Type{{.*}} , name = "signed char", size = 1, compiler_type = {{.*}} signed char -CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} signed char (void *, long, unsigned short, unsigned int, ...) -CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} signed char (*)(void *, long, unsigned short, unsigned int, ...) +CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} char (void *, long, unsigned short, unsigned int, ...) +CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} char (*)(void *, long, unsigned short, unsigned int, ...) CHECK-DAG: Type{{.*}} , name = "VarArgsFuncTypedef", compiler_type = {{.*}} typedef VarArgsFuncTypedef CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = {{.*}} float diff --git a/lit/SymbolFile/PDB/udt-layout.test b/lit/SymbolFile/PDB/udt-layout.test new file mode 100644 index 000000000000..726f633efe5b --- /dev/null +++ b/lit/SymbolFile/PDB/udt-layout.test @@ -0,0 +1,51 @@ +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/UdtLayoutTest.cpp +RUN: %lldb -b -s %S/Inputs/UdtLayoutTest.script -- %t.exe | FileCheck %s + +CHECK:(int) int C::abc = 123 +CHECK:(List [16]) ls = { +CHECK: [15] = { +CHECK: Prev = 0x00000000 +CHECK: Next = 0x00000000 +CHECK: Value = { +CHECK: B<0> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x01' +CHECK: _b = 2 +CHECK: _c = 3 +CHECK: } +CHECK: B<1> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x02' +CHECK: _b = 4 +CHECK: _c = 6 +CHECK: } +CHECK: B<2> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x03' +CHECK: _b = 6 +CHECK: _c = 9 +CHECK: } +CHECK: B<3> = { +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _a = '\x04' +CHECK: _b = 8 +CHECK: _c = 12 +CHECK: } +CHECK: A = { +CHECK: _u = (_u1 = '\x02', _u2 = 2, _u3 = 2) +CHECK: } +CHECK: _x = 5 +CHECK: _y = 10 +CHECK: _z = '\x0f' +CHECK: } +CHECK: } +CHECK:} diff --git a/lit/SymbolFile/PDB/variables-locations.test b/lit/SymbolFile/PDB/variables-locations.test index b70339fa23ac..7696dc92cee8 100644 --- a/lit/SymbolFile/PDB/variables-locations.test +++ b/lit/SymbolFile/PDB/variables-locations.test @@ -1,6 +1,6 @@ -REQUIRES: windows -RUN: clang-cl /Zi %S/Inputs/VariablesLocationsTest.cpp /o %t.exe -RUN: %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/VariablesLocationsTest.cpp +RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s CHECK: g_var = 2222 diff --git a/lit/SymbolFile/PDB/variables.test b/lit/SymbolFile/PDB/variables.test index 6d37cd975b45..2e9b59471091 100644 --- a/lit/SymbolFile/PDB/variables.test +++ b/lit/SymbolFile/PDB/variables.test @@ -1,58 +1,66 @@ -REQUIRES: windows -RUN: clang-cl /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj -RUN: link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe -RUN: lldb-test symbols %T/VariablesTest.cpp.exe | FileCheck %s +REQUIRES: system-windows, msvc +RUN: %build --compiler=clang-cl --mode=compile --arch=64 --nodefaultlib --output=%T/VariablesTest.cpp.obj %S/Inputs/VariablesTest.cpp +RUN: %build --compiler=msvc --mode=link --arch=64 --nodefaultlib --output=%T/VariablesTest.cpp.exe %T/VariablesTest.cpp.obj +RUN: lldb-test symbols %T/VariablesTest.cpp.exe > %T/VariablesTest.out +RUN: FileCheck --check-prefix=GLOBALS --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-F --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-MAIN --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-CONSTRUCTOR --input-file=%T/VariablesTest.out %s +RUN: FileCheck --check-prefix=FUNC-MEMBER --input-file=%T/VariablesTest.out %s -CHECK: Module [[MOD:.*]] -CHECK: SymbolVendor ([[MOD]]) -CHECK: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\VariablesTest.cpp' -CHECK-DAG: Variable{{.*}}, name = "g_IntVar" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "m_StaticClassMember" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_pConst" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "same_name_var" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_EnumVar" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_tls" -CHECK-SAME: scope = thread local, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "ClassVar" -CHECK-SAME: scope = global, location = {{.*}}, external -CHECK-DAG: Variable{{.*}}, name = "g_Const" -CHECK-SAME: scope = ??? (2) +GLOBALS: Module [[MOD:.*]] +GLOBALS: SymbolVendor pdb ([[MOD]]) +GLOBALS: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\VariablesTest.cpp' +GLOBALS-DAG: Variable{{.*}}, name = "g_IntVar" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "m_StaticClassMember" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_pConst" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "same_name_var" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_EnumVar" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_tls" +GLOBALS-SAME: scope = thread local, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "ClassVar" +GLOBALS-SAME: scope = global, location = {{.*}}, external +GLOBALS-DAG: Variable{{.*}}, name = "g_Const" +GLOBALS-SAME: scope = ??? (2) +GLOBALS: Function -CHECK-DAG: Function{[[FID1:.*]]}, mangled = ?f@@YAHHH@Z -CHECK-NEXT: Block{[[FID1]]} -CHECK-DAG: Variable{{.*}}, name = "var_arg1" -CHECK-SAME: scope = parameter -CHECK-DAG: Variable{{.*}}, name = "var_arg2" -CHECK-SAME: scope = parameter -CHECK-DAG: Variable{{.*}}, name = "same_name_var" -CHECK-SAME: scope = local +FUNC-F: Function{{.*}}, mangled = ?f@@YAHHH@Z +FUNC-F-NEXT: Block +FUNC-F-NEXT: Variable{{.*}}, name = "var_arg1" +FUNC-F-SAME: scope = parameter +FUNC-F-NEXT: Variable{{.*}}, name = "var_arg2" +FUNC-F-SAME: scope = parameter +FUNC-F-NEXT: Variable{{.*}}, name = "same_name_var" +FUNC-F-SAME: scope = local -CHECK-DAG: Function{[[FID2:.*]]}, mangled = main -CHECK-NEXT: Block{[[FID2]]} -CHECK-DAG: Variable{{.*}}, name = "same_name_var" -CHECK-SAME: scope = local -CHECK-DAG: Variable{{.*}}, name = "local_const" -CHECK-SAME: scope = local -CHECK-DAG: Variable{{.*}}, name = "local_pCString" -CHECK-SAME: scope = local -CHECK-DAG: Variable{{.*}}, name = "a" -CHECK-SAME: scope = local +FUNC-MAIN: Function{{.*}}, mangled = main +FUNC-MAIN-NEXT: Block +FUNC-MAIN-NEXT: Variable{{.*}}, name = "same_name_var" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "local_const" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "local_CString" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "local_pCString" +FUNC-MAIN-SAME: scope = local +FUNC-MAIN-NEXT: Variable{{.*}}, name = "a" +FUNC-MAIN-SAME: scope = local -CHECK-DAG: Function{[[FID3:.*]]}, mangled = ??0Class@@QEAA@H@Z -CHECK-NEXT: Block{[[FID3]]} -CHECK-DAG: Variable{{.*}}, name = "this" -CHECK-SAME: scope = parameter -CHECK-SAME: artificial -CHECK-DAG: Variable{{.*}}, name = "a" -CHECK-SAME: scope = parameter +FUNC-CONSTRUCTOR: Function{{.*}}, mangled = ??0Class@@QEAA@H@Z +FUNC-CONSTRUCTOR-NEXT: Block +FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "this" +FUNC-CONSTRUCTOR-SAME: scope = parameter +FUNC-CONSTRUCTOR-SAME: artificial +FUNC-CONSTRUCTOR-NEXT: Variable{{.*}}, name = "a" +FUNC-CONSTRUCTOR-SAME: scope = parameter -CHECK-DAG: Function{[[FID4:.*]]}, mangled = ?Func@Class@@QEAAXXZ -CHECK-NEXT: Block{[[FID4]]} -CHECK-DAG: Variable{{.*}}, name = "this" -CHECK-SAME: scope = parameter -CHECK-SAME: artificial
\ No newline at end of file +FUNC-MEMBER: Function{{.*}}, mangled = ?Func@Class@@QEAAXXZ +FUNC-MEMBER-NEXT: Block +FUNC-MEMBER-NEXT: Variable{{.*}}, name = "this" +FUNC-MEMBER-SAME: scope = parameter +FUNC-MEMBER-SAME: artificial diff --git a/lit/SymbolFile/PDB/vbases.test b/lit/SymbolFile/PDB/vbases.test new file mode 100644 index 000000000000..57239e07c87d --- /dev/null +++ b/lit/SymbolFile/PDB/vbases.test @@ -0,0 +1,15 @@ +REQUIRES: system-windows, lld +RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/VBases.cpp +RUN: %lldb -b -s %S/Inputs/VBases.script -- %t.exe | FileCheck %s + +CHECK: { +CHECK: A = (a = '\x01') +CHECK: B = (b = 2) +CHECK: c = 3 +CHECK: } + +CHECK: { +CHECK: A = (a = '\x01') +CHECK: B = (b = 2) +CHECK: c = 3 +CHECK: } |
