Qt Creator fails to start debugging on Mac

2020-07-26 07:03发布

问题:

Recently (I suspect some system/homebrew update) the Qt's debugger stopped working. It hangs forever on 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))

回答1:

This appears to be an issue with the LLDB that comes with CLTools. A temporary workaround would be to fallback to Python 2 by setting the following default:

defaults write com.apple.dt.lldb DefaultPythonVersion 2

A more detailled explanation is that the RPATH in liblldbPluginScriptInterpreterPython3.dylib is wrong. It's failing to find the Python3 framework, which prevents LLDB from loading the scripting plugin. The directory layout is slightly different between Xcode and CLTools. Another workaround would be to use the lldb that's part of Xcode, instead of the one that comes with CLTools.