當前位置: 首頁>>代碼示例>>Python>>正文


Python signal.SIGILL屬性代碼示例

本文整理匯總了Python中signal.SIGILL屬性的典型用法代碼示例。如果您正苦於以下問題:Python signal.SIGILL屬性的具體用法?Python signal.SIGILL怎麽用?Python signal.SIGILL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在signal的用法示例。


在下文中一共展示了signal.SIGILL屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: startProcess

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def startProcess(self, iworker, testQueue, resultQueue, shouldStop, result):
        currentaddr = Value('c',bytes_(''))
        currentstart = Value('d',time.time())
        keyboardCaught = Event()
        p = Process(target=runner,
                   args=(iworker, testQueue,
                         resultQueue,
                         currentaddr,
                         currentstart,
                         keyboardCaught,
                         shouldStop,
                         self.loaderClass,
                         result.__class__,
                         pickle.dumps(self.config)))
        p.currentaddr = currentaddr
        p.currentstart = currentstart
        p.keyboardCaught = keyboardCaught
        old = signal.signal(signal.SIGILL, signalhandler)
        p.start()
        signal.signal(signal.SIGILL, old)
        return p 
開發者ID:singhj,項目名稱:locality-sensitive-hashing,代碼行數:23,代碼來源:multiprocess.py

示例2: test_issue9324

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def test_issue9324(self):
        # Updated for issue #10003, adding SIGBREAK
        handler = lambda x, y: None
        checked = set()
        for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE,
                    signal.SIGILL, signal.SIGINT, signal.SIGSEGV,
                    signal.SIGTERM):
            # Set and then reset a handler for signals that work on windows.
            # Issue #18396, only for signals without a C-level handler.
            if signal.getsignal(sig) is not None:
                signal.signal(sig, signal.signal(sig, handler))
                checked.add(sig)
        # Issue #18396: Ensure the above loop at least tested *something*
        self.assertTrue(checked)

        with self.assertRaises(ValueError):
            signal.signal(-1, handler)

        with self.assertRaises(ValueError):
            signal.signal(7, handler) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:22,代碼來源:test_signal.py

示例3: _default_handler

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def _default_handler(signum, *args):
        ''' The default signal handler. Don't register with built-in
        signal.signal! This needs to be used on the subprocess await
        death workaround.
        '''
        # All valid cpython windows signals
        sigs = {
            signal.SIGABRT: SIGABRT,
            # signal.SIGFPE: 'fpe', # Don't catch this
            # signal.SIGSEGV: 'segv', # Don't catch this
            # signal.SIGILL: 'illegal', # Don't catch this
            signal.SIGINT: SIGINT,
            signal.SIGTERM: SIGTERM,
            # Note that signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT are
            # converted to SIGINT in _await_signal
        }
        
        try:
            exc = sigs[signum]
        except KeyError:
            exc = DaemonikerSignal
            
        _sketch_raise_in_main(exc) 
開發者ID:Muterra,項目名稱:py_daemoniker,代碼行數:25,代碼來源:_signals_windows.py

示例4: __interceptSignals

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def __interceptSignals(self):
        """Intercepts common signals"""
        for signum in [signal.SIGABRT,          # abnormal termination
                       signal.SIGFPE,           # floating point exception
                       signal.SIGILL,           # illegal instruction
                       signal.SIGSEGV]:         # segmentation violation
            signal.signal(signum, self.__signalHandler) 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:9,代碼來源:clientbase_cdm_dbg.py

示例5: __signalHandler

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def __signalHandler(self, signalNumber, stackFrame):
        """Handles signals"""
        if signalNumber == signal.SIGABRT:
            message = "Abnormal Termination"
        elif signalNumber == signal.SIGFPE:
            message = "Floating Point Exception"
        elif signalNumber == signal.SIGILL:
            message = "Illegal Instruction"
        elif signalNumber == signal.SIGSEGV:
            message = "Segmentation Violation"
        else:
            message = "Unknown Signal '{0}'".format(signalNumber)

        filename = self.absPath(stackFrame.f_code.co_filename)

        linenr = stackFrame.f_lineno
        ffunc = stackFrame.f_code.co_name

        if ffunc == '?':
            ffunc = ''

        if ffunc and not ffunc.startswith('<'):
            argInfo = getArgValues(stackFrame)
            try:
                fargs = formatArgValues(
                    argInfo.args, argInfo.varargs,
                    argInfo.keywords, argInfo.locals)
            except Exception:
                fargs = ''
        else:
            fargs = ''

        sendJSONCommand(self.socket, METHOD_SIGNAL,
                        self.procuuid,
                        {'message': message, 'filename': filename,
                         'linenumber': linenr, 'function': ffunc,
                         'arguments': fargs}) 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:39,代碼來源:clientbase_cdm_dbg.py

