1

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.

Shaobo Zi
  • 709
  • 1
  • 10
  • 25
  • 1
    https://docs.python.org/2.7/library/importlib.html 'New in version 2.7' – Amartel Jun 05 '15 at 08:34
  • @Amartel Python2.7 installed and `import importlib` is successful in Python interactive mode. But Qt Creator still report the same error. The default python command points to Python2.7 now. – Shaobo Zi Jun 05 '15 at 09:55
  • I am not sure why QTCreator wants to start python debugger, but it looks like you are missing it. Try running python -m pdb and see what you get. If you are on a Linux, you might need to install some sort of python-devel package. – Andre Jun 05 '15 at 10:01
  • @Amartel A little step forward: GDB use python2.6 although Python2.7 has been installed. should i rebuild gdb with --with python option? – Shaobo Zi Jun 05 '15 at 10:07
  • Have you build gdb manually? If so - then yes, try to rebuild it. Also, most info about your problem I got here: http://stackoverflow.com/questions/11492683/django-apache-mod-wsgi-no-module-named-importlib – Amartel Jun 05 '15 at 10:09
  • 1) check that you really have a gdb at the path shown (or change your debugger in the tool chain, and remember to select the new tool chain); 2) clean all breakpoints – Thalia Jun 05 '15 at 15:54

1 Answers1

3

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?

Shaobo Zi
  • 709
  • 1
  • 10
  • 25