Shaobo Zi
Shaobo Zi

Reputation: 739

Qt Creator failed to start Debugger

Qt c++ project build under Qt Creator 3.4.1 successfully. But when I just can't launch the debugger. Output in the application Output:

Debuging starts

Debuging has failed

Debuging has finished

The debugger never really starts.

output in the terminal :

    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)

More information:

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 .

when I install gdb wiht source code I did not append --with-python option. I googled out that someone did build with that option but nothing happens.

Upvotes: 1

Views: 5926

Answers (1)

Shaobo Zi
Shaobo Zi

Reputation: 739

The outputs in terminal exposed two issues:

  1. the ImportError: No module named importlib leads to unsupported library in Python. So install new version of Python (greater than 2.7) as @Amartel said.But the in my situation the gdb needs to be rebuild with --with-python configuration option to make gdb use newer version of Python.

  2. Python Exception <type 'exceptions.ImportError'> No module named gdb: /usr/local/bin/gdb' can been solved by copy files in the directory: gdb_src_dir/gdb/data-directory/python/gdb to /usr/local/share/gdb. NOTE: my gdb is installed under/usr/local/bin.

Finally, the debugger works all fine.

However, I did not get the reason for issues 2. Any one can explain that?

Upvotes: 3

Related Questions