示例6: test_issue9324

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def test_issue9324(self):
        # Updated for issue #10003, adding SIGBREAK
        handler = lambda x, y: None
        for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE,
                    signal.SIGILL, signal.SIGINT, signal.SIGSEGV,
                    signal.SIGTERM):
            # Set and then reset a handler for signals that work on windows
            signal.signal(sig, signal.signal(sig, handler))

        with self.assertRaises(ValueError):
            signal.signal(-1, handler)

        with self.assertRaises(ValueError):
            signal.signal(7, handler) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:16,代碼來源:test_signal.py

示例7: test_module_constants

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def test_module_constants(self):
        self.assertEqual(signal.NSIG, 23)
        self.assertEqual(signal.SIGABRT, 22)
        self.assertEqual(signal.SIGBREAK, 21)
        self.assertEqual(signal.SIGFPE, 8)
        self.assertEqual(signal.SIGILL, 4)
        self.assertEqual(signal.SIGINT, 2)
        self.assertEqual(signal.SIGSEGV, 11)
        self.assertEqual(signal.SIGTERM, 15)
        self.assertEqual(signal.SIG_DFL, 0)
        self.assertEqual(signal.SIG_IGN, 1) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:13,代碼來源:test_signal.py

示例8: signal_to_string

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def signal_to_string(self, signalNumber):
        if signalNumber < 0:
            signalNumber = signalNumber * -1

        if signalNumber == signal.SIGINT:
            return "SIGINT - Interrupt (Ctrl+C)"
        elif signalNumber == signal.SIGKILL:
            return "SIGKILL - Killed"
        elif signalNumber == signal.SIGTERM:
            return "SIGTERM - Terminated"
        elif signalNumber == signal.SIGSEGV:
            return "SIGSEGV - Segmentation fault"
        elif signalNumber == signal.SIGHUP:
            return "SIGHUP - Hang up"
        elif signalNumber == signal.SIGBUS:
            return "SIGBUS - Bus error"
        elif signalNumber == signal.SIGILL:
            return "SIGILL - Illegal instruction"
        elif signalNumber == signal.SIGFPE:
            return "SIGFPE - Floating point exception"
        elif signalNumber == signal.SIGPIPE:
            return "SIGPIPE - Broken pipe (write to pipe with no readers)"
        elif signalNumber == signal.SIGABRT:
            return "SIGABRT - Called abort()"
        elif signalNumber == signal.SIGXFSZ:
            return "SIGXFSZ - Process created files that were too big."
        elif signalNumber == signal.SIGXCPU:
            return "SIGXCPU - Process used too much CPU time."
        else:
            return "Unknown signal #" + str(signalNumber) 
開發者ID:skuhl,項目名稱:autograder,代碼行數:32,代碼來源:autograder.py

示例9: init

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def init():
    # exit handlers
    for sig in (SIGABRT, SIGILL, SIGINT, SIGSEGV, SIGTERM):
        signal(sig, cleanup) 
開發者ID:maxkrivich,項目名稱:SlowLoris,代碼行數:6,代碼來源:cli.py

示例10: test_read_null

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def test_read_null(self):
        self.check_fatal_error("""
            import faulthandler
            faulthandler.enable()
            faulthandler._read_null()
            """,
            3,
            # Issue #12700: Read NULL raises SIGILL on Mac OS X Lion
            '(?:Segmentation fault|Bus error|Illegal instruction)') 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:11,代碼來源:test_faulthandler.py

