我正试图在eclipse cdt中为STL对象添加漂亮的打印.我试着按照这里描述的步骤:
http://sourceware.org/gdb/wiki/STLSupport
我检查了python文件夹,但我似乎无法完成这个...
我创建了一个gdbinit并为我的调试配置选择,但每当我尝试开始调试时,我都会收到以下错误:
Error while executing Python code.
!STACK 0
java.lang.Exception: /home/lizardking/workspace/eu.sofia.kpi.cpp.x86.testapp/.gdbinit:6: Error in sourced command file:
Error while executing Python code.
at org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl$RxThread.processMIOutput(AbstractMIControl.java:824)
at org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl$RxThread.run(AbstractMIControl.java:662)
Run Code Online (Sandbox Code Playgroud)
如果我尝试在python shell中执行gdbinit的内容,我会收到此错误:
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sys
sys.path.insert(0, '/home/Documents/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named libstdcxx.v6.printers
Run Code Online (Sandbox Code Playgroud)
似乎我没有这样的模块......我对Python没有任何线索所以我甚至不知道Python中的"模块"是什么....
有人可以帮我这个吗?能够看到真正的调试信息对我来说非常重要,或者对它来说非常重要.或者我甚至可以从控制台调试并从gdb获得不错的输出,因为如果我打印一个字符串,例如我得到无用的输出....
问候,亚历克斯
我在 Ubuntu 16.04 上使用 Nsight。我当前的设置允许我通过 nsight IDE 完美地编译和运行我的代码。在确保程序是在调试模式下构建的(最初不是)后,它最终允许我单步调试我的代码。
我遇到的问题是每当我尝试调试代码时,所有变量都显示“不可用”。另外,如果我将鼠标悬停在变量上,它会显示类似“-var-create:无法创建变量对象”之类的内容。这看起来可能是编译器的问题?也许它没有添加它应该做的事情?
Nsight 版本为 7.5,GCC & G++ 版本为 5.3.1,GDB 版本为 7.11,NVCC 版本为 7.5.17。