Hello,

I'm attempting to use PDcurses as a curses implementation for a win32
build of GDB (to enable using the TUI). I was able to get GDB to link
against PDcurses just fine, but I discovered a problem where the
CTRL+C handler was unable to interrupt the running process when GDB
was in TUI mode (i.e. you couldn't interrupt the running inferior
process).

I traced it down to PDcurses explicitly removing the special behavior
of CTRL+C in PDC_mouse_set():

/* If turning on mouse input: Set ENABLE_MOUSE_INPUT, and clear
       all other flags, including the extended flags;
       If turning off the mouse: Set QuickEdit Mode to the status it
       had on startup, and clear all other flags */

    SetConsoleMode(pdc_con_in, SP->_trap_mbe ?
                   (ENABLE_MOUSE_INPUT|0x0080) : (pdc_quick_edit|0x0080));


GDB relies on the special behavior of CTRL+C to interrupt its running
inferior, and thus masking it off prevents it from working. I was able
to fix this problem with a small change:

 SetConsoleMode(pdc_con_in, SP->_trap_mbe ?
                   (ENABLE_MOUSE_INPUT|0x0080|ENABLE_PROCESSED_INPUT)
: (pdc_quick_edit|0x0080|ENABLE_PROCESSED_INPUT));


I think a better solution might be to capture the original state of
the ENABLE_PROCESSED_INPUT flag when PDC_src_open() is called so that
PDC_mouse_set() can not clobber it (similar to how quick_edit is
captured). Does any one have any thoughts or comments about this?

--
~JPEW

Reply via email to