Hello,

I'm new to LLDB community and recently started to dive into LLDB.
I was running tests on my Ubuntu and noticed that sometimes lldb and
inferior process remained in process list after test run is completed:

 ps -elf | grep lldb
0 S ovyalov  13653  4457  0  80   0 - 125362 futex_ 11:09 ?       00:00:00
/usr/local/home/ovyalov/projects/lldb/git/build/bin/lldb --no-lldbinit -b
-o break set -n main -o run -o continue
/usr/local/home/ovyalov/projects/lldb/git/lldb/test/driver/batch_mode/a.out
-- CRASH
0 t ovyalov  13783 13653  0  80   0 -  1049 ptrace 11:09 pts/60   00:00:00
/usr/local/home/ovyalov/projects/lldb/git/lldb/test/driver/batch_mode/a.out
CRASH
0 S ovyalov  14124  4457  0  80   0 - 125362 futex_ 11:43 ?       00:00:00
/usr/local/home/ovyalov/projects/lldb/git/build/bin/lldb --no-lldbinit -b
-o break set -n main -o run -o continue
/usr/local/home/ovyalov/projects/lldb/git/lldb/test/driver/batch_mode/a.out
-- CRASH
0 t ovyalov  14299 14124  0  80   0 -  1049 ptrace 11:43 pts/67   00:00:00
/usr/local/home/ovyalov/projects/lldb/git/lldb/test/driver/batch_mode/a.out
CRASH
0 S ovyalov  14803 14689  0  80   0 - 125297 futex_ 17:15 pts/55  00:00:00
./lldb --no-lldbinit -b -o break set -n main -o run -o continue
/usr/local/home/ovyalov/projects/lldb/git/lldb/test/driver/batch_mode/a.out
-- NOCRASH
0 t ovyalov  14809 14803  0  80   0 -  1048 ptrace 17:15 pts/58   00:00:00
/usr/local/home/ovyalov/projects/lldb/git/lldb/test/driver/batch_mode/a.out
NOCRASH
0 S ovyalov  14837 28698  0  80   0 -  5936 pipe_w 17:16 pts/57   00:00:00
grep --color=auto lldb

As I found out, the problem is in lldbtest.py which improperly handles
exceptions. I've attached a patch to address this issue - please let me
know whether it looks okay.

diff --git a/test/lldbtest.py b/test/lldbtest.py
index 3c626fd..ed11ef8 100644
--- a/test/lldbtest.py
+++ b/test/lldbtest.py
@@ -1014,12 +1014,12 @@ class Base(unittest2.TestCase):
                 self.child.sendline('settings set
interpreter.prompt-on-quit false')
                 self.child.sendline('quit')
                 self.child.expect(pexpect.EOF)
-            except ValueError, ExceptionPexpect:
+            except (ValueError, pexpect.ExceptionPexpect):
                 # child is already terminated
                 pass
-
-            # Give it one final blow to make sure the child is terminated.
-            self.child.close()
+    finally:
+ # Give it one final blow to make sure the child is terminated.
+ self.child.close()


     def tearDown(self):


Thank you.


-- 
Oleksiy Vyalov | Software Engineer | ovya...@google.com
diff --git a/test/lldbtest.py b/test/lldbtest.py
index 3c626fd..ed11ef8 100644
--- a/test/lldbtest.py
+++ b/test/lldbtest.py
@@ -1014,12 +1014,12 @@ class Base(unittest2.TestCase):
                 self.child.sendline('settings set interpreter.prompt-on-quit false')
                 self.child.sendline('quit')
                 self.child.expect(pexpect.EOF)
-            except ValueError, ExceptionPexpect:
+            except (ValueError, pexpect.ExceptionPexpect):
                 # child is already terminated
                 pass
-
-            # Give it one final blow to make sure the child is terminated.
-            self.child.close()
+	    finally:
+		# Give it one final blow to make sure the child is terminated.
+		self.child.close()
 
 
     def tearDown(self):
_______________________________________________
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to