CLion 远程调试控制台`pretty printers setup`错误

作者:一年又一年 分类: 📐 技术 发布时间:2019-12-14 23:09 8420 次浏览 2 条评论

背景:CLion 项目的 Toolchains 配置为 Remote Host,即远程编译、远程运行、远程调试。(CLion 2019.2.x)

在运行调试时,调试控制台输出提示:

Error during pretty printers setup: Error while executing Python code.

Some features and performance optimizations will not be available. 

虽然不是什么关键性问题...

----

根据

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000098784-Python-error-when-debugging

为 CLion debugger 模块启用调试级别的日志记录具体看看错误内容。

关键词:#com.jetbrains.cidr.execution.debugger (详见上方链接)


得到相关日志如下:

DEBUG - brains.cidr.execution.debugger - >python import sys; sys.dont_write_bytecode = True; sys.path.insert(0, "{CLion 目录}/bin/gdb/renderers"); from de...
DEBUG - brains.cidr.execution.debugger - <&"python import sys; sys.dont_write_bytecode = True; sys.path.insert(0, \"{CLion 目录}/bin/gdb/renderers\"); fro...
DEBUG - brains.cidr.execution.debugger - <&"Traceback (most recent call last):\n"
DEBUG - brains.cidr.execution.debugger - <&"  File \"<string>\", line 1, in <module>\n"
DEBUG - brains.cidr.execution.debugger - <&"ImportError: No module named default.printers\n" 
DEBUG - brains.cidr.execution.debugger - <&"Error while executing Python code.\n"
DEBUG - brains.cidr.execution.debugger - <^error,msg="Error while executing Python code."

(根据代码片段和错误信息,我推测 CLion 可能尝试在远程服务器上运行——那些本应该在本地主机运行的、存放在本地主机 CLion 安装目录的 Python 模块(default.printers))


根据

https://youtrack.jetbrains.com/issue/CPP-14177

确实如推测。这个问题在 2018 年 9 月提出,已经得到了确认,但截止到本文撰写之时,过去了一年多时间,还停留在 In Progress 阶段。不过文中提供了临时解决的 workaround。


方法大致为:

拷贝一份 {CLion 目录}/bin/gdb/renderers 到远程主机的某个目录,如 /tmp/gdb/renderers

scp -r {CLion 目录}/bin/gdb/renderers/* remoteUser@remoteHost:/tmp/gdb/renderers/

然后配置一个路径映射,将本地的 {CLion 目录}/bin/gdb/renderers 路径映射为远程主机上的路径:

 Settings -> Build,Execution,Deployment -> Deployment -> Select Proper Host -> Mappings Tab

{CLion 目录}/bin/gdb/renderers -> /tmp/gdb/renderers


配置了这个路径映射后,会使得之后调试时内部运行的 Python 脚本代码里的 {CLion 目录}/bin/gdb/renderers 字符串被替换为 /tmp/gdb/renderers,加之复制了这些脚本文件到远程主机的相应目录,从而问题得以解决。


CLion gdb renderers 远程 调试 remote debug default.printers

♥ 若您欲转载敝站的原创内容,还请您附注出处及相应链接

评论

  1. Avatar of 那人
    那人 2020-05-28 15:50 回复

    太感谢了

    1. Avatar of 一年又一年
      一年又一年 2020-05-30 11:38 回复

      @那人:😀

发表评论

* 标注的项目为必填项。

您的邮箱地址将不会在页面中公开
您的站点地址将会被检查,如被认为不适则可能被移除
Ɣ回顶部