aboutsummaryrefslogtreecommitdiff
path: root/lldb/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/API/commands/frame/var-dil/basics/GlobalVariableLookup/TestFrameVarDILGlobalVariableLookup.py9
-rw-r--r--lldb/test/API/driver/stdio_closed/TestDriverWithClosedSTDIO.py56
-rw-r--r--lldb/test/API/functionalities/vtable/Makefile6
-rw-r--r--lldb/test/API/lang/objc/synthesized-property-accessor/Makefile4
-rw-r--r--lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py30
-rw-r--r--lldb/test/API/lang/objc/synthesized-property-accessor/main.m14
-rw-r--r--lldb/test/API/lit.cfg.py2
-rw-r--r--lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py5
-rw-r--r--lldb/test/Shell/SymbolFile/NativePDB/simple-types.cpp12
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/function-nested-block.test6
-rw-r--r--lldb/test/Shell/SymbolFile/PDB/typedefs.test23
11 files changed, 147 insertions, 20 deletions
diff --git a/lldb/test/API/commands/frame/var-dil/basics/GlobalVariableLookup/TestFrameVarDILGlobalVariableLookup.py b/lldb/test/API/commands/frame/var-dil/basics/GlobalVariableLookup/TestFrameVarDILGlobalVariableLookup.py
index 9cb166e..4d55767 100644
--- a/lldb/test/API/commands/frame/var-dil/basics/GlobalVariableLookup/TestFrameVarDILGlobalVariableLookup.py
+++ b/lldb/test/API/commands/frame/var-dil/basics/GlobalVariableLookup/TestFrameVarDILGlobalVariableLookup.py
@@ -19,6 +19,15 @@ class TestFrameVarDILGlobalVariableLookup(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipIf(macos_version=["<", "15.0"], archs=["arm64", "arm64e"])
+ @expectedFailureAll(
+ dwarf_version=["<", "5"],
+ oslist=[lldbplatformutil.getDarwinOSTriples()],
+ )
+ @expectedFailureAll(
+ compiler="clang",
+ compiler_version=["<", "19.0"],
+ oslist=[lldbplatformutil.getDarwinOSTriples()],
+ )
def test_frame_var(self):
self.build()
lldbutil.run_to_source_breakpoint(
diff --git a/lldb/test/API/driver/stdio_closed/TestDriverWithClosedSTDIO.py b/lldb/test/API/driver/stdio_closed/TestDriverWithClosedSTDIO.py
new file mode 100644
index 0000000..a73322c
--- /dev/null
+++ b/lldb/test/API/driver/stdio_closed/TestDriverWithClosedSTDIO.py
@@ -0,0 +1,56 @@
+"""
+Test that if you exec lldb with the stdio file handles
+closed, it is able to exit without hanging.
+"""
+
+
+import lldb
+import os
+import sys
+import socket
+
+if os.name != "nt":
+ import fcntl
+
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+
+class TestDriverWithClosedSTDIO(TestBase):
+ # If your test case doesn't stress debug info, then
+ # set this to true. That way it won't be run once for
+ # each debug info format.
+ NO_DEBUG_INFO_TESTCASE = True
+
+ # Windows doesn't have the fcntl module, so we can't run this
+ # test there.
+ @skipIf(hostoslist=["windows"])
+ def test_run_lldb_and_wait(self):
+ """This test forks, closes the stdio channels and exec's lldb.
+ Then it waits for it to exit and asserts it did that successfully"""
+ pid = os.fork()
+ if pid == 0:
+ fcntl.fcntl(sys.stdin, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
+ fcntl.fcntl(sys.stdout, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
+ fcntl.fcntl(sys.stderr, fcntl.F_SETFD, fcntl.FD_CLOEXEC)
+ lldb = lldbtest_config.lldbExec
+ print(f"About to run: {lldb}")
+ os.execlp(
+ lldb,
+ lldb,
+ "-x",
+ "-o",
+ "script print(lldb.debugger.GetNumTargets())",
+ "--batch",
+ )
+ else:
+ if pid == -1:
+ print("Couldn't fork a process.")
+ return
+ ret_pid, status = os.waitpid(pid, 0)
+ # We're really just checking that lldb doesn't stall.
+ # At the time this test was written, if you close stdin
+ # in an asserts build, lldb aborts. So handle both
+ # of those cases. The failure will just be that the
+ # waitpid doesn't return, and the test times out.
+ self.assertFalse(os.WIFSTOPPED(status), "We either exited or crashed.")
diff --git a/lldb/test/API/functionalities/vtable/Makefile b/lldb/test/API/functionalities/vtable/Makefile
index 99998b2..cbd7d47 100644
--- a/lldb/test/API/functionalities/vtable/Makefile
+++ b/lldb/test/API/functionalities/vtable/Makefile
@@ -1,3 +1,9 @@
CXX_SOURCES := main.cpp
+ifeq "$(OS)" "Darwin"
+ # Make vtables writable for test_overwrite_vtable test
+ # The -no_data_const flag prevents vtables from being placed in __DATA_CONST
+ LD_EXTRAS := -Wl,-no_data_const
+endif
+
include Makefile.rules
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile b/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile
new file mode 100644
index 0000000..89e6e79
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/Makefile
@@ -0,0 +1,4 @@
+OBJC_SOURCES := main.m
+LDFLAGS := -lobjc
+
+include Makefile.rules
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py b/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py
new file mode 100644
index 0000000..0a171e98
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/TestSynthesizedPropertyAccessor.py
@@ -0,0 +1,30 @@
+"""
+Test debug-info parsing of synthesized Objective-C properties.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestSynthesizedPropertyAccessor(TestBase):
+ def test(self):
+ self.build()
+
+ (target, _, _, _) = lldbutil.run_to_source_breakpoint(
+ self, "return f.fooProp", lldb.SBFileSpec("main.m")
+ )
+
+ getters = target.FindFunctions("-[Foo fooProp]", lldb.eFunctionNameTypeSelector)
+ self.assertEqual(len(getters), 1)
+ getter = getters[0].function.GetType()
+ self.assertTrue(getter)
+ self.assertEqual(getter.GetDisplayTypeName(), "int ()")
+
+ setters = target.FindFunctions(
+ "-[Foo setFooProp:]", lldb.eFunctionNameTypeSelector
+ )
+ self.assertEqual(len(setters), 1)
+ setter = setters[0].function.GetType()
+ self.assertTrue(setter)
+ self.assertEqual(setter.GetDisplayTypeName(), "void (int)")
diff --git a/lldb/test/API/lang/objc/synthesized-property-accessor/main.m b/lldb/test/API/lang/objc/synthesized-property-accessor/main.m
new file mode 100644
index 0000000..4186162
--- /dev/null
+++ b/lldb/test/API/lang/objc/synthesized-property-accessor/main.m
@@ -0,0 +1,14 @@
+#import <Foundation/Foundation.h>
+
+@interface Foo : NSObject
+@property(readwrite) int fooProp;
+@end
+
+@implementation Foo
+@end
+
+int main() {
+ Foo *f = [Foo new];
+ [f setFooProp:10];
+ return f.fooProp;
+}
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index dcff868..f2a14d1 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -90,6 +90,8 @@ def find_python_interpreter():
)
shutil.copy(real_python, copied_python)
+ # macOS 15+ restricts injecting the ASAN runtime to only user-compiled code.
+ subprocess.check_call(["/usr/bin/codesign", "--remove-signature", copied_python])
# Now make sure the copied Python works. The Python in Xcode has a relative
# RPATH and cannot be copied.
diff --git a/lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py b/lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py
index 0f40dfd..9050f6a 100644
--- a/lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py
+++ b/lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py
@@ -18,6 +18,11 @@ def apple_silicon():
def rosetta_debugserver_installed():
+ import platform
+ version = platform.mac_ver()
+ # Workaround for an undiagnosed problem on green dragon.
+ if version[0] == '15.5':
+ return False
return exists("/Library/Apple/usr/libexec/oah/debugserver")
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/simple-types.cpp b/lldb/test/Shell/SymbolFile/NativePDB/simple-types.cpp
index 3781194..3664b04 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/simple-types.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/simple-types.cpp
@@ -3,7 +3,6 @@
// Test that simple types can be found
// RUN: %build --std=c++20 --nodefaultlib --compiler=clang-cl --arch=64 -o %t.exe -- %s
// RUN: lldb-test symbols %t.exe | FileCheck %s
-// RUN: lldb-test symbols %t.exe | FileCheck --check-prefix=FUNC-PARAMS %s
bool *PB;
bool &RB = *PB;
@@ -101,12 +100,14 @@ int main() {
// CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = 0x{{[0-9a-f]+}} float
// CHECK-DAG: Type{{.*}} , name = "const float", size = 4, compiler_type = 0x{{[0-9a-f]+}} const float
+// CHECK-DAG: Type{{.*}} , name = "double", size = 8, compiler_type = 0x{{[0-9a-f]+}} double
+
// CHECK-DAG: Type{{.*}} , name = "_Complex float", size = 4, compiler_type = 0x{{[0-9a-f]+}} _Complex float
// CHECK-DAG: Type{{.*}} , name = "_Complex double", size = 8, compiler_type = 0x{{[0-9a-f]+}} _Complex double
-// CHECK-DAG: Type{{.*}} , name = "ReturnedStruct1", size = 1, decl = simple-types.cpp:21, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct1 {
-// CHECK-DAG: Type{{.*}} , name = "ReturnedStruct2", size = 1, decl = simple-types.cpp:22, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct2 {
-// CHECK-DAG: Type{{.*}} , name = "MyStruct", size = 1, decl = simple-types.cpp:24, compiler_type = 0x{{[0-9a-f]+}} struct MyStruct {
+// CHECK-DAG: Type{{.*}} , name = "ReturnedStruct1", size = 1, decl = simple-types.cpp:20, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct1 {
+// CHECK-DAG: Type{{.*}} , name = "ReturnedStruct2", size = 1, decl = simple-types.cpp:21, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct2 {
+// CHECK-DAG: Type{{.*}} , name = "MyStruct", size = 1, decl = simple-types.cpp:23, compiler_type = 0x{{[0-9a-f]+}} struct MyStruct {
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} struct MyStruct *const
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} const struct MyStruct *const
@@ -137,6 +138,3 @@ int main() {
// CHECK-DAG: Type{{.*}} , size = 0, compiler_type = 0x{{[0-9a-f]+}} struct ReturnedStruct2 (char *)
// CHECK-DAG: Type{{.*}} , size = 8, compiler_type = 0x{{[0-9a-f]+}} long[2]
-
-// double is used as a parameter to `PF`, but not created as an LLDB type
-// FUNC-PARAMS-NOT: Type{{.*}} , name = "double"
diff --git a/lldb/test/Shell/SymbolFile/PDB/function-nested-block.test b/lldb/test/Shell/SymbolFile/PDB/function-nested-block.test
index 4a2355b..a18955b 100644
--- a/lldb/test/Shell/SymbolFile/PDB/function-nested-block.test
+++ b/lldb/test/Shell/SymbolFile/PDB/function-nested-block.test
@@ -1,7 +1,9 @@
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
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-FUNCTION %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -find=block -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-BLOCK %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-FUNCTION %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -find=block -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck --check-prefix=CHECK-BLOCK %s
CHECK-FUNCTION: Found 1 functions:
CHECK-FUNCTION: name = "main"
diff --git a/lldb/test/Shell/SymbolFile/PDB/typedefs.test b/lldb/test/Shell/SymbolFile/PDB/typedefs.test
index 86846fb..31bf714 100644
--- a/lldb/test/Shell/SymbolFile/PDB/typedefs.test
+++ b/lldb/test/Shell/SymbolFile/PDB/typedefs.test
@@ -1,7 +1,8 @@
REQUIRES: system-windows, msvc
RUN: mkdir -p %t.dir
RUN: %build --compiler=msvc --arch=32 --nodefaultlib --output=%t.dir/SimpleTypesTest.cpp.typedefs.exe %S/Inputs/SimpleTypesTest.cpp
-RUN: lldb-test symbols %t.dir/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %t.dir/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %t.dir/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
; Generate 32-bit target
@@ -13,7 +14,7 @@ RUN: lldb-test symbols %t.dir/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
; both of them is the same.
CHECK: Module [[MOD:.*]]
-CHECK: SymbolFile pdb ([[MOD]])
+CHECK: SymbolFile {{(native-)?}}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
@@ -23,7 +24,7 @@ CHECK-DAG: Type{{.*}} , size = 40, compiler_type = {{.*}} unsigned long[10]
CHECK-DAG: Type{{.*}} , name = "double", size = 8, compiler_type = {{.*}} double
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} double *
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} double *&
-CHECK-DAG: Type{{.*}} , name = "RefTypedef", compiler_type = {{.*}} typedef RefTypedef
+CHECK-DAG: Type{{.*}} , name = "RefTypedef"{{(, size = 4)?}}, compiler_type = {{.*}} typedef RefTypedef
CHECK-DAG: Type{{.*}} , name = "wchar_t", size = 2, compiler_type = {{.*}} wchar_t
@@ -37,23 +38,23 @@ CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} short *
CHECK-DAG: Type{{.*}} , name = "const double", size = 8, compiler_type = {{.*}} const double
CHECK-DAG: Type{{.*}} , name = "volatile bool", size = 1, compiler_type = {{.*}} volatile _Bool
CHECK-DAG: Type{{.*}} , name = "long long", size = 8, compiler_type = {{.*}} long long
-CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} long long (int &, unsigned char **, short *, const double, volatile _Bool)
-CHECK-DAG: Type{{.*}} , name = "FuncPtrTypedef", compiler_type = {{.*}} typedef FuncPtrTypedef
+CHECK-DAG: Type{{.*}} {{(, size = 0)?}}, compiler_type = {{.*}} long long (int &, unsigned char **, short *, const double, volatile _Bool)
+CHECK-DAG: Type{{.*}} , name = "FuncPtrTypedef"{{(, size = 4)?}}, compiler_type = {{.*}} typedef FuncPtrTypedef
-CHECK-DAG: Type{{.*}} , name = "void", compiler_type = {{.*}} void
+CHECK-DAG: Type{{.*}} , name = "void"{{(, size = 0)?}}, compiler_type = {{.*}} void
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 = "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 = {{.*}} char (void *, long, unsigned short, unsigned int, ...)
+CHECK-DAG: Type{{.*}} {{(, size = 0)?}}, 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 = "VarArgsFuncTypedef"{{(, size = 4)?}}, compiler_type = {{.*}} typedef VarArgsFuncTypedef
CHECK-DAG: Type{{.*}} , name = "float", size = 4, compiler_type = {{.*}} float
-CHECK-DAG: Type{{.*}} , compiler_type = {{.*}} float (...)
+CHECK-DAG: Type{{.*}} {{(, size = 0)?}}, compiler_type = {{.*}} float (...)
CHECK-DAG: Type{{.*}} , size = 4, compiler_type = {{.*}} float (*)(...)
-CHECK-DAG: Type{{.*}} , name = "VarArgsFuncTypedefA", compiler_type = {{.*}} typedef VarArgsFuncTypedefA
+CHECK-DAG: Type{{.*}} , name = "VarArgsFuncTypedefA"{{(, size = 4)?}}, compiler_type = {{.*}} typedef VarArgsFuncTypedefA
CHECK-DAG: {{^[0-9A-F]+}}: CompileUnit{{[{]0x[0-9a-f]+[}]}}, language = "c++", file = '{{.*}}\SimpleTypesTest.cpp'