[Dwarf-Discuss] CU-local types

David Blaikie dblaikie at gmail.com
Tue May 17 15:17:38 PDT 2022

Looks like gdb and lldb both have issues with C++ local types (either
types defined in anonymous namespaces, or otherwise localized - eg: a
non-local template with a local type or variable in one of its
parameters). GDB correctly associates directly referenced types (eg:
the type of a variable doesn't get confused just because there's a
same-named-but-distinct type in another CU) where LLDB does not (gets
that correct for a type in an anonymous namespace, but not a template
that's made local via a local-typed parameter). Neither debugger then
handles overload resolution and can correctly identify that a function
taking that parameter type from another CU is not a valid overload
candidate for this type.

So... what could/should we do about this?

In theory, using DW_AT_external for non-local types would be
consistent with other DWARF usage, but then a consumer would have to
assume that all non-external types are distinct, which probably isn't
the right default given current deployments? Mandating this in DWARFv6
might be possible?

More information about the Dwarf-Discuss mailing list