Esempio n. 1
0
    def resolve_missing_vmaddrs(self):
        """When called this changes the vmaddr on all contained images from
        the information in the dsym files (if there is no vmaddr already).
        This changes both the image data from the original event submission
        in the debug meta as well as the image data that the symbolizer uses.
        """
        changed_any = False

        loaded_images = self.symsynd_symbolizer.images
        for image_addr, image in six.iteritems(self.image_lookup.images):
            if image.get('image_vmaddr') or not image.get('image_addr'):
                continue
            image_info = loaded_images.get(image_addr)
            if not image_info:
                continue
            dsym_path = normalize_dsym_path(image_info['dsym_path'])
            # Here we use the CPU name from the image as it might be
            # slightly different (armv7 vs armv7f for instance)
            cpu_name = image_info['cpu_name']
            image_vmaddr = get_macho_vmaddr(dsym_path, cpu_name)
            if image_vmaddr:
                image['image_vmaddr'] = image_vmaddr
                image_info['image_vmaddr'] = image_vmaddr
                changed_any = True

        return changed_any
Esempio n. 2
0
    def resolve_missing_vmaddrs(self):
        """When called this changes the vmaddr on all contained images from
        the information in the dsym files (if there is no vmaddr already).
        This changes both the image data from the original event submission
        in the debug meta as well as the image data that the symbolizer uses.
        """
        changed_any = False

        loaded_images = self.symsynd_symbolizer.images
        for image_addr, image in six.iteritems(self.image_lookup.images):
            if image.get('image_vmaddr') or not image.get('image_addr'):
                continue
            image_info = loaded_images.get(image_addr)
            if not image_info:
                continue
            dsym_path = normalize_dsym_path(image_info['dsym_path'])
            # Here we use the CPU name from the image as it might be
            # slightly different (armv7 vs armv7f for instance)
            cpu_name = image_info['cpu_name']
            image_vmaddr = get_macho_vmaddr(dsym_path, cpu_name)
            if image_vmaddr:
                image['image_vmaddr'] = image_vmaddr
                image_info['image_vmaddr'] = image_vmaddr
                changed_any = True

        return changed_any
Esempio n. 3
0
    def symbolize(self,
                  dsym_path,
                  image_vmaddr,
                  image_addr,
                  instruction_addr,
                  cpu_name,
                  uuid=None,
                  silent=True,
                  demangle=True):
        if self._closed:
            raise RuntimeError('Symbolizer is closed')
        if not is_valid_cpu_name(cpu_name):
            raise ValueError('"%s" is not a valid cpu name' % cpu_name)
        dsym_path = normalize_dsym_path(dsym_path)

        image_vmaddr = parse_addr(image_vmaddr)
        if not image_vmaddr:
            image_vmaddr = get_macho_vmaddr(dsym_path, cpu_name) or 0

        image_addr = parse_addr(image_addr)
        instruction_addr = parse_addr(instruction_addr)

        addr = image_vmaddr + instruction_addr - image_addr

        try:
            with self._lock:
                with timedsection('symbolize'):
                    sym = self.symbolizer.symbolize(dsym_path, addr, cpu_name)
            if sym[0] is None:
                raise SymbolicationError('Symbolizer could not find symbol')
        except SymbolicationError:
            if not silent:
                raise
            sym = (None, None, 0, 0)

        symbol_name = sym[0]
        if demangle:
            symbol_name = demangle_symbol(symbol_name)

        return {
            'symbol_name': symbol_name,
            'filename': sym[1],
            'line': sym[2],
            'column': sym[3],
            'uuid': uuid,
        }
Esempio n. 4
0
    def symbolize(self,
                  dsym_path,
                  image_vmaddr,
                  image_addr,
                  instruction_addr,
                  cpu_name,
                  uuid=None,
                  silent=True):
        if self._closed:
            raise RuntimeError('Symbolizer is closed')
        if not is_valid_cpu_name(cpu_name):
            raise ValueError('"%s" is not a valid cpu name' % cpu_name)
        dsym_path = normalize_dsym_path(dsym_path)

        image_vmaddr = parse_addr(image_vmaddr)
        if not image_vmaddr:
            image_vmaddr = get_macho_vmaddr(dsym_path, cpu_name) or 0

        image_addr = parse_addr(image_addr)
        instruction_addr = parse_addr(instruction_addr)

        addr = image_vmaddr + instruction_addr - image_addr

        try:
            with self._lock:
                with timedsection('symbolize'):
                    sym = self.symbolizer.symbolize(dsym_path, addr, cpu_name)
            if sym[0] is None:
                raise SymbolicationError('Symbolizer could not find symbol')
        except SymbolicationError:
            if not silent:
                raise
            sym = (None, None, 0, 0)

        return {
            'symbol_name': demangle_symbol(sym[0]),
            'filename': sym[1],
            'line': sym[2],
            'column': sym[3],
            'uuid': uuid,
        }