通常,在gdb上运行程序时,程序的参数将在run命令中给出.有没有办法使用gdb运行程序,并在shell脚本中提供参数?
我在相关问题中看到了一个答案,提到我们可以在脚本开始执行后将gdb附加到程序中.但接下来我将不得不"等待"该计划.
我很好奇是否还有其他方法可以做到这一点.
我在gdb中启动程序时遇到此错误:
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
Run Code Online (Sandbox Code Playgroud)
谷歌发现了这个错误报告:http://osdir.com/ml/debian-gcc/2014-02/msg00061.html
这个错误报告列表使用python print sys.pathgdb提示符上的命令.但是,当我尝试在gdb提示符上使用任何python时,会发生这种情况:
(gdb) python print sys.path
File "<string>", line 1
print sys.path
^
SyntaxError: invalid syntax
Error while executing Python code.
(gdb) python print "Hello"
File "<string>", line 1
print "HellO"
^
SyntaxError: invalid syntax
Error while executing Python code.
Run Code Online (Sandbox Code Playgroud)
我正在使用Ubuntu 14.04 LTS,相关版本信息:
$ gcc --version
gcc …Run Code Online (Sandbox Code Playgroud)