ptrace.c: Improve the wait / advance_to_state logic somewhat.
ptrace.c: Improve the wait / advance_to_state logic somewhat.

yatsek/reptyr,developerfm/reptyr,nelhage/reptyr,yatsek/reptyr,nelhage/reptyr,nelhage/reptyr,developerfm/reptyr,yatsek/reptyr,jerome-pouiller/reredirect,developerfm/reptyr,jerome-pouiller/reredirect