[lldb-dev] SBProcess::Detach kills target

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Tue Mar 29 01:43:50 PDT 2016


There is no system restriction which prevents you from doing this.
(Without any investigation) my guess would be that your inferior is
dying of SIGHUP, which it receives when we close the master end of its
pty. Could you check whether the behavior persists if your app blocks
SIGHUP and/or you launch it with "process launch --no-stdio").

pl

On 25 March 2016 at 23:33, Jim Ingham via lldb-dev
<lldb-dev at lists.llvm.org> wrote:
> 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
>
> _______________________________________________
> 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