[lldb-dev] SBProcess::Detach kills target

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Fri Apr 1 02:43:49 PDT 2016


> It might be also possible to run an expression that will route stdin/stdout/stderr to /dev/null before detaching if we know that we have a master/slave pty hooked up the the inferior's in/out/err. We could run an expression like:
(At least on linux) you would also need something like:
ioctl(open("/dev/tty", O_RDWR), TIOCNOTTY)
without it, the process will remain tied to the pty and will get a
HUP. Then redirection of file descriptors becomes optional: The
program will not get a SIGHUP, although it will get a SIGPIPE if it
tries to write some output to the slave end of the pty.


On 31 March 2016 at 22:44, Eugene Birukov <eugenebi at hotmail.com> wrote:
> OK, I got the picture, thanks a lot!
>
>      > What is it that you are trying to do anyway?
>
> Well, target termination during detach is unexpected, so my customers might
> get confused.

In case of a console debugger, I don't think anybody would even try
detaching from a launched program. For a graphical debugger, yes, it
will be confusing. In case you don't need access to inferior stdio
running with "process launch --no-stdio" might be an option. Right
now, it redirects io to /dev/null, but it still sets up a controlling
pty, which means you get the SIGHUP. However, I don't think a pty is
needed in this case and it sounds like it could be a good idea to
avoid creating it. Patches welcome.

pl


More information about the lldb-dev mailing list