[Lldb-commits] [PATCH] D46810: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer
Jan Kratochvil via lldb-commits
lldb-commits at lists.llvm.org
Sun Oct 14 09:05:43 PDT 2018
On Thu, 27 Sep 2018 18:21:13 +0200, Greg Clayton via lldb-commits wrote:
> One fix that would work it to make the DWARFDebugInfoEntry* inside the DWARFDie to be mutable and allow it to "fix" itself when a call is made. So the flow would be:
>
> auto CUDie = cu->GetUnitDIEOnly();
> for (auto child = CUDie.GetFirstChild(); ....
>
> The call to DWARFDie::GetFirstChild() would replace "DWARFDebugInfoEntry *m_die" with the correct version by tracking if m_die is just the unit die only by making "DWARFDebugInfoEntry *m_die" into a llvm::PointerIntPair:
>
> PointerIntPair< DWARFDebugInfoEntry *, 1> m_die;
>
>
> We set the bit to 1 if m_die is just the unit DIE. Then we have an accessor on DWARFDie that can promote m_die to the full version if needed:
>
> void DWARFDie::PromoteIfNeeded() {
> if (m_die.getInt()) {
> m_die.setPointer(m_cu->DIEPtr());
> m_die.setInt(false);
> }
> }
Thanks for the mail but I believe this issue has been already fixed by:
2/3: Use DWARFBaseDIE as compile-time protection
https://reviews.llvm.org/D47276
The assertion-regression of this commit is unrelated to stale pointers.
And it has been addressed by now filed:
Fix: Assertion failed: (!m_first_die || m_first_die == m_die_array.front()), function ExtractDIEsRWLocked
https://reviews.llvm.org/D53255
Or do I miss something?
Thanks,
Jan
More information about the lldb-commits
mailing list