Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,29 @@ size_t SymbolFileCTF::ParseTypes(CompileUnit &cu) {

LLDB_LOG(log, "Parsed {0} CTF types", m_ctf_types.size());

for (lldb::user_id_t uid = 1; uid < type_uid; ++uid)
for (lldb::user_id_t uid = 1; uid < type_uid; ++uid) {
ResolveTypeUID(uid);

// Remove the CTF type because we don't need it anymore, except for record
// types which we may need to complete later.
auto ctf_type_it = m_ctf_types.find(uid);
if (ctf_type_it != m_ctf_types.end()) {
CTFType *ctf_type = ctf_type_it->second.get();
if (!llvm::isa<CTFRecord>(ctf_type))
m_ctf_types.erase(uid);
}
}

#ifndef NDEBUG
// Verify that the only CTF types left at this point are record types.
for (auto &t : m_ctf_types) {
CTFType *ctf_type = t.second.get();
assert(ctf_type && "invalid type in m_ctf_types");
assert(llvm::isa<CTFRecord>(ctf_type) && "leaking non record type");
}

#endif

LLDB_LOG(log, "Created {0} CTF types", m_types.size());

return m_types.size();
Expand Down Expand Up @@ -994,6 +1014,8 @@ lldb_private::Type *SymbolFileCTF::ResolveTypeUID(lldb::user_id_t type_uid) {

CTFType *ctf_type = ctf_type_it->second.get();
assert(ctf_type && "m_ctf_types should only contain valid CTF types");
assert(ctf_type->uid == type_uid &&
"CTF type UID doesn't match UID in m_ctf_types");

Log *log = GetLog(LLDBLog::Symbols);

Expand All @@ -1015,11 +1037,6 @@ lldb_private::Type *SymbolFileCTF::ResolveTypeUID(lldb::user_id_t type_uid) {

m_types[type_uid] = type_sp;

// Except for record types which we'll need to complete later, we don't need
// the CTF type anymore.
if (!isa<CTFRecord>(ctf_type))
m_ctf_types.erase(type_uid);

return type_sp.get();
}

Expand Down
Loading