Avoid leakage of file descriptors in LLDB and LLGS
authorPavel Labath <labath@google.com>
Wed, 4 Feb 2015 10:36:57 +0000 (10:36 +0000)
committerPavel Labath <labath@google.com>
Wed, 4 Feb 2015 10:36:57 +0000 (10:36 +0000)
commit493c3a127f64766ddc1bc05a297c2c53052bee62
tree804d71450e724d1bd286967866d36f7766c01b6e
parent2a5c0a51ce5b1516b5007aace25a58d8e3c94425
Avoid leakage of file descriptors in LLDB and LLGS

Summary:
Both LLDB and LLGS are leaking file descriptors into the debugged process. This plugs the leak by
closing the unneeded descriptors. In one case I use O_CLOEXEC, which I hope is supported on
relevant platforms. I also added a regression test and plugged a fd leak in dosep.py.

Reviewers: vharron, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7372

llvm-svn: 228130
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp
lldb/source/Target/ProcessLaunchInfo.cpp
lldb/test/dosep.py
lldb/test/functionalities/avoids-fd-leak/Makefile [new file with mode: 0644]
lldb/test/functionalities/avoids-fd-leak/TestFdLeak.py [new file with mode: 0644]
lldb/test/functionalities/avoids-fd-leak/main.c [new file with mode: 0644]