forked from qt-creator/qt-creator
An application that is using ptrace will send SIGTRAP as soon as it reaches its execve call. The process stub previously expected the only signal sent from the inferior to be SIGSTOP due to the PTRACE_DETACH call with the SIGSTOP argument. This meant that a race could occur where the SIGTRAP was received instead of the SIGSTOP and so the PTRACE_DETACH did not actually detach correctly. This patch fixes it so that it first waits for the SIGTRAP and then calls detach and waits for the expected SIGSTOP. Should this fail, more debug output is added to ease debugging failures. Fixes: QTCREATORBUG-29463 Change-Id: Ibac8b75de0c5604aeb20faba8aff58633329341e Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>