我可以在gdb中更改RET的绑定吗? [英] Can I change the binding of RET in gdb?
问题描述
我想在输入回车符重复执行最后输入的命令时禁用gdb行为.我只希望它什么也不做.这可能吗?
I'd like to disable the gdb behavior where typing a carriage return repeats execution of the last command entered. I'd just like it to do nothing. Is this possible?
推荐答案
似乎重复大多数命令是gdb的默认行为,并且没有设置可以更改它.这就是它在gdb的源代码中的样子:
It seems that repeating most commmands is a default gdb's behavior and there is no setting to change it. This is how it looks in gdb's source:
/* Handle a complete line of input. This is called by the callback
mechanism within the readline library. Deal with incomplete
commands as well, by saving the partial input in a global
buffer. */
static void
command_line_handler (char *rl)
{
...
int repeat = (instream == stdin);
因此您可以看到,如果instream
是STDIN
,则将repeat
分配为1.没有其他方法可以为repeat
分配不同的值.
So as you can see repeat
is assigned 1 if instream
is STDIN
. There is no other way to assign repeat
a different value.
因此,您可以做的是从gdb的源代码在计算机上构建自己的gdb
可执行文件(
So what you can do is to build your own gdb
executable on your machine from gdb`s source (http://ftp.gnu.org/gnu/gdb/). But before building change a little the line 591 in gdb/event-top.c. Instead of
int repeat = (instream == stdin);
写
int repeat = 0;
这篇关于我可以在gdb中更改RET的绑定吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!