Subject: bug#9087: Crash reading from minibuffer with icomplete-mode

From: Juanma Barranquero <[email-masked]>
Date: Sun, 17 Jul 2011 01:19:07 +0200

On Fri, Jul 15, 2011 at 17:24, Eli Zaretskii <[email-masked]> wrote:

>  whatever> gdb ./oo/i386/emacs.exe
>  (gdb) watch interrupt_input_blocked
>  (gdb) commands
>  >p interrupt_input_blocked
>  >bt 5
>  >continue
>  >end
>  (gdb) run ....
>
> Now each time interrupt_input_blocked will change its value, GDB will
> kick in, perform the named "commands", and let Emacs continue.

It seems like doing that from the start is not a good idea. I stopped
my Emacs before I was able to type commands, and already the
watchpoint commands had been executed 1,663,201 times... (I have a
0,95 GiB log file to prove it :-)

If, however, I start "emacs -Q -f icomplete-mode", then stop it, set
the watchpoint and run it again, the watchpoint is never executed
before the crash.

But I think the whole BLOCK_INPUT/UNBLOCK_INPUT might be a red
herring. I think is some memory corruption, and that's why it does not
always crashes at the same place. For example, I just got this one:

Starting program: C:\emacs\debug\src/..\bin\emacs.exe -Q -f icomplete-mode
[New Thread 5400.0x1594]
[New Thread 5400.0x110c]
[New Thread 5400.0xce8]
[New Thread 5400.0xfdc]
[New Thread 5400.0x17f4]
[Switching to Thread 5400.0x17f4]
0x774c01c4 in ntdll!LdrFindResource_U () from C:\Windows\system32\ntdll.dll
Quit (expect signal SIGINT when the program is resumed)
(gdb) watch interrupt_input_blocked
Hardware watchpoint 3: interrupt_input_blocked
(gdb) commands
Type commands for breakpoint(s) 3, one per line.
End with a line saying just "end".
>p interrupt_input_blocked
>bt 5
>cont
>end
(gdb) p interrupt_input_blocked
$1 = 0
(gdb) cont
Continuing.
[New Thread 5400.0x173c]
[New Thread 5400.0x14ec]
[New Thread 5400.0x13f8]
[Switching to Thread 5400.0xce8]

