summaryrefslogtreecommitdiff
path: root/src/strings/astring.py
blob: 063e721e1986c74d71cbe512335f305b4eb7d085 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class AString(object):
    ''' print an AString
    '''
    __slots__ = ('_value')
    name = 'tmwa::strings::AString'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        b = self._value['data']
        s = self._value['special']
        if s == 255:
            b = b.cast(gdb.lookup_type('strings::RString').pointer())
            yield 'allocated', b.dereference()
        else:
            b = b.cast(b.type.target().pointer())
            n = 255
            d = n - s
            yield 'contained', b.lazy_string(length=d)