A GDB internal error happened while I was investigating Emacs bug 28268 (see "https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28268"). My emacs image is compiled with "-O0 -g -ggdb". Note Emacs has its own ".gdbinit", see "http://git.savannah.gnu.org/cgit/emacs.git/tree/src/.gdbinit". I ran Emacs under GDB in a Windows 7 command prompt, triggered the Emacs crash in #28268 (visit git repo, open Git GUI via Magit by typing "C-x g ! g", close Git GUI, type "C-g", Emacs crashes), then entered "thread apply all bt full". The output: Thread 1 received signal SIGTRAP, Trace/breakpoint trap. 0x000007fefcb831f3 in KERNELBASE!DebugBreak () from C:\Windows\system32\KernelBase.dll (gdb) thread apply all bt full Thread 126 (Thread 3644.0x2bcc): #0 0x0000000076e7bd7a in ntdll!ZwWaitForSingleObject () from C:\Windows\SYSTEM32\ntdll.dll No symbol table info available. #1 0x000007fefcb510ac in WaitForSingleObjectEx () from C:\Windows\system32\KernelBase.dll No symbol table info available. #2 0x000000040027c83b in reader_thread (arg=0x401bca480 <child_procs>) at w32proc.c:1140 cp = 0x401bca480 <child_procs> #3 0x0000000076d259cd in KERNEL32!BaseThreadInitThunk () from C:\Windows\system32\kernel32.dll No symbol table info available. #4 0x0000000076e5a561 in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll No symbol table info available. #5 0x0000000000000000 in ?? () No symbol table info available. Backtrace stopped: previous frame inner to this frame (corrupt stack?) [Thread 3644.0x1a90 exited with code 2] [Thread 3644.0x2bcc exited with code 2] [Thread 3644.0x25d0 exited with code 2] [Thread 3644.0x5e4 exited with code 2] [Inferior 1 (process 3644) exited with code 02] ../../gdb-8.0/gdb/infcall.c:1154: internal-error: value* call_function_by_hand_dummy(value*, int, valu e**, void (*)(void*, int), void*): Assertion `tp->thread_fsm == &sm->thread_fsm' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Quit this debugging session? (y or n) [answered Y; input not from terminal] This is a bug, please report it. For instructions, see: <http://www.gnu.org/software/gdb/bugs/>. ../../gdb-8.0/gdb/infcall.c:1154: internal-error: value* call_function_by_hand_dummy(value*, int, valu e**, void (*)(void*, int), void*): Assertion `tp->thread_fsm == &sm->thread_fsm' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. Create a core file of GDB? (y or n) [answered Y; input not from terminal] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
Apparently, this GDB internal error happens if GDB is run in a Windows 7 or Windows 10 command prompt, and does not happen if GDB is run in an MSYS command prompt. Here is a more easily reproducible recipe, assuming you have installed MSYS2 and Git For Windows. See the discussion at the Emacs bug report I mentioned before for the background. ;; Clone the Emacs repository and check out a tree that ;; features the desired Emacs crash git clone git://git.sv.gnu.org/emacs.git git checkout -b gdb-bug-22024 b65cb981cc ;; Build Emacs in an MSYS2 mingw64 shell: ./autogen.sh ./configure --config-cache "CFLAGS=-O0 -g3 -ggdb" make -j4 ;; Increase the "4"; but just "-j" will be painful. ;; Debug Emacs in a Windows command prompt: gdb --quiet -ex run --args src/emacs.exe -Q -eval \ "(start-process \"git gui\" \"*git gui*\" \ \"C:\\\\Program Files\\\\Git\\\\cmd\\\\Git-GUI.exe\")" ;; In Emacs, type "C-g" several times until Emacs shows ;; its abort dialog. Click "Yes" to make Emacs SIGINT ;; itself. ;; In GDB: thread apply all bt ;; GDB crashes.