[lldb-dev] [Bug 15301] New: LLDB prints incorrect size of libstdc++ vector<bool> containers (when inferior built with GCC on Linux)

Enrico Granata egranata at apple.com
Wed May 15 14:32:58 PDT 2013


Yacine,

In addition to what Greg said, I am also slightly confused by your FormatManager changes.
Two points here:

1) a regular expression is not really necessary. If I understand the scope of the GCC bug correctly, all we need to do is match the two *exact* strings
std::vector<std::allocator<bool>> and std::vector<bool, std::allocator<bool>, bool, std::allocator<bool> >
to catch all cases
Regexp matching is slower and it is easy to write a regexp that over-reaches and matches more types than we would like to
If this is a workaround for a bug rather than a necessity, I would rather much keep it as confined as possible, so I would definitely rework in terms of exact matching

2) It looks like you are removing the summary for a vector of bools entirely. Why?
You would just need to add the same summary with a new typename to the category, instead your patch at lines 42 and 43 is removing the creation of the summary for std::vector<bool> and I can’t see the replacement

This is mostly a minor cosmetic issue, and it’s not even enforced consistently in the code, but I tend to add new formatters using AddFormatter calls instead of directly playing with the FormatNavigator objects
It’s kind of laying groundwork for potentially reworking the way built-in formatters are added to an easier to maintain coding style. I have a couple ideas there, just not enough time to code them :-)

Thanks for clarifying these data points.

Enrico Granata
📩 egranata@.com
☎️ 27683

On May 15, 2013, at 1:50 PM, Yacine Belkadi <yacine.belkadi.1 at gmail.com> wrote:

> Hi,
> 
> When the inferior is built with GCC 4.7.2, the DWARF contains duplicate
> DW_AT_template_type_param DIEs for std::vector (and others). There is a
> reported GCC bug about it (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54410).
> Because of this, lldb parses the type
> "std::vector<bool, std::allocator<bool> >" as
> "std::vector<bool, std::allocator<bool, bool>, bool, std::allocator<bool,
> bool> >".
> Later, the FormatManager fails to match this type with the appropriate
> SyntheticChildrenFrontEnd for std::vector<bool>. The printable
> representation produced is then the incorrect:
> (lldb) frame variable vBool
> (std::vector<bool, std::allocator<bool, bool>, bool, std::allocator<bool,
> bool> >) vBool = size=0 {}
> 
> I've attached 3 patches (against r181819) for review:
> - An attempt at a workaround for the GCC bug
> - A change in the FormatManager to allow "std::vector<bool,
>  std:allocator<bool> >" to be matched to the vector<bool> Synthetic.
> - The re-enabling of the test case
> 
> Thanks,
> Yacine
> 
>> http://llvm.org/bugs/show_bug.cgi?id=15301
>> 
>>            Bug ID: 15301
>>           Summary: LLDB prints incorrect size of libstdc++ vector<bool>
>>                    containers (when inferior built with GCC on Linux)
>>           Product: lldb
>>           Version: unspecified
>>          Hardware: PC
>>                OS: Linux
>>            Status: NEW
>>          Severity: enhancement
>>          Priority: P
>>         Component: All Bugs
>>          Assignee: lldb-dev at cs.uiuc.edu
>>          Reporter: daniel.malea at intel.com
>>    Classification: Unclassified
>> 
>> 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
>> 
>> -- 
>> You are receiving this mail because:
>> You are the assignee for the bug.
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://lists.cs.uiuc.edu/pipermail/lldb-dev/attachments/20130219/8ff9c75c/attachment-0001.html>
> 
> 
> 
> 
> <0001-SymbolFile-DWARF-Ignore-duplicate-template-parameter.patch><0002-FormatManager-Match-std-vector-bool-std-allocator-bo.patch><0003-Tests-Re-enable-TestDataFormatterStdVBool.py.patch>_______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130515/b8f74276/attachment.html>


More information about the lldb-dev mailing list