Example #1
0
    def summary(self):
        group = get_header_ptr(self.value['headerAndGroup_'],
                               self.otc.ObjectGroup_ptr_t)
        classp = get_header_ptr(group['headerAndClasp_'],
                                self.otc.JSClass_ptr_t)
        non_native = classp['flags'] & self.otc.class_NON_NATIVE

        # Use GDB to format the class name, but then strip off the address
        # and the quotes.
        class_name = str(classp['name'])
        m = gdb_string_regexp.match(class_name)
        if m:
            class_name = m.group(1)

        if non_native:
            return '[object {}]'.format(class_name)
        else:
            native = self.value.cast(self.otc.NativeObject_ptr_t)
            shape = deref(native['shape_'])
            baseshape = get_header_ptr(shape['headerAndBase_'],
                                       self.otc.BaseShape_ptr_t)
            flags = baseshape['flags']
            is_delegate = bool(flags & self.otc.flag_DELEGATE)
            name = None
            if class_name == 'Function':
                function = self.value
                concrete_type = function.type.strip_typedefs()
                if concrete_type.code == gdb.TYPE_CODE_REF:
                    function = function.address
                function = function.cast(self.otc.func_ptr_type)
                atom = deref(function['atom_'])
                name = str(atom) if atom else '<unnamed>'
            return '[object {}{}]{}'.format(class_name,
                                            ' ' + name if name else '',
                                            ' delegate' if is_delegate else '')
Example #2
0
    def summary(self):
        group = get_header_ptr(self.value, self.otc.ObjectGroup_ptr_t)
        classp = get_header_ptr(group, self.otc.JSClass_ptr_t)
        non_native = classp["flags"] & self.otc.class_NON_NATIVE

        # Use GDB to format the class name, but then strip off the address
        # and the quotes.
        class_name = str(classp["name"])
        m = gdb_string_regexp.match(class_name)
        if m:
            class_name = m.group(1)

        if non_native:
            return "[object {}]".format(class_name)
        else:
            native = self.value.cast(self.otc.NativeObject_ptr_t)
            shape = deref(native["shape_"])
            baseshape = get_header_ptr(shape, self.otc.BaseShape_ptr_t)
            flags = baseshape["flags"]
            is_delegate = bool(flags & self.otc.flag_DELEGATE)
            name = None
            if class_name == "Function":
                function = self.value
                concrete_type = function.type.strip_typedefs()
                if concrete_type.code == gdb.TYPE_CODE_REF:
                    function = function.address
                function = function.cast(self.otc.func_ptr_type)
                atom = deref(function["atom_"])
                name = str(atom) if atom else "<unnamed>"
            return "[object {}{}]{}".format(
                class_name,
                " " + name if name else "",
                " delegate" if is_delegate else "",
            )
Example #3
0
 def summary(self):
     group = deref(self.value['group_'])
     classp = group['clasp_']
     class_name = classp['name'].string()
     non_native = classp['flags'] & self.otc.class_NON_NATIVE
     if non_native:
         return '[object {}]'.format(class_name)
     else:
         native = self.value.cast(self.otc.NativeObject_ptr_t)
         shape = deref(native['shape_'])
         baseshape = deref(shape['base_'])
         flags = baseshape['flags']
         is_delegate = bool(flags & self.otc.flag_DELEGATE)
         name = None
         if class_name == 'Function':
             function = self.value
             concrete_type = function.type.strip_typedefs()
             if concrete_type.code == gdb.TYPE_CODE_REF:
                 function = function.address
             function = function.cast(self.otc.func_ptr_type)
             atom = deref(function['atom_'])
             name = str(atom) if atom else '<unnamed>'
         return '[object {}{}]{}'.format(class_name,
                                         ' ' + name if name else '',
                                         ' delegate' if is_delegate else '')
