Example #1
0
def qdumpHelper__std__tree__iterator(d, value, isSet=False):
    treeTypeName = None
    if value.type.name.endswith("::iterator"):
        treeTypeName = value.type.name[:-len("::iterator")]
    elif value.type.name.endswith("::const_iterator"):
        treeTypeName = value.type.name[:-len("::const_iterator")]
    treeType = d.lookupType(treeTypeName) if treeTypeName else value.type[0]
    keyType = treeType[0]
    valueType = treeType[1]
    node = value["_M_node"].dereference()   # std::_Rb_tree_node_base
    d.putExpandable()
    d.putEmptyValue()
    if d.isExpanded():
        with Children(d):
            if isSet:
                typecode = 'pppp@{%s}' % keyType.name
                (color, parent, left, right, pad1, key) = d.split(typecode, node)
                d.putSubItem("value", key)
            else:
                typecode = 'pppp@{%s}@{%s}' % (keyType.name, valueType.name)
                (color, parent, left, right, pad1, key, pad2, value) = d.split(typecode, node)
                d.putSubItem("first", key)
                d.putSubItem("second", value)
            with SubItem(d, "[node]"):
                d.putExpandable()
                d.putEmptyValue()
                d.putType(" ")
                if d.isExpanded():
                    with Children(d):
                        #d.putSubItem("color", color)
                        nodeType = node.type.pointer()
                        d.putSubItem("left", d.createValue(left, nodeType))
                        d.putSubItem("right", d.createValue(right, nodeType))
                        d.putSubItem("parent", d.createValue(parent, nodeType))
Example #2
0
def qdump__cv__Mat(d, value):
    (flag, dims, rows, cols, data, refcount, datastart, dataend,
            datalimit, allocator, size, stepp) \
        = value.split('iiiipppppppp')
    steps = d.split('p' * dims, stepp)
    innerSize = 0 if dims == 0 else steps[dims - 1]
    if dims != 2:
        d.putEmptyValue()
        d.putPlainChildren(value)
        return

    if d.currentItemFormat() == DisplayFormat.SeparateFormat:
        rs = steps[0] * innerSize
        cs = cols * innerSize
        dform = 'arraydata:separate:int:%d::2:%d:%d' % (innerSize, cols, rows)
        out = ''.join(d.readMemory(data + i * rs, cs) for i in range(rows))
        d.putDisplay(dform, out)

    d.putValue('(%s x %s)' % (rows, cols))
    if d.isExpanded():
        with Children(d):
            innerType = d.createType(TypeCode.TypeCodeIntegral, innerSize)
            for i in range(rows):
                for j in range(cols):
                    with SubItem(d, None):
                        d.putName('[%d,%d]' % (i, j))
                        addr = data + (i * steps[0] + j) * innerSize
                        d.putItem(d.createValue(addr, innerType))
Example #3
0
def qdump__Utils__NameValueDictionary(d, value):
    dptr = d.extractPointer(value["m_values"])
    (ref, n) = d.split('ii', dptr)
    d.check(0 <= n and n <= 100 * 1000 * 1000)
    d.check(-1 <= ref and ref < 100000)

    d.putItemCount(n)
    if d.isExpanded():
        if n > 10000:
            n = 10000

        typeCode = 'ppp@{%s}@{%s}' % ("Utils::DictKey", "QString")

        def helper(node):
            (p, left, right, padding1, key, padding2, value) = d.split(typeCode, node)
            if left:
                for res in helper(left):
                    yield res
            yield (key["name"], value)
            if right:
                for res in helper(right):
                    yield res

        with Children(d, n):
            for (pair, i) in zip(helper(dptr + 8), range(n)):
                d.putPairItem(i, pair, 'key', 'value')
Example #4
0
def qdump__std__set__QNX(d, value):
    try:
        _ = value["_Mypair"]["_Myval2"]["_Myval2"]["_Myproxy"]
        (proxy, head, size) = value.split("ppp")
    except Exception:
        (head, size) = value.split("pp")
    d.check(0 <= size and size <= 100 * 1000 * 1000)
    d.putItemCount(size)
    if d.isExpanded():
        childType = value.type[0]

        def helper(node):
            (left, parent, right, color, isnil, pad,
             value) = d.split("pppcc@{%s}" % childType.name, node)
            if left != head:
                for res in helper(left):
                    yield res
            yield value
            if right != head:
                for res in helper(right):
                    yield res

        (smallest, root) = d.split("pp", head)
        with Children(d, size, maxNumChild=1000):
            for (item, i) in zip(helper(root), d.childRange()):
                d.putSubItem(i, item)
