[Lldb-commits] [PATCH] D10974: Fix _LocalProcess.terminate on Windows
Adrian McCarthy
amccarth at google.com
Mon Jul 6 15:12:53 PDT 2015
amccarth added a reviewer: labath.
amccarth added a subscriber: lldb-commits.
Some of the signals terminate() was trying to send aren't available on Windows, specifically SIGHUP and SIGCONT. This caused lldbtest.py to crash and leave the processes running. This fix should be behavior-preserving on Mac and Linux.
Note that Windows defines SIGINT, but claims it's not a valid signal to send, thus the try/except.
This fix makes it once again possible to run all LLDB tests on Windows, but I'm still investigating why `ninja check-lldb` no longer works.
Warning: I'm a Python newbie.
http://reviews.llvm.org/D10974
Files:
test/lldbtest.py
Index: test/lldbtest.py
===================================================================
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -285,18 +285,15 @@
def terminate(self):
if self._proc.poll() == None:
# Terminate _proc like it does the pexpect
- self._proc.send_signal(signal.SIGHUP)
- time.sleep(self._delayafterterminate)
- if self._proc.poll() != None:
- return
- self._proc.send_signal(signal.SIGCONT)
- time.sleep(self._delayafterterminate)
- if self._proc.poll() != None:
- return
- self._proc.send_signal(signal.SIGINT)
- time.sleep(self._delayafterterminate)
- if self._proc.poll() != None:
- return
+ signals_to_try = [sig for sig in ['SIGHUP', 'SIGCONT', 'SIGINT'] if sig in dir(signal)]
+ for sig in signals_to_try:
+ try:
+ self._proc.send_signal(getattr(signal, sig))
+ time.sleep(self._delayafterterminate)
+ if self._proc.poll() != None:
+ return
+ except ValueError:
+ pass # Windows says SIGINT is not a valid signal to send
self._proc.terminate()
time.sleep(self._delayafterterminate)
if self._proc.poll() != None:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10974.29130.patch
Type: text/x-patch
Size: 1401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150706/70d0d002/attachment.bin>
More information about the lldb-commits
mailing list