Example #4
0
    def summary(self):
        group = deref(self.value['group_'])
        classp = group['clasp_']
        non_native = classp['flags'] & self.otc.class_NON_NATIVE

        # Use GDB to format the class name, but then strip off the address
        # and the quotes.
        class_name = str(classp['name'])
        m = gdb_string_regexp.match(class_name)
        if m:
            class_name = m.group(1)

        if non_native:
            return '[object {}]'.format(class_name)
        else:
            native = self.value.cast(self.otc.NativeObject_ptr_t)
            shape = native['shapeOrExpando_'].cast(self.otc.Shape_ptr_t)
            baseshape = deref(shape['base_'])
            flags = baseshape['flags']
            is_delegate = bool(flags & self.otc.flag_DELEGATE)
            name = None
            if class_name == 'Function':
                function = self.value
                concrete_type = function.type.strip_typedefs()
                if concrete_type.code == gdb.TYPE_CODE_REF:
                    function = function.address
                function = function.cast(self.otc.func_ptr_type)
                atom = deref(function['atom_'])
                name = str(atom) if atom else '<unnamed>'
            return '[object {}{}]{}'.format(class_name,
                                            ' ' + name if name else '',
                                            ' delegate' if is_delegate else '')
Example #5
0
 def summary(self):
     shape = deref(self.value['shape_'])
     baseshape = deref(shape['base_'])
     class_name = baseshape['clasp']['name'].string()
     flags = baseshape['flags']
     is_delegate = bool(flags & self.otc.flag_DELEGATE)
     name = None
     if class_name == 'Function':
         function = self.value.cast(self.otc.func_ptr_type)
         atom = deref(function['atom_'])
         name = str(atom) if atom else '<unnamed>'
     return '[object %s%s]%s' % (class_name,
                                 ' ' + name if name else '',
                                 ' delegate' if is_delegate else '')
Example #6
0
    def summary(self):
        shape = get_header_ptr(self.value, self.otc.Shape_ptr_t)
        baseshape = get_header_ptr(shape, self.otc.BaseShape_ptr_t)
        classp = get_header_ptr(baseshape, self.otc.JSClass_ptr_t)
        non_native = classp["flags"] & self.otc.class_NON_NATIVE

        # Use GDB to format the class name, but then strip off the address
        # and the quotes.
        class_name = str(classp["name"])
        m = gdb_string_regexp.match(class_name)
        if m:
            class_name = m.group(1)

        if non_native:
            return "[object {}]".format(class_name)
        else:
            flags = shape["objectFlags_"]["flags_"]
            used_as_prototype = bool(flags
                                     & self.otc.objectflag_IsUsedAsPrototype)
            name = None
            if class_name == "Function":
                function = self.value
                concrete_type = function.type.strip_typedefs()
                if concrete_type.code == gdb.TYPE_CODE_REF:
                    function = function.address
                function = function.cast(self.otc.func_ptr_type)
                atom = deref(function["atom_"])
                name = str(atom) if atom else "<unnamed>"
            return "[object {}{}]{}".format(
                class_name,
                " " + name if name else "",
                " used_as_prototype" if used_as_prototype else "",
            )
Example #7
0
 def summary(self):
     shape = deref(self.value['shape_'])
     baseshape = deref(shape['base_'])
     class_name = baseshape['clasp']['name'].string()
     flags = baseshape['flags']
     is_delegate = bool(flags & self.otc.flag_DELEGATE)
     name = None
     if class_name == 'Function':
         if self.value.type.code == gdb.TYPE_CODE_PTR:
             function = self.value.cast(self.otc.func_ptr_type)
         elif self.value.type.code == gdb.TYPE_CODE_REF:
             function = self.value.address.cast(self.otc.func_ptr_type)
         atom = deref(function['atom_'])
         name = str(atom) if atom else '<unnamed>'
     return '[object %s%s]%s' % (class_name, ' ' + name if name else '',
                                 ' delegate' if is_delegate else '')
Example #8
0
 def summary(self):
     shape = deref(self.value['shape_'])
     baseshape = deref(shape['base_'])
     group = deref(self.value['group_'])
     class_name = group['clasp_']['name'].string()
     flags = baseshape['flags']
     is_delegate = bool(flags & self.otc.flag_DELEGATE)
     name = None
     if class_name == 'Function':
         function = self.value
         concrete_type = function.type.strip_typedefs()
         if concrete_type.code == gdb.TYPE_CODE_REF:
             function = function.address
         function = function.cast(self.otc.func_ptr_type)
         atom = deref(function['atom_'])
         name = str(atom) if atom else '<unnamed>'
     return '[object %s%s]%s' % (class_name,
                                 ' ' + name if name else '',
                                 ' delegate' if is_delegate else '')