diff options
author | Enrico Granata <egranata@apple.com> | 2016-07-19 23:50:31 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2016-07-19 23:50:31 +0000 |
commit | e555763fc632a4d4877b45e67850dd7bcf0ce3ac (patch) | |
tree | de65f7c667b11b54fbf0dfbb944a9d2cb60ca4cc /lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp | |
parent | b930c84368c758ec31a366833cdfc21eea06e534 (diff) | |
download | bcm5719-llvm-e555763fc632a4d4877b45e67850dd7bcf0ce3ac.tar.gz bcm5719-llvm-e555763fc632a4d4877b45e67850dd7bcf0ce3ac.zip |
Fix an issue where the libc++ std::list formatter wasn't recognizing the new memory layout correctly
rdar://problem/26999542
llvm-svn: 276061
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp')
-rw-r--r-- | lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index 35cee566a77..829e8ac3f66 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -40,17 +40,21 @@ namespace { ListEntry next () { + static ConstString g_next("__next_"); + if (!m_entry_sp) return ListEntry(); - return ListEntry(m_entry_sp->GetChildAtIndexPath({0,1})); + return ListEntry(m_entry_sp->GetChildMemberWithName(g_next, true)); } ListEntry prev () { + static ConstString g_prev("__prev_"); + if (!m_entry_sp) return ListEntry(); - return ListEntry(m_entry_sp->GetChildAtIndexPath({0,0})); + return ListEntry(m_entry_sp->GetChildMemberWithName(g_prev, true)); } uint64_t @@ -304,6 +308,9 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::CalculateNumChildren ( lldb::ValueObjectSP lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::GetChildAtIndex (size_t idx) { + static ConstString g_value("__value_"); + static ConstString g_next("__next_"); + if (idx >= CalculateNumChildren()) return lldb::ValueObjectSP(); @@ -335,6 +342,23 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::GetChildAtIndex (size_ current_sp = current_sp->GetChildAtIndex(1, true); // get the __value_ child if (!current_sp) return lldb::ValueObjectSP(); + + if (current_sp->GetName() == g_next) + { + ProcessSP process_sp(current_sp->GetProcessSP()); + if (!process_sp) + return nullptr; + + // if we grabbed the __next_ pointer, then the child is one pointer deep-er + lldb::addr_t addr = current_sp->GetParent()->GetPointerValue(); + addr = addr + 2*process_sp->GetAddressByteSize(); + ExecutionContext exe_ctx(process_sp); + current_sp = CreateValueObjectFromAddress("__value_", + addr, + exe_ctx, + m_element_type); + } + // we need to copy current_sp into a new object otherwise we will end up with all items named __value_ DataExtractor data; Error error; |