[Lldb-commits] [lldb] r317624 - Update tuple/list/deque data formatters to work with newest libc++
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 7 14:17:29 PST 2017
Author: labath
Date: Tue Nov 7 14:17:29 2017
New Revision: 317624
URL: http://llvm.org/viewvc/llvm-project?rev=317624&view=rev
Log:
Update tuple/list/deque data formatters to work with newest libc++
Summary:
A couple of members of these data structures have been renamed in recent
months. This makes sure they still work with the latest libc++ version.
Reviewers: jingham, EricWF
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D39602
Modified:
lldb/trunk/examples/synthetic/libcxx.py
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
Modified: lldb/trunk/examples/synthetic/libcxx.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/libcxx.py?rev=317624&r1=317623&r2=317624&view=diff
==============================================================================
--- lldb/trunk/examples/synthetic/libcxx.py (original)
+++ lldb/trunk/examples/synthetic/libcxx.py Tue Nov 7 14:17:29 2017
@@ -693,6 +693,13 @@ class stddeque_SynthProvider:
except:
return None
+ def _get_value_of_compressed_pair(self, pair):
+ value = pair.GetChildMemberWithName("__value_")
+ if not value.IsValid():
+ # pre-r300140 member name
+ value = pair.GetChildMemberWithName("__first_")
+ return value.GetValueAsUnsigned(0)
+
def update(self):
logger = lldb.formatters.Logger.Logger()
try:
@@ -709,8 +716,8 @@ class stddeque_SynthProvider:
# variable tells which element in this NxM array is the 0th
# one, and the 'size' element gives the number of elements
# in the deque.
- count = self.valobj.GetChildMemberWithName(
- '__size_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ count = self._get_value_of_compressed_pair(
+ self.valobj.GetChildMemberWithName('__size_'))
# give up now if we cant access memory reliably
if self.block_size < 0:
logger.write("block_size < 0")
@@ -724,8 +731,8 @@ class stddeque_SynthProvider:
'__begin_').GetValueAsUnsigned(0)
map_end = map_.GetChildMemberWithName(
'__end_').GetValueAsUnsigned(0)
- map_endcap = map_.GetChildMemberWithName(
- '__end_cap_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
+ map_endcap = self._get_value_of_compressed_pair(
+ map_.GetChildMemberWithName( '__end_cap_'))
# check consistency
if not map_first <= map_begin <= map_end <= map_endcap:
logger.write("map pointers are not monotonic")
Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp?rev=317624&r1=317623&r2=317624&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp Tue Nov 7 14:17:29 2017
@@ -298,6 +298,15 @@ ValueObjectSP ForwardListFrontEnd::GetCh
m_element_type);
}
+static ValueObjectSP GetValueOfCompressedPair(ValueObject &pair) {
+ ValueObjectSP value = pair.GetChildMemberWithName(ConstString("__value_"), true);
+ if (! value) {
+ // pre-r300140 member name
+ value = pair.GetChildMemberWithName(ConstString("__first_"), true);
+ }
+ return value;
+}
+
bool ForwardListFrontEnd::Update() {
AbstractListFrontEnd::Update();
@@ -310,7 +319,7 @@ bool ForwardListFrontEnd::Update() {
m_backend.GetChildMemberWithName(ConstString("__before_begin_"), true));
if (!impl_sp)
return false;
- impl_sp = impl_sp->GetChildMemberWithName(ConstString("__first_"), true);
+ impl_sp = GetValueOfCompressedPair(*impl_sp);
if (!impl_sp)
return false;
m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get();
@@ -331,10 +340,9 @@ size_t ListFrontEnd::CalculateNumChildre
ValueObjectSP size_alloc(
m_backend.GetChildMemberWithName(ConstString("__size_alloc_"), true));
if (size_alloc) {
- ValueObjectSP first(
- size_alloc->GetChildMemberWithName(ConstString("__first_"), true));
- if (first) {
- m_count = first->GetValueAsUnsigned(UINT32_MAX);
+ ValueObjectSP value = GetValueOfCompressedPair(*size_alloc);
+ if (value) {
+ m_count = value->GetValueAsUnsigned(UINT32_MAX);
}
}
if (m_count != UINT32_MAX) {
Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp?rev=317624&r1=317623&r2=317624&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp Tue Nov 7 14:17:29 2017
@@ -38,7 +38,11 @@ private:
bool TupleFrontEnd::Update() {
m_elements.clear();
- m_base_sp = m_backend.GetChildMemberWithName(ConstString("base_"), true);
+ m_base_sp = m_backend.GetChildMemberWithName(ConstString("__base_"), true);
+ if (! m_base_sp) {
+ // Pre r304382 name of the base element.
+ m_base_sp = m_backend.GetChildMemberWithName(ConstString("base_"), true);
+ }
if (! m_base_sp)
return false;
m_elements.assign(m_base_sp->GetCompilerType().GetNumDirectBaseClasses(),
More information about the lldb-commits
mailing list