summaryrefslogtreecommitdiff
path: root/src/strings/astring.py
blob: ec1dafef0733c79d0157ee78ecc81fd79d3d8b08 (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 = '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)