简体   繁体   English

Qt Creator 无法在 Mac 上开始调试

[英]Qt Creator fails to start debugging on Mac

Recently (I suspect some system/homebrew update) the Qt's debugger stopped working.最近(我怀疑一些系统/自制程序更新)Qt 的调试器停止工作。 It hangs forever on Setting up inferior...它永远挂在Setting up inferior...

The internal log:内部日志:

dStart parameters: 'QGIS' mode: 1
dABI: x86-darwin-generic-mach_o-64bit
dLanguages: c++ 
dExecutable: ./QGIS 
dDirectory: ./build/output/bin/QGIS.app/Contents/MacOS
dDebugger: /Library/Developer/CommandLineTools/usr/bin/lldb
dProject: ./QGIS
dAdditional Search Directories:
dSysroot: 
dDebug Source Location: 
dDebugger settings:
dAdditionalArguments:   (default: )
dAdjustBreakpointLocations: true  (default: true)
dAllPluginBreakpoints: true  (default: true)
dAlwaysAdjustColumnWidths: true  (default: true)
dAutoDerefPointers: true  (default: true)
dAutoEnrichParameters: true  (default: true)
dAutoQuit: false  (default: false)
dBreakEvent:   (default: )
dBreakOnAbort: false  (default: false)
dBreakOnCatch: false  (default: false)
dBreakOnCrtDbgReport: false  (default: false)
dBreakOnFatal: false  (default: false)
dBreakOnThrow: false  (default: false)
dBreakOnWarning: false  (default: false)
dBreakpointCorrection: true  (default: true)
dBreakpointsFullPath: false  (default: false)
dCDB_Console: false  (default: false)
dCloseBuffersOnExit: false  (default: false)
dCloseMemoryBuffersOnExit: true  (default: true)
dDisplayStringLimit: 100  (default: 100)
dEnableReverseDebugging: false  (default: false)
dExtraDumperFile:   (default: )
dFirstChanceExceptionTaskEntry: true  (default: true)
dFontSizeFollowsEditor: false  (default: false)
dGdbCustomDumperCommands:   (default: )
dGdbPostAttachCommands:   (default: )
dGdbStartupCommands:   (default: )
dIdentifyDebugInfoPackages: false  (default: false)
dIgnoreFirstChanceAccessViolation: false  (default: false)
dIntelFlavor: false  (default: false)
dLoadGdbDumpers2: false  (default: false)
dLoadGdbInit: true  (default: true)
dLogTimeStamps: false  (default: false)
dMaximalStackDepth: 20  (default: 20)
dMaximalStringLength: 10000  (default: 10000)
dMultiInferior: false  (default: false)
dNoPluginBreakpoints: false  (default: false)
dQmlInspector.ShowAppOnTop: false  (default: false)
dRaiseOnInterrupt: true  (default: true)
dSecondChanceExceptionTaskEntry: true  (default: true)
dSelectedPluginBreakpoints: false  (default: false)
dSelectedPluginBreakpointsPattern: .*  (default: .*)
dShowQObjectNames2: true  (default: true)
dShowQmlObjectTree: true  (default: true)
dShowQtNamespace: true  (default: true)
dShowStandardNamespace: true  (default: true)
dShowThreadNames: false  (default: false)
dSkipKnownFrames: false  (default: false)
dSortStructMembers: true  (default: true)
dSourcePaths:   (default: )
dStationaryEditorWhileStepping: false  (default: false)
dSwitchModeOnExit: false  (default: false)
dSymbolPaths:   (default: )
dTargetAsync: false  (default: false)
dUseAddressInBreakpointsView: false  (default: false)
dUseAddressInStackView: false  (default: false)
dUseAlternatingRowColours: false  (default: false)
dUseCodeModel: true  (default: true)
dUseDebuggingHelper: true  (default: true)
dUseDynamicType: true  (default: true)
dUseMessageBoxForSignals: true  (default: true)
dUsePythonDumper: true  (default: true)
dUseToolTips: true  (default: true)
dUseToolTipsInBreakpointsView: false  (default: false)
dUseToolTipsInLocalsView: false  (default: false)
dUseToolTipsInStackView: true  (default: true)
dWarnOnReleaseBuilds: true  (default: true)
dWatchdogTimeout: 20  (default: 20)
dState changed from DebuggerNotReady(0) to EngineSetupRequested(1)
dCALL: SETUP ENGINE
dSTARTING LLDB: /Library/Developer/CommandLineTools/usr/bin/lldb
 Setting up inferior...
