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

Iain Sandoe iain@sandoe.co.uk
Sun Mar 7 12:23:55 GMT 2021


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 Linux to  
make a proper comparison - and my results for that were inconclusive -  
since I got:

(gdb) p array
Could not find the frame base for "main()".

So there was no output for the array case to compare (could be a different  
problem or a separate manifestation of the same one).

Iain



More information about the Libstdc++ mailing list