GDB Ctrl-C Interrupt Fails WORKAROUND

Kyle McKay
Thu Jun 15 08:29:00 GMT 2006

On 15 Jun 2006 at 00:44:05 -0400 Christopher Faylor wrote:
> On Wed, Jun 14, 2006 at 08:29:50PM -0700, Kyle McKay wrote:
> >If you have ever tried to interrupt a program running under cygwin
> >gdb, you have probably experienced some frustration.  Especially if
> >the program was built with -mno-cygwin.
> No I never have.  In fact I often rely on CTRL-C interrupting the
> program.  It doesn't matter whether the program is built with
> -mno-cygwin or not.  In fact, I am sometimes frustrated when I  
> actually
> want the CTRL-C to be propagated to the program but then I remember
> about the "handle" command.
> The only time that I can think of when a CTRL-C would not interrupt a
> program would be when you're running gdb under a cygwin pty or  
> tty.  But
> it's usually easy enough not to do that if you are debugging a  
> problem.

I'm happy for you that CTRL-C works for you.  It does not work for me.

I'm almost never running gdb from a genuine DOS command prompt.   
Sometimes via ssh, sometimes via a terminal emulator.  CTRL-C doesn't  
work in those.

Also, if you have "tty" in your CYGWIN variable it doesn't work even  
from a DOS command prompt.

Finally, it NEVER works no matter what if you are debugging a program  
built with a different compiler such as m$ visual C++.  And, of  
course, you say I have no reason to do that since the debugging  
symbols will not be compatible.  However, the m$ visual C++ built  
program is then loading a cygwin/mingw built DLL.  CTRL-C doesn't  
work in this case to interrupt the running program.  Although if you  
are careful you can get breakpoints set, but if you change your mind  
after you start running the program again then you're out of luck.   
That's where the debugbreak utility comes in very handy.

Lacking the ability to interrupt a running program severely limits  
gdb's usefulness.  Fortunately there's a workaround available.

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list