Emacs 中的 gdb:如何启用 readline 功能?

gdb in Emacs: how to enable the readline features?

调用M-x gdb后,我开始了调试过程。但是,Emacs 不尊重我 .inputrc 中的以下内容:

"\C-p":history-search-backward
"\C-n":history-search-forward

如何解决这个问题,以便在 Emacs 的 GDB 控制台中更快地搜索历史记录?

当运行GDB inside Emacs时,不使用readline接口。相反,该界面是一种称为 Comint 的 Emacs 模式,它代表 "command interpreter" 并且是 运行 交互式程序的通用模式。这就是为什么它不获取 .inputrc 的内容的原因,这是一个 readline 配置文件。

在Comint模式下,您可以使用M-r搜索命令历史,它绑定到comint-history-isearch-backward-regexp。它的工作方式类似于 isearch:键入搜索字符串,然后按 C-rC-s 分别转到上一个或下一个匹配项。