Pretty printers for versioned namespace

François Dumont frs.dumont@gmail.com
Fri Dec 9 12:56:00 GMT 2016


On 02/12/2016 01:41, Jonathan Wakely wrote:
> On 01/12/16 22:51 +0100, François Dumont wrote:
>> We needed the StdExpVerAnyPrinter just because of the loopkup for 
>> 'std::string' which has to be 'std::__7::string'. But I used similar 
>> technique exposed previously to get rid of it.
>
> But I don't see any std::__7::string in the relevant symbols. Here's
> the manager function for an std:experimental::__7::any storing a
> std::__7::string:
>
> std::experimental::fundamentals_v1::__7::any::_Manager_internal<std::__7::basic_string<char, 
> std::__7::char_traits<char>, std::__7::allocator<char> > 
> >::_S_manage(std::experimental::fundamentals_v1::__7::any::_Op, 
> >std::experimental::fundamentals_v1::__7::any const*, 
> >std::experimental::fundamentals_v1::__7::any::_Arg*)
>
> Since this has no std::__7::string it doesn't need to be substituted.
>
> Do any tests fail without the change to StdExpAnyPrinter? Which ones?
>
>
Yes, tests involving std::any are failing because of the std::string lookup:

Python Exception <class 'gdb.error'> No type named std::string.:
skipping: Python Exception <class 'gdb.error'> No type named std::string.:
Python Exception <class 'gdb.error'> No type named std::string.:
$9 = {_M_manager = 0x4046f4 
<std::__7::any::_Manager_internal<bool>::_S_manage(std::__7::any::_Op, 
std::__7::any const*, std::__7::any::_Arg*)>, _M_storage = {_M_ptr = 
0x0skipping:
Python Exception <class 'gdb.error'> No type named std::string.:
, _M_buffer = {__data = "\000\000\000\000\000\000\000", __align = {<No 
data fields>}}}}
got: $9 = {_M_manager = 0x4046f4 
<std::__7::any::_Manager_internal<bool>::_S_manage(std::__7::any::_Op, 
std::__7::any const*, std::__7::any::_Arg*)>, _M_storage = {_M_ptr = 
0x0, _M_
buffer = {__data = "\000\000\000\000\000\000\000", __align = {<No data 
fields>}}}}
FAIL: libstdc++-prettyprinters/cxx17.cc print ab

This lookup is needed to correctly handle std::any<std::string>. As 
stated in the comment:

             # FIXME need to expand 'std::string' so that 
gdb.lookup_type works

But I don't know how to fix this so for the moment I just adapt it to 
correctly handle std::__7::string.

Here is my latest version tested with an without version namespace.

Ok to commit ?

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: prettyprinters.patch
Type: text/x-patch
Size: 54310 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161209/43d1ac93/attachment.bin>


More information about the Gcc-patches mailing list