Subject: bug#52414: backtrace when emacs get to stuck

From: "[email-masked]" <[email-masked]>
Date: Sat, 11 Dec 2021 21:35:19 +0800

main thread bt:

#0  0x00007ffc20370764 in ntdll!ZwWaitForAlertByThreadId ()
   from C:\Windows\SYSTEM32\ntdll.dll
(gdb) bt
#0  0x00007ffc20370764 in ntdll!ZwWaitForAlertByThreadId ()
   from C:\Windows\SYSTEM32\ntdll.dll
#1  0x00007ffc2033379d in ntdll!RtlWaitOnAddress ()
   from C:\Windows\SYSTEM32\ntdll.dll
#2  0x00007ffc20333652 in ntdll!RtlWaitOnAddress ()
   from C:\Windows\SYSTEM32\ntdll.dll
#3  0x00007ffc2033346d in ntdll!RtlWaitOnAddress ()
   from C:\Windows\SYSTEM32\ntdll.dll
#4  0x00007ffc202ffcb4 in ntdll!RtlEnterCriticalSection ()
   from C:\Windows\SYSTEM32\ntdll.dll
#5  0x00007ffc202ffae2 in ntdll!RtlEnterCriticalSection ()
   from C:\Windows\SYSTEM32\ntdll.dll
#6  0x00007ffc1f7ac6ad in msvcrt!_setmode ()
   from C:\Windows\System32\msvcrt.dll
#7  0x00007ffc1f7aaccd in msvcrt!_close () from C:\Windows\System32\msvcrt.dll
#8  0x00007ff7e7bfac26 in sys_close (fd=5) at w32.c:8613
#9  0x00007ff7e7a868ea in posix_close (fd=5, flag=1) at sysdep.c:2439
#10 0x00007ff7e7a86928 in emacs_close (fd=5) at sysdep.c:2457
#11 0x00007ff7e7b741b5 in close_process_fd (fd_addr=0x1cc84de9e24)
    at process.c:2040
#12 0x00007ff7e7b785fa in deactivate_process (proc=XIL(0x1cc84de9d55))
    at process.c:4704
#13 0x00007ff7e7b7187a in remove_process (proc=XIL(0x1cc84de9d55))
    at process.c:954
#14 0x00007ff7e7b7e8cb in status_notify (deleting_process=0x1cc84de9d50,
    wait_proc=0x0) at process.c:7558
#15 0x00007ff7e7b71ca1 in Fdelete_process (process=XIL(0x1cc84de9d55))
    at process.c:1107
#16 0x00007ff7e7b1ceab in eval_sub (form=XIL(0x1cc87f80c93)) at eval.c:2540
#17 0x00007ff7e7b18656 in Fprogn (body=XIL(0)) at eval.c:466
#18 0x00007ff7e7b1cb0e in eval_sub (form=XIL(0x1cc87f80cc3)) at eval.c:2493
#19 0x00007ff7e7b1c4e4 in Feval (form=XIL(0x1cc87f80cc3), lexical=XIL(0x30))
    at eval.c:2369
#20 0x00007ff7e7b1e80a in funcall_subr (subr=0x7ff7e7fa4940 <Seval>,
    numargs=2, args=0x300bdfdcd8) at eval.c:3142
#21 0x00007ff7e7b1e40a in Ffuncall (nargs=3, args=0x300bdfdcd0) at eval.c:3065
#22 0x00007ff7e7b6b3e3 in exec_byte_code (bytestr=XIL(0x1cc84052084),
    vector=XIL(0x1cc84050f2d), maxdepth=make_fixnum(15),
    args_template=make_fixnum(257), nargs=1, args=0x300bdfe1f0)
    at bytecode.c:632
#23 0x00007ff7e7b1eabd in fetch_and_exec_byte_code (fun=XIL(0x1cc84050efd),
    syms_left=make_fixnum(257), nargs=1, args=0x300bdfe1e8) at eval.c:3189
#24 0x00007ff7e7b1ee34 in funcall_lambda (fun=XIL(0x1cc84050efd), nargs=1,
    arg_vector=0x300bdfe1e8) at eval.c:3270
#25 0x00007ff7e7b1e45e in Ffuncall (nargs=2, args=0x300bdfe1e0) at eval.c:3069
#26 0x00007ff7e7b6b3e3 in exec_byte_code (bytestr=XIL(0x1cc840521e4),
    vector=XIL(0x1cc84050e9d), maxdepth=make_fixnum(4),
    args_template=make_fixnum(257), nargs=1, args=0x300bdfe868)
    at bytecode.c:632
