是否可以在 GDB 中为命令定义任意组合键?我想知道是否有类似 vim map 命令的东西。例如,我想映射到下一个,到一步,等等..
问问题
1470 次
2 回答
3
在 gdb 中映射键(在 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"
更多信息在这里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 具有内置的基于文本的 gui 称为 TUI 模式,甚至可以在 cygwin/win7 中工作,示例用法:
> g++ -Wall -g -lm -std=c++14 hello.cpp
> gdb -tui a.exe
按 Cx s .. 进入单键模式
q - quit, exit SingleKey mode.
c - continue
d - down
f - finish
n - next
r - run
s - step
u - up
v - info locals
w - where
更多信息https://volse.anduin.net/rabalder/2015/06/01/gdb-tricks-text-based-ui.html和这里https://ftp.gnu.org/old-gnu/Manuals/gdb /html_chapter/gdb_19.html
于 2018-04-25T21:53:40.563 回答
2
GDB 使用 GNU readline 来读取输入。此处的文档(或仅键入man readline
)。
特别要注意如何绑定F1插入文本的例子Function key 1
。
于 2012-10-27T17:06:07.433 回答