tags:

views:

575

answers:

2

I'm on Windows, running GDB on an executable built under MinGW. The program has an infinite loop. I want to find it by hitting Ctrl-C. When I do, both the program and GDB exit. All the help on this subject seems to assume I'm on Linux.

A: 

To find the infinite loop, you could try stepping through the execution until you get to a sequence that repeats indefinitely.

I'm not sure, but I think Ctrl-C should only stop the execution, not gdb itself...

I think there is a "handle" command that you can use to control how the interrupt signal is handled.

mandaleeka
I know. I was hoping not to have to do that.
Mike Dunlavey
You're right on both counts, but it doesn't seem to work in a Windows DOS-box.
Mike Dunlavey
+1  A: 

Which "shell" are you using? If you use the MSYS "rxvt" shell, the behavior is pretty much as you describe. Ctrl-C only works if you are running from a normal Windows command prompt.

Matthew Talbert
That's useful information. I'm at a Windows command prompt, and it didn't seem to work, but I'll give it another try.
Mike Dunlavey
You might also try "Console2". This should behave close to the Windows command prompt, but it's a lot prettier. I use gdb all the time with that, and never have any issues. https://sourceforge.net/projects/console/
Matthew Talbert