summaryrefslogtreecommitdiff
path: root/lldb/test/Shell
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/Shell')
-rw-r--r--lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test133
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/func-symbols.test2
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/pointers.test42
3 files changed, 158 insertions, 19 deletions
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test b/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test
new file mode 100644
index 000000000000..ee96fa8fd5c3
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test
@@ -0,0 +1,133 @@
+# REQUIRES: lld, target-windows
+
+# Test that functions have the correct types.
+# This uses the same input as SymbolFile/PDB/func-symbols.test. However, DIA
+# creates one named `Type` per function and uses identical UIDs for `Type` and
+# `Function`, whereas native creates one unnamed type per signature and has different UIDs.
+
+# RUN: split-file %s %t
+# RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib -o %t.exe %t/main.cpp %t/second.cpp
+# RUN: lldb-test symbols %t.exe | FileCheck --check-prefix=CHECK-ONE %s
+# RUN: lldb-test symbols %t.exe | FileCheck --check-prefix=CHECK-TWO %s
+
+#--- main.cpp
+
+// 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;
+}
+
+#--- main-checks
+
+# CHECK-ONE: Module [[MD:.*]]
+# CHECK-ONE-DAG: SymbolFile native-pdb ([[MD]])
+# CHECK-ONE-DAG: [[TY0:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} int (int *)
+# CHECK-ONE-DAG: [[TY1:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (void)
+# CHECK-ONE-DAG: [[TY2:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (...)
+# CHECK-ONE-DAG: [[TY3:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (char, int)
+# CHECK-ONE-DAG: [[TY4:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} int (void)
+# CHECK-ONE-DAG: [[TY5:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...)
+# CHECK-ONE-DAG: [[TY6:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} long (int)
+# CHECK-ONE-DAG: [[TY7:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} int (int, ...)
+# CHECK-ONE-DAG: [[TY8:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (int)
+# CHECK-ONE-DAG: [[TY9:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (int, int, int)
+# CHECK-ONE-DAG: [[TY10:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (long)
+
+# CHECK-ONE: {{.*}}: CompileUnit{{.*}}, language = "c++", file = '{{.*}}main.cpp'
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_arg_array@@YAHQAH@Z, type = [[TY0]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_arg_void@@YAXXZ, type = [[TY1]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_arg_none@@YAXXZ, type = [[TY1]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_varargs@@YAXZZ, type = [[TY2]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func@NS@@YAXDH@Z, type = [[TY3]]
+# CHECK-ONE-DAG: Function{{.*}}, demangled = main, type = [[TY4]]
+# CHECK-ONE-DAG: Function{{.*}}, demangled = {{.*}}`anonymous namespace'::Func{{.*}}, type = [[TY5]]
+# CHECK-ONE-DAG: Function{{.*}}, demangled = {{.*}}StaticFunction{{.*}}, type = [[TY6]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func@A@MemberTest@@QAAHHZZ, type = [[TY7]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ??$TemplateFunc@$00H@@YAXH@Z, type = [[TY8]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ??$TemplateFunc@$00HHH@@YAXHHH@Z, type = [[TY9]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?InlinedFunction@@YAXJ@Z, type = [[TY10]]
+
+#--- second.cpp
+
+// 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);
+}
+
+#--- second-checks
+
+# We expect new types observed in another compile unit
+# CHECK-TWO-DAG: [[TY1:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} void (void)
+# CHECK-TWO-DAG: [[TY2:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} long (int)
+# CHECK-TWO-DAG: [[TY3:.*]]: Type{{.*}} , size = 0, compiler_type = {{.*}} int (long)
+
+# CHECK-TWO: {{.*}}: CompileUnit{{.*}}, language = "c++", file = '{{.*}}second.cpp'
+# CHECK-TWO-DAG: Function{{.*}}, mangled = ?FunctionCall@@YAXXZ, type = [[TY1]]
+# CHECK-TWO-DAG: Function{{.*}}, demangled = {{.*}}`anonymous namespace'::StaticFunction{{.*}}, type = [[TY2]]
+# CHECK-TWO-DAG: Function{{.*}}, demangled = {{.*}}InlinedFunction{{.*}}, type = [[TY3]]
diff --git a/lldb/test/Shell/SymbolFile/PDB/func-symbols.test b/lldb/test/Shell/SymbolFile/PDB/func-symbols.test
index 408db14ba26f..6417bf39b067 100644
--- a/lldb/test/Shell/SymbolFile/PDB/func-symbols.test
+++ b/lldb/test/Shell/SymbolFile/PDB/func-symbols.test
@@ -1,4 +1,4 @@
-REQUIRES: target-windows, lld
+REQUIRES: target-windows, lld, diasdk
RUN: mkdir -p %t.dir
RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.dir/FuncSymbolsTest.exe %S/Inputs/FuncSymbolsTestMain.cpp %S/Inputs/FuncSymbols.cpp
RUN: lldb-test symbols %t.dir/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-ONE %s
diff --git a/lldb/test/Shell/SymbolFile/PDB/pointers.test b/lldb/test/Shell/SymbolFile/PDB/pointers.test
index 29fe171ca97a..2563ea96d1c9 100644
--- a/lldb/test/Shell/SymbolFile/PDB/pointers.test
+++ b/lldb/test/Shell/SymbolFile/PDB/pointers.test
@@ -2,38 +2,44 @@ REQUIRES: target-windows, msvc
RUN: mkdir -p %t.dir
RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%t.dir/PointerTypeTest.cpp.obj %S/Inputs/PointerTypeTest.cpp
RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%t.dir/PointerTypeTest.cpp.exe %t.dir/PointerTypeTest.cpp.obj
-RUN: lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck %s
-RUN: lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-F %s
-RUN: lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST %s
-RUN: lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN %s
-RUN: lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=F %s
+
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-INT %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-FN %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=F %s
+
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-INT %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN-ST-FN %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/PointerTypeTest.cpp.exe | FileCheck --check-prefix=MAIN %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/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-INT-LABEL: name = "ST", size = 4, decl = PointerTypeTest.cpp:6, compiler_type = {{.*}} struct ST {
+MAIN-ST-INT: int a;
+MAIN-ST-INT-LABEL:}
-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-ST-FN-LABEL: name = "ST", size = 4, decl = PointerTypeTest.cpp:6, compiler_type = {{.*}} struct ST {
+MAIN-ST-FN: int {{.*}}f(int);
+MAIN-ST-FN-LABEL:}
-MAIN: Function{[[FID1:.*]]}, mangled = {{_?}}main
+MAIN: Function{[[FID1:.*]]}, {{(de)?}}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-SAME: (int {{(`extern "C" main'::`2'::)?}}ST::*), scope = local
MAIN: Variable{{.*}}, name = "p_member_method"
-MAIN-SAME: (int (ST::*)(int){{( __attribute__\(\(thiscall\)\))?}}), scope = local
+MAIN-SAME: (int ({{(`extern "C" main'::`2'::)?}}ST::*)(int){{( __attribute__\(\(thiscall\)\))?}}), scope = local
-F: Function{[[FID2:.*]]}, demangled = {{.*}}f(int)
+F: Function{[[FID2:.*]]}, demangled = {{.*}}main::ST::f
F-NEXT: Block{[[FID2]]}
F: Variable{{.*}}, name = "this"
-F-SAME: (ST *), scope = parameter, location = {{(DW_OP.*)|(<empty>)}}, artificial
+F-SAME: ({{(`extern "C" main'::`2'::)?}}ST *), scope = parameter, location = {{DW_OP|<empty>|0x00000000}}
F: Variable{{.*}}, name = "x"
-F-SAME: (int), scope = parameter, decl = PointerTypeTest.cpp:8
+F-SAME: (int), scope = parameter{{(, decl = PointerTypeTest.cpp:8)?}}