summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-09-02 23:54:28 +0000
committermidipix <writeonce@midipix.org>2019-09-07 01:22:51 +0000
commit039cfefbce2b2e6a96a311c30ff1878eac27ac02 (patch)
treec6936aa46053e527627d5ae8a81443af785aad04
parent222ac4f0570e7620e50c498ddecd56d0d2e9bbdb (diff)
downloadchainport-039cfefbce2b2e6a96a311c30ff1878eac27ac02.tar.bz2
chainport-039cfefbce2b2e6a96a311c30ff1878eac27ac02.tar.xz
mgdb: winnt_detach(): finalize logic.
-rw-r--r--overlay/mgdb/gdb/winnt-nat.c20
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(