def symbolize(frame): instr = frame['instruction_addr'] img = self.images.find_image(instr) if img is None: return [frame] dsym_path = self.image_paths.get(parse_addr(img['image_addr'])) if dsym_path is None: return [frame] cpu_name = get_cpu_name(img['cpu_type'], img['cpu_subtype']) if meta is not None: instr = find_best_instruction(instr, cpu_name, meta) rv = self.driver.symbolize(dsym_path, img['image_vmaddr'], img['image_addr'], instr, cpu_name, symbolize_inlined=True) if not rv: return [frame] result = [] for rv in rv: frame = dict(frame) frame['symbol_name'] = demangle_symbol(rv['symbol']) frame['filename'] = rv['abs_path'] frame['line'] = rv['lineno'] frame['column'] = rv['colno'] result.append(frame) return result
def _symbolize_app_frame(self, instruction_addr, img, sdk_info=None): dsym_path = self.dsym_paths.get(img['uuid']) if dsym_path is None: if self._is_optional_dsym(img, sdk_info=sdk_info): type = EventError.NATIVE_MISSING_OPTIONALLY_BUNDLED_DSYM else: type = EventError.NATIVE_MISSING_DSYM raise SymbolicationFailed(type=type, image=img) # cputype of image might be a variation of self.cpu_name # e.g.: armv7 instead of armv7f # (example error fat file does not contain armv7f) cpu_name = get_cpu_name(img['cpu_type'], img['cpu_subtype']) try: rv = self._symbolizer.symbolize( dsym_path, img['image_vmaddr'], img['image_addr'], instruction_addr, cpu_name, symbolize_inlined=True) except SymbolicationError as e: raise SymbolicationFailed( type=EventError.NATIVE_BAD_DSYM, message=six.text_type(e), image=img ) if not rv: raise SymbolicationFailed( type=EventError.NATIVE_MISSING_SYMBOL, image=img ) return [self._process_frame(nf, img) for nf in reversed(rv)]
def __init__(self, message=None, type=None, image=None): Exception.__init__(self) self.message = six.text_type(message) self.type = type if image is not None: self.image_uuid = image['uuid'].lower() self.image_path = image['name'] self.image_name = image['name'].rsplit('/', 1)[-1] self.image_arch = get_cpu_name(image['cpu_type'], image['cpu_subtype']) else: self.image_uuid = None self.image_name = None self.image_path = None self.image_arch = None
def cpu_name_from_data(data): """Returns the CPU name from the given data if it exists.""" device = DeviceContextType.primary_value_for_data(data) if device: arch = device.get('arch') if isinstance(arch, six.string_types): return arch # TODO: kill this here. we want to not support that going forward unique_cpu_name = None images = (data.get('debug_meta') or {}).get('images') or [] for img in images: cpu_name = get_cpu_name(img['cpu_type'], img['cpu_subtype']) if unique_cpu_name is None: unique_cpu_name = cpu_name elif unique_cpu_name != cpu_name: unique_cpu_name = None break return unique_cpu_name
def cpu_name_from_data(data): """Returns the CPU name from the given data if it exists.""" device = DeviceContextType.primary_value_for_data(data) if device: arch = device.get('arch') if isinstance(arch, six.string_types): return arch # TODO: kill this here. we want to not support that going forward unique_cpu_name = None images = (data.get('debug_meta') or {}).get('images') or [] for img in images: cpu_name = get_cpu_name(img['cpu_type'], img['cpu_subtype']) if unique_cpu_name is None: unique_cpu_name = cpu_name elif unique_cpu_name != cpu_name: unique_cpu_name = None break return unique_cpu_name
def test_cpu_names(): assert get_cpu_name(12, 9) == 'armv7' tup = get_cpu_type_tuple('arm64') assert get_cpu_name(*tup) == 'arm64'