Bug 30522 - [gdb/tui] Entering singlekey mode doesn't clear partial command line
Summary: [gdb/tui] Entering singlekey mode doesn't clear partial command line
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: tui (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 14.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-06 12:55 UTC by Tom de Vries
Modified: 2023-06-09 14:40 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2023-06-06 12:55:16 UTC
Say we start gdb in TUI mode:
...
$ gdb -q -tui ./a.out 
...
we get in the command window (X marks blinking cursor):
...
Reading symbols from ./a.out...
(gdb) X
...

Now let's type "sun":
...
Reading symbols from ./a.out...
(gdb) sunX
...
and do C-x s to enter singlekey mode:
...
Reading symbols from ./a.out...
sunX
...
and then press d.  We get:
...
Reading symbols from ./a.out...
sun
Undefined command: "sundown".  Try "help".
X
...

I think when entering singlekey mode we probably want to clear the partial command line.
Comment 2 Sourceware Commits 2023-06-09 14:39:27 UTC
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

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

commit 68bb2e3ee06fa4dbf39f95dc76743be5cd5254f5
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Jun 9 16:39:27 2023 +0200

    [gdb/tui] Delete line buffer when switching to singlekey
    
    Say we're in TUI mode, and type "sun":
    ...
    (gdb) sun
    ...
    
    After switching to SingleKey mode using C-x s, we have just:
    ...
    sun
    ...
    
    After typing "d", we get:
    ...
    sun
    Undefined command: "sundown".  Try "help".
    ...
    
    The SingleKey "d" is supposed run the "down" command.
    
    Fix this by clearing the readline line buffer when switching to SingleKey
    mode.
    
    Tested on x86_64-linux.
    
    PR tui/30522
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30522
    
    Reviewed-By: Tom Tromey <tom@tromey.com>
Comment 3 Tom de Vries 2023-06-09 14:40:33 UTC
Fixed.