Breakpoint 1, w32_abort () at w32fns.c:7182
7182      button = MessageBox (NULL,
(gdb) bt
#0  w32_abort () at w32fns.c:7182
#1  0x011d4c94 in Fframe_first_window (frame_or_window=56209413) at window.c:249
#2  0x0110457b in choose_minibuf_frame () at minibuf.c:133
#3  0x011045e3 in choose_minibuf_frame_1 (ignore=53151770) at minibuf.c:140
#4  0x01039a41 in unbind_to (count=27, value=53151770) at eval.c:3437
#5  0x010334d9 in unwind_to_catch (catch=0x88e450, value=53436670) at
eval.c:1290
#6  0x0103403a in Fsignal (error_symbol=53209954, data=53151770) at eval.c:1748
#7  0x010340ed in xsignal (error_symbol=53209954, data=53151770) at eval.c:1769
#8  0x0103410c in xsignal0 (error_symbol=53209954) at eval.c:1778
#9  0x0126224e in text_read_only (propval=53151794) at textprop.c:92
#10 0x01269a74 in verify_interval_modification (buf=0x35b1800,
start=1, end=114) at textprop.c:2157
#11 0x011121f3 in prepare_to_modify_buffer (start=1, end=114,
preserve_ptr=0x7481f83c) at insdel.c:1851
#12 0x011117c1 in del_range_1 (from=1, to=114, prepare=1,
ret_string=0) at insdel.c:1601
#13 0x0111174a in del_range (from=1, to=114) at insdel.c:1576
#14 0x010bfc20 in Ferase_buffer () at buffer.c:1950
#15 0x011064c8 in read_minibuf_unwind (data=53151770) at minibuf.c:864
#16 0x01039a41 in unbind_to (count=27, value=53151770) at eval.c:3437
#17 0x010334d9 in unwind_to_catch (catch=0x88d9f0, value=53151794) at
eval.c:1290
#18 0x01033577 in Fthrow (tag=56259586, value=53151794) at eval.c:1328
#19 0x0122260d in signal_user_input () at w32fns.c:2482
#20 0x012226aa in post_character_message (hwnd=0x6c035c, msg=258,
wParam=117, lParam=1441793, modifiers=0) at w32fns.c:2542
#21 0x012236eb in w32_wnd_proc (hwnd=0x6c035c, msg=258, wParam=117,
lParam=1441793) at w32fns.c:2913
#22 0x767162fa in USER32!OffsetRect () from C:\Windows\syswow64\user32.dll
#23 0x006c035c in ?? ()
#24 0x00000102 in ?? ()
#25 0x00000075 in ?? ()
#26 0x00160001 in ?? ()
#27 0x012226d3 in post_character_message (hwnd=0x12226d3, msg=7078748,
wParam=258, lParam=117, modifiers=1441793) at w32fns.c:2546
#28 0x76716d3a in USER32!IsWindow () from C:\Windows\syswow64\user32.dll
#29 0x012226d3 in post_character_message (hwnd=0x0, msg=19015379,
wParam=7078748, lParam=258, modifiers=117) at w32fns.c:2546
#30 0x767177c4 in USER32!AnyPopup () from C:\Windows\syswow64\user32.dll
#31 0x00000000 in ?? ()
(gdb) bt
#0  w32_abort () at w32fns.c:7182
#1  0x011ef3d0 in Fset_window_configuration (configuration=56085445)
at window.c:5720
#2  0x01039a41 in unbind_to (count=34, value=53151770) at eval.c:3437
#3  0x010334d9 in unwind_to_catch (catch=0x88d9f0, value=53151794) at
eval.c:1290
#4  0x01033577 in Fthrow (tag=56259586, value=53151794) at eval.c:1328
#5  0x0114eb0c in re_match_2_internal (bufp=0x1638b78, string1=0x0, size1=0,
    string2=0x4c52ef0 "-outline-Liberation
Serif-bold-normal-normal-serif-*-*-*-*-p-*-iso8859-7", size2=72,
pos=0, regs=0x1638de8, stop=72)
    at regex.c:6280
#6  0x01144622 in re_search_2 (bufp=0x1638b78, str1=0x0, size1=0,
    str2=0x4c52ef0 "-outline-Liberation
Serif-bold-normal-normal-serif-*-*-*-*-p-*-iso8859-7", size2=72,
startpos=0, range=0, regs=0x1638de8,
    stop=72) at regex.c:4514
#7  0x01143525 in re_search (bufp=0x1638b78, string=0x4c52ef0
"-outline-Liberation
Serif-bold-normal-normal-serif-*-*-*-*-p-*-iso8859-7", size=72,
    startpos=0, range=72, regs=0x1638de8) at regex.c:4295
