Пример #1
0
    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
Пример #2
0
    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)
Пример #3
0
    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)