summaryrefslogtreecommitdiffstats
path: root/lldb/test/Shell/SymbolFile/PDB/Inputs
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/Shell/SymbolFile/PDB/Inputs')
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/AstRestoreTest.cpp55
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp20
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp111
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/CompilandsTest.cpp3
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest.cpp20
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest0.script7
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest1.script1
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest2.script2
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbols.cpp16
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbolsTestMain.cpp59
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.cpp9
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.h12
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.ord4
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp8
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/PointerTypeTest.cpp23
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp52
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/TypeQualsTest.cpp46
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp61
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script4
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.cpp16
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.script7
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp26
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.script25
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesTest.cpp50
24 files changed, 637 insertions, 0 deletions
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/AstRestoreTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/AstRestoreTest.cpp
new file mode 100644
index 00000000000..8c9e26744d5
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp
new file mode 100644
index 00000000000..60854c04c60
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp
new file mode 100644
index 00000000000..3c4b005cdf1
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/CompilandsTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/CompilandsTest.cpp
new file mode 100644
index 00000000000..4cce7f667ff
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/CompilandsTest.cpp
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest.cpp
new file mode 100644
index 00000000000..3785cd3c64c
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest0.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest0.script
new file mode 100644
index 00000000000..d31a2abb68a
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest1.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest1.script
new file mode 100644
index 00000000000..dac887faa5b
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest1.script
@@ -0,0 +1 @@
+print sum(buf0, 1)
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest2.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest2.script
new file mode 100644
index 00000000000..b19240baf99
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest2.script
@@ -0,0 +1,2 @@
+print sum(buf0, result - 28)
+print sum(buf1 + 3, 3)
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbols.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbols.cpp
new file mode 100644
index 00000000000..ccccf6ffd10
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbols.cpp
@@ -0,0 +1,16 @@
+// Static function
+namespace {
+static long StaticFunction(int a)
+{
+ return 2;
+}
+}
+
+// Inlined function
+static inline int InlinedFunction(long a) { return 10; }
+
+void FunctionCall()
+{
+ StaticFunction(1);
+ InlinedFunction(1);
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbolsTestMain.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbolsTestMain.cpp
new file mode 100644
index 00000000000..17eeab7117b
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbolsTestMain.cpp
@@ -0,0 +1,59 @@
+
+// Global functions
+int Func_arg_array(int array[]) { return 1; }
+void Func_arg_void(void) { return; }
+void Func_arg_none(void) { return; }
+void Func_varargs(...) { return; }
+
+// Class
+namespace MemberTest {
+ class A {
+ public:
+ int Func(int a, ...) { return 1; }
+ };
+}
+
+// Template
+template <int N=1, class ...T>
+void TemplateFunc(T ...Arg) {
+ return;
+}
+
+// namespace
+namespace {
+ void Func(int a, const long b, volatile bool c, ...) { return; }
+}
+
+namespace NS {
+ void Func(char a, int b) {
+ return;
+ }
+}
+
+// Static function
+static long StaticFunction(int a)
+{
+ return 2;
+}
+
+// Inlined function
+inline void InlinedFunction(long a) { return; }
+
+extern void FunctionCall();
+
+int main() {
+ MemberTest::A v1;
+ v1.Func('a',10);
+
+ Func(1, 5, true, 10, 8);
+ NS::Func('c', 2);
+
+ TemplateFunc(10);
+ TemplateFunc(10,11,88);
+
+ StaticFunction(2);
+ InlinedFunction(1);
+
+ FunctionCall();
+ return 0;
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.cpp
new file mode 100644
index 00000000000..fa0030bacbf
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.cpp
@@ -0,0 +1,9 @@
+#include "FunctionLevelLinkingTest.h"
+
+int foo() {
+ return 0;
+}
+
+int main() {
+ return foo() + bar() + baz();
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.h b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.h
new file mode 100644
index 00000000000..0cc9d80d85d
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.h
@@ -0,0 +1,12 @@
+#ifndef FUNCTION_LEVEL_LINKING_TEST_H
+#define FUNCTION_LEVEL_LINKING_TEST_H
+
+int bar() {
+ return 0;
+}
+
+int baz() {
+ return 0;
+}
+
+#endif
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.ord b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.ord
new file mode 100644
index 00000000000..48abd0b872f
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.ord
@@ -0,0 +1,4 @@
+?foo@@YAHXZ
+?bar@@YAHXZ
+main
+?baz@@YAHXZ
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp
new file mode 100644
index 00000000000..62e201df5fe
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp
@@ -0,0 +1,8 @@
+int main() {
+ auto r = 0;
+ for (auto i = 1; i <= 10; i++) {
+ r += i & 1 + (i - 1) & 1 - 1;
+ }
+
+ return r;
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/PointerTypeTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/PointerTypeTest.cpp
new file mode 100644
index 00000000000..6612c30f00d
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
new file mode 100644
index 00000000000..de13a5b430c
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
@@ -0,0 +1,52 @@
+// typedef
+typedef unsigned long ULongArrayTypedef[10];
+ULongArrayTypedef ULongArrayVar;
+
+typedef long double*& RefTypedef;
+long double* LongDoublePtrVar = 0;
+RefTypedef RefVar = LongDoublePtrVar;
+
+typedef long long (*FuncPtrTypedef)(int&, unsigned char**, short[], const double, volatile bool);
+FuncPtrTypedef FuncVar;
+
+typedef char (*VarArgsFuncTypedef)(void*, long, unsigned short, unsigned int, ...);
+VarArgsFuncTypedef VarArgsFuncVar;
+
+typedef float (*VarArgsFuncTypedefA)(...);
+VarArgsFuncTypedefA VarArgsFuncVarA;
+
+// unscoped enum
+enum Enum { RED, GREEN, BLUE };
+Enum EnumVar;
+
+enum EnumConst { LOW, NORMAL = 10, HIGH };
+EnumConst EnumConstVar;
+
+enum EnumEmpty {};
+EnumEmpty EnumEmptyVar;
+
+enum EnumUChar : unsigned char { ON, OFF, AUTO };
+EnumUChar EnumCharVar;
+
+// scoped enum
+enum class EnumClass { YES, NO, DEFAULT };
+EnumClass EnumClassVar;
+
+enum struct EnumStruct { red, blue, black };
+EnumStruct EnumStructVar;
+
+typedef signed char SCharTypedef;
+SCharTypedef SCVar;
+
+typedef char16_t WChar16Typedef;
+WChar16Typedef WC16Var;
+
+typedef char32_t WChar32Typedef;
+WChar32Typedef WC32Var;
+
+typedef wchar_t WCharTypedef;
+WCharTypedef WCVar;
+
+int main() {
+ return 0;
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/TypeQualsTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/TypeQualsTest.cpp
new file mode 100644
index 00000000000..bedafcdacfc
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/TypeQualsTest.cpp
@@ -0,0 +1,46 @@
+// Rank > 0 array
+typedef volatile int* RankNArray[10][100];
+RankNArray ArrayVar;
+
+typedef int __unaligned *UnalignedTypedef;
+UnalignedTypedef UnVar;
+
+typedef long* __restrict RestrictTypedef;
+RestrictTypedef RestrictVar;
+
+void Func1(const int* a, int const* b, const int ** const c, const int* const* d) {
+ return;
+}
+
+void Func2(volatile int* a, int volatile* b) {
+ return;
+}
+
+void Func3(int*& a, int& b, const int&c, int&& d) {
+ return;
+}
+
+void Func4(int* __unaligned a, __unaligned int* b) {
+ return;
+}
+
+void Func5(int a, int* __restrict b, int& __restrict c) {
+ return;
+}
+
+void Func6(const volatile int* __restrict b) {
+ return;
+}
+
+// LValue
+typedef int& IntRef;
+int x = 0;
+IntRef IVar = x;
+
+// RValue
+typedef int&& IIRef;
+IIRef IIVar = int(1);
+
+int main() {
+ return 0;
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp
new file mode 100644
index 00000000000..59a4fc585d7
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script
new file mode 100644
index 00000000000..91de55f4ade
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script
@@ -0,0 +1,4 @@
+breakpoint set --file UdtLayoutTest.cpp --line 60
+run
+target variable
+frame variable
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.cpp
new file mode 100644
index 00000000000..a5e84bd3657
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.script
new file mode 100644
index 00000000000..8675890b76e
--- /dev/null
+++ b/lldb/test/Shell/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/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
new file mode 100644
index 00000000000..7b7180a3ec4
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
@@ -0,0 +1,26 @@
+int g_var = 2222;
+
+void __fastcall foo(short arg_0, float arg_1) {
+ char loc_0 = 'x';
+ double loc_1 = 0.5678;
+}
+
+__declspec(align(128)) struct S {
+ int a = 1234;
+};
+
+void bar(int arg_0) {
+ S loc_0;
+ int loc_1 = 5678;
+}
+
+
+int main(int argc, char *argv[]) {
+ bool loc_0 = true;
+ int loc_1 = 3333;
+
+ foo(1111, 0.1234);
+ bar(22);
+
+ return 0;
+}
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.script b/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
new file mode 100644
index 00000000000..7dd90352cce
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
@@ -0,0 +1,25 @@
+breakpoint set --file VariablesLocationsTest.cpp --line 6
+breakpoint set --file VariablesLocationsTest.cpp --line 15
+
+run
+
+target variable g_var
+
+frame variable arg_0
+frame variable arg_1
+
+frame variable loc_0
+frame variable loc_1
+
+frame select 1
+
+frame variable loc_0
+frame variable loc_1
+
+continue
+
+frame variable arg_0
+
+frame variable loc_0
+frame variable loc_1
+
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesTest.cpp b/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesTest.cpp
new file mode 100644
index 00000000000..304d9056609
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesTest.cpp
@@ -0,0 +1,50 @@
+typedef int IntTypedef;
+IntTypedef g_IntVar; // Testing globals.
+
+typedef enum Enum { // Testing constants.
+ RED,
+ GREEN,
+ BLUE
+} EnumTypedef;
+EnumTypedef g_EnumVar; // Testing members.
+
+// FIXME: `sg_IntVar` appears both in global scope's children and compiland's
+// children but with different symbol's id.
+static int sg_IntVar = -1; // Testing file statics.
+
+// FIXME: `g_Const` appears both in global scope's children and compiland's
+// children but with different symbol's id.
+const int g_Const = 0x88; // Testing constant data.
+const int *g_pConst = &g_Const; // Avoid optimizing the const away
+
+thread_local int g_tls = 0; // Testing thread-local storage.
+
+class Class {
+ static int m_StaticClassMember;
+public:
+ explicit Class(int a) {}
+ void Func() {}
+};
+int Class::m_StaticClassMember = 10; // Testing static class members.
+Class ClassVar(1);
+
+int f(int var_arg1, int var_arg2) { // Testing parameters.
+ long same_name_var = -1;
+ return 1;
+}
+
+int same_name_var = 100;
+int main() {
+ int same_name_var = 0; // Testing locals.
+ const char local_const = 0x1;
+
+ // FIXME: 'local_CString` is not found through compiland's children.
+ const char local_CString[] = "abc"; // Testing constant string.
+ const char *local_pCString = local_CString; // Avoid optimizing the const away
+
+ int a = 10;
+ a++;
+
+ ClassVar.Func();
+ return 0;
+}
OpenPOWER on IntegriCloud