<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>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:<br>

<br></div>sudo lldb -p <pid><br></div>c<br></div>q<br><br></div>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.<br>

<br></div>I also tried to add a unit test for this and the previous patch, however I hit <a href="http://llvm.org/pr16172">http://llvm.org/pr16172</a>. 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:<br>

<br></div>attach -p <pid> (ok)<br></div>c (ok)<br></div>detach (error: Detach failed: No such process)<br><br></div>And:<br><br>attach -p <pid> (ok)<br>c (ok)<br></div>process interrupt (ok)<br>c (error: Failed to resume process: Resume request failed - process still running..)<br>

</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 21, 2014 at 8:37 PM, Ed Maste <span dir="ltr"><<a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 21 March 2014 15:14,  <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br>
> 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.<br>


<br>
</div>We definitely have some, because they used to fail early on in the<br>
FreeBSD porting effort.  I suspect that your suggestion is correct and<br>
they just don't do anything but attach and then quit.<br>
<br>
On a related note, I'm pretty sure we don't have tests for detach.<br>
I'll see about extending tests to include that at some point.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Ed<br>
</font></span></blockquote></div><br></div>