diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl')
13 files changed, 168 insertions, 127 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py index 6a832e02990a..63eb5e087e14 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py @@ -23,8 +23,7 @@ class LibCxxFunctionTestCase(TestBase): var.SetPreferSyntheticValue(True) return var - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows yet + @add_test_categories(["libc++"]) def test(self): """Test that std::function as defined by libc++ is correctly printed by LLDB""" self.build() @@ -36,9 +35,6 @@ class LibCxxFunctionTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py index 5d23fcef04ce..9b4308f54095 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py @@ -22,9 +22,10 @@ class LibcxxIteratorDataFormatterTestCase(TestBase): TestBase.setUp(self) # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') + ns = 'ndk' if lldbplatformutil.target_is_android() else '' + self.namespace = 'std::__' + ns + '1' - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows yet + @add_test_categories(["libc++"]) def test_with_run_command(self): """Test that libc++ iterators format properly.""" self.build() @@ -35,9 +36,6 @@ class LibcxxIteratorDataFormatterTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', @@ -57,8 +55,6 @@ class LibcxxIteratorDataFormatterTestCase(TestBase): # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) - self.expect('image list', substrs=self.getLibcPlusPlusLibs()) - self.expect('frame variable ivI', substrs=['item = 3']) self.expect('expr ivI', substrs=['item = 3']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py index e2e082c795f7..e1ebbd5c226d 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/loop/TestDataFormatterLibcxxListLoop.py @@ -19,9 +19,8 @@ class LibcxxListDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows yet - @add_test_categories(["pyapi"]) + @add_test_categories(["libc++"]) + @expectedFailureAndroid(bugnumber="llvm.org/pr32592") @skipIfDarwin # rdar://25499635 def test_with_run_command(self): self.build() @@ -40,8 +39,6 @@ class LibcxxListDataFormatterTestCase(TestBase): # Run the program, it should stop at breakpoint 1. process = target.LaunchSimple( None, None, self.get_process_working_directory()) - lldbutil.skip_if_library_missing( - self, target, lldbutil.PrintableRegex("libc\+\+")) self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID) self.assertEqual( len(lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint1)), 1) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py index 7433a0b0da2c..fc4714ea94e2 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py @@ -17,8 +17,12 @@ class LibcxxMapDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows yet + def setUp(self): + TestBase.setUp(self) + ns = 'ndk' if lldbplatformutil.target_is_android() else '' + self.namespace = 'std::__' + ns + '1' + + @add_test_categories(["libc++"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() @@ -30,9 +34,6 @@ class LibcxxMapDataFormatterTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', @@ -52,16 +53,16 @@ class LibcxxMapDataFormatterTestCase(TestBase): # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) - self.expect('image list', substrs=self.getLibcPlusPlusLibs()) - + ns = self.namespace self.expect('frame variable ii', - substrs=['size=0', + substrs=['%s::map' % ns, + 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ii', - substrs=['size=2', + substrs=['%s::map' % ns, 'size=2', '[0] = ', 'first = 0', 'second = 0', @@ -72,7 +73,7 @@ class LibcxxMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ii', - substrs=['size=4', + substrs=['%s::map' % ns, 'size=4', '[2] = ', 'first = 2', 'second = 0', @@ -83,7 +84,7 @@ class LibcxxMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable ii", - substrs=['size=8', + substrs=['%s::map' % ns, 'size=8', '[5] = ', 'first = 5', 'second = 0', @@ -92,7 +93,7 @@ class LibcxxMapDataFormatterTestCase(TestBase): 'second = 1']) self.expect("p ii", - substrs=['size=8', + substrs=['%s::map' % ns, 'size=8', '[5] = ', 'first = 5', 'second = 0', @@ -124,17 +125,17 @@ class LibcxxMapDataFormatterTestCase(TestBase): self.runCmd("continue") self.expect('frame variable ii', - substrs=['size=0', + substrs=['%s::map' % ns, 'size=0', '{}']) self.expect('frame variable si', - substrs=['size=0', + substrs=['%s::map' % ns, 'size=0', '{}']) self.runCmd("continue") self.expect('frame variable si', - substrs=['size=1', + substrs=['%s::map' % ns, 'size=1', '[0] = ', 'first = \"zero\"', 'second = 0']) @@ -142,7 +143,7 @@ class LibcxxMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable si", - substrs=['size=4', + substrs=['%s::map' % ns, 'size=4', '[0] = ', 'first = \"zero\"', 'second = 0', @@ -157,7 +158,7 @@ class LibcxxMapDataFormatterTestCase(TestBase): 'second = 3']) self.expect("p si", - substrs=['size=4', + substrs=['%s::map' % ns, 'size=4', '[0] = ', 'first = \"zero\"', 'second = 0', @@ -192,19 +193,19 @@ class LibcxxMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable si', - substrs=['size=0', + substrs=['%s::map' % ns, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable is', - substrs=['size=0', + substrs=['%s::map' % ns, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable is", - substrs=['size=4', + substrs=['%s::map' % ns, 'size=4', '[0] = ', 'second = \"goofy\"', 'first = 85', @@ -219,7 +220,7 @@ class LibcxxMapDataFormatterTestCase(TestBase): 'first = 3']) self.expect("p is", - substrs=['size=4', + substrs=['%s::map' % ns, 'size=4', '[0] = ', 'second = \"goofy\"', 'first = 85', @@ -254,19 +255,19 @@ class LibcxxMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable is', - substrs=['size=0', + substrs=['%s::map' % ns, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ss', - substrs=['size=0', + substrs=['%s::map' % ns, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable ss", - substrs=['size=3', + substrs=['%s::map' % ns, 'size=3', '[0] = ', 'second = \"hello\"', 'first = \"ciao\"', @@ -278,7 +279,7 @@ class LibcxxMapDataFormatterTestCase(TestBase): 'first = \"gatto\"']) self.expect("p ss", - substrs=['size=3', + substrs=['%s::map' % ns, 'size=3', '[0] = ', 'second = \"hello\"', 'first = \"ciao\"', @@ -309,5 +310,5 @@ class LibcxxMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ss', - substrs=['size=0', + substrs=['%s::map' % ns, 'size=0', '{}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py index 66091e6e113f..b28a7e6bc31b 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py @@ -18,8 +18,12 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfWindows # libc++ not ported to Windows yet - @skipIf(compiler="gcc") + def setUp(self): + TestBase.setUp(self) + ns = 'ndk' if lldbplatformutil.target_is_android() else '' + self.namespace = 'std::__' + ns + '1' + + @add_test_categories(["libc++"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() @@ -31,9 +35,6 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', @@ -53,16 +54,15 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) - self.expect('image list', substrs=self.getLibcPlusPlusLibs()) - + multimap = self.namespace + "::multimap" self.expect('frame variable ii', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ii', - substrs=['size=2', + substrs=[multimap, 'size=2', '[0] = ', 'first = 0', 'second = 0', @@ -73,7 +73,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ii', - substrs=['size=4', + substrs=[multimap, 'size=4', '[2] = ', 'first = 2', 'second = 0', @@ -84,7 +84,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable ii", - substrs=['size=8', + substrs=[multimap, 'size=8', '[5] = ', 'first = 5', 'second = 0', @@ -93,7 +93,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): 'second = 1']) self.expect("p ii", - substrs=['size=8', + substrs=[multimap, 'size=8', '[5] = ', 'first = 5', 'second = 0', @@ -125,17 +125,17 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ii', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) self.expect('frame variable si', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable si', - substrs=['size=1', + substrs=[multimap, 'size=1', '[0] = ', 'first = \"zero\"', 'second = 0']) @@ -143,7 +143,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable si", - substrs=['size=4', + substrs=[multimap, 'size=4', '[0] = ', 'first = \"zero\"', 'second = 0', @@ -158,7 +158,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): 'second = 3']) self.expect("p si", - substrs=['size=4', + substrs=[multimap, 'size=4', '[0] = ', 'first = \"zero\"', 'second = 0', @@ -193,19 +193,19 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable si', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable is', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable is", - substrs=['size=4', + substrs=[multimap, 'size=4', '[0] = ', 'second = \"goofy\"', 'first = 85', @@ -220,7 +220,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): 'first = 3']) self.expect("p is", - substrs=['size=4', + substrs=[multimap, 'size=4', '[0] = ', 'second = \"goofy\"', 'first = 85', @@ -255,19 +255,19 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable is', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ss', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable ss", - substrs=['size=3', + substrs=[multimap, 'size=3', '[0] = ', 'second = \"hello\"', 'first = \"ciao\"', @@ -279,7 +279,7 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): 'first = \"gatto\"']) self.expect("p ss", - substrs=['size=3', + substrs=[multimap, 'size=3', '[0] = ', 'second = \"hello\"', 'first = \"ciao\"', @@ -310,5 +310,5 @@ class LibcxxMultiMapDataFormatterTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect('frame variable ss', - substrs=['size=0', + substrs=[multimap, 'size=0', '{}']) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py index d40bce83e0af..2f448e8fd115 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py @@ -17,8 +17,17 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows yet + def setUp(self): + TestBase.setUp(self) + ns = 'ndk' if lldbplatformutil.target_is_android() else '' + self.namespace = 'std::__' + ns + '1' + + def getVariableType(self, name): + var = self.frame().FindVariable(name) + self.assertTrue(var.IsValid()) + return var.GetType().GetCanonicalType().GetName() + + @add_test_categories(["libc++"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() @@ -30,9 +39,6 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', @@ -52,7 +58,9 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase): # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) - self.expect('image list', substrs=self.getLibcPlusPlusLibs()) + ii_type = self.getVariableType("ii") + self.assertTrue(ii_type.startswith(self.namespace + "::multiset"), + "Type: " + ii_type) self.expect("frame variable ii", substrs=["size=0", "{}"]) lldbutil.continue_to_breakpoint(self.process(), bkpt) @@ -86,6 +94,9 @@ class LibcxxMultiSetDataFormatterTestCase(TestBase): self.expect("frame variable ii", substrs=["size=0", "{}"]) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect("frame variable ii", substrs=["size=0", "{}"]) + ss_type = self.getVariableType("ss") + self.assertTrue(ss_type.startswith(self.namespace + "::multiset"), + "Type: " + ss_type) self.expect("frame variable ss", substrs=["size=0", "{}"]) lldbutil.continue_to_breakpoint(self.process(), bkpt) self.expect( diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py index b0e84121dded..5b9b14d549e5 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py @@ -23,9 +23,10 @@ class LibcxxStringDataFormatterTestCase(TestBase): TestBase.setUp(self) # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') + ns = 'ndk' if lldbplatformutil.target_is_android() else '' + self.namespace = 'std::__' + ns + '1' - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows yet + @add_test_categories(["libc++"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() @@ -36,9 +37,6 @@ class LibcxxStringDataFormatterTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', @@ -58,17 +56,18 @@ class LibcxxStringDataFormatterTestCase(TestBase): # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) + ns = self.namespace self.expect( "frame variable", substrs=[ - '(std::__1::wstring) s = L"hello world! מזל טוב!"', - '(std::__1::wstring) S = L"!!!!"', + '(%s::wstring) s = L"hello world! מזל טוב!"'%ns, + '(%s::wstring) S = L"!!!!"'%ns, '(const wchar_t *) mazeltov = 0x', 'L"מזל טוב"', - '(std::__1::string) q = "hello world"', - '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"', - '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"', - '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"']) + '(%s::string) q = "hello world"'%ns, + '(%s::string) Q = "quite a long std::strin with lots of info inside it"'%ns, + '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns, + '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns]) self.runCmd("n") @@ -91,11 +90,11 @@ class LibcxxStringDataFormatterTestCase(TestBase): self.expect( "frame variable", substrs=[ - '(std::__1::wstring) s = L"hello world! מזל טוב!"', - '(std::__1::wstring) S = L"!!!!!"', + '(%s::wstring) s = L"hello world! מזל טוב!"'%ns, + '(%s::wstring) S = L"!!!!!"'%ns, '(const wchar_t *) mazeltov = 0x', 'L"מזל טוב"', - '(std::__1::string) q = "hello world"', - '(std::__1::string) Q = "quite a long std::strin with lots of info inside it"', - '(std::__1::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"', - '(std::__1::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"']) + '(%s::string) q = "hello world"'%ns, + '(%s::string) Q = "quite a long std::strin with lots of info inside it"'%ns, + '(%s::string) IHaveEmbeddedZeros = "a\\0b\\0c\\0d"'%ns, + '(%s::wstring) IHaveEmbeddedZerosToo = L"hello world!\\0てざ ル゜䋨ミ㠧槊 きゅへ狦穤襩 じゃ馩リョ 䤦監"'%ns]) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py index 8a08d38975cf..f61a715a4d3e 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py @@ -17,10 +17,13 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIfWindows # libc++ not ported to Windows yet - @skipIf(compiler="gcc") + def setUp(self): + TestBase.setUp(self) + ns = 'ndk' if lldbplatformutil.target_is_android() else '' + self.namespace = 'std::__' + ns + '1' + + @add_test_categories(["libc++"]) def test_with_run_command(self): - """Test that that file and class static variables display correctly.""" self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) @@ -29,9 +32,6 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', @@ -51,30 +51,30 @@ class LibcxxUnorderedDataFormatterTestCase(TestBase): # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) - self.expect('image list', substrs=self.getLibcPlusPlusLibs()) - + ns = self.namespace self.look_for_content_and_continue( - "map", ['size=5 {', 'hello', 'world', 'this', 'is', 'me']) + "map", ['%s::unordered_map' % + ns, 'size=5 {', 'hello', 'world', 'this', 'is', 'me']) self.look_for_content_and_continue( - "mmap", ['size=6 {', 'first = 3', 'second = "this"', - 'first = 2', 'second = "hello"']) + "mmap", ['%s::unordered_multimap' % ns, 'size=6 {', 'first = 3', 'second = "this"', + 'first = 2', 'second = "hello"']) self.look_for_content_and_continue( - "iset", ['size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2']) + "iset", ['%s::unordered_set' % + ns, 'size=5 {', '\[\d\] = 5', '\[\d\] = 3', '\[\d\] = 2']) self.look_for_content_and_continue( - "sset", ['size=5 {', '\[\d\] = "is"', '\[\d\] = "world"', - '\[\d\] = "hello"']) + "sset", ['%s::unordered_set' % ns, 'size=5 {', '\[\d\] = "is"', '\[\d\] = "world"', + '\[\d\] = "hello"']) self.look_for_content_and_continue( - "imset", ['size=6 {', '(\[\d\] = 3(\\n|.)+){3}', - '\[\d\] = 2', '\[\d\] = 1']) + "imset", ['%s::unordered_multiset' % ns, 'size=6 {', '(\[\d\] = 3(\\n|.)+){3}', + '\[\d\] = 2', '\[\d\] = 1']) self.look_for_content_and_continue( - "smset", - ['size=5 {', '(\[\d\] = "is"(\\n|.)+){2}', - '(\[\d\] = "world"(\\n|.)+){2}']) + "smset", ['%s::unordered_multiset' % ns, 'size=5 {', '(\[\d\] = "is"(\\n|.)+){2}', + '(\[\d\] = "world"(\\n|.)+){2}']) def look_for_content_and_continue(self, var_name, patterns): self.expect(("frame variable %s" % var_name), patterns=patterns) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py index 43d5ad4f1033..a7a00068383f 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/TestDataFormatterLibcxxVBool.py @@ -23,16 +23,12 @@ class LibcxxVBoolDataFormatterTestCase(TestBase): # Find the line number to break at. self.line = line_number('main.cpp', '// Set break point at this line.') - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows. + @add_test_categories(["libc++"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - lldbutil.run_break_set_by_file_and_line( self, "main.cpp", self.line, num_expected_locations=-1) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp index 7b9956ed36ea..91fe509465e7 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vbool/main.cpp @@ -65,5 +65,6 @@ int main() vBool.push_back(true); vBool.push_back(true); - return 0; // Set break point at this line. + printf ("size: %d", (int) vBool.size()); // Set break point at this line. + return 0; } diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py index 719ed7300505..9e226a100a10 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py @@ -17,16 +17,12 @@ class LibcxxVectorDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipIf(compiler="gcc") - @skipIfWindows # libc++ not ported to Windows yet + @add_test_categories(["libc++"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) - lldbutil.skip_if_library_missing( - self, self.target(), lldbutil.PrintableRegex("libc\+\+")) - bkpt = self.target().FindBreakpointByID( lldbutil.run_break_set_by_source_regexp( self, "break here")) diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py index 770d87178f50..37adb28d7d59 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py @@ -34,21 +34,25 @@ class StdUniquePtrDataFormatterTestCase(TestBase): self.assertTrue(frame.IsValid()) self.expect("frame variable nup", substrs=['nup = nullptr']) - self.expect("frame variable iup", substrs=['iup = 0x', 'object = 123']) - self.expect("frame variable sup", substrs=['sup = 0x', 'object = "foobar"']) + self.expect("frame variable iup", substrs=['iup = 0x']) + self.expect("frame variable sup", substrs=['sup = 0x']) self.expect("frame variable ndp", substrs=['ndp = nullptr']) - self.expect("frame variable idp", substrs=['idp = 0x', 'object = 456', 'deleter = ', 'a = 1', 'b = 2']) - self.expect("frame variable sdp", substrs=['sdp = 0x', 'object = "baz"', 'deleter = ', 'a = 3', 'b = 4']) - + self.expect("frame variable idp", substrs=['idp = 0x', 'deleter = ', 'a = 1', 'b = 2']) + self.expect("frame variable sdp", substrs=['sdp = 0x', 'deleter = ', 'a = 3', 'b = 4']) + self.assertEqual(123, frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned()) + self.assertEqual(123, frame.GetValueForVariablePath("*iup").GetValueAsUnsigned()) self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid()) self.assertEqual('"foobar"', frame.GetValueForVariablePath("sup.object").GetSummary()) + self.assertEqual('"foobar"', frame.GetValueForVariablePath("*sup").GetSummary()) self.assertFalse(frame.GetValueForVariablePath("sup.deleter").IsValid()) self.assertEqual(456, frame.GetValueForVariablePath("idp.object").GetValueAsUnsigned()) + self.assertEqual(456, frame.GetValueForVariablePath("*idp").GetValueAsUnsigned()) self.assertEqual('"baz"', frame.GetValueForVariablePath("sdp.object").GetSummary()) + self.assertEqual('"baz"', frame.GetValueForVariablePath("*sdp").GetSummary()) idp_deleter = frame.GetValueForVariablePath("idp.deleter") self.assertTrue(idp_deleter.IsValid()) @@ -59,3 +63,34 @@ class StdUniquePtrDataFormatterTestCase(TestBase): self.assertTrue(sdp_deleter.IsValid()) self.assertEqual(3, sdp_deleter.GetChildMemberWithName("a").GetValueAsUnsigned()) self.assertEqual(4, sdp_deleter.GetChildMemberWithName("b").GetValueAsUnsigned()) + + @skipIfFreeBSD + @skipIfWindows # libstdcpp not ported to Windows + @skipIfDarwin # doesn't compile on Darwin + def test_recursive_unique_ptr(self): + # Tests that LLDB can handle when we have a loop in the unique_ptr + # reference chain and that it correctly handles the different options + # for the frame variable command in this case. + 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) + self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, + substrs=['stopped', 'stop reason = breakpoint']) + + self.expect("frame variable f1->fp", + substrs=['fp = 0x']) + self.expect("frame variable --ptr-depth=1 f1->fp", + substrs=['data = 2', 'fp = 0x']) + self.expect("frame variable --ptr-depth=2 f1->fp", + substrs=['data = 2', 'fp = 0x', 'data = 1']) + + frame = self.frame() + self.assertTrue(frame.IsValid()) + self.assertEqual(2, frame.GetValueForVariablePath("f1->fp.object.data").GetValueAsUnsigned()) + self.assertEqual(2, frame.GetValueForVariablePath("f1->fp->data").GetValueAsUnsigned()) + self.assertEqual(1, frame.GetValueForVariablePath("f1->fp.object.fp.object.data").GetValueAsUnsigned()) + self.assertEqual(1, frame.GetValueForVariablePath("f1->fp->fp->data").GetValueAsUnsigned()) + diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp index 4a40309338c1..dd0072764d4e 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp @@ -8,6 +8,11 @@ struct Deleter { int b; }; +struct Foo { + int data; + std::unique_ptr<Foo> fp; +}; + int main() { std::unique_ptr<char> nup; std::unique_ptr<int> iup(new int{123}); @@ -18,5 +23,13 @@ int main() { std::unique_ptr<std::string, Deleter> sdp(new std::string("baz"), Deleter{3, 4}); + std::unique_ptr<Foo> fp(new Foo{3}); + + // Set up a structure where we have a loop in the unique_ptr chain. + Foo* f1 = new Foo{1}; + Foo* f2 = new Foo{2}; + f1->fp.reset(f2); + f2->fp.reset(f1); + return 0; // Set break point at this line. } |