aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/types
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/types')
-rw-r--r--packages/Python/lldbsuite/test/types/AbstractBase.py259
-rw-r--r--packages/Python/lldbsuite/test/types/HideTestFailures.py78
-rw-r--r--packages/Python/lldbsuite/test/types/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/types/TestFloatTypes.py41
-rw-r--r--packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py44
-rw-r--r--packages/Python/lldbsuite/test/types/TestIntegerTypes.py113
-rw-r--r--packages/Python/lldbsuite/test/types/TestIntegerTypesExpr.py113
-rw-r--r--packages/Python/lldbsuite/test/types/TestRecursiveTypes.py51
-rw-r--r--packages/Python/lldbsuite/test/types/basic_type.cpp211
-rw-r--r--packages/Python/lldbsuite/test/types/char.cpp9
-rw-r--r--packages/Python/lldbsuite/test/types/double.cpp9
-rw-r--r--packages/Python/lldbsuite/test/types/float.cpp9
-rw-r--r--packages/Python/lldbsuite/test/types/int.cpp9
-rw-r--r--packages/Python/lldbsuite/test/types/long.cpp18
-rw-r--r--packages/Python/lldbsuite/test/types/long_long.cpp18
-rw-r--r--packages/Python/lldbsuite/test/types/recursive_type_1.cpp12
-rw-r--r--packages/Python/lldbsuite/test/types/recursive_type_2.cpp10
-rw-r--r--packages/Python/lldbsuite/test/types/recursive_type_main.cpp8
-rw-r--r--packages/Python/lldbsuite/test/types/short.cpp9
-rw-r--r--packages/Python/lldbsuite/test/types/unsigned_char.cpp9
-rw-r--r--packages/Python/lldbsuite/test/types/unsigned_int.cpp9
-rw-r--r--packages/Python/lldbsuite/test/types/unsigned_long.cpp18
-rw-r--r--packages/Python/lldbsuite/test/types/unsigned_long_long.cpp18
-rw-r--r--packages/Python/lldbsuite/test/types/unsigned_short.cpp9
24 files changed, 1091 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/types/AbstractBase.py b/packages/Python/lldbsuite/test/types/AbstractBase.py
new file mode 100644
index 000000000000..dd09c91f4d02
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/AbstractBase.py
@@ -0,0 +1,259 @@
+"""
+Abstract base class of basic types provides a generic type tester method.
+"""
+
+from __future__ import print_function
+
+import os, time
+import re
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+def Msg(var, val, using_frame_variable):
+ return "'%s %s' matches the output (from compiled code): %s" % (
+ 'frame variable --show-types' if using_frame_variable else 'expression' ,var, val)
+
+class GenericTester(TestBase):
+
+ # This is the pattern by design to match the " var = 'value'" output from
+ # printf() stmts (see basic_type.cpp).
+ pattern = re.compile(" (\*?a[^=]*) = '([^=]*)'$")
+
+ # Assert message.
+ DATA_TYPE_GROKKED = "Data type from expr parser output is parsed correctly"
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # We'll use the test method name as the exe_name.
+ # There are a bunch of test cases under test/types and we don't want the
+ # module cacheing subsystem to be confused with executable name "a.out"
+ # used for all the test cases.
+ self.exe_name = self.testMethodName
+ self.golden_filename = os.path.join(os.getcwd(), "golden-output.txt")
+
+ def tearDown(self):
+ """Cleanup the test byproducts."""
+ #print("Removing golden-output.txt...")
+ if os.path.exists(self.golden_filename):
+ os.remove(self.golden_filename)
+ TestBase.tearDown(self)
+
+ #==========================================================================#
+ # Functions build_and_run() and build_and_run_expr() are generic functions #
+ # which are called from the Test*Types*.py test cases. The API client is #
+ # responsible for supplying two mandatory arguments: the source file, e.g.,#
+ # 'int.cpp', and the atoms, e.g., set(['unsigned', 'long long']) to the #
+ # functions. There are also three optional keyword arguments of interest, #
+ # as follows: #
+ # #
+ # bc -> blockCaptured (defaulted to False) #
+ # True: testing vars of various basic types from inside a block #
+ # False: testing vars of various basic types from a function #
+ # qd -> quotedDisplay (defaulted to False) #
+ # True: the output from 'frame var' or 'expr var' contains a pair #
+ # of single quotes around the value #
+ # False: no single quotes are to be found around the value of #
+ # variable #
+ #==========================================================================#
+
+ def build_and_run(self, source, atoms, bc=False, qd=False):
+ self.build_and_run_with_source_atoms_expr(source, atoms, expr=False, bc=bc, qd=qd)
+
+ def build_and_run_expr(self, source, atoms, bc=False, qd=False):
+ self.build_and_run_with_source_atoms_expr(source, atoms, expr=True, bc=bc, qd=qd)
+
+ def build_and_run_with_source_atoms_expr(self, source, atoms, expr, bc=False, qd=False):
+ # See also Makefile and basic_type.cpp:177.
+ if bc:
+ d = {'CXX_SOURCES': source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DTEST_BLOCK_CAPTURED_VARS'}
+ else:
+ d = {'CXX_SOURCES': source, 'EXE': self.exe_name}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ if expr:
+ self.generic_type_expr_tester(self.exe_name, atoms, blockCaptured=bc, quotedDisplay=qd)
+ else:
+ self.generic_type_tester(self.exe_name, atoms, blockCaptured=bc, quotedDisplay=qd)
+
+ def process_launch_o(self, localPath):
+ # process launch command output redirect always goes to host the process is running on
+ if lldb.remote_platform:
+ # process launch -o requires a path that is valid on the target
+ self.assertIsNotNone(lldb.remote_platform.GetWorkingDirectory())
+ remote_path = lldbutil.append_to_process_working_directory("lldb-stdout-redirect.txt")
+ self.runCmd('process launch -o {remote}'.format(remote=remote_path))
+ # copy remote_path to local host
+ self.runCmd('platform get-file {remote} "{local}"'.format(
+ remote=remote_path, local=self.golden_filename))
+ else:
+ self.runCmd('process launch -o "{local}"'.format(local=self.golden_filename))
+
+ def generic_type_tester(self, exe_name, atoms, quotedDisplay=False, blockCaptured=False):
+ """Test that variables with basic types are displayed correctly."""
+
+ self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+
+ # First, capture the golden output emitted by the oracle, i.e., the
+ # series of printf statements.
+
+ self.process_launch_o(self.golden_filename)
+
+ with open(self.golden_filename) as f:
+ go = f.read()
+
+ # This golden list contains a list of (variable, value) pairs extracted
+ # from the golden output.
+ gl = []
+
+ # Scan the golden output line by line, looking for the pattern:
+ #
+ # variable = 'value'
+ #
+ for line in go.split(os.linesep):
+ # We'll ignore variables of array types from inside a block.
+ if blockCaptured and '[' in line:
+ continue
+ match = self.pattern.search(line)
+ if match:
+ var, val = match.group(1), match.group(2)
+ gl.append((var, val))
+ #print("golden list:", gl)
+
+ # This test uses a #include of "basic_type.cpp" so we need to enable
+ # always setting inlined breakpoints.
+ self.runCmd('settings set target.inline-breakpoint-strategy always')
+ # And add hooks to restore the settings during tearDown().
+ self.addTearDownHook(
+ lambda: self.runCmd("settings set target.inline-breakpoint-strategy headers"))
+
+ # Bring the program to the point where we can issue a series of
+ # 'frame variable --show-types' command.
+ if blockCaptured:
+ break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
+ else:
+ break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
+ lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", break_line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = [" at basic_type.cpp:%d" % break_line,
+ "stop reason = breakpoint"])
+
+ #self.runCmd("frame variable --show-types")
+
+ # Now iterate through the golden list, comparing against the output from
+ # 'frame variable --show-types var'.
+ for var, val in gl:
+ self.runCmd("frame variable --show-types %s" % var)
+ output = self.res.GetOutput()
+
+ # The input type is in a canonical form as a set of named atoms.
+ # The display type string must contain each and every element.
+ #
+ # Example:
+ # runCmd: frame variable --show-types a_array_bounded[0]
+ # output: (char) a_array_bounded[0] = 'a'
+ #
+ try:
+ dt = re.match("^\((.*)\)", output).group(1)
+ except:
+ self.fail(self.DATA_TYPE_GROKKED)
+
+ # Expect the display type string to contain each and every atoms.
+ self.expect(dt,
+ "Display type: '%s' must contain the type atoms: '%s'" %
+ (dt, atoms),
+ exe=False,
+ substrs = list(atoms))
+
+ # The (var, val) pair must match, too.
+ nv = ("%s = '%s'" if quotedDisplay else "%s = %s") % (var, val)
+ self.expect(output, Msg(var, val, True), exe=False,
+ substrs = [nv])
+ pass
+
+ def generic_type_expr_tester(self, exe_name, atoms, quotedDisplay=False, blockCaptured=False):
+ """Test that variable expressions with basic types are evaluated correctly."""
+
+ self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+
+ # First, capture the golden output emitted by the oracle, i.e., the
+ # series of printf statements.
+
+ self.process_launch_o(self.golden_filename)
+
+ with open(self.golden_filename) as f:
+ go = f.read()
+
+ # This golden list contains a list of (variable, value) pairs extracted
+ # from the golden output.
+ gl = []
+
+ # Scan the golden output line by line, looking for the pattern:
+ #
+ # variable = 'value'
+ #
+ for line in go.split(os.linesep):
+ # We'll ignore variables of array types from inside a block.
+ if blockCaptured and '[' in line:
+ continue
+ match = self.pattern.search(line)
+ if match:
+ var, val = match.group(1), match.group(2)
+ gl.append((var, val))
+ #print("golden list:", gl)
+
+ # This test uses a #include of "basic_type.cpp" so we need to enable
+ # always setting inlined breakpoints.
+ self.runCmd('settings set target.inline-breakpoint-strategy always')
+ # And add hooks to restore the settings during tearDown().
+ self.addTearDownHook(
+ lambda: self.runCmd("settings set target.inline-breakpoint-strategy headers"))
+
+ # Bring the program to the point where we can issue a series of
+ # 'expr' command.
+ if blockCaptured:
+ break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
+ else:
+ break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
+ lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", break_line, num_expected_locations=1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = [" at basic_type.cpp:%d" % break_line,
+ "stop reason = breakpoint"])
+
+ #self.runCmd("frame variable --show-types")
+
+ # Now iterate through the golden list, comparing against the output from
+ # 'expr var'.
+ for var, val in gl:
+ self.runCmd("expression %s" % var)
+ output = self.res.GetOutput()
+
+ # The input type is in a canonical form as a set of named atoms.
+ # The display type string must contain each and every element.
+ #
+ # Example:
+ # runCmd: expr a
+ # output: (double) $0 = 1100.12
+ #
+ try:
+ dt = re.match("^\((.*)\) \$[0-9]+ = ", output).group(1)
+ except:
+ self.fail(self.DATA_TYPE_GROKKED)
+
+ # Expect the display type string to contain each and every atoms.
+ self.expect(dt,
+ "Display type: '%s' must contain the type atoms: '%s'" %
+ (dt, atoms),
+ exe=False,
+ substrs = list(atoms))
+
+ # The val part must match, too.
+ valPart = ("'%s'" if quotedDisplay else "%s") % val
+ self.expect(output, Msg(var, val, False), exe=False,
+ substrs = [valPart])
+ pass
diff --git a/packages/Python/lldbsuite/test/types/HideTestFailures.py b/packages/Python/lldbsuite/test/types/HideTestFailures.py
new file mode 100644
index 000000000000..5818166ef5ee
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/HideTestFailures.py
@@ -0,0 +1,78 @@
+"""
+Test that variables of integer basic types are displayed correctly.
+"""
+
+from __future__ import print_function
+
+
+
+import AbstractBase
+import sys
+import lldb
+from lldbsuite.test.lldbtest import *
+
+# rdar://problem/9649573
+# Capture the lldb and gdb-remote log files for test failures when run with no "-w" option
+class DebugIntegerTypesFailures(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # If we're lucky, test_long_type_with_dsym fails.
+ # Let's turn on logging just for that.
+ try:
+ if "test_long_type_with_dsym" in self.id():
+ self.runCmd(
+ "log enable -n -f %s lldb commands event process state" %
+ os.environ["DEBUG_LLDB_LOG"])
+ self.runCmd(
+ "log enable -n -f %s gdb-remote packets process" %
+ os.environ["DEBUG_GDB_REMOTE_LOG"])
+ except:
+ pass
+
+ def tearDown(self):
+ # If we're lucky, test_long_type_with_dsym fails.
+ # Let's turn off logging just for that.
+ if "test_long_type_with_dsym" in self.id():
+ self.runCmd("log disable lldb")
+ self.runCmd("log disable gdb-remote")
+ # Call super's tearDown().
+ TestBase.tearDown(self)
+
+ def test_char_type(self):
+ """Test that char-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'char.cpp'}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.generic_type_tester(set(['char']), quotedDisplay=True)
+
+ def test_short_type(self):
+ """Test that short-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'short.cpp'}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.generic_type_tester(set(['short']))
+
+ def test_int_type(self):
+ """Test that int-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'int.cpp'}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.generic_type_tester(set(['int']))
+
+ def test_long_type(self):
+ """Test that long-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'long.cpp'}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.generic_type_tester(set(['long']))
+
+ def test_long_long_type(self):
+ """Test that 'long long'-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'long_long.cpp'}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.generic_type_tester(set(['long long']))
diff --git a/packages/Python/lldbsuite/test/types/Makefile b/packages/Python/lldbsuite/test/types/Makefile
new file mode 100644
index 000000000000..c1b4cb32561d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/Makefile
@@ -0,0 +1,7 @@
+LEVEL = ../make
+
+# Example:
+#
+# CXX_SOURCES := int.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/packages/Python/lldbsuite/test/types/TestFloatTypes.py b/packages/Python/lldbsuite/test/types/TestFloatTypes.py
new file mode 100644
index 000000000000..01fd4a267804
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/TestFloatTypes.py
@@ -0,0 +1,41 @@
+"""
+Test that variables of floating point types are displayed correctly.
+"""
+
+from __future__ import print_function
+
+
+
+import AbstractBase
+import lldb
+import sys
+from lldbsuite.test.lldbtest import *
+
+class FloatTypesTestCase(AbstractBase.GenericTester):
+
+ mydir = AbstractBase.GenericTester.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ AbstractBase.GenericTester.setUp(self)
+ # disable "There is a running process, kill it and restart?" prompt
+ self.runCmd("settings set auto-confirm true")
+ self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
+ def test_float_type(self):
+ """Test that float-type variables are displayed correctly."""
+ self.build_and_run('float.cpp', set(['float']))
+
+ @skipUnlessDarwin
+ def test_float_type_from_block(self):
+ """Test that float-type variables are displayed correctly from a block."""
+ self.build_and_run('float.cpp', set(['float']), bc=True)
+
+ def test_double_type(self):
+ """Test that double-type variables are displayed correctly."""
+ self.build_and_run('double.cpp', set(['double']))
+
+ @skipUnlessDarwin
+ def test_double_type_from_block(self):
+ """Test that double-type variables are displayed correctly from a block."""
+ self.build_and_run('double.cpp', set(['double']), bc=True)
diff --git a/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py b/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py
new file mode 100644
index 000000000000..a825a92c66cc
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/TestFloatTypesExpr.py
@@ -0,0 +1,44 @@
+"""
+Test that variable expressions of floating point types are evaluated correctly.
+"""
+
+from __future__ import print_function
+
+
+
+import AbstractBase
+import lldb
+import sys
+from lldbsuite.test.lldbtest import *
+
+class FloatTypesExprTestCase(AbstractBase.GenericTester):
+
+ mydir = AbstractBase.GenericTester.compute_mydir(__file__)
+
+ # rdar://problem/8493023
+ # test/types failures for Test*TypesExpr.py: element offset computed wrong and sign error?
+
+ def setUp(self):
+ # Call super's setUp().
+ AbstractBase.GenericTester.setUp(self)
+ # disable "There is a running process, kill it and restart?" prompt
+ self.runCmd("settings set auto-confirm true")
+ self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
+ def test_float_type(self):
+ """Test that float-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('float.cpp', set(['float']))
+
+ @skipUnlessDarwin
+ def test_float_type_from_block(self):
+ """Test that float-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('float.cpp', set(['float']), bc=True)
+
+ def test_double_type(self):
+ """Test that double-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('double.cpp', set(['double']))
+
+ @skipUnlessDarwin
+ def test_double_type_from_block(self):
+ """Test that double-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('double.cpp', set(['double']), bc=True)
diff --git a/packages/Python/lldbsuite/test/types/TestIntegerTypes.py b/packages/Python/lldbsuite/test/types/TestIntegerTypes.py
new file mode 100644
index 000000000000..4b979df51db3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/TestIntegerTypes.py
@@ -0,0 +1,113 @@
+"""
+Test that variables of integer basic types are displayed correctly.
+"""
+
+from __future__ import print_function
+
+
+
+import AbstractBase
+import lldb
+import sys
+from lldbsuite.test.lldbtest import *
+
+class IntegerTypesTestCase(AbstractBase.GenericTester):
+
+ mydir = AbstractBase.GenericTester.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ AbstractBase.GenericTester.setUp(self)
+ # disable "There is a running process, kill it and restart?" prompt
+ self.runCmd("settings set auto-confirm true")
+ self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
+ def test_char_type(self):
+ """Test that char-type variables are displayed correctly."""
+ self.build_and_run('char.cpp', set(['char']), qd=True)
+
+ @skipUnlessDarwin
+ def test_char_type_from_block(self):
+ """Test that char-type variables are displayed correctly from a block."""
+ self.build_and_run('char.cpp', set(['char']), bc=True, qd=True)
+
+ def test_unsigned_char_type(self):
+ """Test that 'unsigned_char'-type variables are displayed correctly."""
+ self.build_and_run('unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+
+ @skipUnlessDarwin
+ def test_unsigned_char_type_from_block(self):
+ """Test that 'unsigned char'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)
+
+ def test_short_type(self):
+ """Test that short-type variables are displayed correctly."""
+ self.build_and_run('short.cpp', set(['short']))
+
+ @skipUnlessDarwin
+ def test_short_type_from_block(self):
+ """Test that short-type variables are displayed correctly from a block."""
+ self.build_and_run('short.cpp', set(['short']), bc=True)
+
+ def test_unsigned_short_type(self):
+ """Test that 'unsigned_short'-type variables are displayed correctly."""
+ self.build_and_run('unsigned_short.cpp', set(['unsigned', 'short']))
+
+ @skipUnlessDarwin
+ def test_unsigned_short_type_from_block(self):
+ """Test that 'unsigned short'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
+
+ def test_int_type(self):
+ """Test that int-type variables are displayed correctly."""
+ self.build_and_run('int.cpp', set(['int']))
+
+ @skipUnlessDarwin
+ def test_int_type_from_block(self):
+ """Test that int-type variables are displayed correctly from a block."""
+ self.build_and_run('int.cpp', set(['int']))
+
+ def test_unsigned_int_type(self):
+ """Test that 'unsigned_int'-type variables are displayed correctly."""
+ self.build_and_run('unsigned_int.cpp', set(['unsigned', 'int']))
+
+ @skipUnlessDarwin
+ def test_unsigned_int_type_from_block(self):
+ """Test that 'unsigned int'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_int.cpp', set(['unsigned', 'int']), bc=True)
+
+ def test_long_type(self):
+ """Test that long-type variables are displayed correctly."""
+ self.build_and_run('long.cpp', set(['long']))
+
+ @skipUnlessDarwin
+ def test_long_type_from_block(self):
+ """Test that long-type variables are displayed correctly from a block."""
+ self.build_and_run('long.cpp', set(['long']), bc=True)
+
+ def test_unsigned_long_type(self):
+ """Test that 'unsigned long'-type variables are displayed correctly."""
+ self.build_and_run('unsigned_long.cpp', set(['unsigned', 'long']))
+
+ @skipUnlessDarwin
+ def test_unsigned_long_type_from_block(self):
+ """Test that 'unsigned_long'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_long.cpp', set(['unsigned', 'long']), bc=True)
+
+ def test_long_long_type(self):
+ """Test that 'long long'-type variables are displayed correctly."""
+ self.build_and_run('long_long.cpp', set(['long long']))
+
+ @skipUnlessDarwin
+ def test_long_long_type_from_block(self):
+ """Test that 'long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run('long_long.cpp', set(['long long']), bc=True)
+
+ def test_unsigned_long_long_type(self):
+ """Test that 'unsigned long long'-type variables are displayed correctly."""
+ self.build_and_run('unsigned_long_long.cpp', set(['unsigned', 'long long']))
+
+ @skipUnlessDarwin
+ def test_unsigned_long_long_type_from_block(self):
+ """Test that 'unsigned_long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_long_long.cpp', set(['unsigned', 'long long']), bc=True)
diff --git a/packages/Python/lldbsuite/test/types/TestIntegerTypesExpr.py b/packages/Python/lldbsuite/test/types/TestIntegerTypesExpr.py
new file mode 100644
index 000000000000..c6dda91ad13e
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/TestIntegerTypesExpr.py
@@ -0,0 +1,113 @@
+"""
+Test that variable expressions of integer basic types are evaluated correctly.
+"""
+
+from __future__ import print_function
+
+
+
+import AbstractBase
+import lldb
+import sys
+from lldbsuite.test.lldbtest import *
+
+class IntegerTypesExprTestCase(AbstractBase.GenericTester):
+
+ mydir = AbstractBase.GenericTester.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ AbstractBase.GenericTester.setUp(self)
+ # disable "There is a running process, kill it and restart?" prompt
+ self.runCmd("settings set auto-confirm true")
+ self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+
+ def test_char_type(self):
+ """Test that char-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('char.cpp', set(['char']), qd=True)
+
+ @skipUnlessDarwin
+ def test_char_type_from_block(self):
+ """Test that char-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('char.cpp', set(['char']), bc=True, qd=True)
+
+ def test_unsigned_char_type(self):
+ """Test that 'unsigned_char'-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+
+ @skipUnlessDarwin
+ def test_unsigned_char_type_from_block(self):
+ """Test that 'unsigned char'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)
+
+ def test_short_type(self):
+ """Test that short-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('short.cpp', set(['short']))
+
+ @skipUnlessDarwin
+ def test_short_type_from_block(self):
+ """Test that short-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('short.cpp', set(['short']), bc=True)
+
+ def test_unsigned_short_type(self):
+ """Test that 'unsigned_short'-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']))
+
+ @skipUnlessDarwin
+ def test_unsigned_short_type_from_block(self):
+ """Test that 'unsigned short'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
+
+ def test_int_type(self):
+ """Test that int-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('int.cpp', set(['int']))
+
+ @skipUnlessDarwin
+ def test_int_type_from_block(self):
+ """Test that int-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('int.cpp', set(['int']))
+
+ def test_unsigned_int_type(self):
+ """Test that 'unsigned_int'-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']))
+
+ @skipUnlessDarwin
+ def test_unsigned_int_type_from_block(self):
+ """Test that 'unsigned int'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), bc=True)
+
+ def test_long_type(self):
+ """Test that long-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('long.cpp', set(['long']))
+
+ @skipUnlessDarwin
+ def test_long_type_from_block(self):
+ """Test that long-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('long.cpp', set(['long']), bc=True)
+
+ def test_unsigned_long_type(self):
+ """Test that 'unsigned long'-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']))
+
+ @skipUnlessDarwin
+ def test_unsigned_long_type_from_block(self):
+ """Test that 'unsigned_long'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), bc=True)
+
+ def test_long_long_type(self):
+ """Test that 'long long'-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('long_long.cpp', set(['long long']))
+
+ @skipUnlessDarwin
+ def test_long_long_type_from_block(self):
+ """Test that 'long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('long_long.cpp', set(['long long']), bc=True)
+
+ def test_unsigned_long_long_type(self):
+ """Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
+ self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']))
+
+ @skipUnlessDarwin
+ def test_unsigned_long_long_type_from_block(self):
+ """Test that 'unsigned_long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), bc=True)
diff --git a/packages/Python/lldbsuite/test/types/TestRecursiveTypes.py b/packages/Python/lldbsuite/test/types/TestRecursiveTypes.py
new file mode 100644
index 000000000000..0b60b5a4d63a
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/TestRecursiveTypes.py
@@ -0,0 +1,51 @@
+"""
+Test that recursive types are handled correctly.
+"""
+
+from __future__ import print_function
+
+
+
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+import sys
+from lldbsuite.test.lldbtest import *
+
+class RecursiveTypesTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # disable "There is a running process, kill it and restart?" prompt
+ self.runCmd("settings set auto-confirm true")
+ self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+ # Find the line number to break for main.c.
+ self.line = line_number('recursive_type_main.cpp',
+ '// Test at this line.')
+
+ self.d1 = {'CXX_SOURCES': 'recursive_type_main.cpp recursive_type_1.cpp'}
+ self.d2 = {'CXX_SOURCES': 'recursive_type_main.cpp recursive_type_2.cpp'}
+
+ def test_recursive_type_1(self):
+ """Test that recursive structs are displayed correctly."""
+ self.build(dictionary=self.d1)
+ self.setTearDownCleanup(dictionary=self.d1)
+ self.print_struct()
+
+ def test_recursive_type_2(self):
+ """Test that recursive structs are displayed correctly."""
+ self.build(dictionary=self.d2)
+ self.setTearDownCleanup(dictionary=self.d2)
+ self.print_struct()
+
+ def print_struct(self):
+ self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line (self, "recursive_type_main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ self.expect("print tpi", RUN_SUCCEEDED)
+ self.expect("print *tpi", RUN_SUCCEEDED)
diff --git a/packages/Python/lldbsuite/test/types/basic_type.cpp b/packages/Python/lldbsuite/test/types/basic_type.cpp
new file mode 100644
index 000000000000..1651815fa0ca
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/basic_type.cpp
@@ -0,0 +1,211 @@
+// This file must have the following defined before it is included:
+// T defined to the type to test (int, float, etc)
+// T_CSTR a C string representation of the type T ("int", "float")
+// T_VALUE_1 defined to a valid initializer value for TEST_TYPE (7 for int, 2.0 for float)
+// T_VALUE_2, T_VALUE_3, T_VALUE_4 defined to a valid initializer value for TEST_TYPE that is different from TEST_VALUE_1
+// T_PRINTF_FORMAT defined if T can be printed with printf
+//
+// An example for integers is below
+#if 0
+
+#define T int
+#define T_CSTR "int"
+#define T_VALUE_1 11001110
+#define T_VALUE_2 22002220
+#define T_VALUE_3 33003330
+#define T_VALUE_4 44044440
+#define T_PRINTF_FORMAT "%i"
+
+#include "basic_type.cpp"
+
+#endif
+
+#ifdef TEST_BLOCK_CAPTURED_VARS
+#include <dispatch/dispatch.h>
+#endif
+
+class a_class
+{
+public:
+ a_class (const T& a, const T& b) :
+ m_a (a),
+ m_b (b)
+ {
+ }
+
+ ~a_class ()
+ {
+ }
+
+ const T&
+ get_a() const
+ {
+ return m_a;
+ }
+
+ void
+ set_a (const T& a)
+ {
+ m_a = a;
+ }
+
+ const T&
+ get_b() const
+ {
+ return m_b;
+ }
+
+ void
+ set_b (const T& b)
+ {
+ m_b = b;
+ }
+
+protected:
+ T m_a;
+ T m_b;
+};
+
+typedef struct a_struct_tag {
+ T a;
+ T b;
+} a_struct_t;
+
+
+typedef union a_union_zero_tag {
+ T a;
+ double a_double;
+} a_union_zero_t;
+
+typedef struct a_union_nonzero_tag {
+ double a_double;
+ a_union_zero_t u;
+} a_union_nonzero_t;
+
+
+#include <stdint.h>
+#include <stdio.h>
+
+int
+main (int argc, char const *argv[])
+{
+ T a = T_VALUE_1;
+ T* a_ptr = &a;
+ T& a_ref = a;
+ T a_array_bounded[2] = { T_VALUE_1, T_VALUE_2 };
+ T a_array_unbounded[] = { T_VALUE_1, T_VALUE_2 };
+
+ a_class a_class_instance (T_VALUE_1, T_VALUE_2);
+ a_class *a_class_ptr = &a_class_instance;
+ a_class &a_class_ref = a_class_instance;
+
+ a_struct_t a_struct = { T_VALUE_1, T_VALUE_2 };
+ a_struct_t *a_struct_ptr = &a_struct;
+ a_struct_t &a_struct_ref = a_struct;
+
+ // Create a union with type T at offset zero
+ a_union_zero_t a_union_zero;
+ a_union_zero.a = T_VALUE_1;
+ a_union_zero_t *a_union_zero_ptr = &a_union_zero;
+ a_union_zero_t &a_union_zero_ref = a_union_zero;
+
+ // Create a union with type T at a non-zero offset
+ a_union_nonzero_t a_union_nonzero;
+ a_union_nonzero.u.a = T_VALUE_1;
+ a_union_nonzero_t *a_union_nonzero_ptr = &a_union_nonzero;
+ a_union_nonzero_t &a_union_nonzero_ref = a_union_nonzero;
+
+ a_struct_t a_struct_array_bounded[2] = {{ T_VALUE_1, T_VALUE_2 }, { T_VALUE_3, T_VALUE_4 }};
+ a_struct_t a_struct_array_unbounded[] = {{ T_VALUE_1, T_VALUE_2 }, { T_VALUE_3, T_VALUE_4 }};
+ a_union_zero_t a_union_zero_array_bounded[2];
+ a_union_zero_array_bounded[0].a = T_VALUE_1;
+ a_union_zero_array_bounded[1].a = T_VALUE_2;
+ a_union_zero_t a_union_zero_array_unbounded[] = {{ T_VALUE_1 }, { T_VALUE_2 }};
+
+#ifdef T_PRINTF_FORMAT
+ printf ("%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a);
+ printf ("%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr);
+ printf ("%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref);
+
+ printf ("%s[2]: a_array_bounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[0]);
+ printf ("%s[2]: a_array_bounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_bounded[1]);
+
+ printf ("%s[]: a_array_unbounded[0] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[0]);
+ printf ("%s[]: a_array_unbounded[1] = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_array_unbounded[1]);
+
+ printf ("(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a());
+ printf ("(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b());
+ printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a());
+ printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b());
+ printf ("(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a());
+ printf ("(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b());
+
+ printf ("(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a);
+ printf ("(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b);
+ printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a);
+ printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b);
+ printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a);
+ printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b);
+
+ printf ("(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a);
+ printf ("(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a);
+ printf ("(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a);
+
+ printf ("(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a);
+ printf ("(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a);
+ printf ("(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a);
+
+ printf ("(a_struct_t[2]) a_struct_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].a);
+ printf ("(a_struct_t[2]) a_struct_array_bounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[0].b);
+ printf ("(a_struct_t[2]) a_struct_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].a);
+ printf ("(a_struct_t[2]) a_struct_array_bounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_bounded[1].b);
+
+ printf ("(a_struct_t[]) a_struct_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].a);
+ printf ("(a_struct_t[]) a_struct_array_unbounded[0].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[0].b);
+ printf ("(a_struct_t[]) a_struct_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].a);
+ printf ("(a_struct_t[]) a_struct_array_unbounded[1].b = '" T_PRINTF_FORMAT "'\n", a_struct_array_unbounded[1].b);
+
+ printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[0].a);
+ printf ("(a_union_zero_t[2]) a_union_zero_array_bounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_bounded[1].a);
+
+ printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[0].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[0].a);
+ printf ("(a_union_zero_t[]) a_union_zero_array_unbounded[1].a = '" T_PRINTF_FORMAT "'\n", a_union_zero_array_unbounded[1].a);
+
+#endif
+ puts("About to exit, break here to check values..."); // Here is the line we will break on to check variables.
+
+#ifdef TEST_BLOCK_CAPTURED_VARS
+ void (^myBlock)() = ^() {
+ printf ("%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a);
+ printf ("%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr);
+ printf ("%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref);
+
+ printf ("(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a());
+ printf ("(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b());
+ printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a());
+ printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b());
+ printf ("(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a());
+ printf ("(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b());
+
+ printf ("(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a);
+ printf ("(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b);
+ printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a);
+ printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b);
+ printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a);
+ printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b);
+
+ printf ("(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a);
+ printf ("(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a);
+ printf ("(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a);
+
+ printf ("(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a);
+ printf ("(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a);
+ printf ("(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a);
+
+ printf ("That's All Folks!\n"); // Break here to test block captured variables.
+ };
+
+ myBlock();
+#endif
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/types/char.cpp b/packages/Python/lldbsuite/test/types/char.cpp
new file mode 100644
index 000000000000..584582ed9b9c
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/char.cpp
@@ -0,0 +1,9 @@
+#define T char
+#define T_CSTR "char"
+#define T_VALUE_1 'a'
+#define T_VALUE_2 'b'
+#define T_VALUE_3 '!'
+#define T_VALUE_4 '~'
+#define T_PRINTF_FORMAT "%c"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/double.cpp b/packages/Python/lldbsuite/test/types/double.cpp
new file mode 100644
index 000000000000..6788dadfe02f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/double.cpp
@@ -0,0 +1,9 @@
+#define T double
+#define T_CSTR "double"
+#define T_VALUE_1 1100.125
+#define T_VALUE_2 2200.250
+#define T_VALUE_3 33.00
+#define T_VALUE_4 44.00
+#define T_PRINTF_FORMAT "%lg"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/float.cpp b/packages/Python/lldbsuite/test/types/float.cpp
new file mode 100644
index 000000000000..4bc124661aad
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/float.cpp
@@ -0,0 +1,9 @@
+#define T float
+#define T_CSTR "float"
+#define T_VALUE_1 1100.125
+#define T_VALUE_2 2200.250
+#define T_VALUE_3 33.00
+#define T_VALUE_4 44.00
+#define T_PRINTF_FORMAT "%g"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/int.cpp b/packages/Python/lldbsuite/test/types/int.cpp
new file mode 100644
index 000000000000..922398b1c6e3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/int.cpp
@@ -0,0 +1,9 @@
+#define T int
+#define T_CSTR "int"
+#define T_VALUE_1 11001110
+#define T_VALUE_2 22002220
+#define T_VALUE_3 33003330
+#define T_VALUE_4 44004440
+#define T_PRINTF_FORMAT "%i"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/long.cpp b/packages/Python/lldbsuite/test/types/long.cpp
new file mode 100644
index 000000000000..9056b42ee77d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/long.cpp
@@ -0,0 +1,18 @@
+#define T long
+#define T_CSTR "long"
+
+#ifdef __LP64__
+#define T_VALUE_1 110011101111
+#define T_VALUE_2 220022202222
+#define T_VALUE_3 330033303333
+#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
+#define T_PRINTF_FORMAT "%ld"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/long_long.cpp b/packages/Python/lldbsuite/test/types/long_long.cpp
new file mode 100644
index 000000000000..5b442e7257e9
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/long_long.cpp
@@ -0,0 +1,18 @@
+#define T long long
+#define T_CSTR "long long"
+
+#ifdef __LP64__
+#define T_VALUE_1 110011101111
+#define T_VALUE_2 220022202222
+#define T_VALUE_3 330033303333
+#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
+#define T_PRINTF_FORMAT "%lld"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/recursive_type_1.cpp b/packages/Python/lldbsuite/test/types/recursive_type_1.cpp
new file mode 100644
index 000000000000..81d923ffd945
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/recursive_type_1.cpp
@@ -0,0 +1,12 @@
+typedef struct t *tp;
+typedef tp (*get_tp)();
+
+struct s {
+ get_tp get_tp_p;
+};
+
+struct t {
+ struct s *s;
+};
+
+struct t t;
diff --git a/packages/Python/lldbsuite/test/types/recursive_type_2.cpp b/packages/Python/lldbsuite/test/types/recursive_type_2.cpp
new file mode 100644
index 000000000000..304739049a06
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/recursive_type_2.cpp
@@ -0,0 +1,10 @@
+typedef struct t *tp;
+typedef tp (*get_tp)();
+
+struct t {
+ struct {
+ get_tp get_tp_p;
+ };
+};
+
+struct t t;
diff --git a/packages/Python/lldbsuite/test/types/recursive_type_main.cpp b/packages/Python/lldbsuite/test/types/recursive_type_main.cpp
new file mode 100644
index 000000000000..e06cd309be30
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/recursive_type_main.cpp
@@ -0,0 +1,8 @@
+typedef struct t *tp;
+extern struct t t;
+
+int main() {
+ tp tpi = &t;
+ // Test at this line.
+ return 0;
+}
diff --git a/packages/Python/lldbsuite/test/types/short.cpp b/packages/Python/lldbsuite/test/types/short.cpp
new file mode 100644
index 000000000000..470c68aa8ba7
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/short.cpp
@@ -0,0 +1,9 @@
+#define T short
+#define T_CSTR "short"
+#define T_VALUE_1 11001
+#define T_VALUE_2 22002
+#define T_VALUE_3 -32768
+#define T_VALUE_4 32767
+#define T_PRINTF_FORMAT "%hd"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/unsigned_char.cpp b/packages/Python/lldbsuite/test/types/unsigned_char.cpp
new file mode 100644
index 000000000000..0ac555a5a183
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/unsigned_char.cpp
@@ -0,0 +1,9 @@
+#define T unsigned char
+#define T_CSTR "unsigned char"
+#define T_VALUE_1 '0'
+#define T_VALUE_2 '9'
+#define T_VALUE_3 '@'
+#define T_VALUE_4 '$'
+#define T_PRINTF_FORMAT "%c"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/unsigned_int.cpp b/packages/Python/lldbsuite/test/types/unsigned_int.cpp
new file mode 100644
index 000000000000..1b307b04afc1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/unsigned_int.cpp
@@ -0,0 +1,9 @@
+#define T unsigned int
+#define T_CSTR "unsigned int"
+#define T_VALUE_1 11001110
+#define T_VALUE_2 22002220
+#define T_VALUE_3 33003330
+#define T_VALUE_4 44004440
+#define T_PRINTF_FORMAT "%u"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/unsigned_long.cpp b/packages/Python/lldbsuite/test/types/unsigned_long.cpp
new file mode 100644
index 000000000000..0c442e399d53
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/unsigned_long.cpp
@@ -0,0 +1,18 @@
+#define T unsigned long
+#define T_CSTR "unsigned long"
+
+#ifdef __LP64__
+#define T_VALUE_1 110011101111
+#define T_VALUE_2 220022202222
+#define T_VALUE_3 330033303333
+#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
+#define T_PRINTF_FORMAT "%lu"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/unsigned_long_long.cpp b/packages/Python/lldbsuite/test/types/unsigned_long_long.cpp
new file mode 100644
index 000000000000..648aad01b3a3
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/unsigned_long_long.cpp
@@ -0,0 +1,18 @@
+#define T unsigned long long
+#define T_CSTR "unsigned long long"
+
+#ifdef __LP64__
+#define T_VALUE_1 110011101111
+#define T_VALUE_2 220022202222
+#define T_VALUE_3 330033303333
+#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
+#define T_PRINTF_FORMAT "%llu"
+
+#include "basic_type.cpp"
diff --git a/packages/Python/lldbsuite/test/types/unsigned_short.cpp b/packages/Python/lldbsuite/test/types/unsigned_short.cpp
new file mode 100644
index 000000000000..09af2aad62c2
--- /dev/null
+++ b/packages/Python/lldbsuite/test/types/unsigned_short.cpp
@@ -0,0 +1,9 @@
+#define T unsigned short
+#define T_CSTR "unsigned short"
+#define T_VALUE_1 11001
+#define T_VALUE_2 22002
+#define T_VALUE_3 0
+#define T_VALUE_4 65535
+#define T_PRINTF_FORMAT "%hu"
+
+#include "basic_type.cpp"