Is it possible to define an arbitrary key combination to a command in GDB? I would like to know if there is something like the VIM map command. For example, I would like to map to next, to step, and so on..
To map keys in gdb (tested on gdb/cygwin/win7)
1. Start gdb
2. Find the key generated by F7, Press C-v F7
(gdb) ^[[18~
3. vi ~/.inputrc
# Map F7 to next
"\e[18~": "n\n"
4. Restart gdb, and now F7 will be mapped to "next\n"
More Info here https://sourceware.org/gdb/onlinedocs/gdb/Readline-Init-File-Syntax.html
# Sample ~/.inputrc
$if Gdb
"\e[23~": "next\n # [F7] next.\n"
"\e[A": "# Up key\n"
"\e[B": "next\n # [Down] next line.\n"
"\e[C": "step\n # [Right] step into func.\n"
"\e[D": "finish\n # [Left] to finish.\n"
$endif
gdb has builtin text based gui called TUI mode, even works in cygwin/win7, Sample usage:
> g++ -Wall -g -lm -std=c++14 hello.cpp
> gdb -tui a.exe
Press C-x s .. for Single key mode
q - quit, exit SingleKey mode.
c - continue
d - down
f - finish
n - next
r - run
s - step
u - up
v - info locals
w - where
More info https://volse.anduin.net/rabalder/2015/06/01/gdb-tricks-text-based-ui.html and here https://ftp.gnu.org/old-gnu/Manuals/gdb/html_chapter/gdb_19.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With