Example #5
0
def qdump__std____1__map(d, value):
    try:
        (proxy, head, size) = value.split("ppp")
        d.check(0 <= size and size <= 100 * 1000 * 1000)

    # Sometimes there is extra data at the front. Don't know why at the moment.
    except RuntimeError:
        (junk, proxy, head, size) = value.split("pppp")
        d.check(0 <= size and size <= 100 * 1000 * 1000)

    d.putItemCount(size)

    if d.isExpanded():
        keyType = value.type[0]
        valueType = value.type[1]
        pairType = value.type[3][0]

        def in_order_traversal(node):
            (left, right, parent, color, pad,
             pair) = d.split("pppB@{%s}" % (pairType.name), node)

            if left:
                for res in in_order_traversal(left):
                    yield res

            yield pair.split("{%s}@{%s}" % (keyType.name, valueType.name))[::2]

            if right:
                for res in in_order_traversal(right):
                    yield res

        with Children(d, size, maxNumChild=1000):
            for (i, pair) in zip(d.childRange(), in_order_traversal(head)):
                d.putPairItem(i, pair, 'key', 'value')
Example #6
0
def qdump__std__map(d, value):
    if d.isQnxTarget() or d.isMsvcTarget():
        qdump_std__map__helper(d, value)
        return

    # stuff is actually (color, pad) with 'I@', but we can save cycles/
    (compare, stuff, parent, left, right, size) = value.split('pppppp')
    d.check(0 <= size and size <= 100*1000*1000)
    d.putItemCount(size)

    if d.isExpanded():
        keyType = value.type[0]
        valueType = value.type[1]
        with Children(d, size, maxNumChild=1000):
            node = value["_M_t"]["_M_impl"]["_M_header"]["_M_left"]
            nodeSize = node.dereference().type.size()
            typeCode = "@{%s}@{%s}" % (keyType.name, valueType.name)
            for i in d.childRange():
                (pad1, key, pad2, value) = d.split(typeCode, node.pointer() + nodeSize)
                d.putPairItem(i, (key, value))
                if node["_M_right"].pointer() == 0:
                    parent = node["_M_parent"]
                    while True:
                        if node.pointer() != parent["_M_right"].pointer():
                            break
                        node = parent
                        parent = parent["_M_parent"]
                    if node["_M_right"] != parent:
                        node = parent
                else:
                    node = node["_M_right"]
                    while True:
                        if node["_M_left"].pointer() == 0:
                            break
                        node = node["_M_left"]
Example #7
0
def qdump__std____1__map__iterator(d, value):
    d.putEmptyValue()
    if d.isExpanded():
        with Children(d):
            node = value['__i_']['__ptr_'].dereference()['__value_']['__cc']
            d.putSubItem('first', node['first'])
            d.putSubItem('second', node['second'])
Example #8
0
def qdump_std__map__helper(d, value):
    try:
        _ = value["_Mypair"]["_Myval2"]["_Myval2"]["_Myproxy"]
        (proxy, head, size) = value.split("ppp")
    except Exception:
        (head, size) = value.split("pp")
    d.check(0 <= size and size <= 100 * 1000 * 1000)
    d.putItemCount(size)
    if d.isExpanded():
        keyType = value.type[0]
        valueType = value.type[1]
        pairType = value.type[3][0]

        def helper(node):
            (left, parent, right, color, isnil, pad,
             pair) = d.split("pppcc@{%s}" % (pairType.name), node)
            if left != head:
                for res in helper(left):
                    yield res
            yield pair.split("{%s}@{%s}" % (keyType.name, valueType.name))[::2]
            if right != head:
                for res in helper(right):
                    yield res

        (smallest, root) = d.split("pp", head)
        with Children(d, size, maxNumChild=1000):
            for (pair, i) in zip(helper(root), d.childRange()):
                d.putPairItem(i, pair)
Example #9
0
def qdump__std__list(d, value):
    if d.isQnxTarget() or d.isMsvcTarget():
        qdump__std__list__QNX(d, value)
        return

    if value.type.size() == 3 * d.ptrSize():
        # C++11 only.
        (dummy1, dummy2, size) = value.split("ppp")
        d.putItemCount(size)
    else:
        # Need to count manually.
        p = d.extractPointer(value)
        head = value.address()
        size = 0
        while head != p and size < 1001:
            size += 1
            p = d.extractPointer(p)
        d.putItemCount(size, 1000)

    if d.isExpanded():
        p = d.extractPointer(value)
        innerType = value.type[0]
        with Children(d, size, maxNumChild=1000, childType=innerType):
            for i in d.childRange():
                d.putSubItem(i, d.createValue(p + 2 * d.ptrSize(), innerType))
                p = d.extractPointer(p)
