WineDbg both in regular mode and in gdb proxy mode, no longer properly reacts to ctrl-c (which is supposed when debuggee is running, to stop the debuggee execution and reenter debugger where the debuggee has stopped). Currently, it just terminates WineDbg (and gdb in proxy mode).
First, start.exe, for any child process shouldn't handle the ctrl-c event. It's up to child to decide what to do with it. Quitting start.exe too early detaches all start.exe's children and grand* children from the Unix console, which prevents any user input.
Then in proxy mode, only gdb should handle ctrl-c (winedbg must be transparent).
With those two patches applied, both situations are now properly handled.
A+ ---
Eric Pouech (2): programs/start: ignore Ctrl-C and let the child decides what to do with it. programs/winedbg: in gdb proxy mode, ignore ctrl-c
programs/start/start.c | 1 + programs/winedbg/gdbproxy.c | 2 ++ 2 files changed, 3 insertions(+)
Based on a patch in [1] from Bernhard Übelacker
Funnily enough, this fixes ctrl-c for getting back to WineDbg prompt but when not in gdb proxy mode (what the BZ entry is about).
[1] https://bugs.winehq.org/show_bug.cgi?id=51766
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/start/start.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/programs/start/start.c b/programs/start/start.c index e78968e2052..dcd0a113f59 100644 --- a/programs/start/start.c +++ b/programs/start/start.c @@ -676,6 +676,7 @@ done:
if (sei.fMask & SEE_MASK_NOCLOSEPROCESS) { DWORD exitcode; + SetConsoleCtrlHandler(NULL, TRUE); WaitForSingleObject(sei.hProcess, INFINITE); GetExitCodeProcess(sei.hProcess, &exitcode); ExitProcess(exitcode);
This just lets gdb handle the control-c instead of killing winedbg.
fixes https://bugs.winehq.org/show_bug.cgi?id=51766
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/gdbproxy.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index 0fb27023957..8d8ae30fce5 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -2499,6 +2499,8 @@ static int gdb_remote(unsigned flags, unsigned port) struct gdb_context gdbctx;
if (!gdb_init_context(&gdbctx, flags, port)) return 0; + /* don't handle ctrl-c, but let gdb do the job */ + SetConsoleCtrlHandler(NULL, TRUE); for (;;) { fd_set read_fds, err_fds;