コード例 #1
0
ファイル: applecrashreport.py プロジェクト: zsirfs/sentry
 def _get_slide_value(self, image_addr):
     if self.debug_images:
         for debug_image in self.debug_images:
             if parse_addr(
                     debug_image['image_addr']) == parse_addr(image_addr):
                 return parse_addr(debug_image['image_vmaddr'])
     return 0
コード例 #2
0
 def _convert_frame_to_apple_string(self, frame, next=None, number=0):
     if frame.get('instruction_addr') is None:
         return None
     slide_value = self._get_slide_value(frame.get('image_addr'))
     instruction_addr = slide_value + \
         parse_addr(frame.get('instruction_addr'))
     image_addr = slide_value + parse_addr(frame.get('image_addr'))
     offset = ''
     if frame.get('image_addr') is not None and \
        (not self.symbolicated or (
             frame.get('function') or NATIVE_UNKNOWN_STRING) == NATIVE_UNKNOWN_STRING):
         offset = ' + %s' % (
             instruction_addr - slide_value -
             parse_addr(frame.get('symbol_addr'))
         )
     symbol = hex(image_addr)
     if self.symbolicated:
         file = ''
         if frame.get('filename') and frame.get('lineno'):
             file = ' (%s:%s)' % (
                 posixpath.basename(frame.get('filename')
                                    or NATIVE_UNKNOWN_STRING),
                 frame['lineno']
             )
         symbol = '%s%s' % (frame.get('function')
                            or NATIVE_UNKNOWN_STRING, file)
         if next and parse_addr(frame['instruction_addr']) == \
            parse_addr(next['instruction_addr']):
             symbol = '[inlined] ' + symbol
     return '%s%s%s%s%s' % (
         str(number).ljust(4, ' '),
         (frame.get('package') or NATIVE_UNKNOWN_STRING).rsplit(
             '/', 1)[-1].ljust(32, ' '),
         hex(instruction_addr).ljust(20, ' '), symbol, offset
     )
コード例 #3
0
 def _convert_frame_to_apple_string(self, frame, next=None, number=0):
     if frame.get("instruction_addr") is None:
         return None
     slide_value = self._get_slide_value(frame.get("image_addr"))
     instruction_addr = slide_value + parse_addr(frame.get("instruction_addr"))
     image_addr = slide_value + parse_addr(frame.get("image_addr"))
     offset = ""
     if frame.get("image_addr") is not None and (
         not self.symbolicated
         or (frame.get("function") or NATIVE_UNKNOWN_STRING) == NATIVE_UNKNOWN_STRING
     ):
         offset = " + %s" % (
             instruction_addr - slide_value - parse_addr(frame.get("symbol_addr"))
         )
     symbol = hex(image_addr)
     if self.symbolicated:
         file = ""
         if frame.get("filename") and frame.get("lineno"):
             file = " ({}:{})".format(
                 posixpath.basename(frame.get("filename") or NATIVE_UNKNOWN_STRING),
                 frame["lineno"],
             )
         symbol = "{}{}".format(frame.get("function") or NATIVE_UNKNOWN_STRING, file)
         if next and parse_addr(frame.get("instruction_addr")) == parse_addr(
             next.get("instruction_addr")
         ):
             symbol = "[inlined] " + symbol
     return "{}{}{}{}{}".format(
         str(number).ljust(4, " "),
         image_name(frame.get("package") or NATIVE_UNKNOWN_STRING).ljust(32, " "),
         hex(instruction_addr).ljust(20, " "),
         symbol,
         offset,
     )
コード例 #4
0
def convert_ios_symbolserver_match(instruction_addr, symbolserver_match):
    if not symbolserver_match:
        return []

    symbol = symbolserver_match['symbol']
    if symbol[:1] == '_':
        symbol = symbol[1:]

    # We still use this construct from symbolic for demangling (at least)
    line_info = LineInfo(
        sym_addr=parse_addr(symbolserver_match['addr']),
        instr_addr=parse_addr(instruction_addr),
        line=None,
        lang=None,
        symbol=symbol
    )

    function = line_info.function_name
    package = symbolserver_match['object_name']

    return [{
        'sym_addr': '0x%x' % (line_info.sym_addr,),
        'instruction_addr': '0x%x' % (line_info.instr_addr,),
        'function': function,
        'symbol': symbol if function != symbol else None,
        'filename': trim(line_info.rel_path, 256),
        'abs_path': trim(line_info.abs_path, 256),
        'package': package,
    }]
コード例 #5
0
ファイル: applecrashreport.py プロジェクト: zsirfs/sentry
 def _convert_frame_to_apple_string(self, frame, next=None, number=0):
     if frame.get('instruction_addr') is None:
         return None
     slide_value = self._get_slide_value(frame.get('image_addr'))
     instruction_addr = slide_value + \
         parse_addr(frame.get('instruction_addr'))
     image_addr = slide_value + parse_addr(frame.get('image_addr'))
     offset = ''
     if frame.get('image_addr') is not None and \
        (not self.symbolicated or (
             frame.get('function') or NATIVE_UNKNOWN_STRING) == NATIVE_UNKNOWN_STRING):
         offset = ' + %s' % (instruction_addr - slide_value -
                             parse_addr(frame.get('symbol_addr')))
     symbol = hex(image_addr)
     if self.symbolicated:
         file = ''
         if frame.get('filename') and frame.get('lineno'):
             file = ' (%s:%s)' % (posixpath.basename(
                 frame.get('filename')
                 or NATIVE_UNKNOWN_STRING), frame['lineno'])
         symbol = '%s%s' % (frame.get('function')
                            or NATIVE_UNKNOWN_STRING, file)
         if next and parse_addr(frame['instruction_addr']) == \
            parse_addr(next['instruction_addr']):
             symbol = '[inlined] ' + symbol
     return '%s%s%s%s%s' % (str(number).ljust(
         4, ' '), (frame.get('package') or NATIVE_UNKNOWN_STRING).rsplit(
             '/', 1)[-1].ljust(32, ' '), hex(instruction_addr).ljust(
                 20, ' '), symbol, offset)
コード例 #6
0
 def _get_slide_value(self, image_addr):
     if self.debug_images:
         for debug_image in self.debug_images:
             if parse_addr(debug_image.get("image_addr")) == parse_addr(
                     image_addr):
                 return parse_addr(debug_image.get("image_vmaddr", 0))
     return 0
コード例 #7
0
 def _convert_debug_meta_to_binary_image_row(self, debug_image):
     slide_value = parse_addr(debug_image['image_vmaddr'])
     image_addr = parse_addr(debug_image['image_addr']) + slide_value
     return '%s - %s %s %s  <%s> %s' % (
         hex(image_addr), hex(image_addr + debug_image['image_size'] - 1),
         image_name(debug_image['name']), self.context['device']['arch'],
         debug_image['uuid'].replace('-', '').lower(), debug_image['name'])
コード例 #8
0
ファイル: applecrashreport.py プロジェクト: hosmelq/sentry
 def _convert_debug_meta_to_binary_image_row(self, debug_image):
     slide_value = parse_addr(debug_image['image_vmaddr'])
     image_addr = parse_addr(debug_image['image_addr']) + slide_value
     return '%s - %s %s %s  <%s> %s' % (
         hex(image_addr), hex(image_addr + debug_image['image_size'] - 1),
         image_name(debug_image['name']), self.context['device']['arch'],
         debug_image['uuid'].replace('-', '').lower(), debug_image['name']
     )
コード例 #9
0
 def _convert_debug_meta_to_binary_image_row(self, debug_image):
     slide_value = parse_addr(debug_image.get("image_vmaddr", 0))
     image_addr = parse_addr(debug_image["image_addr"]) + slide_value
     return "%s - %s %s %s  <%s> %s" % (
         hex(image_addr),
         hex(image_addr + debug_image["image_size"] - 1),
         image_name(debug_image.get("code_file") or NATIVE_UNKNOWN_STRING),
         get_path(self.context, "device", "arch") or NATIVE_UNKNOWN_STRING,
         debug_image.get("debug_id").replace("-", "").lower(),
         debug_image.get("code_file") or NATIVE_UNKNOWN_STRING,
     )
コード例 #10
0
 def _convert_debug_meta_to_binary_image_row(self, debug_image):
     slide_value = parse_addr(debug_image["image_vmaddr"])
     image_addr = parse_addr(debug_image["image_addr"]) + slide_value
     return "%s - %s %s %s  <%s> %s" % (
         hex(image_addr),
         hex(image_addr + debug_image["image_size"] - 1),
         image_name(debug_image["name"]),
         self.context["device"]["arch"],
         (debug_image.get("id") or debug_image.get("uuid")).replace(
             "-", "").lower(),
         debug_image["name"],
     )
コード例 #11
0
ファイル: plugin.py プロジェクト: nick-seward/sentry
    def find_best_instruction(self, processable_frame):
        """Given a frame, stacktrace info and frame index this returns the
        interpolated instruction address we then use for symbolication later.
        """
        if self.arch is None:
            return parse_addr(processable_frame['instruction_addr'])

        crashing_frame = False
        signal = None
        ip_reg = None

        # We only need to provide meta information for frame zero
        if processable_frame.idx == 0:
            # The signal is useful information for symbolic in some situations
            # to disambiugate the first frame.  If we can get this information
            # from the mechanism we want to pass it onwards.
            signal = self.signal

            registers = processable_frame.stacktrace_info.stacktrace.get(
                'registers')
            if registers:
                ip_reg_name = arch_get_ip_reg_name(self.arch)
                if ip_reg_name:
                    ip_reg = registers.get(ip_reg_name)
            crashing_frame = True

        return find_best_instruction(processable_frame['instruction_addr'],
                                     arch=self.arch,
                                     crashing_frame=crashing_frame,
                                     signal=signal,
                                     ip_reg=ip_reg)
コード例 #12
0
ファイル: plugin.py プロジェクト: yaoqi/sentry
    def find_best_instruction(self, processable_frame):
        """Given a frame, stacktrace info and frame index this returns the
        interpolated instruction address we then use for symbolication later.
        """
        if self.arch is None:
            return parse_addr(processable_frame['instruction_addr'])

        crashing_frame = False
        signal = None
        ip_reg = None

        # We only need to provide meta information for frame zero
        if processable_frame.idx == 0:
            # The signal is useful information for symbolic in some situations
            # to disambiugate the first frame.  If we can get this information
            # from the mechanism we want to pass it onwards.
            signal = self.signal

            registers = processable_frame.stacktrace_info.stacktrace.get('registers')
            if registers:
                ip_reg_name = arch_get_ip_reg_name(self.arch)
                if ip_reg_name:
                    ip_reg = registers.get(ip_reg_name)
            crashing_frame = True

        return find_best_instruction(
            processable_frame['instruction_addr'],
            arch=self.arch,
            crashing_frame=crashing_frame,
            signal=signal,
            ip_reg=ip_reg
        )
