gpt4 book ai didi

python - Qt Creator 启动调试器失败

转载 作者:行者123 更新时间:2023-11-30 02:38:37 24 4
gpt4 key购买 nike

在 Qt Creator 3.4.1 下成功构建 Qt c++ 项目。但是当我无法启动调试器时。应用程序中的输出输出:

调试开始

调试失败

调试完成

调试器永远不会真正启动。

终端输出:

    QProcess: Destroyed while process ("/usr/local/bin/gdb") is still running.
Unexpected GDB stderr: "Python Exception <type 'exceptions.ImportError'> No module named gdb:
/usr/local/bin/gdb: warning:
Could not load the Python gdb module from `/usr/local/share/gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.

"
Warning: HANDLE RUNCONTROL START FAILED (no active run control)
Warning: State changed from EngineSetupFailed(2) to DebuggerFinished(23) [master] (no active run control)
Warning: (gdb) (no active run control)
Warning: 48^done (no active run control)
Warning: (gdb) (no active run control)
Warning: UNEXPECTED GDB STDERR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/Qt5.4.2/Tools/QtCreator/share/qtcreator/debugger/gdbbridge.py", line 20, in <module>
from dumper import *
File "/opt/Qt5.4.2/Tools/QtCreator/share/qtcreator/debugger/dumper.py", line 37, in <module>
import importlib
ImportError: No module named importlib
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'theDumper' is not defined
(no active run control)
Unexpected GDB stderr: "Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/Qt5.4.2/Tools/QtCreator/share/qtcreator/debugger/gdbbridge.py", line 20, in <module>
from dumper import *
File "/opt/Qt5.4.2/Tools/QtCreator/share/qtcreator/debugger/dumper.py", line 37, in <module>
import importlib
ImportError: No module named importlib
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'theDumper' is not defined
"
Warning: QUIT DEBUGGER REQUESTED IN STATE 23 (no active run control)

更多信息:

gcc used by qt creator : version 5.0.1
gdb used by qt creator : version 7.9

python 2.6.6 installed on my CentOS 6.5 ,and is in PATH .

当我使用源代码安装 gdb 时,我没有附加 --with-python 选项。我用谷歌搜索发现有人确实使用该选项进行构建,但没有任何反应。

最佳答案

终端的输出暴露了两个问题:

  1. ImportError: No module named importlib导致 Python 中不受支持的库。因此,按照@Amartel 的说法安装新版本的 Python(大于 2.7)。但是在我的情况下,gdb 需要使用 --with-python 配置选项重建以使 gdb 使用较新版本的 Python .

  2. Python Exception <type 'exceptions.ImportError'> No module named gdb:
    /usr/local/bin/gdb'
    可以通过复制目录中的文件来解决:gdb_src_dir/gdb/data-directory/python/gdb/usr/local/share/gdb .注意:我的 gdb 安装在 /usr/local/bin 下.

最后,调试器工作正常。

但是,我没有得到问题 2 的原因。任何人都可以解释一下吗?

关于python - Qt Creator 启动调试器失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30661671/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com