gpt4 book ai didi

linux - 如何将一长串参数读入 GDB/DDD

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:29:54 26 4
gpt4 key购买 nike

我写了这个 C++ 程序,它有一个相当长的参数列表,我在 BASH 命令行提供。

但是用GDB调试,打字很痛苦在 GDB 命令提示符处运行 param1 param2 .... 以调试我的可执行文件。

那么有没有一种方法可以将这个冗长的列表存储到一个文本文件中,并告诉 GDB 查看这个文本文件中的参数,以便为我的 a.out 提供参数。

最佳答案

So is there a way to store this lengthy list into a text file and tell GDB to look at this text file for the parameters for supplying the arguments to my a.out

将其放入文本文件中:

set args foo bar baz ...

然后

(gdb) source commands.txt

或者:

gdb --args ./a.out foo bar baz ...
(gdb) run

关于linux - 如何将一长串参数读入 GDB/DDD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16006684/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com