Add full-state-checking detach tests
In light of bugs like #3116 (closed), we should add detach tests that explicitly check that every piece of state is properly restored: every register, segment state, signal state. The current detach tests just ensure that execution continues without crashing, but we could mess up several registers and not crash these simple test apps.
For #3116 (closed) I am adding some signal state testing to existing detach tests. This issue covers writing new tests with threads that place specific values into each register and segment and check that they are restored.