diff options
Diffstat (limited to 'overlay/mgdb')
-rw-r--r-- | overlay/mgdb/gdb/winnt-nat.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/overlay/mgdb/gdb/winnt-nat.c b/overlay/mgdb/gdb/winnt-nat.c index 5d2d309..7009df1 100644 --- a/overlay/mgdb/gdb/winnt-nat.c +++ b/overlay/mgdb/gdb/winnt-nat.c @@ -272,24 +272,28 @@ static void winnt_attach (struct target_ops * t, const char * args, int from_tty static void winnt_detach (struct target_ops * t, const char * args, int from_tty) { - pid_t pid; - int pfd; + pid_t pid; + winnt_process * pidinfo; if ((pid = ptid_get_pid(inferior_ptid)) < 0) - winnt_error ("cannot parse pid to detach"); + winnt_error ("cannot determine pid to detach"); - if ((pfd = winnt_pfd_from_pid(pid)) < 0) + if (!(pidinfo = winnt_process_record(pid))) winnt_perror ("debuggee record does not exist",pid); - if (__dbg_detach(pfd) < 0) - winnt_perror ("could not attach from process",pid); + if (__dbg_detach(pidinfo->pfd) < 0) + winnt_perror ("could not detach from process",pid); - if (close(pfd) < 0) + if (close(pidinfo->pfd) < 0) winnt_perror ("failed to close process file descriptor",pid); - winnt_plist_remove(pid); + inferior_ptid = null_ptid; + detach_inferior(pidinfo->syspid); x86_cleanup_dregs(); + inf_child_maybe_unpush_target(t); + + winnt_plist_remove(pid); } static ptid_t winnt_wait( |