#8  0x010f9ba3 in string_match_1 (regexp=56277489, string=55222961,
start=0, posix=0) at search.c:411
#9  0x010f9cdc in Fstring_match (regexp=56277489, string=55222961,
start=0) at search.c:451
#10 0x011088fd in Fall_completions (string=20058337,
collection=57679878, predicate=53151770, hide_spaces=53151770) at
minibuf.c:1590
#11 0x01037e6b in Ffuncall (nargs=4, args=0x88ba84) at eval.c:3020
#12 0x01124959 in exec_byte_code (bytestr=20580889, vector=20580957,
maxdepth=48, args_template=4112, nargs=4, args=0x88bcf8) at
bytecode.c:785
#13 0x010387f8 in funcall_lambda (fun=20580861, nargs=4,
arg_vector=0x88bce8) at eval.c:3174
#14 0x01038113 in Ffuncall (nargs=5, args=0x88bce4) at eval.c:3058
#15 0x01124959 in exec_byte_code (bytestr=20581785, vector=54683493,
maxdepth=24, args_template=0, nargs=0, args=0x88bf54) at
bytecode.c:785
#16 0x010387f8 in funcall_lambda (fun=54681829, nargs=0,
arg_vector=0x88bf54) at eval.c:3174
#17 0x01038113 in Ffuncall (nargs=1, args=0x88bf50) at eval.c:3058
#18 0x01035bd9 in eval_sub (form=53438006) at eval.c:2329
#19 0x0103395a in internal_lisp_condition_case (var=54352858,
bodyform=53438006, handlers=53437654) at eval.c:1440
#20 0x01125214 in exec_byte_code (bytestr=20581449, vector=20581629,
maxdepth=144, args_template=5136, nargs=4, args=0x88c434) at
bytecode.c:981
#21 0x010387f8 in funcall_lambda (fun=20581421, nargs=4,
arg_vector=0x88c424) at eval.c:3174
#22 0x01038113 in Ffuncall (nargs=5, args=0x88c420) at eval.c:3058
#23 0x01124959 in exec_byte_code (bytestr=20581897, vector=20581949,
maxdepth=56, args_template=4112, nargs=4, args=0x88c6a8) at
bytecode.c:785
#24 0x010387f8 in funcall_lambda (fun=20581869, nargs=4,
arg_vector=0x88c698) at eval.c:3174
#25 0x01038113 in Ffuncall (nargs=5, args=0x88c694) at eval.c:3058
#26 0x01124959 in exec_byte_code (bytestr=20565865, vector=54680037,
maxdepth=24, args_template=1028, nargs=1, args=0x88c8fc) at
bytecode.c:785
#27 0x010387f8 in funcall_lambda (fun=54712581, nargs=1,
arg_vector=0x88c8f8) at eval.c:3174
#28 0x01038113 in Ffuncall (nargs=2, args=0x88c8f4) at eval.c:3058
#29 0x01124959 in exec_byte_code (bytestr=20561185, vector=55622469,
maxdepth=20, args_template=0, nargs=0, args=0x88cb64) at
bytecode.c:785
#30 0x010387f8 in funcall_lambda (fun=55622213, nargs=0,
arg_vector=0x88cb64) at eval.c:3174
#31 0x01038113 in Ffuncall (nargs=1, args=0x88cb60) at eval.c:3058
#32 0x01035bd9 in eval_sub (form=53136638) at eval.c:2329
#33 0x0103395a in internal_lisp_condition_case (var=53801322,
bodyform=53136638, handlers=53129382) at eval.c:1440
#34 0x01125214 in exec_byte_code (bytestr=20561009, vector=20561109,
maxdepth=60, args_template=2056, nargs=2, args=0x88cff0) at
bytecode.c:981
#35 0x010387f8 in funcall_lambda (fun=20560981, nargs=2,
arg_vector=0x88cfe8) at eval.c:3174
#36 0x01038113 in Ffuncall (nargs=3, args=0x88cfe4) at eval.c:3058
#37 0x01124959 in exec_byte_code (bytestr=20565513, vector=20565813,
maxdepth=60, args_template=5136, nargs=5, args=0x88d278) at
bytecode.c:785
#38 0x010387f8 in funcall_lambda (fun=20565725, nargs=5,
arg_vector=0x88d264) at eval.c:3174
#39 0x01038113 in Ffuncall (nargs=6, args=0x88d260) at eval.c:3058
#40 0x01124959 in exec_byte_code (bytestr=20567769, vector=20567917,
maxdepth=72, args_template=0, nargs=0, args=0x88d4e4) at
bytecode.c:785
#41 0x010387f8 in funcall_lambda (fun=20567741, nargs=0,
arg_vector=0x88d4e4) at eval.c:3174
#42 0x01038113 in Ffuncall (nargs=1, args=0x88d4e0) at eval.c:3058
#43 0x01124959 in exec_byte_code (bytestr=55187489, vector=56338437,
maxdepth=36, args_template=53151770, nargs=0, args=0x0) at
bytecode.c:785
#44 0x01038c78 in funcall_lambda (fun=54991109, nargs=4,
arg_vector=0x88d754) at eval.c:3240
#45 0x01038113 in Ffuncall (nargs=5, args=0x88d750) at eval.c:3058
#46 0x01124959 in exec_byte_code (bytestr=55204129, vector=56251013,
maxdepth=20, args_template=53151770, nargs=0, args=0x0) at
bytecode.c:785
#47 0x01123f0a in Fbyte_code (bytestr=55204129, vector=56251013,
maxdepth=20) at bytecode.c:423
#48 0x01035e98 in eval_sub (form=57841918) at eval.c:2363
#49 0x01033424 in internal_catch (tag=56259586, func=0x103547a
<eval_sub>, arg=57841918) at eval.c:1247
#50 0x011251ad in exec_byte_code (bytestr=55204209, vector=54990245,
maxdepth=8, args_template=53151770, nargs=0, args=0x0) at
bytecode.c:966
#51 0x01123f0a in Fbyte_code (bytestr=55204209, vector=54990245,
maxdepth=8) at bytecode.c:423
#52 0x01035e98 in eval_sub (form=57841982) at eval.c:2363
#53 0x0103395a in internal_lisp_condition_case (var=53151770,
bodyform=57841982, handlers=57841886) at eval.c:1440
#54 0x01125214 in exec_byte_code (bytestr=55204433, vector=56072581,
maxdepth=28, args_template=53151770, nargs=0, args=0x0) at
bytecode.c:981
#55 0x01038c78 in funcall_lambda (fun=54989701, nargs=0,
arg_vector=0x88e0c8) at eval.c:3240
#56 0x01038113 in Ffuncall (nargs=1, args=0x88e0c4) at eval.c:3058
#57 0x01036c72 in funcall_nil (nargs=1, args=0x88e0c4) at eval.c:2526
#58 0x010370db in run_hook_with_args (nargs=1, args=0x88e0c4,
funcall=0x1036c5a <funcall_nil>) at eval.c:2715
#59 0x01036cbc in Frun_hooks (nargs=1, args=0x88e174) at eval.c:2553
#60 0x01037a78 in Ffuncall (nargs=2, args=0x88e170) at eval.c:2991
#61 0x01124959 in exec_byte_code (bytestr=55204689, vector=53285573,
maxdepth=8, args_template=53151770, nargs=0, args=0x0) at
bytecode.c:785
#62 0x01038c78 in funcall_lambda (fun=54990853, nargs=0,
arg_vector=0x88e3f4) at eval.c:3240
#63 0x01038113 in Ffuncall (nargs=1, args=0x88e3f0) at eval.c:3058
#64 0x010371d9 in call0 (fn=54990853) at eval.c:2763
#65 0x0100772d in safe_run_hooks_1 () at keyboard.c:1868
#66 0x01033a64 in internal_condition_case (bfun=0x10076b0
<safe_run_hooks_1>, handlers=53151794, hfun=0x100772f
<safe_run_hooks_error>)
    at eval.c:1493
