我在windows10上使用eclipse 4.16.0和Mingw-w64。我的gdb(8.1)版本支持python。我的机器上有python 2.7.9(与我在Mingw-W64文件夹中找到的python版本兼容)。问题是当我在eclipse中选中“在变量/表达式树中启用漂亮的打印机”的选项时;这不起作用,因为我在调试器窗口中仍然看不到std::vector的元素。我搜索并找到了这个页面:https://wiki.eclipse.org/CDT/User/FAQ#How_can_I_inspect_the_contents_of_STL_containers.3F作为指南,但我认为这并没有更新,因为eclipse中已经有了漂亮的打印机选项。当我在gdb中运行info pretty-printers时,一切看起来都很好!所有的容器和迭代器都会出现。我还检查了gdbinit的内容,它包含:
python
import sys
sys.path.insert(0, sys.path[0] + '/../../gcc-8.1.0/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end所以我觉得这个https://sourceware.org/gdb/wiki/STLSupport是不应该做的。我说的对吗?如果有人能帮我找出问题出在哪里,我将不胜感激。
发布于 2020-09-11 17:55:52
我已经找到解决方案了!事实上,即使使用最新版本的eclipse和支持python的Mingw-w64,也需要手动完成一些工作。首先,确保您的系统上正确安装了python 2.7 (与Mingw支持的版本兼容)。这意味着python路径被添加到系统的环境中。其次,在我的例子中,唯一应该做的就是修改以下目录中的.gdbint : C:\Program python修改它,使其indisde '‘为python27的路径
我的.gdbint现在包含:
python导入sys Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\share\gcc-8.1.0\python') (0,'C:\Program sys.path.insert
从libstdcxx.v6导入register_libstdcxx_printers register_libstdcxx_printers (无)结束
然后,最后一步是调试配置;编辑配置/调试器您只需要以以下方式更改gdb命令文件: C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\etc\gdbinit
https://stackoverflow.com/questions/63649565
复制相似问题