[Lldb-commits] [PATCH] D46810: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 14 05:23:19 PDT 2018

jankratochvil added a comment.

In https://reviews.llvm.org/D46810#1097503, @labath wrote:

> - if nothing has been parsed, m_die_array is empty  and m_first_die is empty
> - if the cu die has been parsed, m_die_array us empty and m_first_die is full
> - if everything has been parsed m_first_die and m_die_array are full, **and** the first element of m_die_array contains a copy of m_first_die Is that an accurate description of what you are doing here?

Yes. I will add a comment to the code.

> (If that is true, then I think this is workable, but there are still some details which need to be ironed out; e.g., `m_first_die.GetFirstChild()`)

The current code calling `GetUnitDIEOnly()` (returning `DWARFDIE`) or `GetUnitDIEPtrOnly` (returning `DWARFDebugInfoEntry *`) is never dealing with child DIEs of what it gets - it also makes sense as there is no guarantee they have been read in. Such code would already cause ASAN error accessing memory behind `std::vector`. So I find such assertion check orthogonal to this patch but I will prepare another patch for that.

Thanks for checking validity of this patch, I was not sure whether LLDB code is intended to be thread-safe in the first place.


More information about the lldb-commits mailing list