LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 15301 - LLDB prints incorrect size of libstdc++ STL containers
Summary: LLDB prints incorrect size of libstdc++ STL containers
Status: RESOLVED FIXED
Alias: None
Product: lldb
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P enhancement
Assignee: Enrico Granata
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-19 13:41 PST by Daniel Malea
Modified: 2016-09-26 09:31 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Malea 2013-02-19 13:41:13 PST
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
Comment 1 Stefanus Du Toit 2013-02-25 17:04:27 PST
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.
Comment 2 Daniel Malea 2013-03-01 16:45:18 PST
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
Comment 3 Ashok Thirumurthi 2013-05-29 10:21:45 PDT
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.
Comment 4 Enrico Granata 2013-06-18 19:29:11 PDT
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.
Comment 5 Daniel Malea 2013-07-09 15:07:18 PDT
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
----------------------------------------------------------------------
Comment 6 Daniel Malea 2013-07-09 15:08:13 PDT
I should mention in the above test run, I was validating against LLDB built on Linux from SVN revision 185951.
Comment 7 Stefanus Du Toit 2013-07-12 14:26:35 PDT
With which standard C++ library implementation? Kind of important for this issue!
Comment 8 Daniel Malea 2013-07-12 15:11:32 PDT
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.
Comment 9 emaste 2013-12-05 09:16:42 PST
These tests are XPASS on FreeBSD with clang and and libstdc++ 4.2.1 or libc++.
Comment 10 labath 2016-09-26 09:31:34 PDT
The tests pass now.