MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / kill

Method kill

pydevd_attach_to_process/winappdbg/debug.py:656–706  ·  view source on GitHub ↗

Kills a process currently being debugged. @see: L{detach} @type dwProcessId: int @param dwProcessId: Global ID of a process to kill. @type bIgnoreExceptions: bool @param bIgnoreExceptions: C{True} to ignore any exceptions that may be

(self, dwProcessId, bIgnoreExceptions=False)

Source from the content-addressed store, hash-verified

654 warnings.warn(str(e), RuntimeWarning)
655
656 def kill(self, dwProcessId, bIgnoreExceptions=False):
657 """
658 Kills a process currently being debugged.
659
660 @see: L{detach}
661
662 @type dwProcessId: int
663 @param dwProcessId: Global ID of a process to kill.
664
665 @type bIgnoreExceptions: bool
666 @param bIgnoreExceptions: C{True} to ignore any exceptions that may be
667 raised when killing the process.
668
669 @raise WindowsError: Raises an exception on error, unless
670 C{bIgnoreExceptions} is C{True}.
671 """
672
673 # Keep a reference to the process. We'll need it later.
674 try:
675 aProcess = self.system.get_process(dwProcessId)
676 except KeyError:
677 aProcess = Process(dwProcessId)
678
679 # Cleanup all data referring to the process.
680 self.__cleanup_process(dwProcessId, bIgnoreExceptions=bIgnoreExceptions)
681
682 # Kill the process.
683 try:
684 try:
685 if self.is_debugee(dwProcessId):
686 try:
687 if aProcess.is_alive():
688 aProcess.suspend()
689 finally:
690 self.detach(dwProcessId, bIgnoreExceptions=bIgnoreExceptions)
691 finally:
692 aProcess.kill()
693 except Exception:
694 if not bIgnoreExceptions:
695 raise
696 e = sys.exc_info()[1]
697 warnings.warn(str(e), RuntimeWarning)
698
699 # Cleanup what remains of the process data.
700 try:
701 aProcess.clear()
702 except Exception:
703 if not bIgnoreExceptions:
704 raise
705 e = sys.exc_info()[1]
706 warnings.warn(str(e), RuntimeWarning)
707
708 def kill_all(self, bIgnoreExceptions=False):
709 """

Callers 9

kill_allMethod · 0.95
pid_existsFunction · 0.45
interrupt_main_threadFunction · 0.45
run_processMethod · 0.45
testFunction · 0.45
kill_processMethod · 0.45
kill_threadMethod · 0.45
execlMethod · 0.45

Calls 9

__cleanup_processMethod · 0.95
is_debugeeMethod · 0.95
is_aliveMethod · 0.95
suspendMethod · 0.95
detachMethod · 0.95
killMethod · 0.95
clearMethod · 0.95
ProcessClass · 0.90
get_processMethod · 0.45

Tested by 1

run_processMethod · 0.36