[Dwarf-Discuss] Using DWARF for C++ runtime reflection
Michael Eager
eager@eagercon.com
Tue Mar 6 19:55:07 GMT 2018
> Yes, assuming that the compiler generates a valid source type.
> In some
> cases, particularly with template classes, this may not be the case.
>
>
> ?So DWARF does not give any guarantees and it's up to compiler
> vendor to decide about DW_AT_name?
>
>
> DWARF doesn't give guarantees, just suggestions. Practically speaking
> there's certainly benefit to compilers ensuring they produce a
> consistent name across different translation units - and potentially
> even a consistent name across compilers (so that code built with
> different compilers and then debugged can behave consistently/well). (or
> consistent enough for a debugger to cope with it - but I think as Daniel
> pointed out, having the debugger have to decompose the name and do
> various type equivalences is painful - which might lean one towards
> trying to produce more consistent names across GCC and Clang - the few
> cases I know of (enums, for example) could probably be improved just for
> the compiler self-consistency aspect and incidentally improve the cross
> compiler consistency anyway)
Exactly. In many areas, the DWARF Standard is permissive. There are
specific constraints which are mentioned, but the producer is given a
lot of latitude whether to generate complete or incomplete, good or poor
DWARF. DWARF guarantees the organization and structure of the data.
There is a comment about names on the DWARF Wiki under Best Practices:
http://wiki.dwarfstd.org/index.php?title=Best_Practices
--
Michael Eager eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306
More information about the Dwarf-discuss
mailing list