def to_string_v1(self): try: node = self.val['base_']['node_'] if not node: return utils.invalid_iterator node_type = node.type.strip_typedefs() if node_type.code == gdb.TYPE_CODE_PTR: node_type = node_type.target() allocator_type = node_type.template_argument(0) pair_type = allocator_type.template_argument(0) value_base_type = gdb.lookup_type( 'boost::unordered_detail::value_base < %s >' % str(pair_type)).pointer() node_pointer = gdb.lookup_type( "boost::unordered_detail::hash_node<%s, boost::unordered_detail::ungrouped>" % str(allocator_type)).pointer() value_base = node.cast(node_pointer).cast(value_base_type) pair = value_base['data_']['data_']['buf'].address.cast(pair_type.pointer()).dereference() l = utils.pairValueToList(pair) if utils.getParameter('boost_unordered_map_iterator_first'): return l[0] elif utils.getParameter('boost_unordered_map_iterator_second'): return l[1] else: return utils.pairToString(l) except gdb.error: return utils.invalid_iterator
def to_string(self): v = self.value() if v is None: return utils.invalid_iterator first = utils.getParameter('std_map_iterator_first') second = utils.getParameter('std_map_iterator_second') if first: return v['first'] elif second: return v['second'] else: l = utils.pairValueToList(v) return utils.pairToString(l)
def to_string_v2(self): node = self.val['node_'] if not node: return utils.invalid_iterator node_type = node.type.strip_typedefs() if node_type.code == gdb.TYPE_CODE_PTR: node_type = node_type.target() pair_type = str(node_type.template_argument(0)) pair_pointer = gdb.lookup_type(pair_type).pointer() buf = node['data_']['data_']['buf'] data = buf.address.cast(pair_pointer) d = data.dereference() l = utils.pairValueToList(d) if utils.getParameter('boost_unordered_map_iterator_first'): return l[0] elif utils.getParameter('boost_unordered_map_iterator_second'): return l[1] else: return utils.pairToString(l)
def to_string(self): if show_debug(): if self.val: print str(self.val.dynamic_type) print str(self.val.type) else: print 'Container Model is nil' if not utils.getParameter('show_abstract_container'): return 'Abstract Container Model' if self.val.type == self.val.dynamic_type: return utils.uninitialized_value derived = self.val.cast(self.val.dynamic_type) return derived
import gdb import re from utils import utils from utils.typeinfo import TypeInfo show_debug = utils.getParameter('show_debug') class Index (TypeInfo): def __init__ (self, val): super(Index, self).__init__(val) def to_string(self): cache = self.val['mCache'] if cache: return cache else: return utils.invalid_index
def show_debug(): return utils.getParameter('show_debug')