【问题标题】:Eclipse CDT prettyprint brokenEclipse CDT 漂亮打印损坏
【发布时间】:2014-01-24 01:06:51
【问题描述】:

我正在使用 Ubuntu 13.10、Eclipse Kepler Service Release 1、GDB 7.6.1-ubuntu 和可通过 Eclipse“安装新软件”获得的最新 CDT。我按照几个网站上发布的说明为 STL 容器设置了漂亮打印。

由于它不能以这种方式工作,因此我按照其他说明修改了 printers.py 以将字符串的 len 最大化为 100,并将所有 raise ValueError, "..." 格式化为 raise ValueError("..." )。

我的 .gdbinit 文件如下:

python
import sys
sys.path.insert(0, '/home/fbence/stlPrettyPrinter')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end

我的设置如下:

http://fbence.web.elte.hu/setup.png

如果我转到调试按钮,它会将我的配置设置为第一个,并且它似乎也使用它(否则我不必更改我认为的 printers.py),但调试为...是空的。

gbd 跟踪有如下消息:

193,677 36^error,msg="无法获得子迭代器"。

193,674 35^done,name="var5",numchild="0",value="{static npos = , _M_dataplus = {> = {<__ gnu_cxx::new_allocator> = {}, }, _M_p = 0x0}}",type="std::stri\ ng",thread-id="1",displayhint="string",dynamic="1",has_more="0"

这是输出: http://fbence.web.elte.hu/eclipseproblem.png

当我想打印一个简单的向量时,从终端使用 gdb 会产生以下输出:

Python Exception <class 'TypeError'> iter() returned non-iterator of type '_iterator':

$3 = std::vector of length 6, capacity 16

显然,我的问题是,我该如何解决这个问题?没有prettyprint,我宁愿在windows下调试,但我真的不想这样做:)

【问题讨论】:

  • 在没有 Eclipse 的情况下,gdb 命令行中是否可以进行漂亮的打印?
  • 我编辑了这个问题,简短的回答是否定的:)

标签: gdb eclipse-cdt pretty-print


【解决方案1】:

gdb libstdc++ 漂亮的打印机现在实际上在 Ubuntu 13.10 中被破坏了。例如,请参阅this bug

gdb 在 Ubuntu 13.10 中与 Python3 链接,而漂亮的打印机脚本仅支持 Python2 语法。您可以将this patch 应用于您漂亮的打印机。它将增加对 Python3 的支持。尽管我不使用 Eclipse 进行调试,但此解决方案对我有用。

【讨论】:

    猜你喜欢
    • 2014-07-13
    • 1970-01-01
    • 2010-09-13
    • 2014-07-01
    • 2011-06-26
    • 2016-05-31
    • 2015-11-07
    • 1970-01-01
    • 2021-06-22
    相关资源
    最近更新 更多