diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 5786e757ef7ea..48bc4f200523f 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -459,7 +459,8 @@ class CommandObjectMemoryRead : public CommandObjectParsed { if (frame) search_first = frame->GetSymbolContext(eSymbolContextModule).module_sp; TypeQuery query(lookup_type_name.GetStringRef(), - TypeQueryOptions::e_find_one); + TypeQueryOptions::e_find_one | + TypeQueryOptions::e_search_by_mangled_name); TypeResults results; target->GetImages().FindTypes(search_first.get(), query, results); TypeSP type_sp = results.GetFirstType(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp index 64a8005308454..f5368e5c379e1 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp @@ -147,12 +147,10 @@ IterationAction DWARFIndex::ProcessTypeDIEMatchQuery( // Since mangled names are unique, we only need to check if the names are // the same. - if (query.GetSearchByMangledName()) { - if (die.GetMangledName(/*substitute_name_allowed=*/false) != + if (query.GetSearchByMangledName()) + if (die.GetMangledName(/*substitute_name_allowed=*/false) == query.GetTypeBasename().GetStringRef()) - return IterationAction::Continue; - return callback(die); - } + return callback(die); std::vector die_context; if (query.GetModuleSearch()) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 881268bc4ca03..ade70bc208c4b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2878,7 +2878,7 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) { bool have_index_match = false; m_index->GetTypesWithQuery(query_full, [&](DWARFDIE die) { if (Type *matching_type = ResolveType(die, true, true)) { - if (!query.GetSearchByMangledName() && matching_type->IsTemplateType()) { + if (matching_type->IsTemplateType()) { // We have to watch out for case where we lookup a type by basename and // it matches a template with simple template names. Like looking up // "Foo" and if we have simple template names then we will match @@ -2913,7 +2913,7 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) { // With -gsimple-template-names, a templated type's DW_AT_name will not // contain the template parameters. Try again stripping '<' and anything // after, filtering out entries with template parameters that don't match. - if (!have_index_match && !query.GetSearchByMangledName()) { + if (!have_index_match) { // Create a type matcher with a compiler context that is tuned for // -gsimple-template-names. We will use this for the index lookup and the // context matching, but will use the original "match" to insert matches