【问题标题】:Pretty Printers Error while executing Python code in Eclipse Ubuntu 14在 Eclipse Ubuntu 14 中执行 Python 代码时出现漂亮的打印机错误
【发布时间】:2014-12-18 03:22:41
【问题描述】:

我正在尝试在 Ubuntu 14.0.4 的 Eclipse 中启用 Pretty Printing。 我已按照步骤设置漂亮的打印:http://wiki.eclipse.org/CDT/User/FAQ 我已经 SVNed 一个目录,使用建议的代码和正确的路径创建了一个 .gdbinit 文件,并将我的 Eclipse 调试指向该文件。我已经修复了 printers.py 文件中的错误。当我使用此选项运行调试时,我得到 ​​p>

Error in final launch sequence
Failed to execute MI command:
source /home/dreitz/python/init.gdbinit
Error message from debugger back end:
/home/dreitz/python/init.gdbinit:6: Error in sourced command file:\nError while executing Python code.
/home/dreitz/python/init.gdbinit:6: Error in sourced command file:\nError while executing Python code.

init.gdbinit 包含 python 启动代码。谁能看出这是什么问题?

我发现一些让我感到困惑的解决方案:

  • 一个 ~/.gdbinit 文件被引用为正在更新,而不是创建您自己的 .gdbinit 文件。我不知道在哪里可以找到这个预先存在的文件。

  • 与版本不匹配。我检查了 GDB 是否已安装,并且 python 2.7.8 已安装。

【问题讨论】:

    标签: c++ eclipse ubuntu gdb pretty-print


    【解决方案1】:

    经过一些测试,对我有用的是将 .gdbinit 内容更改为:

    python
    import sys
    sys.path.insert(0, '/your/path/here/python')
    sys.path.insert(0, '/your/path/here/python/libstdcxx/v6')
    from libstdcxx.v6.printers import register_libstdcxx_printers
    end
    

    基本上,我将其中一个子文件夹添加到路径中,并删除了调用方法 register_libstdcxx_printers (None) 的行,因为我的 gdb 抱怨它已经加载。

    我不知道为什么原来的命令不起作用,但至少现在可以了。

    【讨论】:

      猜你喜欢
      • 2014-07-13
      • 1970-01-01
      • 1970-01-01
      • 2010-09-13
      • 2021-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多