diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple')
3 files changed, 66 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile new file mode 100644 index 000000000000..beb2fd583e7a --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile @@ -0,0 +1,8 @@ +LEVEL = ../../../../../make + +CXX_SOURCES := main.cpp + +USE_LIBSTDCPP := 1 +CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS) + +include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py new file mode 100644 index 000000000000..56e231da8522 --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py @@ -0,0 +1,49 @@ +""" +Test lldb data formatter subsystem. +""" + +from __future__ import print_function + +import os +import time +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class StdTupleDataFormatterTestCase(TestBase): + mydir = TestBase.compute_mydir(__file__) + + @skipIfFreeBSD + @skipIfWindows # libstdcpp not ported to Windows + @skipIfDarwin # doesn't compile on Darwin + def test_with_run_command(self): + self.build() + self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) + + lldbutil.run_break_set_by_source_regexp( + self, "Set break point at this line.") + self.runCmd("run", RUN_SUCCEEDED) + + # The stop reason of the thread should be breakpoint. + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs=['stopped', 'stop reason = breakpoint']) + + frame = self.frame() + self.assertTrue(frame.IsValid()) + + self.expect("frame variable ti", substrs=['[0] = 1']) + self.expect("frame variable ts", substrs=['[0] = "foobar"']) + self.expect("frame variable tt", substrs=['[0] = 1', '[1] = "baz"', '[2] = 2']) + + self.assertEqual(1, frame.GetValueForVariablePath("ti[0]").GetValueAsUnsigned()) + self.assertFalse(frame.GetValueForVariablePath("ti[1]").IsValid()) + + self.assertEqual('"foobar"', frame.GetValueForVariablePath("ts[0]").GetSummary()) + self.assertFalse(frame.GetValueForVariablePath("ts[1]").IsValid()) + + self.assertEqual(1, frame.GetValueForVariablePath("tt[0]").GetValueAsUnsigned()) + self.assertEqual('"baz"', frame.GetValueForVariablePath("tt[1]").GetSummary()) + self.assertEqual(2, frame.GetValueForVariablePath("tt[2]").GetValueAsUnsigned()) + self.assertFalse(frame.GetValueForVariablePath("tt[3]").IsValid()) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp new file mode 100644 index 000000000000..7247742ee6bb --- /dev/null +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp @@ -0,0 +1,9 @@ +#include <memory> +#include <string> + +int main() { + std::tuple<int> ti{1}; + std::tuple<std::string> ts{"foobar"}; + std::tuple<int, std::string, int> tt{1, "baz", 2}; + return 0; // Set break point at this line. +} |