Hey Todd, great! I think if we end up in there and it's not a SIGSTOP then
we have no idea what's going on and it's not clear what the correct
behaviour would be. I'm happy to wrap the whole thing in an if statement
checking for SIGSTOP though if you think that's best, though it's not clear
whether the thing to do is to continue or return at that point.

Thanks!


On Mon, Jan 27, 2014 at 6:06 PM, Todd Fiala <[email protected]> wrote:

> Verified this fixes it.  I'll go ahead and check it in.
>
>
> On Mon, Jan 27, 2014 at 9:00 AM, Todd Fiala <[email protected]> wrote:
>
>> I'm giving this a shot now locally.  The change looks reasonable to me -
>> any ptrace experts disagree?
>>
>> The one bit I'm not entirely sure about is: if assertions are disabled,
>> and for some reason the WSTOPSIG(status) is not SIGSTOP (since we're not
>> explicitly checking before the Resume(wait_pid, SIGSTOP) call), how badly
>> can that gunk things up?  An if check before the Resume call would at least
>> stop the wrong signal from getting sent to the inferior if I'm reading it
>> right.
>>
>>
>> On Mon, Jan 27, 2014 at 2:47 AM, Andrew MacPherson <[email protected]
>> > wrote:
>>
>>> This patch addresses a bug where in a multi-threaded program a new
>>> signal from the inferior may be received before all group-stop messages
>>> from an earlier signal have been handled. The attached .cpp file exposes
>>> the issue:
>>>
>>>    - clang++ -o thread thread.cpp -lpthread -g -O0
>>>    - lldb ./thread
>>>    - r
>>>    - hit Ctrl-C
>>>    - br set -f thread.cpp -l 11
>>>    - c
>>>    - <hang>
>>>
>>> A breakpoint is usually hit before all the group-stop messages involved
>>> in restarting the process are handled and the internal state then gets out
>>> of sync.
>>>
>>> The attached patch solves the issue and all unit tests pass, I'm not a
>>> ptrace expert though so there may be a more appropriate fix. The group-stop
>>> handling was taken from the existing ProcessMonitor::MonitorCallback.
>>>
>>> Thanks,
>>>
>>> Andrew
>>>
>>>
>>>
>>> _______________________________________________
>>> lldb-dev mailing list
>>> [email protected]
>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>>>
>>>
>>
>>
>> --
>>  Todd Fiala | Software Engineer |  [email protected] |  650-943-3180
>>
>
>
>
> --
> Todd Fiala | Software Engineer |  [email protected] |  650-943-3180
>
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to