[cfe-dev] DebugInfo: Template names

via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 22 11:02:44 PST 2021


> Hey Paul - you mentioned the SCE debugger always rebuilds names
> from the DWARF tags (after stripping the <...> suffix from the
> DW_AT_name in the DWARF, I guess/assume?) - I was curious if you
> (or others you could cc on this thread) know how that solution
> deals with some of the more difficult issues I've punted on so
> far with the Simplified Template Names work. 
>
> The specific one that comes to mind is any pointer non-type
> template parameters. (eg: "template<int*> void f1(); int g; ...
> f1<&g>()" - so far as I know there's not enough data in the DWARF
> to reconstruct that name.

This one I'm pretty sure about: The template_value_parameter has
a DW_AT_location that is the address of the actual parameter, and
that address ought to be resolvable to "g" (at least once you have
the linked image, it should be straightforward, because "g" would
have a DWARF description whose location had that as the address).
We don't have to worry about things like "&array[10]" because 
that's not legal for a non-type template parameter (as per
[temp.arg.nontype]p3 in C++11).

But I've asked anyway, to confirm.

> The other one I came across was unnamed struct types V lambda
> types - they have distinct manglings & so need different naming
> I think? But the DWARF has no record of that, and probably
> doesn't have enough data to reconstruct the original naming
> (because the naming is based on the number of lambdas seen so
> far - and the DWARF isn't adequately/guaranteed to be ordered
> like the source and also may omit some types if they're unused
> leading to holes in the numbering)

I was recently unable to figure out how to pass a lambda as a
template parameter, so if you could provide an example that would
be helpful both for this question and the other thing I was doing.
I've passed your description along just in case they know off the
tops of their heads.
--paulr



More information about the cfe-dev mailing list