[PATCH] [WineDbg]: add a kill command to kill the current process
Eric Pouech
eric.pouech at orange.fr
Sat Oct 25 02:12:30 CDT 2008
A+
---
programs/winedbg/dbg.y | 3 ++-
programs/winedbg/debug.l | 1 +
programs/winedbg/tgt_active.c | 9 ++++++++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y
index 190c106..c88d3e8 100644
--- a/programs/winedbg/dbg.y
+++ b/programs/winedbg/dbg.y
@@ -59,7 +59,7 @@ static int dbg_error(const char*);
%token tSTEPI tNEXTI tFINISH tSHOW tDIR tWHATIS tSOURCE
%token <string> tPATH tIDENTIFIER tSTRING tDEBUGSTR tINTVAR
%token <integer> tNUM tFORMAT
-%token tSYMBOLFILE tRUN tATTACH tDETACH tMAINTENANCE tTYPE tMINIDUMP
+%token tSYMBOLFILE tRUN tATTACH tDETACH tKILL tMAINTENANCE tTYPE tMINIDUMP
%token tNOPROCESS
%token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
@@ -141,6 +141,7 @@ command:
| tWHATIS expr_lvalue { dbg_printf("type = "); types_print_type(&$2.type, FALSE); dbg_printf("\n"); }
| tATTACH tNUM { dbg_attach_debuggee($2, FALSE); dbg_active_wait_for_first_exception(); }
| tDETACH { dbg_curr_process->process_io->close_process(dbg_curr_process, FALSE); }
+ | tKILL { dbg_curr_process->process_io->close_process(dbg_curr_process, TRUE); }
| tMINIDUMP pathname { minidump_write($2, (dbg_curr_thread && dbg_curr_thread->in_exception) ? &dbg_curr_thread->excpt_record : NULL);}
| tECHO tSTRING { dbg_printf("%s\n", $2); }
| run_command
diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l
index 66fe70d..3a47a17 100644
--- a/programs/winedbg/debug.l
+++ b/programs/winedbg/debug.l
@@ -183,6 +183,7 @@ STRING \"[^\n"]+\"
<INITIAL>whatis|whati|what { BEGIN(NOCMD); return tWHATIS; }
<INITIAL,NOPROCESS>run|ru|r { BEGIN(ASTRING_EXPECTED); return tRUN;}
<INITIAL>detach|detac|deta|det { BEGIN(NOCMD); return tDETACH; }
+<INITIAL>kill|kil|ki|k { BEGIN(NOCMD); return tKILL; }
<INITIAL,NOPROCESS>maintenance|maint { BEGIN(MAINT_CMD); return tMAINTENANCE; }
<INITIAL>minidump|mdmp { BEGIN(PATH_EXPECTED); return tMINIDUMP; }
<INITIAL>echo { BEGIN(ASTRING_EXPECTED); return tECHO; }
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index 9cb0a56..f5ea8f2 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -979,7 +979,14 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
SetThreadContext(dbg_curr_thread->handle, &dbg_context);
ContinueDebugEvent(dbg_curr_pid, dbg_curr_tid, DBG_CONTINUE);
}
- if (!kill && !DebugActiveProcessStop(dbg_curr_pid)) return FALSE;
+ }
+ if (kill)
+ {
+ TerminateProcess(pcs->handle, 0);
+ }
+ else
+ {
+ if (!DebugActiveProcessStop(pcs->pid)) return FALSE;
}
SymCleanup(pcs->handle);
dbg_del_process(pcs);
More information about the wine-patches
mailing list