Thanks for your help. I've got a backtrace when the bug happens ;) (The story is, there must be some problems of the developing toolchain on my distro (tested on 2 PCs running it), so I burn a new ubuntu live CD and built & debugged Emacs on it, works like a charm.) The backtrace: --- Thread 1 "emacs" hit Breakpoint 3, signal_or_quit (error_symbol=XIL(0x555555e9b520), data=XIL(0xbee0), keyboard_quit=false) at eval.c:1793 1793 { #0 signal_or_quit (error_symbol=XIL(0x555555e9b520), data=XIL(0xbee0), keyboard_quit=false) at eval.c:1793 #1 0x000055555582d7ad in quit () at eval.c:1783 #2 0x000055555582d68b in process_quit_flag () at eval.c:1730 #3 0x000055555582d6d7 in maybe_quit () at eval.c:1750 #4 0x0000555555839e4a in list_length (list=XIL(0)) at fns.c:150 #5 0x000055555590036e in get_logical_fringe_bitmap (w=0x5555567d5870, bitmap=XIL(0xe430), right_p=1, partial_p=0) at fringe.c:746 #6 0x0000555555903a0b in update_window_fringes (w=0x5555567d5870, keep_current_p=true) at fringe.c:1248 #7 0x000055555560a033 in redisplay_window (window=XIL(0x5555567d5875), just_this_one_p=false) at xdisp.c:19401 #8 0x00005555555feaea in redisplay_window_0 (window=XIL(0x5555567d5875)) at xdisp.c:16617 #9 0x000055555582ce52 in internal_condition_case_1 (bfun=0x5555555feaa4 , arg=XIL(0x5555567d5875), handlers=XIL(0x7ffff4f39aeb), hfun=0x5555555fea68 ) at eval.c:1502 #10 0x00005555555fea39 in redisplay_windows (window=XIL(0x5555567d5875)) at xdisp.c:16597 #11 0x00005555555fe9eb in redisplay_windows (window=XIL(0x55555626ae75)) at xdisp.c:16591 #12 0x00005555555fd36d in redisplay_internal () at xdisp.c:16065 #13 0x00005555555fe1af in redisplay_preserve_echo_area (from_where=8) at xdisp.c:16414 #14 0x000055555576221f in detect_input_pending_run_timers (do_display=true) at keyboard.c:10392 #15 0x00005555558a5422 in wait_reading_process_output (time_limit=30, nsecs=0, read_kbd=-1, do_display=true, wait_for_cell=XIL(0), wait_proc=0x0, just_wait_proc=0) at process.c:5664 #16 0x00005555555ab5b3 in sit_for (timeout=make_fixnum(30), reading=true, display_option=1) at dispnew.c:6159 #17 0x000055555574d2e1 in read_char (commandflag=1, map=XIL(0x5555564f7463), prev_event=XIL(0), used_mouse_menu=0x7fffffffd9fd, end_time=0x0) at keyboard.c:2784 #18 0x0000555555760119 in read_key_sequence (keybuf=0x7fffffffdbe0, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9569 #19 0x0000555555748958 in command_loop_1 () at keyboard.c:1376 #20 0x000055555582cd6f in internal_condition_case (bfun=0x5555557484ba , handlers=XIL(0x90), hfun=0x555555747906 ) at eval.c:1478 #21 0x000055555574807b in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1117 #22 0x000055555582be66 in internal_catch (tag=XIL(0xe280), func=0x555555748050 , arg=XIL(0x90)) at eval.c:1198 #23 0x000055555574801b in command_loop () at keyboard.c:1095 #24 0x00005555557473b1 in recursive_edit_1 () at keyboard.c:720 #25 0x00005555557475cd in Frecursive_edit () at keyboard.c:792 #26 0x0000555555743179 in main (argc=1, argv=0x7fffffffe068) at emacs.c:2310 Lisp Backtrace: "redisplay_internal (C function)" (0x0) $59 = 1 --- 1. I've recorded several backtraces when the bug happens. They look basically the same so I just post one here. To me the update_window_fringes looks suspicious. 2. I tested with mode-line-format being nil or the default value, the backtrace when bug happens look the same, so I believe you've fixed the modeline part. Eli Zaretskii 于2021年8月16日周一 上午2:29写道: > > From: Amai Kinono > > Date: Mon, 16 Aug 2021 02:10:33 +0800 > > Cc: "44448@debbugs.gnu.org" <44448@debbugs.gnu.org> > > > > I tried and the bug can happen with breakpoint set. Haven't got a > backtrace though. > > > > I have several questions. > > > > 1. I am not familiar with GDB. I set the breakpoint by "b > signal_or_quit", is that right? > > Yes. > > > 2. When I reached the breakpoint, "p current_buffer" gives me "No symbol > "current_buffer" in current > > context." How should I get the point position in current window? > > I don't understand how this could happen. current_buffer is a global > variable, it should be visible everywhere. Is your Emacs built with > the -g3 switch (i.e. CFLAGS includes -g3)? If not, please rebuild > with CFLAGS=-g3. > > > 3. When the bug happens, the cursor doesn't jump before hitting the > breakpoint, but immediately after I > > continue using "c". Does this seem right? (I guess so) > > Yes. But you should define commands for the breakpoint, so that Emacs > keeps running. Like this: > > (gdb) break signal_or_quit > (gdb) commands > > backtrace > > print current_buffer->pt > > continue > > end > > > Printing the backtrace is so slow that it freezes my desktop for a long > time (and I don't know if that's > > forever). I need a way to tell if the bug happens before I print the > backtrace (I think that's the 2nd question > > above), so I can make sure I am getting the right backtrace and leave my > PC there for a while. > > I don't know how to tell that. In my testing, I kept typing C-g until > I saw the buffer displayed at BOB, then stopped typing C-g and looked > at the last few (2 to 4) backtraces. I think the backtraces that are > interesting are inside redisplay (under the function > redisplay_internal). > > Printing backtrace should be fast enough, it definitely shouldn't > freeze anything. It didn't freeze for me here. >