#67 0x01007b5b in safe_run_hook_funcall (nargs=1, args=0x88e590) at
keyboard.c:1923
#68 0x010370db in run_hook_with_args (nargs=1, args=0x88e590,
funcall=0x1007aa1 <safe_run_hook_funcall>) at eval.c:2715
#69 0x01007baa in safe_run_hooks (hook=54990853) at keyboard.c:1940
#70 0x01006461 in command_loop_1 () at keyboard.c:1586
#71 0x01033a64 in internal_condition_case (bfun=0x100545f
<command_loop_1>, handlers=53209522, hfun=0x1004c89 <cmd_error>) at
eval.c:1493
#72 0x010050c5 in command_loop_2 (ignore=53151770) at keyboard.c:1156
#73 0x01033424 in internal_catch (tag=53301730, func=0x10050a2
<command_loop_2>, arg=53151770) at eval.c:1247
#74 0x0100502c in command_loop () at keyboard.c:1121
#75 0x01004647 in recursive_edit_1 () at keyboard.c:756
#76 0x011059d7 in read_minibuf (map=53496782, initial=53151770,
prompt=80803073, backup_n=53151770, expflag=0, histvar=53327474,
histpos=0,
    defalt=53151770, allow_props=0, inherit_input_method=0) at minibuf.c:663
#77 0x0110672a in Fread_from_minibuffer (prompt=80803073,
initial_contents=53151770, keymap=53496782, sys_read=53151770,
hist=53151770,
    default_value=53151770, inherit_input_method=53151770) at minibuf.c:957
