Subject: bug#20808: 24.5; Emacs looping with 100% CPU at line 15287 (?) of xdisp.c

From: Eli Zaretskii <[email-masked]>
Date: Sun, 14 Jun 2015 17:08:34 +0300

> From: [email-masked] (N. Jackson)
> Date: Sun, 14 Jun 2015 01:15:29 -0300
> 
> 
> I have Emacs stuck in a loop and running at 100% CPU. GDB is attached.
> 
>     (gdb) bt
>     #0  0x0000000000462063 in redisplay_window (window=18301693, just_this_one_p=just_this_one_p@entry=true) at ../../src/xdisp.c:15286
>     #1  0x0000000000463a36 in redisplay_window_1 (window=window@entry=18301693) at ../../src/xdisp.c:14381
>     #2  0x000000000055a58b in internal_condition_case_1 (bfun=0x463a00 <redisplay_window_1>, arg=18301693, handlers=<optimized out>, hfun=0x42bac0 <redisplay_window_error>) at ../../src/eval.c:1372
>     #3  0x0000000000453aa1 in redisplay_internal () at ../../src/xdisp.c:14024
>     #4  0x0000000000454455 in redisplay () at ../../src/xdisp.c:13229
>     #5  0x00000000004f44a1 in read_char (commandflag=1, map=map@entry=93744966, prev_event=12311602, used_mouse_menu=used_mouse_menu@entry=0x7ffc481ee12b, end_time=end_time@entry=0x0) at ../../src/keyboard.c:2571
>     #6  0x00000000004f5c1f in read_key_sequence (keybuf=keybuf@entry=0x7ffc481ee200, prompt=12311602, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false, bufsize=30)
>         at ../../src/keyboard.c:9089
>     #7  0x00000000004f7990 in command_loop_1 () at ../../src/keyboard.c:1453
>     #8  0x000000000055a467 in internal_condition_case (bfun=bfun@entry=0x4f7790 <command_loop_1>, handlers=<optimized out>, hfun=hfun@entry=0x4ee950 <cmd_error>)
>         at ../../src/eval.c:1348
>     #9  0x00000000004e9f6e in command_loop_2 (ignore=ignore@entry=12311602) at ../../src/keyboard.c:1178
>     #10 0x000000000055a34b in internal_catch (tag=12359074, func=func@entry=0x4e9f50 <command_loop_2>, arg=12311602) at ../../src/eval.c:1112
>     #11 0x00000000004ee567 in recursive_edit_1 () at ../../src/keyboard.c:1157
>     #12 0x00000000004ee567 in recursive_edit_1 () at ../../src/keyboard.c:778
>     #13 0x00000000004ee880 in Frecursive_edit () at ../../src/keyboard.c:849
>     #14 0x0000000000418079 in main (argc=<optimized out>, argv=0x7ffc481ee568) at ../../src/emacs.c:1642
> 
> I can step through the code without difficulty:
> 
>     (gdb) step
>     bidi_shelve_cache () at ../../src/bidi.c:846
>     846       if (bidi_cache_idx == 0)
> 
> But trying to step out with `finish', leaves me looping again trying to
> exit from #0:
> 
>     (gdb) finish
>     Run till exit from #0  bidi_shelve_cache () at ../../src/bidi.c:846
>     redisplay_window (window=18301693, just_this_one_p=just_this_one_p@entry=true) at ../../src/xdisp.c:15287
>     15287             } while (line_bottom_y (&it1) - start_y < amount_to_scroll);
>     Value returned is $1 = (void *) 0x0
>     (gdb) finish
>     Run till exit from #0  redisplay_window (window=18301693, just_this_one_p=just_this_one_p@entry=true) at ../../src/xdisp.c:15287
>     ^C
>     Program received signal SIGINT, Interrupt.
>     0x0000000000462063 in redisplay_window (window=18301693, just_this_one_p=just_this_one_p@entry=true) at ../../src/xdisp.c:15286
>     15286               SAVE_IT (it1, it, it1data);
>     (gdb)
> 
> What should I do next? Can any information still be gleaned from this?

Yes, the information you collected is useful, thanks.  If you could
come up with a reproducible recipe for this, it would be even better.
Failing that, I could give you instructions regarding GDB commands
that will collect some more data, in the hope that the data will allow
to come up with a fix.

Thanks.