#27 0x00007ff7e7b1eabd in fetch_and_exec_byte_code (fun=XIL(0x1cc84050e65),
    syms_left=make_fixnum(257), nargs=1, args=0x300bdfe860) at eval.c:3189
#28 0x00007ff7e7b1ee34 in funcall_lambda (fun=XIL(0x1cc84050e65), nargs=1,
    arg_vector=0x300bdfe860) at eval.c:3270
#29 0x00007ff7e7b1e45e in Ffuncall (nargs=2, args=0x300bdfe858) at eval.c:3069
#30 0x00007ff7e7b147ac in Ffuncall_interactively (nargs=2, args=0x300bdfe858)
    at callint.c:260
#31 0x00007ff7e7b1e714 in funcall_subr (
    subr=0x7ff7e7fa4140 <Sfuncall_interactively>, numargs=2,
    args=0x300bdfe858) at eval.c:3120
#32 0x00007ff7e7b1e40a in Ffuncall (nargs=3, args=0x300bdfe850) at eval.c:3065
#33 0x00007ff7e7b16c0e in Fcall_interactively (
    function=XIL(0xffff81d49bfd6e50), record_flag=XIL(0),
    keys=XIL(0x1cc843a6815)) at callint.c:798
#34 0x00007ff7e7b1e83d in funcall_subr (
    subr=0x7ff7e7fa4180 <Scall_interactively>, numargs=3, args=0x300bdfeca0)
    at eval.c:3145
#35 0x00007ff7e7b1e40a in Ffuncall (nargs=4, args=0x300bdfec98) at eval.c:3065
#36 0x00007ff7e7b6b3e3 in exec_byte_code (bytestr=XIL(0x1cc83dae6a4),
    vector=XIL(0x1cc83dae30d), maxdepth=make_fixnum(13),
    args_template=make_fixnum(1025), nargs=1, args=0x300bdff210)
    at bytecode.c:632
#37 0x00007ff7e7b1eabd in fetch_and_exec_byte_code (fun=XIL(0x1cc83dae2dd),
    syms_left=make_fixnum(1025), nargs=1, args=0x300bdff208) at eval.c:3189
#38 0x00007ff7e7b1ee34 in funcall_lambda (fun=XIL(0x1cc83dae2dd), nargs=1,
    arg_vector=0x300bdff208) at eval.c:3270
#39 0x00007ff7e7b1e45e in Ffuncall (nargs=2, args=0x300bdff200) at eval.c:3069
#40 0x00007ff7e7b1dd50 in call1 (fn=XIL(0x4680), arg1=XIL(0xffff81d49bfd6e50))
    at eval.c:2925
#41 0x00007ff7e7a62f84 in command_loop_1 () at keyboard.c:1506
#42 0x00007ff7e7b1a730 in internal_condition_case (
    bfun=0x7ff7e7a62636 <command_loop_1>, handlers=XIL(0x90),
    hfun=0x7ff7e7a61af6 <cmd_error>) at eval.c:1492
#43 0x00007ff7e7a62294 in command_loop_2 (handlers=XIL(0x90))
    at keyboard.c:1134
#44 0x00007ff7e7b19e57 in internal_catch (tag=XIL(0xf930),

test thread bt:

#1  0x00007ffc1da1aeb3 in ReadFile () from C:\Windows\System32\KernelBase.dll
#2  0x00007ffc1f7ae84a in msvcrt!_read () from C:\Windows\System32\msvcrt.dll
#3  0x00007ffc1f7ae52b in msvcrt!_read () from C:\Windows\System32\msvcrt.dll
#4  0x00007ff7e7bfb050 in _sys_read_ahead (fd=5) at w32.c:8750
#5  0x00007ff7e7c068b5 in reader_thread (arg=0x7ff7e80abb60 <child_procs>)
    at w32proc.c:1228
#6  0x00007ffc1e9b7034 in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\System32\kernel32.dll
#7  0x00007ffc20322651 in ntdll!RtlUserThreadStart ()
   from C:\Windows\SYSTEM32\ntdll.dll
#8  0x0000000000000000 in ?? ()

    func=0x7ff7e7a6226b <command_loop_2>, arg=XIL(0x90)) at eval.c:1223
#45 0x00007ff7e7a621f3 in command_loop () at keyboard.c:1112
#46 0x00007ff7e7a6167c in recursive_edit_1 () at keyboard.c:721
#47 0x00007ff7e7a61834 in Frecursive_edit () at keyboard.c:804
#48 0x00007ff7e7a5deb5 in main (argc=2, argv=0x1cc823569f0) at emacs.c:2409