#78 0x01038024 in Ffuncall (nargs=8, args=0x88ea58) at eval.c:3035
#79 0x01124959 in exec_byte_code (bytestr=20583857, vector=20583941,
maxdepth=72, args_template=8200, nargs=8, args=0x88ece4) at
bytecode.c:785
#80 0x010387f8 in funcall_lambda (fun=20583829, nargs=8,
arg_vector=0x88ecc4) at eval.c:3174
#81 0x01038113 in Ffuncall (nargs=9, args=0x88ecc0) at eval.c:3058
#82 0x01108b01 in Fcompleting_read (prompt=80803073,
collection=57679878, predicate=53151770, require_match=53151770,
initial_input=53151770,
    hist=53151770, def=53151770, inherit_input_method=53151770) at
minibuf.c:1702
#83 0x010380cb in Ffuncall (nargs=3, args=0x88edd0) at eval.c:3042
#84 0x01124959 in exec_byte_code (bytestr=20388249, vector=20388325,
maxdepth=32, args_template=53151770, nargs=0, args=0x0) at
bytecode.c:785
#85 0x01038c78 in funcall_lambda (fun=20388221, nargs=2,
arg_vector=0x88f034) at eval.c:3240
#86 0x01038113 in Ffuncall (nargs=3, args=0x88f030) at eval.c:3058
#87 0x01124959 in exec_byte_code (bytestr=20388945, vector=20389037,
maxdepth=16, args_template=53151770, nargs=0, args=0x0) at
bytecode.c:785
#88 0x01038c78 in funcall_lambda (fun=20388917, nargs=1,
arg_vector=0x88f1f0) at eval.c:3240
#89 0x01038448 in apply_lambda (fun=20388917, args=20383310) at eval.c:3117
#90 0x010361ba in eval_sub (form=20383302) at eval.c:2402
#91 0x01035469 in Feval (form=20383302, lexical=53151770) at eval.c:2211
#92 0x01121b49 in Fcall_interactively (function=53705922,
record_flag=53151794, keys=53172997) at callint.c:346
#93 0x01037dec in Ffuncall (nargs=4, args=0x88f640) at eval.c:3016
#94 0x01037287 in call3 (fn=53316994, arg1=53705922, arg2=53151794,
arg3=53151770) at eval.c:2809
#95 0x0101ffc1 in Fcommand_execute (cmd=53705922,
record_flag=53151794, keys=53151770, special=53151770) at
keyboard.c:10274
#96 0x010202bd in Fexecute_extended_command (prefixarg=53151770) at
keyboard.c:10363
#97 0x01037d0c in Ffuncall (nargs=2, args=0x88f880) at eval.c:3009
#98 0x01123986 in Fcall_interactively (function=53207762,
record_flag=53151770, keys=53172997) at callint.c:857
#99 0x01037dec in Ffuncall (nargs=4, args=0x88fb20) at eval.c:3016
#100 0x01037287 in call3 (fn=53316994, arg1=53207762, arg2=53151770,
arg3=53151770) at eval.c:2809
#101 0x0101ffc1 in Fcommand_execute (cmd=53207762,
record_flag=53151770, keys=53151770, special=53151770) at
keyboard.c:10274
#102 0x01006422 in command_loop_1 () at keyboard.c:1572
#103 0x01033a64 in internal_condition_case (bfun=0x100545f
<command_loop_1>, handlers=53209522, hfun=0x1004c89 <cmd_error>) at
eval.c:1493
#104 0x010050c5 in command_loop_2 (ignore=53151770) at keyboard.c:1156
#105 0x01033424 in internal_catch (tag=53207546, func=0x10050a2
<command_loop_2>, arg=53151770) at eval.c:1247
#106 0x0100507d in command_loop () at keyboard.c:1135
#107 0x01004647 in recursive_edit_1 () at keyboard.c:756
#108 0x01004969 in Frecursive_edit () at keyboard.c:820
#109 0x010027eb in main (argc=4, argv=0xb82d70) at emacs.c:1701
(gdb)