[Bug tui/18215] need to save/reset/restore tty settings when popping into a shell from tui mode

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Fri Jul 25 17:08:06 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=18215

--- Comment #2 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a7f7d0be3a2953fd110f084b34586ce9c649d66

commit 3a7f7d0be3a2953fd110f084b34586ce9c649d66
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Jul 25 19:07:59 2025 +0200

    [gdb/tui] Fix shell command terminal settings

    In bash I have the following terminal settings:
    ...
    $ stty
    speed 38400 baud; line = 0;
    -brkint -imaxbel iutf8
    ...
    and then in gdb using the shell command likewise:
    ...
    (gdb) shell stty
    speed 38400 baud; line = 0;
    -brkint -imaxbel iutf8
    (gdb)
    ...
    and likewise using a shell session:
    ...
    (gdb) shell
    $ stty
    speed 38400 baud; line = 0;
    -brkint -imaxbel iutf8
    $
    ...

    But in TUI, we get different settings (removed runaway indentation for
    readability):
    ...
    (gdb) shell sttyspeed 38400 baud; line = 0;
    min = 1; time = 0;
    -brkint -icrnl -imaxbel iutf8
    -onlcr
    -icanon -echo

    (gdb)
    ...
    and consequently the shell is not really usable.  This is PR tui/18215.

    The easiest way to fix this is to just temporarily leave TUI while in the
shell,
    leaving the output of the commands in CLI mode, but that's a bit confusing.

    Fix this (as suggested in the PR) by restoring the initial terminal
settings
    while in the shell command, such that also in TUI we have:
    ...
    (gdb) shell sttyspeed 38400 baud; line = 0;
    -brkint -imaxbel iutf8

    (gdb)
    ...

    Tested on x86_64-linux.

    Reported-By: Doug Evans <dje@google.com>
    Approved-By: Tom Tromey <tom@tromey.com>

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18215

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list