如何在 GDB 中编辑用户定义的命令

How to edit user-defined command in GDB

例如,我创建了一个名为print_info

的命令
(gdb) define print_info
> i r
> end

现在我想将此命令编辑为

i r $eax

我知道我可以 运行 define print_info 并重新定义它。但我想知道我是否可以根据现有命令对其进行编辑。这样当命令很复杂时,我不必完全重写。

I want to know if I can just edit it base on the existed command.

没有

So that when the command is complex, I don't have to do a complete rewrite.

将命令保存到一个文件中,并在编辑该文件后使用 source filename 重新定义您的 print_info 命令。