[lldb-dev] [PATCH] Unexpected group-stop with threading under Linux

Andrew MacPherson andrew.macp at gmail.com
Mon Jan 27 02:47:00 PST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140127/0f341d5a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thread.cpp
Type: text/x-c++src
Size: 443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140127/0f341d5a/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: extra-group-stop.patch
Type: text/x-diff
Size: 1564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140127/0f341d5a/attachment.patch>


More information about the lldb-dev mailing list