<1loadDumpers({"token":1})
<2setupInferior({"attachpid":0,"breakonmain":0,<environment suppressed>,"executable":"/Users/peter/Projects/qgis3/build-QGIS-Qt_5_12_3_5_12_3-Debug/output/bin/QGIS.app/Contents/MacOS/QGIS","nativemixed":0,"platform":"","processargs":"","remotechannel":"","startmode":1,"sysroot":"","token":2,"useterminal":0,"workingdirectory":"./output/bin/QGIS.app/Contents/MacOS"})

eERROR: Lldb stderr: error: there is no embedded script interpreter in this mode.
eerror: there is no embedded script interpreter in this mode.
eERROR: Lldb stderr: error: there is no embedded script interpreter in this mode.
eerror: there is no embedded script interpreter in this mode.

>(lldb) script sys.path.insert(1, '/Applications/Qt Creator.app/Contents/Resources/debugger/')
>(lldb) script from lldbbridge import *
>(lldb) script theDumper.loadDumpers({"token":1})
>(lldb) script theDumper.setupInferior({"attachpid":0,"breakonmain":0,"environment":["4170706c655f5075625375625f536f636b65745f52656e6465723d2f707269766174652f746d702f636f6d2e6170706c652e6c61756e6368642e523977366371596a6d642f52656e646572","434c49434f4c4f523d31","444953504c41593d2f707269766174652f746d702f636f6d2e6170706c652e6c61756e6368642e734648496356415574732f6f72672e6d61636f73666f7267652e7871756172747a3a30","484f4d453d2f55736572732f7065746572","484f4d45425245575f43433d636c616e67","484f4d45425245575f4358583d636c616e672b2b","484f4d45425245575f4e4f5f4155544f5f5550444154453d31","4c414e473d656e5f55532e5554462d38","4c435f414c4c3d656e5f55532e5554462d38","4c435f43545950453d5554462d38","4c4f474e414d453d7065746572","4f4c445057443d2f55736572732f70657465722f50726f6a656374732f71676973332f51474953","504154483d2f7573722f6c6f63616c2f7362696e3a2f7573722f6c6f63616c2f62696e3a2f7573722f62696e3a2f62696e3a2f7573722f7362696e3a2f7362696e3a2f4c6962726172792f5465582f74657862696e3a2f6f70742f5831312f62696e","5053313d5c5b5c655b33326d5c5d5c755c5b5c655b6d5c5d5c5b5c655b33326d5c5d405c5b5c655b6d5c5d5c5b5c655b33326d5c5d5c685c5b5c655b6d5c5d3a5c5b5c655b33346d5c5d5c775c5b5c655b6d5c5d5c2420","51544449523d2f7573722f6c6f63616c2f43656c6c61722f71742f352e31322e33","534543555249545953455353494f4e49443d3138366138","5348454c4c3d2f62696e2f62617368","53484c564c3d31","5353485f415554485f534f434b3d2f707269766174652f746d702f636f6d2e6170706c652e6c61756e6368642e7836626d74703371524a2f4c697374656e657273","5445524d3d787465726d2d323536636f6c6f72","5445524d5f50524f4752414d3d4170706c655f5465726d696e616c","5445524d5f50524f4752414d5f56455253494f4e3d3432312e32","5445524d5f53455353494f4e5f49443d34434644433031342d393731392d344437442d394132382d344637413739354235453632","544d504449523d2f7661722f666f6c646572732f395f2f316e747a31736778317167666c6b32707973686e74726d7230303030676e2f542f","555345523d7065746572","5850435f464c4147533d307830","5850435f534552564943455f4e414d453d6f72672e71742d70726f6a6563742e717463726561746f722e3435343736","5f3d2f7573722f62696e2f6f70656e","5f5f43465f555345525f544558545f454e434f44494e473d30783146353a3078303a307830"],"executable":"/Users/peter/Projects/qgis3/build-QGIS-Qt_5_12_3_5_12_3-Debug/output/bin/QGIS.app/Contents/MacOS/QGIS","nativemixed":0,"platform":"","processargs":"","remotechannel":"","startmode":1,"sysroot":"","token":2,"useterminal":0,"workingdirectory":"/Users/peter/Projects/qgis3/build-QGIS-Qt_5_12_3_5_12_3-Debug/output/bin/QGIS.app/Contents/MacOS"})

