[Lldb-commits] [lldb] [lldb][SymbolFileDWARF] CompleteType: Lookup type in the declaration DIE's SymbolFile (PR #120569)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 20 04:46:17 PST 2024


Michael137 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 possibly 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. So I'll go with this suggestion. Confirmed that this does fix the test attached test-case

https://github.com/llvm/llvm-project/pull/120569


More information about the lldb-commits mailing list