DWARF debug info version on macOS and 'std::' namespace (and pretty-printers)

Jonathan Wakely jwakely@redhat.com
Sun Mar 7 16:07:25 GMT 2021


On 07/03/21 12:23 +0000, Iain Sandoe wrote:
>Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>>On Sun, 7 Mar 2021, 05:12 Philippe Blain via Libstdc++, 
>><libstdc++@gcc.gnu.org> wrote:
>>
>>I would think it's what GCC emits though, since LLDB acts similarly 
>>(although
>>I could be wrong...)
>>
>>Yes, seems likely to be a GCC problem.
>
>(unfortunately, I’m not familiar with exactly what language features 
>can be represented by each DWARF revision but, hypothetically, it 
>could be that something in the current sources is not representable 
>properly by DWARF-2)
>
>Notes
>
> * Darwin defaults to dwarf-2 and also strict-dwarf.
> * dwarfdump —verify does not report any issues for the object files produced by the example command lines below.
>
>So that [on Darwin16 / macOS 10.12]
>g++ /source/test/cxx/debug-vect.C -save-temps -o t -g
>
>=>
>
>(lldb) p array
>(vector<double, allocator<double> >) $0 = {
>  _Vector_base<double, allocator<double> > = {
>    _M_impl = {
>      _Vector_impl_data = {
>        _M_start = 0x0000000100501f40
>        _M_finish = 0x0000000100501f60
>        _M_end_of_storage = 0x0000000100501f60
>      }
>    }
>  }
>}
>
>but
>g++ /source/test/cxx/debug-vect.C -save-temps -o t -g 
>-gno-strict-dwarf -gdwarf-2
>
>(lldb) p array
>(std::vector<double, std::allocator<double> >) $0 = size=4 {
>  [0] = 0
>  [1] = 0
>  [2] = 0
>  [3] = 0
>}
>
>=====
>
>So I think one would have to try “-gdwarf-2 -gstrict-dwarf -g” on 

Ah, I wasn't using -gstrict-dwarf but if I add that I can reproduce
the problem on GNU/Linux with current versions of GCC and GDB.



More information about the Libstdc++ mailing list