the relevant error is probably:相关错误可能是:

ERROR: Lldb stderr: error: there is no embedded script interpreter in this mode.

I have lldb-1100.0.25.3, MacOS 10.14.5, Qt Creator 4.9.0 (Based on Qt 5.12.2 (Clang 10.0 (Apple), 64 bit))我有 lldb-1100.0.25.3、MacOS 10.14.5、Qt Creator 4.9.0(基于 Qt 5.12.2(Clang 10.0(Apple),64 位))

This appears to be an issue with the LLDB that comes with CLTools.这似乎是 CLTools 附带的 LLDB 的问题。 A temporary workaround would be to fallback to Python 2 by setting the following default:一个临时的解决方法是通过设置以下默认值回退到 Python 2:

defaults write com.apple.dt.lldb DefaultPythonVersion 2

A more detailled explanation is that the RPATH in liblldbPluginScriptInterpreterPython3.dylib is wrong.更详细的解释是 liblldbPluginScriptInterpreterPython3.dylib 中的 RPATH 错误。 It's failing to find the Python3 framework, which prevents LLDB from loading the scripting plugin.它无法找到 Python3 框架,这会阻止 LLDB 加载脚本插件。 The directory layout is slightly different between Xcode and CLTools. Xcode 和 CLTools 的目录布局略有不同。 Another workaround would be to use the lldb that's part of Xcode, instead of the one that comes with CLTools.另一种解决方法是使用 Xcode 中的 lldb,而不是 CLTools 附带的。

I had this issue today after updating to Mac OS to v12.3.1.在将 Mac OS 更新到 v12.3.1 后,我今天遇到了这个问题。 In my case, what worked was to do what @Jonas suggested, but setting python version to 3 instead of 2:就我而言,有效的是按照@Jonas 的建议进行操作,但将 python 版本设置为 3 而不是 2:

$ defaults write com.apple.dt.lldb DefaultPythonVersion 3

This solution is more like a workaround than a fix since I still have the error but at least it does not get stuck and I am able to debug normally.这个解决方案更像是一种解决方法而不是修复,因为我仍然有错误,但至少它没有卡住并且我能够正常调试。 Setting DefaultPythonVersion back to 2 triggers the error again.将 DefaultPythonVersion 设置回 2 会再次触发错误。

I suspect that the issue is because I have installed an Xcode version that is not supported anymore by Mac OS v12.3.1 but is required by the QT 5.12.12 version that I am using.我怀疑这个问题是因为我安装了 Mac OS v12.3.1 不再支持但我正在使用的 QT 5.12.12 版本需要的 Xcode 版本。 Updating to the most recent Xcode should fix the issue but it would require update to QT 6 which I'm not ready yet.更新到最新的 Xcode 应该可以解决这个问题,但它需要更新到我还没有准备好的 QT 6。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM