0

I use ddd as frontend for gdb.

I want to prepare a small file which contains some commands like

(gdb) graph display x

But if I do a

(gdb) source myfile

and myfile contains any graph command the result is:

(gdb) source myfile
x:1: Error in sourced command file:
Undefined command: "graph".  Try "help".
(gdb) graph display res

Any idea how I can script ddd. It looks that the source command is executed from gdb and gdb itself knows no "graph" command. But how to load a script in ddd itself?

4

2 回答 2

1

我发现在 DDD 中,我们可以使用菜单“Commands-Define Command”菜单将命令序列定义为新命令。在那里,您可以将任何 DDD 命令序列定义为新命令。
例如,要定义一个命令 disp1,您可以这样定义它。
我使用“记录”按钮开始命令记录并使用“结束”按钮结束它。我想你也可以稍后编辑它。
然后,您可以选择您想要的命令按钮出现的位置。例如,如果选择“源”按钮,命令按钮会出现在源窗口窗格上方,如果选择“数据”,它会出现在“数据”窗口中。您可以在编辑它时尝试“执行”以查看它是否正常工作。最后你按下'nd按下'执行'按钮,它们就会被执行。

在此处输入图像描述

定义命令后,它会出现在命令/源/数据窗口上方,如下所示。您可以通过按下按钮来执行它。

在此处输入图像描述

于 2017-08-29T07:15:16.447 回答
1

graph display命令属于ddd,而不是gdb

source <file_name>属于gdb。您可以使用它执行文件中列出的gdb命令。

因此,就您而言,就像您在gdbgraph display上输入命令一样。而且gdb不知道任何命令,因此会出错。graph display

根据ddd 手册,我认为还没有在ddd中加载脚本的支持。

于 2016-03-11T17:18:03.917 回答