如何调试从gdb中的脚本获取输入的c++程序
How to debug a C++ program that takes input from a script in gdb
背景信息:c++程序(LAMMPS -一个开放源代码)接受一个包含所有要执行的命令的输入脚本。可执行文件名为"lmp_fedora",输入脚本名为"in.hit"。程序的运行命令"。/lmp_fedora & lt;在。点击"
我的问题:我正试图调试LAMMPS中的.cpp文件之一。
My Attempts:我尝试了"gdb lmp_fedora
我的问题:你如何调试一个输入脚本(有命令链接到c++项目)使用gdb?
使用gdb run
命令:
$ gdb lmp_fedora
(gdb) run <in.hit
从帮助:
(gdb) help run
Start debugged program. You may specify arguments to give it.
Args may include "*", or "[...]"; they are expanded using "sh".
Input and output redirection with ">", "<", or ">>" are also allowed.
With no arguments, uses arguments last specified (with "run" or "set args").
To cancel previous arguments and run with no arguments,
use "set args" without arguments.
当您说gdb foo < bar
时,这意味着bar
输入到gdb
,而不是foo
。
我认为你想使用的是gdb
命令set args
。
相关文章:
- C++为构建时间获取QDateTime的可靠方法
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 使用指针从C++中的数组中获取最大值
- 如何获取std::result_of函数的返回类型
- 如何在openssl-ecc中获取十六进制格式的私钥
- 使用Unreal C++获取VR耳机的世界位置/方向
- 获取日期异步信号安全吗?如果在信号处理程序中使用,它会导致死锁吗
- 从C字符串中获取奇怪的字符串长度
- 从C++应用获取PowerShell脚本输出
- 困在PyObject_GetAttrString():如何从C++代码中获取Python函数脚本
- 如何在 ubuntu 上的 php 脚本中获取程序(c,c++,java,python,php)的执行时间和内存使用量?
- 从 qmake 运行脚本以获取内部版本号
- 获取对源文件中特定函数的所有调用并生成其他文件(使用 C、C++预处理器或脚本)
- Linux获取通过execl脚本启动的程序的PID
- 如何在 V8 中获取脚本的源文件名
- C++cgi脚本获取空的环境变量作为表单的操作
- 在QT中获取Python脚本的输出
- 如何调试从gdb中的脚本获取输入的c++程序
- 如何通过脚本从Windbg中获取C++属性的地址