[lldb-dev] SBProcess::Detach kills target

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Fri Mar 25 16:33:03 PDT 2016


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.

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.

Jim


> On Mar 25, 2016, at 3:57 PM, Greg Clayton via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> 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:
> 
> % lldb /bin/ls
> (lldb) b malloc
> (lldb) run
> (lldb) quit
> 
> 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:
> 
> % lldb /bin/ls
> (lldb) b malloc
> (lldb) run
> (lldb) detach
> 
> Then this should always detach if the user explicitly requests it no matter how it was launched.
> 
>> On Mar 25, 2016, at 3:35 PM, Eugene Birukov via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>> 
>> Hi,
>> 
>> Is this expected behavior or am I doing something wrong?
>> 
>> I am running my C++ program that uses LLDB API on Linux Ubuntu 15.10.
>> 
>> 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?
>> 
>> Thanks,
>> Eugene
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list