run gdb in watchdog without double fork (+ refactoring)
cleanup control flow in monitor