I've been playing around with TUI, and tried to find an easy way to do a stress test. I came up with starting a hello world, and doing si and then keeping my finger on the enter key and see what happens. I eventually ran into screen garbling, which could be repaired using ^L. I realized this garbling could be the result of printing the "hello", so I moved to compiling "int main (void) { return 0; }", doing a starti, and stepi-ing from there. I played around with this for a while, and found that I could reproduce the problem within minutes when starting to stepi from __GI___tunables_init. I tried to write a test-case that mimics this in the testsuite, but sofar I didn't manage to reproduce this. So, here are the steps I followed (this may be way over-specific): - openSUSE Leap 15.4 x86_64-linux - gdb build using -O0 - gdb build from commit 38b95a52938 ("Automatic date update in version.in") - gnome-terminal (on KDE desktop) - TERM=xterm (native TERM=xterm-256colors) - tab with COLUMNS 145, LINES 37 - stay in the tab, to avoid ncurses refresh when switching back to the tab. This also prevents resetting the regs window layout to one reg on one line. - gdb started using "gdb ~/a.out" - starti - layout asm (enter tui, use asm window) - layout regs (add regs window) - stepi (populate regs window, should show two regs on one line) - b __GI___tunables_init, continue - stepi (command to repeat) - press-and-hold enter - observe garbling and release enter (for me, after about 3/4 minutes) I've now also reproduce by starting gdb like so: ... $ gdb -q ~/a.out \ -ex "starti" \ -ex "layout asm" \ -ex "layout regs" \ -ex "stepi" -ex "b __GI___tunables_init" ... and then continue, stepi, and press-and-hold enter.
Created attachment 14873 [details] screenshot after garbling
Created attachment 14874 [details] screenshot after garbling is repaired using ^L
Created attachment 14875 [details] Attempt at test-case
reproduced with gdb-13-branch.
reproduced with gdb-12-branch.
Didn't reproduce with -O2 build, gave up after 7 minutes.
Reproduced with build without system readline.
Reproduced with changing tabs forth and back after the continue, changing the regs window to one reg per line.
Didn't reproduce without layout regs, so without register window.
Reproduced without layout asm, so src (showing no source available throughout) instead of asm window.
Reproduced with combination of comment 8 and 10.
OK, new way to reproduce: ... $ gdb -q ~/a.out \ -ex "starti" \ -ex "layout src" \ -ex "b __GI___tunables_init" \ -ex continue ... and do "stepi 1000", followed by press-and-hold enter. Reproduces within seconds. Now also reproduces with system gdb based on 12.1 and build with -O2.
I'm starting to think this is the input variant of PR14332. By doing stepi, we temporarily hand the terminal to the inferior. Some of the enters will land in that window where the inferior has the terminal, and will be handled according to those terminal settings, not the terminal settings as setup for/by ncurses, and they're probably just translated into a newline and echoed.
Duplicate. *** This bug has been marked as a duplicate of bug 14332 ***