[lldb-dev] Resuming traced process on Linux and SIGSTOP

Todd Fiala tfiala at google.com
Tue Mar 25 12:09:30 PDT 2014

I just finished clearing out some Linux test errors (I'm now all green on
Linux x86_64).  I'll add this to a queue I've got with some changes from
Piotr, Ed and you in it now.

On Tue, Mar 25, 2014 at 12:08 PM, Andrew MacPherson
<andrew.macp at gmail.com>wrote:

> Just pinging this again in case anyone has a chance to review the small
> Linux detach patch here. Thanks!
> On Sat, Mar 22, 2014 at 11:05 AM, Andrew MacPherson <andrew.macp at gmail.com
> > wrote:
>> I'm attaching a patch here that resolves the issue of a signal being
>> delivered to the inferior on detach, let me know if I should start a new
>> thread for this but since it's related to what we were discussing I'm
>> attaching it here. To reproduce the issue just launch a process, then in a
>> new terminal:
>> sudo lldb -p <pid>
>> c
>> q
>> When quitting the inferior receives a SIGSTOP because the process is
>> already running when the PTRACE_DETACH is sent. I can't find a clear answer
>> on what's supposed to happen here (PTRACE_DETACH sent to running thread)
>> but this is the behaviour I'm seeing. The docs do indicate that
>> PRACE_DETACH is like PTRACE_CONT and should only be sent to a stopped
>> thread.
>> I also tried to add a unit test for this and the previous patch, however
>> I hit http://llvm.org/pr16172. The tests these two patches require are
>> similar to the one mentioned in that case and I get the same errors in my
>> sample test as when running that one:
>> attach -p <pid> (ok)
>> c (ok)
>> detach (error: Detach failed: No such process)
>> And:
>> attach -p <pid> (ok)
>> c (ok)
>> process interrupt (ok)
>> c (error: Failed to resume process: Resume request failed - process still
>> running..)
>> On Fri, Mar 21, 2014 at 8:37 PM, Ed Maste <emaste at freebsd.org> wrote:
>>> On 21 March 2014 15:14,  <jingham at apple.com> wrote:
>>> > I'm pretty sure we have some test cases that test attach.  If we
>>> don't, then it would be great to add one.  If we do, then it would be
>>> interesting to see why they didn't fail.  For instance, maybe they just
>>> didn't bother to try "continue" after the attach.  Just adding that would
>>> be good too.
>>> We definitely have some, because they used to fail early on in the
>>> FreeBSD porting effort.  I suspect that your suggestion is correct and
>>> they just don't do anything but attach and then quit.
>>> On a related note, I'm pretty sure we don't have tests for detach.
>>> I'll see about extending tests to include that at some point.
>>> -Ed

Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140325/a118bb0f/attachment.html>

More information about the lldb-dev mailing list