<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>I believe this is not SIGHUP on debugger exit. I am using my own C++ program that calls into LLDB API. So, this program is still alive after calling SBProcess::Detach() but the target dies. Also, the target intercepts SIGHUP to do cleanup before exiting. I put printf there, it was not hit.<div><br></div><div>I tried interactive LLDB, the target is not there:</div><div><br></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><font face="Courier New, sans-serif" size="2">Process 49145 stopped</font></div><div><font face="Courier New, sans-serif" size="2">* thread #1: tid = 49145, ..., stop reason = signal SIGSTOP</font></div><div><font face="Courier New, sans-serif" size="2"> frame #0: 0x00007ffff6a5bbed libc.so.6 at syscall-template.S:81</font></div><div><font face="Courier New, sans-serif" size="2">(lldb) detach</font></div></div><div><div><font face="Courier New, sans-serif" size="2">Process 49145 detached</font></div></div><div><div><font face="Courier New, sans-serif" size="2">(lldb) q</font></div></div><div><div><font face="Courier New, sans-serif" size="2">eugene@EUGENEBI-L1:~/tmp$ ps</font></div></div><div><div><font face="Courier New, sans-serif" size="2"> PID TTY TIME CMD</font></div></div><div><div><font face="Courier New, sans-serif" size="2">30714 pts/17 00:00:00 bash</font></div></div><div><div><font face="Courier New, sans-serif" size="2">49259 pts/17 00:00:00 ps</font></div></div><div><div><font face="Courier New, sans-serif" size="2">eugene@EUGENEBI-L1:~/tmp$</font></div></div></blockquote><div><br></div><div>Eugene<br><br><div>> From: labath@google.com<br>> Date: Tue, 29 Mar 2016 09:43:50 +0100<br>> Subject: Re: [lldb-dev] SBProcess::Detach kills target<br>> To: jingham@apple.com; eugenebi@hotmail.com<br>> CC: lldb-dev@lists.llvm.org<br>> <br>> There is no system restriction which prevents you from doing this.<br>> (Without any investigation) my guess would be that your inferior is<br>> dying of SIGHUP, which it receives when we close the master end of its<br>> pty. Could you check whether the behavior persists if your app blocks</div><div><br></div><div><br></div><div><br>> SIGHUP and/or you launch it with "process launch --no-stdio").<br>> <br>> pl<br>> <br>> On 25 March 2016 at 23:33, Jim Ingham via lldb-dev<br>> <lldb-dev@lists.llvm.org> wrote:<br>> > I vaguely remember that not all Unixen support detaching from a process that is a child of the debugger that is attached to it. If you run the process under gdb & detach, does the process survive? This may not be an exact test, since gdb may use procfs rather than ptrace, I don't know any more... But if it doesn't work for gdb, it's probably a system limitation.<br>> ><br>> > Anyway, launch then detach works as Greg described on OS X, so all the bits down to the call into the Process plugin's Detach is working correctly. So either there's a bug in llgs or in the Process plugin for Linux's detach.<br>> ><br>> > Jim<br>> ><br>> ><br>> >> On Mar 25, 2016, at 3:57 PM, Greg Clayton via lldb-dev <lldb-dev@lists.llvm.org> wrote:<br>> >><br>> >> Calling SBProcess::Detach() on a process that is currently running should always detach and this seems like a bug. This might be this way because if you launch a process in LLDB and then quit:<br>> >><br>> >> % lldb /bin/ls<br>> >> (lldb) b malloc<br>> >> (lldb) run<br>> >> (lldb) quit<br>> >><br>> >> This should kill the process if it was launched and detach if we attached. But only when we quit without telling it to do something. If we did:<br>> >><br>> >> % lldb /bin/ls<br>> >> (lldb) b malloc<br>> >> (lldb) run<br>> >> (lldb) detach<br>> >><br>> >> Then this should always detach if the user explicitly requests it no matter how it was launched.<br>> >><br>> >>> On Mar 25, 2016, at 3:35 PM, Eugene Birukov via lldb-dev <lldb-dev@lists.llvm.org> wrote:<br>> >>><br>> >>> Hi,<br>> >>><br>> >>> Is this expected behavior or am I doing something wrong?<br>> >>><br>> >>> I am running my C++ program that uses LLDB API on Linux Ubuntu 15.10.<br>> >>><br>> >>> If I attach to already running process then SBProcess::Detach() behaves as expected - my debugger quits and the target keeps running. But if the target was launched by my debugger, then detach just kills it. Is there any way to leave the target running?<br>> >>><br>> >>> Thanks,<br>> >>> Eugene<br>> >>> _______________________________________________<br>> >>> lldb-dev mailing list<br>> >>> lldb-dev@lists.llvm.org<br>> >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br>> >><br>> >> _______________________________________________<br>> >> lldb-dev mailing list<br>> >> lldb-dev@lists.llvm.org<br>> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br>> ><br>> > _______________________________________________<br>> > lldb-dev mailing list<br>> > lldb-dev@lists.llvm.org<br>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br></div></div> </div></body>
</html>