gdb reads its input commands via the readline interface. This gnu library provides consistent behavior for programs which provide a command line interface to the user. Advantages are gnu Emacs-style or vi-style inline editing of commands, csh-like history substitution, and a storage and recall of command history across debugging sessions.
You may control the behavior of command line editing in gdb with the command set.
Enable command line editing (enabled by default).
Disable command line editing.
Show whether command line editing is enabled.