In the TestDataFormatterStdVBool, instead of printing the correct size (49) lldb prints -1 for the size of the std::vector<bool> container (libstdc++). To reproduce, run: python dotest.py functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool -C gcc
Is this compiler dependent, library dependent, or both? If you could post the combinations of compiler and C++ library you tested and what works/fails, that would make this bug a lot clearer.
It looks like the data formatter bug is probably not compiler related -- I am seeing some related tests fail with Clang (and libstdc++). Specifically, the following two tests reproduce the test failure due to incorrect size: TestDataFormatterStdMap TestDataFormatterStdVector
The test variant 'data_formatter_commands_after_steps' exposes a loss of every second "next" command. This variant sets a breakpoint before a list is populated, and steps 4 times to populate the list with 4 items. When this script is run using dotest, dosep or manually at the lldb command prompt, 2 "next" commands are required to populate a single list item. Note that this does not occur if the std::list contains integers rather than elements of type std::string. Note that a single line of code constructs an std::string and adds an element to the list. Also, this specific failure cannot be reproduced with clang r182733, whereas it reproduces with gcc 4.6.3 (Ubuntu 12.04) and 4.6.2 (LLDB buildbot) and icc 13.1.
Author: enrico Date: Tue Jun 18 19:20:57 2013 New Revision: 184265 URL: http://llvm.org/viewvc/llvm-project?rev=184265&view=rev Log: <rdar://problem/14086503> Hardening the libstdc++ std::map test case against line table changes Let me know if this fixes the bug.
I re-ran these tests, and am still seeing some failures. When running with clang, I got the following failures: ====================================================================== FAIL: test_with_dwarf_and_run_command (TestDataFormatterStdMap.StdMapDataFormatterTestCase) Test data formatter commands. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 651, in wrapper func(*args, **kwargs) File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 368, in wrapper return func(self, *args, **kwargs) File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py", line 30, in test_with_dwarf_and_run_command self.data_formatter_commands() File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py", line 80, in data_formatter_commands 'second = 1']) File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 1735, in expect msg if msg else EXP_MSG(str, exe)) AssertionError: False is not True : 'map has 2 items' returns expected result Config=x86_64-clang ====================================================================== FAIL: test_with_dwarf_and_run_command (TestDataFormatterStdVector.StdVectorDataFormatterTestCase) Test data formatter commands. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 368, in wrapper return func(self, *args, **kwargs) File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py", line 27, in test_with_dwarf_and_run_command self.data_formatter_commands() File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py", line 70, in data_formatter_commands '}']) File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 1735, in expect msg if msg else EXP_MSG(str, exe)) AssertionError: False is not True : 'numbers = size=1' returns expected result When running with GCC (4.7.2) I am seeing the following: ====================================================================== FAIL: test_with_dwarf_and_run_command (TestDataFormatterStdVBool.StdVBoolDataFormatterTestCase) Test data formatter commands. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 368, in wrapper return func(self, *args, **kwargs) File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py", line 26, in test_with_dwarf_and_run_command self.data_formatter_commands() File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vbool/TestDataFormatterStdVBool.py", line 61, in data_formatter_commands substrs = ['size=49','[0] = false','[1] = true','[18] = false','[27] = true','[36] = false','[47] = true','[48] = true']) File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 1735, in expect msg if msg else EXP_MSG(str, exe)) AssertionError: False is not True : 'size=49' returns expected result Config=x86_64-gcc ====================================================================== FAIL: test_with_dwarf_and_run_command (TestDataFormatterStdIterator.StdIteratorDataFormatterTestCase) Test data formatter commands. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 368, in wrapper return func(self, *args, **kwargs) File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py", line 27, in test_with_dwarf_and_run_command self.data_formatter_commands() File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/TestDataFormatterStdIterator.py", line 66, in data_formatter_commands self.expect('frame variable simI', substrs = ['first = "world"','second = 42']) File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 1735, in expect msg if msg else EXP_MSG(str, exe)) AssertionError: False is not True : 'first = "world"' returns expected result Config=x86_64-gcc ====================================================================== FAIL: test_with_dwarf_and_run_command (TestDataFormatterStdVector.StdVectorDataFormatterTestCase) Test data formatter commands. ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 368, in wrapper return func(self, *args, **kwargs) File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py", line 27, in test_with_dwarf_and_run_command self.data_formatter_commands() File "/home/daniel/dev/llvm/tools/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py", line 70, in data_formatter_commands '}']) File "/home/daniel/dev/llvm/tools/lldb/test/lldbtest.py", line 1735, in expect msg if msg else EXP_MSG(str, exe)) AssertionError: False is not True : 'numbers = size=1' returns expected result Config=x86_64-gcc ----------------------------------------------------------------------
I should mention in the above test run, I was validating against LLDB built on Linux from SVN revision 185951.
With which standard C++ library implementation? Kind of important for this issue!
Right, here's additional information: TestTypeCompletion.py fails with gcc-4.6/libstdc++ 4.6 (but passes with gcc-4.7/libstdc++-4.7) TestDataFormatterStdIterator and TestDataFormatterStdVBool fail with gcc-4.6/libstdc++-4.6 and gcc-4.7/libstdc++-4.7 (but pass clang/libstdc++-4.7) TestDataFormatterStdMap crashes LLDB when built against gcc-4.6 and gcc-4.7 (see llvm.org/pr15036) and fails when built with clang/libstdc++-4.7. TestDataFormatterStdVector fails with gcc-4.6/libstdc++-4.6, gcc-4.7/libstdc++-4.7 and clang/libstdc++-4.7. TestDataFormatterStdList fails with gcc-4.6/libstdc++-4.6 but passes when built with clang or gcc-4.7 with libstdc++-4.7.
These tests are XPASS on FreeBSD with clang and and libstdc++ 4.2.1 or libc++.
The tests pass now.