示例11: test_sigill

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def test_sigill(self):
        self.check_fatal_error("""
            import _testcapi
            import faulthandler
            import signal

            faulthandler.enable()
            _testcapi.raise_signal(signal.SIGILL)
            """,
            6,
            'Illegal instruction') 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:13,代碼來源:test_faulthandler.py

示例12: GetMonitorData

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def GetMonitorData(self):
        time.sleep(self.lookout_time)
        sytem_crash_report = self.get_crash_report(self.system_report_path)
        bucket = {}

        if not len(self.crash_trace):
            if self.process.returncode < 0:
                crashSignals = [
                    # POSIX.1-1990 signals
                    signal.SIGILL,
                    signal.SIGABRT,
                    signal.SIGFPE,
                    signal.SIGSEGV,
                    # SUSv2 / POSIX.1-2001 signals
                    signal.SIGBUS,
                    signal.SIGSYS,
                    signal.SIGTRAP,
            ]
            for crashSignal in crashSignals:
                if process.returncode == -crashSignal:
                    bucket["auxdat.txt"] = "Process exited with signal: %d" % -process.returncode
        else:
            bucket["auxdat.txt"] = "".join(self.crash_trace)

        if sytem_crash_report:
            bucket["system_crash_report.txt"] = sytem_crash_report

        if self.console_log:
            bucket["stdout.txt"] = "".join(self.console_log[-1000:])

        if self.failure:
            meta = {
                "environ": os.environ.data,
                "command": self.arguments
            }
            bucket["meta.txt"] = json.dumps(dict(meta))
            bucket["Bucket"] = os.path.basename(self.command)
            return bucket 
開發者ID:MozillaSecurity,項目名稱:peach,代碼行數:40,代碼來源:process.py

示例13: crashes

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def crashes(self, signals=(signal.SIGSEGV, signal.SIGILL)):
        """
        Retrieve the crashes discovered by AFL. Since we are now detecting flag
        page leaks (via SIGUSR1) we will not return these leaks as crashes.
        Instead, these 'crashes' can be found with the leaks function.

        :param signals: list of valid kill signal numbers to override the default (SIGSEGV and SIGILL)
        :return: a list of strings which are crashing inputs
        """

        return self._get_crashing_inputs(signals) 
開發者ID:shellphish,項目名稱:fuzzer,代碼行數:13,代碼來源:fuzzer.py

示例14: crashes

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def crashes(self, signals=(signal.SIGSEGV, signal.SIGILL)):
        """
        Retrieve the crashes discovered by AFL. Since we are now detecting flag
        page leaks (via SIGUSR1) we will not return these leaks as crashes.
        Instead, these 'crashes' can be found with the leaks function.

        :param signals: list of valid kill signal numbers to override the default (SIGSEGV and SIGILL)
        :return: a list of strings which are crashing inputs
        """
        raise NotImplementedError() 
開發者ID:angr,項目名稱:phuzzer,代碼行數:12,代碼來源:__init__.py

示例15: force_crash

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGILL [as 別名]
def force_crash(self, uc_error: UcError) -> None:
        """
        This function should be called to indicate to AFL that a crash occurred during emulation.
        Pass in the exception received from Uc.emu_start()
        :param uc_error: The unicorn Error
        """
        mem_errors = [
            UC_ERR_READ_UNMAPPED,
            UC_ERR_READ_PROT,
            UC_ERR_READ_UNALIGNED,
            UC_ERR_WRITE_UNMAPPED,
            UC_ERR_WRITE_PROT,
            UC_ERR_WRITE_UNALIGNED,
            UC_ERR_FETCH_UNMAPPED,
            UC_ERR_FETCH_PROT,
            UC_ERR_FETCH_UNALIGNED,
        ]
        if uc_error.errno in mem_errors:
            # Memory error - throw SIGSEGV
            os.kill(os.getpid(), signal.SIGSEGV)
        elif uc_error.errno == UC_ERR_INSN_INVALID:
            # Invalid instruction - throw SIGILL
            os.kill(os.getpid(), signal.SIGILL)
        else:
            # Not sure what happened - throw SIGABRT
            os.kill(os.getpid(), signal.SIGABRT) 
開發者ID:fgsect,項目名稱:unicorefuzz,代碼行數:28,代碼來源:unicorefuzz.py


注:本文中的signal.SIGILL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。