[Lldb-commits] [PATCH] D141318: [lldb] Store shared pointers in DieToTypePtr map instead of raw pointers

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 11 15:12:55 PST 2023


clayborg added a comment.

> Storing raw pointers in DieToTypePtr may cause use-after-frees to occur, since there are no guarantees that the shared pointers that owns the underlying pointer to the type are kept around as long as the map. Change the map to store a shared pointer instead.

This isn't true. SymbolFile has a m_type_list that is used to store all shared pointers to any types that are created. Since SymbolFileDWARF is an instance of SymbolFile, it is safe to store "Type *" anywhere inside this class because as along as the SymbolFileDWARF is around, so will the SymbolFile that owns all of the types. If there are any places where someone is creating a type and _not_ storing it in the SymbolFile::m_type_list, then this is the bug and that should be fixed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141318/new/

https://reviews.llvm.org/D141318



More information about the lldb-commits mailing list