Demangle symbols in debug assertion messages

François Dumont frs.dumont@gmail.com
Tue May 19 20:47:00 GMT 2015


Hello

     Is it ok ?

François

On 04/05/2015 22:31, François Dumont wrote:
> Hi
>
>     Here is  the patch to demangle symbols in debug messages. I have 
> also simplify code in formatter.h.
>
>     Here is an example of assertion message:
>
> /home/fdt/dev/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/debug/functions.h:213: 
>
>     error: function requires a valid iterator range [__first, __last).
>
> Objects involved in the operation:
> iterator "__first" @ 0x0x7fff165d68b0 {
>   type = 
> __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*, 
> std::__cxx1998::vector<int, std::allocator<int> > >, 
> std::__debug::vector<int, std::allocator<int> > > (mutable iterator);
>   state = dereferenceable;
>   references sequence with type `std::__debug::vector<int, 
> std::allocator<int> >' @ 0x0x7fff165d69d0
> }
> iterator "__last" @ 0x0x7fff165d68e0 {
>   type = 
> __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<int*, 
> std::__cxx1998::vector<int, std::allocator<int> > >, 
> std::__debug::vector<int, std::allocator<int> > > (mutable iterator);
>   state = dereferenceable;
>   references sequence with type `std::__debug::vector<int, 
> std::allocator<int> >' @ 0x0x7fff165d69d0
> }
>
>
>     * include/debug/formatter.h (_GLIBCXX_TYPEID): New macro to simplify
>     usage of typeid.
>     (_Error_formatter::_M_print_type): New.
>     * src/c++11/debug.cc
>     (_Error_formatter::_Parameter::_M_print_field): Use latter.
>     (_Error_formatter::_M_print_type): Implement latter using
>     __cxaabiv1::__cxa_demangle to print demangled type name.
>
> I just hope that __cxa_demangle is portable.
>
> Ok to commit ?
>
> François
>



More information about the Libstdc++ mailing list