[Dwarf-Discuss] Using DWARF for C++ runtime reflection
Roman Popov
ripopov@gmail.com
Tue Mar 6 18:37:22 GMT 2018
Hi everyone,
I'm working on a dynamic analysis tool that needs runtime reflection in
C++. Since C++ has no standardized runtime reflection, I'm using DWARF as a
source of reflection metadata.
Is it a legitimate use-case from DWARF standard point of view?
It has been working great for me until I've upgraded to latest g++ and
clang compilers. Those compilers produce ambiguous names for some template
instantiations, so my tools no longer work. So I start to wonder: whether
it me misusing DWARF, or it is compilers that are buggy.
In particular, what is the DWARF answer for these questions:
1. Does DWARF guarantees that:
typeid(T1) == typeid(T2) ==> DW_AT_name(T1) == DW_AT_name(T2)
typeid(T1) != typeid(T2) ==> DW_AT_name(T1) != DW_AT_name(T2)
i.e. Is DW_AT_name an unique identifier for type?
2. Does DWARF guarantees that DW_AT_name(T) is a valid source language
name?
i.e. If I copy string from DW_AT_name to source code, and compile it with
the same compiler that produced DWARF, will it produce the same type?
T var1;
DW_AT_name(T) var2;
typeid(var1) == typeid (var2) ?
Thanks,
Roman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20180306/58dacdce/attachment.html>
More information about the Dwarf-discuss
mailing list