Reputation:
When searching gdb command history, is there a way to go through only those command matching a given one?
for example, sometimes I only want to search previous break commands, not the entire command history. Is there a shortcut to only go through commands that start with "break" or "b"? That can save me a million keystroke.
Upvotes: 8
Views: 2106
Reputation: 25599
In regular GDB, CtrlR enables search mode. This works the same as bash, zsh, and many other shells.
Once in search mode, the prompt changes:
(reverse-i-search)`':
Typing letters then enters the text to find:
(reverse-i-search)`br': break main
To find the next command that matches, hit CtrlR again.
To run the command again, hit Enter.
To edit the command, hit the left or right cursor key.
Upvotes: 18