diff options
author | Miguel Costa <miguel.costa@qt.io> | 2019-01-25 14:39:12 +0100 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2019-01-30 11:39:43 +0000 |
commit | 0f31f8145f92f4b7b8575621c9fde5695c300ce8 (patch) | |
tree | 6eedc5239e5b324788832407df26f61bd2dc4f72 | |
parent | 7cf1eea3ff24ef036b92e775821691d2ac7fbecd (diff) |
Improve error handling/reporting in the QML debug launcher
Added the following improvements to the handling of errors when
launching QML debug sessions:
* Stop the search for the project being debugged when that project is
found, even if there are errors launching the QML debug session;
* Provide more detailed information about the reasons for failure to
launch the QML debug session.
Task-number: QTVSADDINBUG-610
Change-Id: I2d396263cc4b6a117560d985dd117e862a7382ad
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/qtvstools/QML/Debugging/QmlDebugLauncher.cs | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs b/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs index cad958e0..cc77aa5b 100644 --- a/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs +++ b/src/qtvstools/QML/Debugging/QmlDebugLauncher.cs @@ -179,23 +179,39 @@ namespace QtVsTools.Qml.Debug if (!sameFile) continue; + OutputWriteLine(string.Format("Debugging project '{0}'...", vcProject.Name)); + var qtProject = QtProject.Create(vcProject); - if (qtProject == null || !qtProject.IsQtMsBuildEnabled()) - continue; + if (qtProject == null) { + OutputWriteLine("DISABLED: Non-Qt project"); + return false; + } - OutputWriteLine(string.Format("Debugging project '{0}'", vcProject.Name)); + if (!qtProject.IsQtMsBuildEnabled()) { + OutputWriteLine("DISABLED: Non-Qt/MSBuild project"); + return false; + } + + if (!qtProject.QmlDebug) { + OutputWriteLine("DISABLED: QML debugging disabled in Qt project settings"); + return false; + } var execArgs = props.GetPropertyValue("LocalDebuggerCommandArguments", vcConfig.Name, "UserFile"); - if (string.IsNullOrEmpty(execArgs)) - continue; + if (string.IsNullOrEmpty(execArgs)) { + OutputWriteLine("DISABLED: Error reading command line arguments"); + return false; + } var cmd = "\"" + execPath + "\" " + execArgs; - if (!QmlDebugger.CheckCommandLine(execPath, cmd)) - continue; + if (!QmlDebugger.CheckCommandLine(execPath, cmd)) { + OutputWriteLine("DISABLED: Error parsing command line arguments"); + return false; + } - OutputWriteLine("QML debugging enabled"); + OutputWriteLine("Starting QML debug session..."); execCmd = cmd; rccItems = ((IVCCollection)vcProject.Files).Cast<VCFile>() @@ -205,7 +221,7 @@ namespace QtVsTools.Qml.Debug return true; } - OutputWriteLine("QML debugging disabled"); + OutputWriteLine("DISABLED: Could not identify project being debugged"); return false; } @@ -213,7 +229,7 @@ namespace QtVsTools.Qml.Debug void OutputWriteLine(string msg) { if (debugOutput != null) - debugOutput.OutputString(string.Format("Qt VS Tools: {0}\r\n", msg)); + debugOutput.OutputString(string.Format("Qt VS Tools: QML debug: {0}\r\n", msg)); } void LaunchDebug( @@ -233,8 +249,6 @@ namespace QtVsTools.Qml.Debug LaunchFlags = (uint)__VSDBGLAUNCHFLAGS5.DBGLAUNCH_BreakOneProcess, }}; - OutputWriteLine("Starting QML debug engine..."); - var processInfo = new VsDebugTargetProcessInfo[targets.Length]; try { debugger4.LaunchDebugTargets4((uint)targets.Length, targets, processInfo); |