Debugger: Show output of debugger detection

... in tooltip of debugger path lineedit.

Helps with cases where necessary libraries are missing.

The tooltip is a bit hard to recognize, but as such cases now also
are marked in red text there's at least some direct hint that something
is not ok.

Change-Id: Ic5da8dcb1921a98f91f6eed755fa87ce5feed698
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2021-08-03 12:22:25 +02:00
parent 2f6c5db856
commit 4652ef286b
3 changed files with 17 additions and 3 deletions

View File

@@ -151,7 +151,7 @@ static bool isUVisionExecutable(const QFileInfo &fileInfo)
return baseName == "UV4";
}
void DebuggerItem::reinitializeFromFile(const Environment &sysEnv)
void DebuggerItem::reinitializeFromFile(const Environment &sysEnv, QString *error)
{
// CDB only understands the single-dash -version, whereas GDB and LLDB are
// happy with both -version and --version. So use the "working" -version
@@ -190,12 +190,14 @@ void DebuggerItem::reinitializeFromFile(const Environment &sysEnv)
proc.setEnvironment(sysEnv);
proc.setCommand({m_command, {version}});
proc.runBlocking();
const QString output = proc.allOutput().trimmed();
if (proc.result() != QtcProcess::FinishedWithSuccess) {
if (error)
*error = output;
m_engineType = NoEngineType;
return;
}
m_abis.clear();
const QString output = proc.allOutput().trimmed();
if (output.contains("gdb")) {
m_engineType = GdbEngineType;
@@ -263,6 +265,8 @@ void DebuggerItem::reinitializeFromFile(const Environment &sysEnv)
m_engineType = PdbEngineType;
return;
}
if (error)
*error = output;
m_engineType = NoEngineType;
}

View File

@@ -98,7 +98,8 @@ public:
bool operator==(const DebuggerItem &other) const;
bool operator!=(const DebuggerItem &other) const { return !operator==(other); }
void reinitializeFromFile(const Utils::Environment &sysEnv = Utils::Environment::systemEnvironment());
void reinitializeFromFile(const Utils::Environment &sysEnv = Utils::Environment::systemEnvironment(),
QString *error = nullptr);
Utils::FilePath workingDirectory() const { return m_workingDirectory; }
void setWorkingDirectory(const Utils::FilePath &workingPath) { m_workingDirectory = workingPath; }

View File

@@ -314,6 +314,15 @@ DebuggerItemConfigWidget::DebuggerItemConfigWidget()
m_binaryChooser->setExpectedKind(PathChooser::ExistingCommand);
m_binaryChooser->setMinimumWidth(400);
m_binaryChooser->setHistoryCompleter("DebuggerPaths");
m_binaryChooser->setValidationFunction([this](FancyLineEdit *edit, QString *errorMessage) {
if (!m_binaryChooser->defaultValidationFunction()(edit, errorMessage))
return false;
DebuggerItem item;
item.setCommand(m_binaryChooser->filePath());
errorMessage->clear();
item.reinitializeFromFile({}, errorMessage);
return errorMessage->isEmpty();
});
m_workingDirectoryChooser = new PathChooser(this);
m_workingDirectoryChooser->setExpectedKind(PathChooser::Directory);