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 t
If you install the latest MinGW-x64 from https://www.msys2.org/ then Ctrl-C just works.
c:\test>gdb a.exe
GNU gdb (GDB) 7.11.1
. . .
Reading symbols from a.exe...done.
(gdb) r
Starting program: c:\test\a.exe
<Ctrl>-<C>
Thread 5 received signal SIGINT, Interrupt.
[Switching to Thread 17312.0x5614]
0x00007ff97e75d7e3 in TlsGetValue () from C:\WINDOWS\System32\KernelBase.dll
(gdb)
If you're in Cygwin, you need to tell gdb
to handle SIGINT
:
(gdb) handle SIGINT
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) y
Signal Stop Print Pass to program Description
SIGINT Yes Yes No Interrupt
(gdb)
This is because GDB doesn't handle the Ctrl + C event of the GUI (non-console) program properly.
You can find the workaround in Workaround for GDB Ctrl-C Interrupt.