PR libstdc++/90520 adjust Xmethod for recent unique_ptr changes
PR libstdc++/90520 * python/libstdcxx/v6/printers.py (UniquePointerPrinter.__init__): Raise exception if unique_ptr tuple member has unknown structure. * python/libstdcxx/v6/xmethods.py (UniquePtrGetWorker.__call__): Adjust worker to support new __uniq_ptr_data base class. Do not assume field called _M_head_impl is the first tuple element. From-SVN: r271363
This commit is contained in:
parent
b5ba95ba97
commit
1a0a374429
|
@ -1,3 +1,12 @@
|
||||||
|
2019-05-18 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/90520
|
||||||
|
* python/libstdcxx/v6/printers.py (UniquePointerPrinter.__init__):
|
||||||
|
Raise exception if unique_ptr tuple member has unknown structure.
|
||||||
|
* python/libstdcxx/v6/xmethods.py (UniquePtrGetWorker.__call__):
|
||||||
|
Adjust worker to support new __uniq_ptr_data base class. Do not
|
||||||
|
assume field called _M_head_impl is the first tuple element.
|
||||||
|
|
||||||
2019-05-17 François Dumont <fdumont@gcc.gnu.org>
|
2019-05-17 François Dumont <fdumont@gcc.gnu.org>
|
||||||
|
|
||||||
* include/bits/stl_deque.h
|
* include/bits/stl_deque.h
|
||||||
|
|
|
@ -197,6 +197,8 @@ class UniquePointerPrinter:
|
||||||
self.pointer = tuple_member['_M_head_impl']
|
self.pointer = tuple_member['_M_head_impl']
|
||||||
elif head_field.is_base_class:
|
elif head_field.is_base_class:
|
||||||
self.pointer = tuple_member.cast(head_field.type)
|
self.pointer = tuple_member.cast(head_field.type)
|
||||||
|
else:
|
||||||
|
raise ValueError("Unsupported implementation for tuple in unique_ptr: %s" % impl_type)
|
||||||
|
|
||||||
def children (self):
|
def children (self):
|
||||||
return SmartPtrIterator(self.pointer)
|
return SmartPtrIterator(self.pointer)
|
||||||
|
|
|
@ -586,11 +586,22 @@ class UniquePtrGetWorker(gdb.xmethod.XMethodWorker):
|
||||||
|
|
||||||
def __call__(self, obj):
|
def __call__(self, obj):
|
||||||
impl_type = obj.dereference().type.fields()[0].type.tag
|
impl_type = obj.dereference().type.fields()[0].type.tag
|
||||||
if re.match('^std::(__\d+::)?__uniq_ptr_impl<.*>$', impl_type): # New implementation
|
# Check for new implementations first:
|
||||||
return obj['_M_t']['_M_t']['_M_head_impl']
|
if re.match('^std::(__\d+::)?__uniq_ptr_(data|impl)<.*>$', impl_type):
|
||||||
|
tuple_member = obj['_M_t']['_M_t']
|
||||||
elif re.match('^std::(__\d+::)?tuple<.*>$', impl_type):
|
elif re.match('^std::(__\d+::)?tuple<.*>$', impl_type):
|
||||||
return obj['_M_t']['_M_head_impl']
|
tuple_member = obj['_M_t']
|
||||||
return None
|
else:
|
||||||
|
return None
|
||||||
|
tuple_impl_type = tuple_member.type.fields()[0].type # _Tuple_impl
|
||||||
|
tuple_head_type = tuple_impl_type.fields()[1].type # _Head_base
|
||||||
|
head_field = tuple_head_type.fields()[0]
|
||||||
|
if head_field.name == '_M_head_impl':
|
||||||
|
return tuple_member['_M_head_impl']
|
||||||
|
elif head_field.is_base_class:
|
||||||
|
return tuple_member.cast(head_field.type)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
class UniquePtrDerefWorker(UniquePtrGetWorker):
|
class UniquePtrDerefWorker(UniquePtrGetWorker):
|
||||||
"Implements std::unique_ptr<T>::operator*()"
|
"Implements std::unique_ptr<T>::operator*()"
|
||||||
|
|
Loading…
Reference in New Issue