[Lldb-commits] [lldb] [lldb][SymbolFileDWARF] Share GetDIEToType between SymbolFiles of a SymbolFileDWARFDebugMap (PR #120569)
Zequan Wu via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 20 11:10:30 PST 2024
ZequanWu wrote:
> > > As an alternative, we might be able to make the die-to-type map shared between all symbol files in a debug map (similar to how "unique dwarf ast type map" is shared).
> >
> >
> > Yea I considered that, but I was concerned with the unforeseen complications this might have. Particularly I'm not sure how the `TypeSP` ownership should be managed. IIUC, a `TypeSP` is solely supposed to be owned by a single `SymbolFile` (`MakeType` kind of binds the two together). But then if we bundled `TypeSP`s from different modules into a single map on `SymbolFileDWARFDebugMap`, could we run into issues if one of the `SymbolFile`'s gets torn down (if that can happen)? Though I'm also not certain that we _only_ store `TypeSP`s inside the `SymbolFileDWARF`. I don't think there's anything asserting/enforcing this.
>
> On second thought, this does feel more consistent with how all the other bookkeeping structures already work. And re. the ownership, my current patch pretty much achieves the same thing (but in a less apparent manner). I'm still mixing `Type*` into `GetDIEToType` of a different `SymbolFile`. And the `UniqueDWARFASTType` owns a `TypeSP`, and we are sharing those via a debug-map already. So I'll go with this suggestion. Confirmed that this does fix the test attached test-case
Good to hear that works and making `TypeSP` shared among different `SymbolFile` make life easier.
https://github.com/llvm/llvm-project/pull/120569
More information about the lldb-commits
mailing list