Commit bc5c462d authored by Friedemann Kleint's avatar Friedemann Kleint

Debugging helpers: Build Gdb helper on Mac only.

Reviewed-by: default avatarKai Köhne <kai.koehne@nokia.com>
parent d144936f
......@@ -2,42 +2,20 @@
<ui version="4.0">
<class>Qt4ProjectManager::Internal::DebuggingHelper</class>
<widget class="QWidget" name="Qt4ProjectManager::Internal::DebuggingHelper">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>321</width>
<height>150</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="gdbHelperLabel">
<property name="toolTip">
<string>Helps showing content of Qt types. Only used in older versions of gdb.</string>
</property>
<property name="text">
<string>Gdb Helper:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="gdbHelperStatus">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="qmlDumpLabel">
<property name="toolTip">
......@@ -98,13 +76,6 @@
</property>
</spacer>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="gdbHelperBuildButton">
<property name="text">
<string>Build</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="qmlDumpBuildButton">
<property name="text">
......@@ -153,6 +124,43 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="gdbHelperLabel">
<property name="toolTip">
<string>Helps showing content of Qt types. Only used in older versions of gdb.</string>
</property>
<property name="text">
<string>Gdb Helper:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="gdbHelperStatus">
<property name="text">
<string notr="true">TextLabel</string>
</property>
</widget>
</item>
<item row="4" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="4">
<widget class="QPushButton" name="gdbHelperBuildButton">
<property name="text">
<string>Build</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......
......@@ -39,6 +39,8 @@
#include <qt4projectmanager/qtversionmanager.h>
#include <projectexplorer/toolchainmanager.h>
#include <projectexplorer/debugginghelper.h>
#include <projectexplorer/abi.h>
#include <utils/qtcassert.h>
#include <QtCore/QCoreApplication>
......@@ -47,7 +49,8 @@ using namespace Qt4ProjectManager::Internal;
using ProjectExplorer::DebuggingHelperLibrary;
DebuggingHelperBuildTask::DebuggingHelperBuildTask(const QtVersion *version, Tools tools)
DebuggingHelperBuildTask::DebuggingHelperBuildTask(const QtVersion *version, Tools tools) :
m_tools(tools & availableTools(version))
{
if (!version || !version->isValid())
return;
......@@ -90,35 +93,32 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const QtVersion *version, Too
m_qmakeCommand = version->qmakeCommand();
m_makeCommand = tc->makeCommand();
m_mkspec = version->mkspec();
}
m_tools = tools;
DebuggingHelperBuildTask::~DebuggingHelperBuildTask()
{
}
DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const QtVersion *version)
{
QTC_ASSERT(version, return 0; )
// Check the build requirements of the tools
if (m_tools & QmlDump) {
if (!QmlDumpTool::canBuild(version)) {
m_tools ^= QmlDump;
}
}
if (m_tools & QmlObserver) {
if (!QmlObserverTool::canBuild(version)) {
m_tools ^= QmlObserver;
} else {
m_tools |= QmlDebugging;
DebuggingHelperBuildTask::Tools tools = 0;
// Gdb helpers are needed on Mac/gdb only.
foreach (const ProjectExplorer::Abi &abi, version->qtAbis()) {
if (abi.os() == ProjectExplorer::Abi::MacOS) {
tools |= DebuggingHelperBuildTask::GdbDebugging;
break;
}
}
if (m_tools & QmlDebugging) {
if (!QmlDebuggingLibrary::canBuild(version)) {
m_tools ^= QmlDebugging;
m_tools &= ~QmlObserver; // remove observer if set
}
if (QmlDumpTool::canBuild(version))
tools |= QmlDump;
if (QmlDebuggingLibrary::canBuild(version)) {
tools |= QmlDebugging;
if (QmlObserverTool::canBuild(version))
tools |= QmlObserver; // requires QML debugging.
}
}
DebuggingHelperBuildTask::~DebuggingHelperBuildTask()
{
return tools;
}
void DebuggingHelperBuildTask::run(QFutureInterface<void> &future)
......
......@@ -62,13 +62,15 @@ public:
void run(QFutureInterface<void> &future);
static Tools availableTools(const QtVersion *version);
signals:
void finished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output);
private:
bool buildDebuggingHelper(QFutureInterface<void> &future, QString *output);
Tools m_tools;
const Tools m_tools;
int m_qtId;
QString m_qtInstallData;
......
......@@ -39,10 +39,6 @@
#include "qt4projectmanagerconstants.h"
#include "qt4target.h"
#include "qtversionmanager.h"
#include "qmldumptool.h"
#include "qmlobservertool.h"
#include "qmldebugginglibrary.h"
#include "debugginghelperbuildtask.h"
#include <projectexplorer/abi.h>
#include <projectexplorer/debugginghelper.h>
......@@ -439,20 +435,22 @@ void QtOptionsPageWidget::removeQtDir()
void QtOptionsPageWidget::updateDebuggingHelperUi()
{
QtVersion *version = currentVersion();
const QtVersion *version = currentVersion();
const QTreeWidgetItem *currentItem = m_ui->qtdirList->currentItem();
if (!version || !version->supportsBinaryDebuggingHelper()) {
m_ui->debuggingHelperWidget->setVisible(false);
} else {
bool canBuildQmlDumper = QmlDumpTool::canBuild(version);
bool canBuildQmlDebuggingLib = QmlDebuggingLibrary::canBuild(version);
bool canBuildQmlObserver = QmlObserverTool::canBuild(version);
const DebuggingHelperBuildTask::Tools availableTools = DebuggingHelperBuildTask::availableTools(version);
const bool canBuildGdbHelper = availableTools & DebuggingHelperBuildTask::GdbDebugging;
const bool canBuildQmlDumper = availableTools & DebuggingHelperBuildTask::QmlDump;
const bool canBuildQmlDebuggingLib = availableTools & DebuggingHelperBuildTask::QmlDebugging;
const bool canBuildQmlObserver = availableTools & DebuggingHelperBuildTask::QmlObserver;
bool hasGdbHelper = !version->gdbDebuggingHelperLibrary().isEmpty();
bool hasQmlDumper = version->hasQmlDump();
bool hasQmlDebuggingLib = version->hasQmlDebuggingLibrary();
bool hasQmlObserver = !version->qmlObserverTool().isEmpty();
const bool hasGdbHelper = !version->gdbDebuggingHelperLibrary().isEmpty();
const bool hasQmlDumper = version->hasQmlDump();
const bool hasQmlDebuggingLib = version->hasQmlDebuggingLibrary();
const bool hasQmlObserver = !version->qmlObserverTool().isEmpty();
bool isBuildingGdbHelper = false;
bool isBuildingQmlDumper = false;
......@@ -495,11 +493,15 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
gdbHelperText = QDir::toNativeSeparators(version->gdbDebuggingHelperLibrary());
gdbHelperTextFlags = Qt::TextSelectableByMouse;
} else {
gdbHelperText = tr("<i>Not yet built.</i>");
if (canBuildGdbHelper) {
gdbHelperText = tr("<i>Not yet built.</i>");
} else {
gdbHelperText = tr("<i>Not needed.</i>");
}
}
m_debuggingHelperUi->gdbHelperStatus->setText(gdbHelperText);
m_debuggingHelperUi->gdbHelperStatus->setTextInteractionFlags(gdbHelperTextFlags);
m_debuggingHelperUi->gdbHelperBuildButton->setEnabled(!isBuildingGdbHelper);
m_debuggingHelperUi->gdbHelperBuildButton->setEnabled(canBuildGdbHelper && !isBuildingGdbHelper);
QString qmlDumpStatusText;
Qt::TextInteractionFlags qmlDumpStatusTextFlags = Qt::NoTextInteraction;
......@@ -535,7 +537,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
if (qmlDebuggingLibStatusText != debugPath) {
if (!qmlDebuggingLibStatusText.isEmpty()
&& !debugPath.isEmpty()) {
qmlDebuggingLibStatusText += QLatin1String("\n");
qmlDebuggingLibStatusText += QLatin1Char('\n');
}
qmlDebuggingLibStatusText += debugPath;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment