__init__.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:vivisect-py3 作者: bat-serjo 项目源码 文件源码
def platformProcessEvent(self, event):
        """
        Handle a mach exception message
        """
        #if self.attaching:
            #self.useptrace = True
            #return self.handlePosixSignal(event)

        #self.useptrace = False

        # Some event states that need to be reset
        self.softexc = False

        threadid, excode, codes = event

        # Set the thread that signaled.
        self.setMeta('ThreadId', threadid)
        self.setMeta('StoppedThreadId', threadid)

        self.setMeta('MachException', event)

        if excode == EXC_SOFTWARE:

            self.softexc = True

            assert( len(codes) == 2 )
            assert( codes[0] == EXC_SOFT_SIGNAL )

            sig = codes[1]
            self.handlePosixSignal(sig)

        elif excode == EXC_BAD_ACCESS:
            print('exc_bad_access',repr([hex(x) for x in codes ]))
            signo = signal.SIGSEGV
            #if codes[0] == KERN_INVALID_ADDRESS:
                #signo = signal.SIGBUS

            self._fireSignal(signo)

        elif excode == EXC_BAD_INSTRUCTION:
            print('exc_bad_instruction',repr([hex(x) for x in codes ]))
            self._fireSignal(signal.SIGILL)

        elif excode == EXC_CRASH:
            print('exc_crash')
            print('Crash:',repr([hex(x) for x in codes]))
            self._fireExit(0xffffffff)

        elif excode == EXC_BREAKPOINT:
            print('exc_breakpoint',codes)
            self.handlePosixSignal(signal.SIGTRAP)

        else:
            print('Unprocessed Exception Type: %d' % excode)
            self.fireNotifiers(vtrace.NOTIFY_SIGNAL)

        return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号