GDB:如何添加一个运行命令的组合键? [英] GDB: How to add a key combination which runs a command?
问题描述
我使用 -tui
模式使用 GNU gdb(GDB)7.10.1
。我想为命令 up
和 down
添加一个组合键。对于向上
和 Ctrl + d kbd> for down
。
I'm using GNU gdb (GDB) 7.10.1
with the -tui
mode. I would like to add a key combination for the commands up
and down
. Something like Ctrl+u for up
and Ctrl+d for down
.
我只看过readline的评论,但没有解释如何整合gdb init文件中的组合。任何想法?
I've seen only comments about readline but not an example explaining how to integrate the combination in the gdb init file. Any idea?
推荐答案
我不是TUI用户,但我的理解是TUI有两种模式。
I am not a TUI user, but my understanding is that the TUI has two modes.
在其初始(普通)模式下,它使用readline,如普通的gdb CLI。 Readline提供了重新绑定密钥的方法
In its initial (normal) mode, it uses readline like the ordinary gdb CLI. Readline provides a way to rebind keys via ~/.inputrc
. The main thing you need to know here is that gdb is, sensibly enough, called "gdb" for readline's purposes. So a binding might look like:
$if gdb
"\C-u": "up\n"
$endif
TUI还有一个单键模式。据我所知,这种模式不使用readline,也没有办法重新绑定密钥。但是,在这种模式下,u和d已经按照你喜欢的方式绑定了。
The TUI also has a "single key" mode. As far as I know, this mode doesn't use readline and there is no way to rebind keys. However, in this mode, "u" and "d" are already bound the way you'd like.
这篇关于GDB:如何添加一个运行命令的组合键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!