Qt Creator fails to debug on MacOS if debugged is run with arguments
-
wrote on 3 Nov 2018, 09:02 last edited by
Hi! I am a big fan of Qt Creator, but there is one thing that bugs me:
I can't debug a native app on MacOS if I specify command line arguments, without those debugging works just fine.Here all the details:
I am building an open-source C++ library and C++ test driver program for that library on MacOS Vojave (version 10.14 (18A391)) with an open source version of Qt Creator (Qt Creator 4.7.2). The project is a CMake-based, not trivial but not too complicated, the build directory is outside of source tree, obviously.
The kit I use for compiling is a "Desktop" one, configured automatically to GCC/LLDB, Qt itself is not installed.Here are all the versions of all stuff involved:
$ /usr/bin/gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin $ /usr/bin/g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin $ /usr/bin/lldb --version lldb-1000.11.38.2 Swift-4.2 $ /usr/local/bin/cmake --version cmake version 3.11.4 CMake suite maintained and supported by Kitware (kitware.com/cmake).
It builds and runs gorgeously, and I even can debug my test driver program. Unless I specify an argument to in Projects/Build and Run/Desktop. Then it fails to stop at any break point, and it appears like the debugged itself wasn't ran at all, since "Application Output" pane simply says:
11:33:42: Debugging starts 11:33:45: Debugging has finished
While if I just run (not debug) there is a lot of output.
I first noticed this issue when I moved to MacOS as my primary environment from Linux about a year ago with Qt Creator 4.5 or something, and MacOS 10.12 or 10.13 (not sure), and the issue is still there with the most recent version of OS and Qt Creator.
  
-
Hi! I am a big fan of Qt Creator, but there is one thing that bugs me:
I can't debug a native app on MacOS if I specify command line arguments, without those debugging works just fine.Here all the details:
I am building an open-source C++ library and C++ test driver program for that library on MacOS Vojave (version 10.14 (18A391)) with an open source version of Qt Creator (Qt Creator 4.7.2). The project is a CMake-based, not trivial but not too complicated, the build directory is outside of source tree, obviously.
The kit I use for compiling is a "Desktop" one, configured automatically to GCC/LLDB, Qt itself is not installed.Here are all the versions of all stuff involved:
$ /usr/bin/gcc --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin $ /usr/bin/g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target: x86_64-apple-darwin18.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin $ /usr/bin/lldb --version lldb-1000.11.38.2 Swift-4.2 $ /usr/local/bin/cmake --version cmake version 3.11.4 CMake suite maintained and supported by Kitware (kitware.com/cmake).
It builds and runs gorgeously, and I even can debug my test driver program. Unless I specify an argument to in Projects/Build and Run/Desktop. Then it fails to stop at any break point, and it appears like the debugged itself wasn't ran at all, since "Application Output" pane simply says:
11:33:42: Debugging starts 11:33:45: Debugging has finished
While if I just run (not debug) there is a lot of output.
I first noticed this issue when I moved to MacOS as my primary environment from Linux about a year ago with Qt Creator 4.5 or something, and MacOS 10.12 or 10.13 (not sure), and the issue is still there with the most recent version of OS and Qt Creator.
  
@Enmk hi, that sounds strange. does Windows > Views > Debugger Log shows some more info? probably some parameter passing or quoting went wrong.
-
@Enmk hi, that sounds strange. does Windows > Views > Debugger Log shows some more info? probably some parameter passing or quoting went wrong.
wrote on 4 Nov 2018, 12:26 last edited by@aha_1980 Hi, thank you for pointers!
Well, the Debugger Log clearly shows that there is an error:
(lldb) script theDumper.runEngine({"token":22}) >@ >success="0",error={type="1",status="process exited with status -1 (cannot attach to process due to System Integrity Protection)",code="4294967295",desc="error: process exited with status -1 (cannot attach to process due to System Integrity Protection)"}@ >@ >state="enginerunfailed"@ dNOTE: ENGINE RUN FAILED sRun failed. dState changed from EngineRunRequested(4) to EngineRunFailed(5) [master] dState changed from EngineRunFailed(5) to EngineShutdownRequested(15) [master] dCALL: SHUTDOWN ENGINE dNOTE: ENGINE SHUTDOWN FINISHED dState changed from EngineShutdownRequested(15) to EngineShutdownFinished(16) [master] dState changed from EngineShutdownFinished(16) to DebuggerFinished(17) [master] sDebugger finished.
I believe that might be due to funny way Qt Creator launches debuggee (is it an immediate child of debugger?)
Anyhow, it is quite surprising that debugging a process with no command line arguments works as expected. -
@aha_1980 Hi, thank you for pointers!
Well, the Debugger Log clearly shows that there is an error:
(lldb) script theDumper.runEngine({"token":22}) >@ >success="0",error={type="1",status="process exited with status -1 (cannot attach to process due to System Integrity Protection)",code="4294967295",desc="error: process exited with status -1 (cannot attach to process due to System Integrity Protection)"}@ >@ >state="enginerunfailed"@ dNOTE: ENGINE RUN FAILED sRun failed. dState changed from EngineRunRequested(4) to EngineRunFailed(5) [master] dState changed from EngineRunFailed(5) to EngineShutdownRequested(15) [master] dCALL: SHUTDOWN ENGINE dNOTE: ENGINE SHUTDOWN FINISHED dState changed from EngineShutdownRequested(15) to EngineShutdownFinished(16) [master] dState changed from EngineShutdownFinished(16) to DebuggerFinished(17) [master] sDebugger finished.
I believe that might be due to funny way Qt Creator launches debuggee (is it an immediate child of debugger?)
Anyhow, it is quite surprising that debugging a process with no command line arguments works as expected.That one:
(cannot attach to process due to System Integrity Protection)
looks very strange, but I'm no mac user, so I cannot say how things are supposed to work.
I suggest you to try the 4.8 beta first (you can install it with the online installer), and if that behaves the same, you should create a bugreport at bugreports.qt.io. Attach the debugger log (both sides) to the report and wait what the devs say.
Regards
-
Continued as QTCREATORBUG-21433, therefore setting this here as SOLVED.
1/5