Fix various debugger operations. Fix a ptrace-related bug.