示例#1
0
    def __init__(self, val):
        self.val = val

        # Get the type name.
        self.type = strip_all_type(self.val)

        #Dereference pointers
        self.lval = dereference_if_possible(self.val)
    def __init__(self, val):
        self.val = val

        # Get the type name.
        self.type = strip_all_type(self.val)

        #Dereference pointers
        self.lval = dereference_if_possible(self.val)
示例#3
0
    def to_string(self):
        # Get the type name.
        type = strip_all_type(self.val)

        #Dereference pointers
        lval = dereference_if_possible(self.val)

        #Return the underlying base class
        baseclass = type.fields()[0].type

        shared = lval.cast(baseclass)['val_']
        if shared == 0:
            return 'NULL'

        #Print the untranslated string or an error
        try:
            ret = shared.dereference()['val']['value_']['iter_']['first']
        except RuntimeError, e:
            return "wesnoth_gdb error invalid tstring"
    def to_string(self):
        # Get the type name.
        type = strip_all_type(self.val)

        #Dereference pointers
        lval = dereference_if_possible(self.val)

        #Return the underlying base class
        baseclass = type.fields()[0].type

        shared = lval.cast(baseclass)['val_']
        if shared == 0:
            return 'NULL'

        #Print the untranslated string or an error
        try:
            ret = shared.dereference()['val']['value_']['iter_']['first']
        except RuntimeError, e:
            return "wesnoth_gdb error invalid tstring"
示例#5
0
    def children(self):
        # Get the type.
        self.type = strip_all_type(self.val)

        try:
            #Dereference pointers
            lval = dereference_if_possible(self.val)

            attr = lval
            attr_type = attr['type_']

            class Atype:
                EMPTY = 0
                BOOL = 1
                INT = 2
                DOUBLE = 3
                TSTRING = 4
                TOKEN = 5

            if attr_type == Atype.EMPTY:
                yield "EMPTY", ""
            elif attr_type == Atype.BOOL:
                yield 'bool', 'true' if attr['bool_value_'] else 'false'
            elif attr_type == Atype.INT:
                yield 'int', 'int ' + ('%s' % attr['int_value_'])
            elif attr_type == Atype.DOUBLE:
                yield 'double', 'double ' + ('%s' % attr['double_value_'])
            elif attr_type == Atype.TOKEN:
                yield 'token', 'token ' + ('%s' % attr['token_value_'])
            elif attr_type == Atype.TSTRING:
                yield 't_string', 't_string ' + ('%s' %
                                                 attr['t_string_value_'])
            else:
                yield 'unknown', "unknown type code = " + ('%d' % attr_type)

        except RuntimeError, e:
            yield 'error', "wesnoth_gdb error invalid %s" % self.val.type
    def children(self):
        # Get the type.
        self.type = strip_all_type(self.val)

        try:
            #Dereference pointers
            lval = dereference_if_possible(self.val)

            attr = lval
            attr_type = attr['type_']

            class Atype:
                EMPTY = 0
                BOOL = 1
                INT = 2
                DOUBLE = 3
                TSTRING = 4
                TOKEN = 5

            if attr_type == Atype.EMPTY:
                yield "EMPTY", ""
            elif attr_type == Atype.BOOL:
                yield 'bool', 'true' if attr['bool_value_'] else 'false'
            elif attr_type == Atype.INT:
                yield 'int', 'int ' + ('%s' % attr['int_value_'])
            elif attr_type == Atype.DOUBLE:
                yield 'double', 'double ' + ('%s' % attr['double_value_'])
            elif attr_type == Atype.TOKEN:
                yield 'token', 'token ' + ('%s' % attr['token_value_'])
            elif attr_type == Atype.TSTRING:
                yield 't_string', 't_string ' + ('%s' % attr['t_string_value_'])
            else:
                yield 'unknown', "unknown type code = " + ('%d' % attr_type)

        except RuntimeError, e:
            yield 'error', "wesnoth_gdb error invalid %s" % self.val.type
    def children(self):
        # Get the type.
        self.type = strip_all_type(self.val)

        try:
            # Dereference pointers
            lval = dereference_if_possible(self.val)

            attr = lval
            attr_type = attr["type_"]

            class Atype:
                EMPTY = 0
                BOOL = 1
                INT = 2
                DOUBLE = 3
                TSTRING = 4
                TOKEN = 5

            if attr_type == Atype.EMPTY:
                yield "EMPTY", ""
            elif attr_type == Atype.BOOL:
                yield "bool", "true" if attr["bool_value_"] else "false"
            elif attr_type == Atype.INT:
                yield "int", "int " + ("%s" % attr["int_value_"])
            elif attr_type == Atype.DOUBLE:
                yield "double", "double " + ("%s" % attr["double_value_"])
            elif attr_type == Atype.TOKEN:
                yield "token", "token " + ("%s" % attr["token_value_"])
            elif attr_type == Atype.TSTRING:
                yield "t_string", "t_string " + ("%s" % attr["t_string_value_"])
            else:
                yield "unknown", "unknown type code = " + ("%d" % attr_type)

        except RuntimeError, e:
            yield "error", "wesnoth_gdb error invalid %s" % self.val.type