コード例 #13
0
ファイル: test_plugin.py プロジェクト: zsirfs/sentry
 def sym_mac_app_frame(self, instruction_addr, img, sdk_info=None):
     object_name = (
         "/Users/haza/Library/Developer/Xcode/Archives/2017-06-19/"
         "CrashProbe 19-06-2017, 08.53.xcarchive/Products/Applications/"
         "CrashProbe.app/Contents/Frameworks/"
         "CrashLib.framework/Versions/A/CrashLib")
     if not (4295098384 <= parse_addr(instruction_addr) < 4295098388):
         return [{
             'filename': 'Foo.swift',
             'abs_path': 'Foo.swift',
             'lineno': 82,
             'colno': 23,
             'package': object_name,
             'function': 'other_main',
             'symbol_addr': '0x1',
             "instruction_addr": '0x1',
         }]
     return [{
         'filename': 'Foo.swift',
         'abs_path': 'Foo.swift',
         'lineno': 42,
         'colno': 23,
         'package': object_name,
         'function': 'real_main',
         'symbol_addr': '0x1000262a0',
         "instruction_addr": '0x100026330',
     }]
コード例 #14
0
ファイル: test_plugin.py プロジェクト: alshopov/sentry
 def sym_app_frame(self, instruction_addr, img, sdk_info=None):
     object_name = (
         "/var/containers/Bundle/Application/"
         "B33C37A8-F933-4B6B-9FFA-152282BFDF13/"
         "SentryTest.app/SentryTest"
     )
     if not (4295098384 <= parse_addr(instruction_addr) < 4295098388):
         return [{
             'filename': 'Foo.swift',
             'abs_path': 'Foo.swift',
             'lineno': 82,
             'colno': 23,
             'package': object_name,
             'function': 'other_main',
             'symbol_addr': '0x1',
             "instruction_addr": '0x1',
         }]
     return [{
         'filename': 'Foo.swift',
         'abs_path': 'Foo.swift',
         'lineno': 42,
         'colno': 23,
         'package': object_name,
         'function': 'real_main',
         'symbol_addr': '0x1000262a0',
         "instruction_addr": '0x100026330',
     }]
コード例 #15
0
ファイル: test_plugin.py プロジェクト: alshopov/sentry
 def sym_mac_app_frame(self, instruction_addr, img, sdk_info=None):
     object_name = (
         "/Users/haza/Library/Developer/Xcode/Archives/2017-06-19/"
         "CrashProbe 19-06-2017, 08.53.xcarchive/Products/Applications/"
         "CrashProbe.app/Contents/Frameworks/"
         "CrashLib.framework/Versions/A/CrashLib"
     )
     if not (4295098384 <= parse_addr(instruction_addr) < 4295098388):
         return [{
             'filename': 'Foo.swift',
             'abs_path': 'Foo.swift',
             'lineno': 82,
             'colno': 23,
             'package': object_name,
             'function': 'other_main',
             'symbol_addr': '0x1',
             "instruction_addr": '0x1',
         }]
     return [{
         'filename': 'Foo.swift',
         'abs_path': 'Foo.swift',
         'lineno': 42,
         'colno': 23,
         'package': object_name,
         'function': 'real_main',
         'symbol_addr': '0x1000262a0',
         "instruction_addr": '0x100026330',
     }]
コード例 #16
0
ファイル: test_plugin.py プロジェクト: zsirfs/sentry
 def sym_app_frame(self, instruction_addr, img, sdk_info=None):
     object_name = ("/var/containers/Bundle/Application/"
                    "B33C37A8-F933-4B6B-9FFA-152282BFDF13/"
                    "SentryTest.app/SentryTest")
     if not (4295098384 <= parse_addr(instruction_addr) < 4295098388):
         return [{
             'filename': 'Foo.swift',
             'abs_path': 'Foo.swift',
             'lineno': 82,
             'colno': 23,
             'package': object_name,
             'function': 'other_main',
             'symbol_addr': '0x1',
             "instruction_addr": '0x1',
         }]
     return [{
         'filename': 'Foo.swift',
         'abs_path': 'Foo.swift',
         'lineno': 42,
         'colno': 23,
         'package': object_name,
         'function': 'real_main',
         'symbol_addr': '0x1000262a0',
         "instruction_addr": '0x100026330',
     }]
