[Dwarf-Discuss] content of DW_AT_name for template

Moore, David david.moore at intel.com
Thu Jun 9 07:56:42 PDT 2011

Issue 1: 

I assume this is being proposed as a "clarification" for Dwarf-4 rather than a change for Dwarf-5. Really it impacts previous versions too so all Dwarf emitters are potentially impacted.

Given the impact, I don't find the rational for this change sufficiently compelling. If I am understanding correctly, the rational is "to speed up dwarf read times for the debugger". I paraphrase, but I think that captures the intent - if it doesn't, I have missed something. 

So, it is an optimization that renders currently conforming implementations non-conforming for the sake of a performance improvement. The spec may be unclear at present, so you can argue it is just a clarification, but once you clarify it, it renders some reasonable interpretations, including the one I would choose, non-conforming.

In addition, given that names in C++ can be astonishingly long, using indirect strings seems like a good idea in general. In that case I don't think there is much of a performance improvement. If you lay down many S<int>'s you only have to read the full name once if you are using indirect strings while if you are clever enough to merge them, you only have to read it once anyway. [1]

So if this is to be added as a clarification to Dwarf-4 I think it should be as a "may" (be the simple name) rather than "shall" be the simple name. In dwarf-5 it could then be firmed up (made a "shall"). By then we would hopefully have some implementation experience (of the form, what broke and how hard was it to fix)

The main effect of "may" is that consumers of the dwarf could be expected to still handle the long form of the name which, if they also supported the short form, they could presumably do by throwing away everything from the first "<" onwards.

In addition, the emitter of the dwarf could institute an option to emit one form or the other so that a consumer which was not capable of reconstituting the full name could be handed dwarf it could eat.

Issue 2: 

Do you want a fully qualified name rather than a simple name? You did not mention how to make this part of the reconstruction of the full name and, although I have not spent more than ten minutes looking at the problem, I am not seeing how to do it. 

[1] In Dwarf-5, we should perhaps think about creating a way to compose indirect strings so that we can merge long common prefixes from names. This is off-topic but I wanted to get the thought on the record while it was in my head.

More information about the Dwarf-Discuss mailing list