2015-06-05 151 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.任何人都可以解釋這一點?