コード例 #17
0
ファイル: symbolizer.py プロジェクト: NuttasitBoonwat/sentry
    def _convert_symbolserver_match(self, instruction_addr, symbolserver_match, obj):
        """Symbolizes a frame with system symbols only."""
        if symbolserver_match is None:
            return []

        symbol = symbolserver_match['symbol']
        if symbol[:1] == '_':
            symbol = symbol[1:]

        return [
            self._process_frame(Symbol(
                sym_addr=parse_addr(symbolserver_match['addr']),
                instr_addr=parse_addr(instruction_addr),
                line=None,
                symbol=symbol,
            ), obj, package=symbolserver_match['object_name'])
        ]
コード例 #18
0
ファイル: symbolizer.py プロジェクト: xsbchen/sentry
    def _convert_symbolserver_match(self, instruction_addr, symbolserver_match, obj):
        """Symbolizes a frame with system symbols only."""
        if symbolserver_match is None:
            return []

        symbol = symbolserver_match['symbol']
        if symbol[:1] == '_':
            symbol = symbol[1:]

        return [
            self._process_frame(Symbol(
                sym_addr=parse_addr(symbolserver_match['addr']),
                instr_addr=parse_addr(instruction_addr),
                line=None,
                symbol=symbol,
            ), obj, package=symbolserver_match['object_name'])
        ]
コード例 #19
0
 def get_binary_images_apple_string(self):
     # We don't need binary images on symbolicated crashreport
     if self.symbolicated or self.debug_images is None:
         return ""
     binary_images = map(
         lambda i: self._convert_debug_meta_to_binary_image_row(debug_image=i),
         sorted(self.debug_images, key=lambda i: parse_addr(i["image_addr"])),
     )
     return "Binary Images:\n" + "\n".join(binary_images)
コード例 #20
0
 def get_binary_images_apple_string(self):
     # We dont need binary images on symbolicated crashreport
     if self.symbolicated or self.debug_images is None:
         return ''
     binary_images = map(
         lambda i: self._convert_debug_meta_to_binary_image_row(
             debug_image=i),
         sorted(self.debug_images,
                key=lambda i: parse_addr(i['image_addr']))
     )
     return 'Binary Images:\n' + '\n'.join(binary_images)
コード例 #21
0
ファイル: debug_meta.py プロジェクト: alexandrul/sentry
def process_symbolic_image(image):
    try:
        symbolic_image = {
            'id': normalize_debug_id(image.get('id')),
            'image_addr': _addr(image.get('image_addr')),
            'image_size': parse_addr(image['image_size']),
            'image_vmaddr': _addr(image.get('image_vmaddr') or 0),
            'name': image.get('name'),
        }

        if image.get('arch') is not None:
            symbolic_image['arch'] = image.get('arch')

        return symbolic_image
    except KeyError as e:
        raise InterfaceValidationError('Missing value for symbolic image: %s' % e.args[0])
コード例 #22
0
ファイル: debug_meta.py プロジェクト: zsy785622069/sentry
def process_symbolic_image(image):
    try:
        symbolic_image = {
            'id': normalize_debug_id(image.get('id')),
            'image_addr': _addr(image.get('image_addr')),
            'image_size': parse_addr(image['image_size']),
            'image_vmaddr': _addr(image.get('image_vmaddr') or 0),
            'name': image.get('name'),
        }

        if image.get('arch') is not None:
            symbolic_image['arch'] = image.get('arch')

        return symbolic_image
    except KeyError as e:
        raise InterfaceValidationError('Missing value for symbolic image: %s' %
                                       e.args[0])
