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

Iain Sandoe iain@sandoe.co.uk
Sat Apr 3 19:36:07 GMT 2021


Hi Philippe,

Philippe Blain <levraiphilippeblain@gmail.com> wrote:

> Le 2021-03-07 à 11:07, Jonathan Wakely a écrit :
>> 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…)

>>> (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)
>>>
>>>

>>> 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.
>
> Looking at the summary of the changes in DWARF 3 [1] it seems
> C++ namespaces were added in that revision of the standard, so maybe
> in a way it does make sense for "-gdwarf-2 -gstrict-dwarf -g" to not show
> 'vector' in the 'std' namespace since DWARF 2 does not know about  
> namespaces…

indeed
>
> [1] http://dwarfstd.org/Dwarf3Std.php

thanks for doing the checking!

----

For GCC12, at least for macOS >= 10.10, I am going to look into changing the
default to DWARF-4.  The problem is not really with GCC itself, but that GCC
relies on the assembler/linker and more importantly debug linker (dsymutil)  
from
Xcode, so it’s important that the versions used there support the  
constructs we emit.

In the meantime, I would expect that if you are using GCC on >= macOS 10.10  
it
would be reasonable to put -gdwarf-4 on the command lines.  Before that, the
support might be unreliable.

thanks
Iain



More information about the Libstdc++ mailing list