[Lldb-commits] [PATCH] D46810: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue May 15 01:44:12 PDT 2018
labath added a comment.
Trying to be smart while being lazy and multithreaded is going to make the code complicated (possibility for bugs) and/or introduce a lot of locking overhead.
A lot simpler solution is to let the caller decide if it want's the full CU or just the root DIE, and then make it hard for him to get this wrong. This shouldn't be too much to ask, as that's pretty much what we have now, without the second part. The second part can be achieved by changing the `GetUnitDIEOnly` function to return a different type, say `DWARFBasicDIE` which does not even have child accessor functions. Then DWARFDIE can inherit from that and add the extra child/parent accessor methods. This way it will be impossible to get it wrong as you'll get a compile error if you try to access the children of a unit-only die.
More information about the lldb-commits