コード例 #23
0
    def find_best_instruction(self, processable_frame):
        """Given a frame, stacktrace info and frame index this returns the
        interpolated instruction address we then use for symbolication later.
        """
        if self.arch is None:
            return parse_addr(processable_frame['instruction_addr'])

        crashing_frame = False
        signal = None
        ip_reg = None

        # We only need to provide meta information for frame zero
        if processable_frame.idx == 0:
            # The signal is useful information for symbolic in some situations
            # to disambiugate the first frame.  If we can get this information
            # from the mechanism we want to pass it onwards.
            signal = None
            exc = self.data.get('sentry.interfaces.Exception')
            if exc is not None:
                mechanism = exc['values'][0].get('mechanism')
                if mechanism and 'meta' in mechanism and \
                    'signal' in mechanism['meta'] and \
                        'number' in mechanism['meta']['signal']:
                    signal = int(mechanism['meta']['signal']['number'])
            registers = processable_frame.stacktrace_info.stacktrace.get(
                'registers')
            if registers:
                ip_reg_name = arch_get_ip_reg_name(self.arch)
                if ip_reg_name:
                    ip_reg = registers.get(ip_reg_name)
            crashing_frame = True

        return find_best_instruction(
            processable_frame['instruction_addr'],
            arch=self.arch,
            crashing_frame=crashing_frame,
            signal=signal,
            ip_reg=ip_reg
        )
コード例 #24
0
ファイル: plugin.py プロジェクト: binlee1990/sentry
    def find_best_instruction(self, processable_frame):
        """Given a frame, stacktrace info and frame index this returns the
        interpolated instruction address we then use for symbolication later.
        """
        if self.arch is None:
            return parse_addr(processable_frame['instruction_addr'])

        crashing_frame = False
        signal = None
        ip_reg = None

        # We only need to provide meta information for frame zero
        if processable_frame.idx == 0:
            # The signal is useful information for symbolic in some situations
            # to disambiugate the first frame.  If we can get this information
            # from the mechanism we want to pass it onwards.
            signal = None
            exc = self.data.get('sentry.interfaces.Exception')
            if exc is not None:
                mechanism = exc['values'][0].get('mechanism')
                if mechanism and 'meta' in mechanism and \
                    'signal' in mechanism['meta'] and \
                        'number' in mechanism['meta']['signal']:
                    signal = int(mechanism['meta']['signal']['number'])
            registers = processable_frame.stacktrace_info.stacktrace.get(
                'registers')
            if registers:
                ip_reg_name = arch_get_ip_reg_name(self.arch)
                if ip_reg_name:
                    ip_reg = registers.get(ip_reg_name)
            crashing_frame = True

        return find_best_instruction(
            processable_frame['instruction_addr'],
            arch=self.arch,
            crashing_frame=crashing_frame,
            signal=signal,
            ip_reg=ip_reg
        )
コード例 #25
0
ファイル: debug_meta.py プロジェクト: getsentry/sentry
def _addr(x):
    if x is None:
        return None
    return '0x%x' % parse_addr(x)
コード例 #26
0
ファイル: utils.py プロジェクト: zdYng/sentry
def rebase_addr(instr_addr, obj):
    return parse_addr(instr_addr) - parse_addr(obj.addr)
コード例 #27
0
ファイル: debug_meta.py プロジェクト: NuttasitBoonwat/sentry
 def _addr(x):
     return '0x%x' % parse_addr(x)
コード例 #28
0
ファイル: debug_meta.py プロジェクト: zsy785622069/sentry
def _addr(x):
    return '0x%x' % parse_addr(x)
コード例 #29
0
ファイル: utils.py プロジェクト: Kayle009/sentry
def rebase_addr(instr_addr, obj):
    return parse_addr(instr_addr) - parse_addr(obj.addr)
コード例 #30
0
ファイル: debug_meta.py プロジェクト: yarikc/sentry
def _addr(x):
    if x is None:
        return None
    return '0x%x' % parse_addr(x)
コード例 #31
0
 def _get_slide_value(self, image_addr):
     if self.debug_images:
         for debug_image in self.debug_images:
             if parse_addr(debug_image['image_addr']) == parse_addr(image_addr):
                 return parse_addr(debug_image['image_vmaddr'])
     return 0