This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Support recursive record types in CTF
ClosedPublic

Authored by JDevlieghere on Jul 27 2023, 5:42 PM.

Details

Summary

Support recursive record types in CTF. We are now more lazy when creating LLDB types. When encountering a record type (struct or union) we create a forward declaration and only complete it when requested.

Diff Detail

Event Timeline

JDevlieghere created this revision.Jul 27 2023, 5:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2023, 5:42 PM
JDevlieghere requested review of this revision.Jul 27 2023, 5:42 PM

Generally LGTM, just some clarifications questions

lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
509

Just to clarify the lifetimes. This ctf_record lives on m_ast while the m_compiler_types on the SymbolFile, so we're guaranteed that the ctf_record lives long enough?

525–530

Nit: would it make sense to just add classof methods to CTFType and use the llvm cast facilities?

Feel free to ignore since there's just one instance of such cast afaict

JDevlieghere marked 2 inline comments as done.Jul 29 2023, 9:32 PM
JDevlieghere added inline comments.
lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp
509
  1. Yes, the ctf_record is owned by the m_ctf_types; whose lifetime is the same as the SymbolFile. We only need the CTF types until they're converted to LLDB types so we can be more memory efficient. I'll tackle that in a follow up.
  2. Once we've completed a type, we should remove the compiler type from m_compiler_types. I'll include that in this patch.
525–530

I considered it too, but at this point I don't think it's worth it. If we need other casts that's definitely the way to go.

This revision was not accepted when it landed; it landed in state Needs Review.Jul 29 2023, 10:32 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
JDevlieghere marked 2 inline comments as done.
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2023, 10:32 PM