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

Method kill

pydevd_attach_to_process/winappdbg/thread.py:364–385  ·  view source on GitHub ↗

Terminates the thread execution. @note: If the C{lpInjectedMemory} member contains a valid pointer, the memory is freed. @type dwExitCode: int @param dwExitCode: (Optional) Thread exit code.

(self, dwExitCode=0)

Source from the content-addressed store, hash-verified

362 self.get_handle(win32.SYNCHRONIZE).wait(dwTimeout)
363
364 def kill(self, dwExitCode=0):
365 """
366 Terminates the thread execution.
367
368 @note: If the C{lpInjectedMemory} member contains a valid pointer,
369 the memory is freed.
370
371 @type dwExitCode: int
372 @param dwExitCode: (Optional) Thread exit code.
373 """
374 hThread = self.get_handle(win32.THREAD_TERMINATE)
375 win32.TerminateThread(hThread, dwExitCode)
376
377 # Ugliest hack ever, won't work if many pieces of code are injected.
378 # Seriously, what was I thinking? :(
379 if self.pInjectedMemory is not None:
380 try:
381 self.get_process().free(self.pInjectedMemory)
382 self.pInjectedMemory = None
383 except Exception:
384 ## raise # XXX DEBUG
385 pass
386
387 # XXX TODO
388 # suspend() and resume() should have a counter of how many times a thread

Callers

nothing calls this directly

Calls 3

get_handleMethod · 0.95
get_processMethod · 0.95
freeMethod · 0.80

Tested by

no test coverage detected