Ejemplo n.º 1
0
def get_size_attr(die):
    for attrname, attrval in iteritems(die.attributes):
        if attrname == 'DW_AT_byte_size':
            return attrval.value
        if attrname == 'DW_AT_type':
            subtype = die_list[attrval.value]
    return get_size_attr(subtype)
Ejemplo n.º 2
0
def get_size_attr(die):
    for attrname, attrval in iteritems(die.attributes):
        if attrname == 'DW_AT_byte_size':
            return attrval.value
        if attrname == 'DW_AT_type':
            subtype = die_list[attrval.value]
    return get_size_attr(subtype)
Ejemplo n.º 3
0
def get_members(die):
    global die_list
    members = []
    for child in die.iter_children():
        if child.tag == 'DW_TAG_member':
            members.append(child)

    if len(members) == 0:
        for attrname, attrval in iteritems(die.attributes):
            if attrval.name == 'DW_AT_type':
                return get_members(die_list[attrval.value])
        return []
    else:
        return members
Ejemplo n.º 4
0
def get_members(die):
    global die_list
    members = []
    for child in die.iter_children():
        if child.tag == 'DW_TAG_member':
            members.append(child)

    if len(members) == 0:
        for attrname, attrval in iteritems(die.attributes):
            if attrval.name == 'DW_AT_type':
                return get_members(die_list[attrval.value])
        return []
    else:
        return members
Ejemplo n.º 5
0
 def assertLineState(self, state, **kwargs):
     """ Assert that the state attributes specified in kwargs have the given
         values (the rest are default).
     """
     for k, v in iteritems(kwargs):
         self.assertEqual(getattr(state, k), v)
Ejemplo n.º 6
0
 def test_iterdict(self):
     d = {1: 'foo', 2: 'bar'}
     self.assertEqual(list(sorted(iterkeys(d))), [1, 2])
     self.assertEqual(list(sorted(itervalues(d))), ['bar', 'foo'])
     self.assertEqual(list(sorted(iteritems(d))), [(1, 'foo'), (2, 'bar')])