最近更新了QTCreater14版本,更新后QT5.15.2的项目无法正常调试,经过证实,发现是因为QTCreater14版本存在问题,gdb调试时无法正确使用python版本。
gdb错误信息:
>&"python from gdbbridge import *\n"
>&"Traceback (most recent call last):\n"
>&" File \"<string>\", line 1, in <module>\n"
>&" File \"C:/QT/5.15.2/Tools/QtCreator/share/qtcreator/debugger/gdbbridge.py\", line 16, in <module>\n"
>&" from dumper import DumperBase, Children, TopLevelItem\n"
>&" File \"C:/QT/5.15.2/Tools/QtCreator/share/qtcreator/debugger/dumper.py\", line 130, in <module>\n"
>&" class DumperBase():\n"
>&" File \"C:/QT/5.15.2/Tools/QtCreator/share/qtcreator/debugger/dumper.py\", line 3729, in DumperBase\n"
>&" @functools.lru_cache(maxsize = None)\n"
>&"AttributeError: 'module' object has no attribute 'lru_cache'\n"
>&"Error while executing Python code.\n"
>166^error,msg="Error while executing Python code."
>&"python theDumper.loadDumpers({\"token\":167})\n"
>&"Traceback (most recent call last):\n"
>&" File \"<string>\", line 1, in <module>\n"
>&"NameError: name 'theDumper' is not defined\n"
>&"Error while executing Python code.\n"
>167^error,msg="Error while executing Python code."
d[GDB] NOTE: ENGINE SETUP FAILED
d[GDB] State changed from EngineSetupRequested(1) to EngineSetupFailed(2)
<Debugging has failed.
d[GDB] State changed from EngineSetupFailed(2) to DebuggerFinished(16)
无奈只能换回QTCreater13.0.版本,切换之后恢复正常。下载链接:
https://download.qt.io/official_releases/qtcreator/13.0/13.0.2/
下载安装好后只需要手动选择一下之前已经安装好QT Kits的目录就好了,不需要再把Kits重新安装一遍。