2015-06-05 146 views
1

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

调试运行开始

调试运行失败

调试运行结束

从来没有真正启动调试器。

输出在终端:

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-蟒选项。我发现有人用这个选项构建,但没有任何反应。

+1

https://docs.python.org/2.7/library/importlib.html'2.7版本的新功能' – Amartel

+0

@Amartel在Python交互模式下安装Python2.7并导入importlib成功。但Qt Creator仍然报告相同的错误。默认的python命令现在指向Python2.7。 –

+0

我不知道为什么QTCreator想要启动python调试器,但看起来你错过了它。尝试运行python -m pdb,看看你得到了什么。如果你在Linux上,你可能需要安装某种python-devel软件包。 – Andre

回答

3

在终端的输出端露出的两个问题:

  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.任何人都可以解释这一点?