summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-09-07 02:01:44 +0000
committermidipix <writeonce@midipix.org>2019-09-07 22:25:51 +0000
commita6b988dd91021cd4f530697e892cb380c4c136a5 (patch)
treed106b2eec909915c62091ec61308991c60147713
parentdb75fad00d1a81b788ce826a448f69e67f9902e5 (diff)
downloadchainport-a6b988dd91021cd4f530697e892cb380c4c136a5.tar.bz2
chainport-a6b988dd91021cd4f530697e892cb380c4c136a5.tar.xz
mgdb: winnt_kill(): initial implementation and integration.
-rw-r--r--overlay/mgdb/gdb/winnt-nat.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/overlay/mgdb/gdb/winnt-nat.c b/overlay/mgdb/gdb/winnt-nat.c
index 0ba63c3..bf997c9 100644
--- a/overlay/mgdb/gdb/winnt-nat.c
+++ b/overlay/mgdb/gdb/winnt-nat.c
@@ -279,6 +279,16 @@ static void winnt_attach (struct target_ops * t, const char * args, int from_tty
winnt_prepare(t,pid,pfd,from_tty);
}
+static void winnt_abandon (struct target_ops * t, winnt_process * pidinfo)
+{
+ inferior_ptid = null_ptid;
+
+ x86_cleanup_dregs();
+ inf_child_maybe_unpush_target(t);
+
+ winnt_plist_remove(pidinfo->pid);
+}
+
static void winnt_detach (struct target_ops * t, const char * args, int from_tty)
{
pid_t pid;
@@ -296,13 +306,9 @@ static void winnt_detach (struct target_ops * t, const char * args, int from_tty
if (close(pidinfo->pfd) < 0)
winnt_perror ("failed to close process file descriptor",pid);
- inferior_ptid = null_ptid;
detach_inferior(pidinfo->syspid);
- x86_cleanup_dregs();
- inf_child_maybe_unpush_target(t);
-
- winnt_plist_remove(pid);
+ winnt_abandon(t,pidinfo);
}
static ptid_t winnt_wait(
@@ -354,7 +360,19 @@ static void winnt_resume (
static void winnt_kill (struct target_ops * t)
{
- /* current_inferior() */
+ struct inferior * cinf;
+ struct winnt_process * pidinfo;
+
+ if (!(cinf = current_inferior()))
+ winnt_error("failed to obtain current inferior");
+
+ if (!(pidinfo = winnt_process_record(cinf->pid)))
+ winnt_perror("internal error: record not found",cinf->pid);
+
+ if (__dbg_kill(pidinfo->pfd) < 0)
+ winnt_perror("failed to kill current inferior",cinf->pid);
+
+ winnt_abandon(t,pidinfo);
}
static void winnt_mourn_inferior (struct target_ops * t)