Example #10
0
def qdump__std__deque__QNX(d, value):
    innerType = value.type[0]
    innerSize = innerType.size()
    if innerSize <= 1:
        bufsize = 16
    elif innerSize <= 2:
        bufsize = 8
    elif innerSize <= 4:
        bufsize = 4
    elif innerSize <= 8:
        bufsize = 2
    else:
        bufsize = 1

    try:
        val = value['_Mypair']['_Myval2']
    except:
        val = value

    myoff = val['_Myoff'].integer()
    mysize = val['_Mysize'].integer()
    mapsize = val['_Mapsize'].integer()

    d.check(0 <= mapsize and mapsize <= 1000 * 1000 * 1000)
    d.putItemCount(mysize)
    if d.isExpanded():
        with Children(d, mysize, maxNumChild=2000, childType=innerType):
            map = val['_Map']
            for i in d.childRange():
                block = myoff / bufsize
                offset = myoff - (block * bufsize)
                if mapsize <= block:
                    block -= mapsize
                d.putSubItem(i, map[block][offset])
                myoff += 1
Example #11
0
def qdump__std__deque__MSVC(d, value):
    innerType = value.type[0]
    innerSize = innerType.size()
    if innerSize <= 1:
        bufsize = 16
    elif innerSize <= 2:
        bufsize = 8
    elif innerSize <= 4:
        bufsize = 4
    elif innerSize <= 8:
        bufsize = 2
    else:
        bufsize = 1

    (proxy, map, mapsize, myoff, mysize) = value.split("ppppp")

    d.check(0 <= mapsize and mapsize <= 1000 * 1000 * 1000)
    d.putItemCount(mysize)
    if d.isExpanded():
        with Children(d, mysize, maxNumChild=2000, childType=innerType):
            for i in d.childRange():
                if myoff >= bufsize * mapsize:
                    myoff = 0
                buf = map + ((myoff // bufsize) * d.ptrSize())
                address = d.extractPointer(buf) + (
                    (myoff % bufsize) * innerSize)
                d.putSubItem(i, d.createValue(address, innerType))
                myoff += 1
Example #12
0
def qdumpHelper__std__deque__libstdcxx(d, value):
    innerType = value.type[0]
    innerSize = innerType.size()
    bufsize = 1
    if innerSize < 512:
        bufsize = 512 // innerSize

    (mapptr, mapsize, startCur, startFirst, startLast, startNode, finishCur,
     finishFirst, finishLast, finishNode) = value.split("pppppppppp")

    size = bufsize * ((finishNode - startNode) // d.ptrSize() - 1)
    size += (finishCur - finishFirst) // innerSize
    size += (startLast - startCur) // innerSize

    d.check(0 <= size and size <= 1000 * 1000 * 1000)
    d.putItemCount(size)
    if d.isExpanded():
        with Children(d, size, maxNumChild=2000, childType=innerType):
            pcur = startCur
            plast = startLast
            pnode = startNode
            for i in d.childRange():
                d.putSubItem(i, d.createValue(pcur, innerType))
                pcur += innerSize
                if pcur == plast:
                    newnode = pnode + d.ptrSize()
                    pfirst = d.extractPointer(newnode)
                    plast = pfirst + bufsize * d.ptrSize()
                    pcur = pfirst
                    pnode = newnode
Example #13
0
def qdumpHelper__std__vector__QNX(d, value):
    innerType = value.type[0]
    isBool = innerType.name == 'bool'
    if isBool:
        (proxy1, proxy2, start, last, end, size) = value.split("pppppi")
    else:
        (proxy, start, last, end) = value.split("pppp")
        size = (last - start) // innerType.size()

    d.check(0 <= size and size <= 1000 * 1000 * 1000)
    d.check(last <= end)
    if size > 0:
        d.checkPointer(start)
        d.checkPointer(last)
        d.checkPointer(end)

    d.putItemCount(size)
    if d.isExpanded():
        if isBool:
            with Children(d, size, maxNumChild=10000, childType=innerType):
                for i in d.childRange():
                    q = start + int(i / 8)
                    with SubItem(d, i):
                        d.putValue((d.extractPointer(q) >> (i % 8)) & 1)
                        d.putType("bool")
        else:
            d.putPlotData(start, size, innerType)
Example #14
0
def qdump__std____1__set(d, value):
    (proxy, head, size) = value.split("ppp")

    d.check(0 <= size and size <= 100 * 1000 * 1000)
    d.putItemCount(size)

    if d.isExpanded():
        valueType = value.type[0]

        def in_order_traversal(node):
            (left, right, parent, color, pad,
             data) = d.split("pppB@{%s}" % (valueType.name), node)

            if left:
                for res in in_order_traversal(left):
                    yield res

            yield data

            if right:
                for res in in_order_traversal(right):
                    yield res

        with Children(d, size, maxNumChild=1000):
            for (i, data) in zip(d.childRange(), in_order_traversal(head)):
                d.putSubItem(i, data)
Example #15
0
def qdump__QtcDumperTest_PointerArray(d, value):
    foos = value["foos"]
    d.putItemCount(10)
    if d.isExpanded():
        with Children(d, 10):
            for i in d.childRange():
                d.putSubItem(i, foos[i])
Example #16
0
def qdump__std__set(d, value):
    if d.isQnxTarget() or d.isMsvcTarget():
        qdump__std__set__QNX(d, value)
        return

    impl = value["_M_t"]["_M_impl"]
    size = impl["_M_node_count"].integer()
    d.check(0 <= size and size <= 100 * 1000 * 1000)
    d.putItemCount(size)
    if d.isExpanded():
        valueType = value.type[0]
        node = impl["_M_header"]["_M_left"]
        nodeSize = node.dereference().type.size()
        typeCode = "@{%s}" % valueType.name
        with Children(d, size, maxNumChild=1000, childType=valueType):
            for i in d.childRange():
                (pad, val) = d.split(typeCode, node.pointer() + nodeSize)
                d.putSubItem(i, val)
                if node["_M_right"].pointer() == 0:
                    parent = node["_M_parent"]
                    while node.pointer() == parent["_M_right"].pointer():
                        node = parent
                        parent = parent["_M_parent"]
                    if node["_M_right"] != parent:
                        node = parent
                else:
                    node = node["_M_right"]
                    while node["_M_left"].pointer() != 0:
                        node = node["_M_left"]
Example #17
0
def qdump____m512i(d, value):
    data = d.hexencode(value.data(64))
    d.putValue(':'.join('%04x' % int(data[i:i+4], 16) for i in range(0, 64, 4))
               + ', ' + ':'.join('%04x' % int(data[i:i+4], 16) for i in range(64, 128, 4)))
    if d.isExpanded():
        with Children(d):
            d.putArrayItem('uint32x16', value.address(), 16, 'unsigned int')
            d.putArrayItem('uint64x8', value.address(), 8, 'unsigned long long')
Example #18
0
 def qdump__tree(d, value):
     count = value['count']
     entries = value['entries']
     base = value['base'].pointer()
     d.putItemCount(count)
     if d.isExpanded():
         with Children(d):
             with SubItem(d, 'tree'):
                 d.putEmptyValue()
                 d.putNoType()
                 if d.isExpanded():
                     with Children(d):
                         for i in range(count):
                             d.putSubItem(Item(entries[i], iname))
             with SubItem(d, 'data'):
                 d.putEmptyValue()
                 d.putNoType()
                 if d.isExpanded():
                     with Children(d):
                         for i in range(count):
                             with SubItem(d, i):
                                 entry = entries[i]
                                 mpitype = str(entry['type'])
                                 d.putType(mpitype)
                                 length = int(entry['blocklength'])
                                 offset = int(entry['offset'])
                                 d.putValue('%s items at %s' %
                                            (length, offset))
                                 if mpitype == 'MPI_INT':
                                     innerType = 'int'
                                 elif mpitype == 'MPI_CHAR':
                                     innerType = 'char'
                                 elif mpitype == 'MPI_DOUBLE':
                                     innerType = 'double'
                                 else:
                                     length = 0
                                 d.putNumChild(length)
                                 if d.isExpanded():
                                     with Children(d):
                                         t = d.lookupType(
                                             innerType).pointer()
                                         p = (base + offset).cast(t)
                                         for j in range(length):
                                             d.putSubItem(
                                                 j, p.dereference())
Example #19
0
def qdump__std__complex(d, value):
    innerType = value.type[0]
    (real, imag) = value.split('{%s}{%s}' % (innerType.name, innerType.name))
    d.putValue("(%s, %s)" % (real.display(), imag.display()))
    d.putExpandable()
    if d.isExpanded():
        with Children(d, 2, childType=innerType):
            d.putSubItem("real", real)
            d.putSubItem("imag", imag)
Example #20
0
def qdump__System__Drawing__Size(d, value):
    w, h = value.split('ii')
    d.putValue('Width = %d Height = %d' % (w, h))
    d.putExpandable()
    if d.isExpanded():
        with Children(d):
            d.putBoolItem('IsEmpty', w == 0 and h == 0)
            d.putIntItem('Width', w)
            d.putIntItem('Heigth', h)
Example #21
0
def qdump__System__Drawing__PointF(d, value):
    x, y = value.split('ff')
    d.putValue('X = %g Y = %g' % (x, y))
    d.putExpandable()
    if d.isExpanded():
        with Children(d):
            d.putBoolItem('IsEmpty', x == 0 and y == 0)
            putFloatItem(d, 'X', x)
            putFloatItem(d, 'Y', y)
Example #22
0
def qdump__System__Drawing__Point(d, value):
    x, y = value.split('ii')
    d.putValue('X = %d Y = %d' % (x, y))
    d.putExpandable()
    if d.isExpanded():
        with Children(d):
            d.putBoolItem('IsEmpty', x == 0 and y == 0)
            d.putIntItem('X', x)
            d.putIntItem('Y', y)
Example #23
0
def qdump__QtcDumperTest_List(d, value):
    innerType = value.type[0]
    d.putExpandable()
    p = value['root']
    if d.isExpanded():
        with Children(d):
            d.putSubItem("[p]", p)
            d.putSubItem("[root]", value["root"].cast(innerType))
            d.putFields(value)
Example #24
0
def qdump__System__Drawing__SizeF(d, value):
    w, h = value.split('ff')
    d.putValue('Width = %g Height = %g' % (w, h))
    d.putExpandable()
    if d.isExpanded():
        with Children(d):
            d.putBoolItem('IsEmpty', w == 0 and h == 0)
            putFloatItem(d, 'Width', w)
            putFloatItem(d, 'Heigth', h)
Example #25
0
def qdump__std__pair(d, value):
    typeCode = '{%s}@{%s}' % (value.type[0].name, value.type[1].name)
    first, pad, second = value.split(typeCode)
    with Children(d):
        key = d.putSubItem('first', first)
        value = d.putSubItem('second', second)
    key = key.value if key.encoding is None else "..."
    value = value.value if value.encoding is None else "..."
    d.putValue('(%s, %s)' % (key, value))
Example #26
0
def qdump____m256i(d, value):
    data = d.hexencode(value.data(32))
    d.putValue(':'.join('%04x' % int(data[i:i+4], 16) for i in range(0, 64, 4)))
    if d.isExpanded():
        with Children(d):
            addr = value.address()
            d.putArrayItem('uint8x32', addr, 32, 'unsigned char')
            d.putArrayItem('uint16x16', addr, 16, 'unsigned short')
            d.putArrayItem('uint32x8', addr, 8, 'unsigned int')
            d.putArrayItem('uint64x4', addr, 4, 'unsigned long long')
Example #27
0
def qdumpHelper__std__vector__bool(d, start, size, inner_type):
    d.check(0 <= size and size <= 1000 * 1000 * 1000)
    d.putItemCount(size)
    if d.isExpanded():
        with Children(d, size, maxNumChild=10000, childType=inner_type):
            for i in d.childRange():
                q = start + int(i / 8)
                with SubItem(d, i):
                    d.putValue((int(d.extractPointer(q)) >> (i % 8)) & 1)
                    d.putType("bool")
Example #28
0
def qdump__std__pair(d, value):
    typeCode = '{%s}@{%s}' % (value.type[0].name, value.type[1].name)
    first, pad, second = value.split(typeCode)
    with Children(d):
        key = d.putSubItem('first', first)
        value = d.putSubItem('second', second)
    d.putField('key', key.value)
    if key.encoding is not None:
        d.putField('keyencoded', key.encoding)
    d.putValue(value.value, value.encoding)
Example #29
0
def qdump__std__variant(d, value):
    which = int(value["_M_index"])
    type = d.templateArgument(value.type, which)
    d.putValue("<%s:%s>" % (which, type.name))

    d.putNumChild(1)
    if d.isExpanded():
        storage = value["_M_u"]["_M_first"]["_M_storage"]
        with Children(d, 1):
            d.putSubItem("value", storage.cast(type))
Example #30
0
def qdump__std__list__QNX(d, value):
    (proxy, head, size) = value.split("ppp")
    d.putItemCount(size, 1000)

    if d.isExpanded():
        p = d.extractPointer(head)
        innerType = value.type[0]
        with Children(d, size, maxNumChild=1000, childType=innerType):
            for i in d.childRange():
                d.putSubItem(i, d.createValue(p + 2 * d.ptrSize(), innerType))
                p = d.extractPointer(p)