fallkrum added a comment.
In D88483#2343694 <https://reviews.llvm.org/D88483#2343694>, @labath wrote:
> <drive-by>
> It sounds like that could be an artefact from how we parse function types
> from dwarf. I haven't checked if that's what happens in this particular case,
> but I know that we parse function types by just taking the function DIE
> (which describes the whole function, not just its type) and let the generic
> ParseTypeFromDWARF function loose on it. It could be that this function picks
> up the DW_AT_name attribute from there (which is the function name in this
> case, but for other kinds of types it would actually be the type name). We
> could probably change that function to ignore the DW_AT_name for functions,
> though it's not clear to me whether the current behavior has any adverse
> effects (the final type name seems to come out alright...)
> </drive-by>
Thanks for reply, it seems it works the way you tell. Added to my above example
one more function definition, so the source file function_type.c looks like:
int main1 (int argc, const char * argv[]) {
return 0;
}
int main (int argc, const char * argv[]) {
return 0;
}
At the end of dwarf parsing content of m_die_to_type is:
(lldb_private::ConstString) $27 = (m_string = "main1")
(lldb_private::ConstString) $28 = (m_string = "int (int, const char **)")
(lldb_private::ConstString) $29 = (m_string = "main")
(lldb_private::ConstString) $30 = (m_string = "int (int, const char **)")
(lldb_private::ConstString) $31 = (m_string = "int")
(lldb_private::ConstString) $32 = (m_string = "int")
(lldb_private::ConstString) $33 = (m_string = 0x0000000000000000)
(lldb_private::ConstString) $34 = (m_string = "const char **")
(lldb_private::ConstString) $35 = (m_string = 0x0000000000000000)
(lldb_private::ConstString) $36 = (m_string = "const char *")
(lldb_private::ConstString) $37 = (m_string = "char")
(lldb_private::ConstString) $38 = (m_string = "char")
Where first and second m_string in each block are m_name and
m_compiler_type->GetTypeName() of Type correspondingly. Later on in
SymbolFileDWARF::GetTypes type duplicates are filtered out:
std::set<CompilerType> compiler_type_set;
for (Type *type : type_set) {
CompilerType compiler_type = type->GetForwardCompilerType();
if (compiler_type_set.find(compiler_type) == compiler_type_set.end()) {
compiler_type_set.insert(compiler_type);
type_list.Insert(type->shared_from_this());
}
}
Ending up with resulting type list as follows:
(lldb_private::ConstString) $27 = (m_string = "main1")
(lldb_private::ConstString) $28 = (m_string = "int (int, const char **)")
(lldb_private::ConstString) $31 = (m_string = "int")
(lldb_private::ConstString) $32 = (m_string = "int")
(lldb_private::ConstString) $33 = (m_string = 0x0000000000000000)
(lldb_private::ConstString) $34 = (m_string = "const char **")
(lldb_private::ConstString) $35 = (m_string = 0x0000000000000000)
(lldb_private::ConstString) $36 = (m_string = "const char *")
(lldb_private::ConstString) $37 = (m_string = "char")
(lldb_private::ConstString) $38 = (m_string = "char")
Maybe of course that's not a problem but for me it was at least confusing,
Type's m_name actually not a type's name but identifier in a source file. :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88483/new/
https://reviews.llvm.org/D88483
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits