Merge remote-tracking branch 'origin/4.0'

Change-Id: I89c52ca2145a43c94d3366367ba72fde605dd577
This commit is contained in:
Eike Ziller
2016-05-31 12:01:58 +02:00
23 changed files with 148 additions and 95 deletions

View File

@@ -64,29 +64,29 @@ namespace Internal {
static QStringList toArguments(const CMakeConfig &config, const ProjectExplorer::Kit *k) {
return Utils::transform(config, [k](const CMakeConfigItem &i) -> QString {
QString a = QString::fromLatin1("-D");
a.append(QString::fromUtf8(i.key));
switch (i.type) {
case CMakeConfigItem::FILEPATH:
a.append(QLatin1String(":FILEPATH="));
break;
case CMakeConfigItem::PATH:
a.append(QLatin1String(":PATH="));
break;
case CMakeConfigItem::BOOL:
a.append(QLatin1String(":BOOL="));
break;
case CMakeConfigItem::STRING:
a.append(QLatin1String(":STRING="));
break;
case CMakeConfigItem::INTERNAL:
a.append(QLatin1String(":INTERNAL="));
break;
}
a.append(i.expandedValue(k));
QString a = QString::fromLatin1("-D");
a.append(QString::fromUtf8(i.key));
switch (i.type) {
case CMakeConfigItem::FILEPATH:
a.append(QLatin1String(":FILEPATH="));
break;
case CMakeConfigItem::PATH:
a.append(QLatin1String(":PATH="));
break;
case CMakeConfigItem::BOOL:
a.append(QLatin1String(":BOOL="));
break;
case CMakeConfigItem::STRING:
a.append(QLatin1String(":STRING="));
break;
case CMakeConfigItem::INTERNAL:
a.append(QLatin1String(":INTERNAL="));
break;
}
a.append(i.expandedValue(k));
return a;
});
return a;
});
}
// --------------------------------------------------------------------

View File

@@ -1280,6 +1280,7 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
bp.notifyBreakpointReleased();
DebuggerToolTipManager::deregisterEngine(this);
d->m_memoryAgent.handleDebuggerFinished();
prepareForRestart();
}
showMessage(msg, LogDebug);

View File

@@ -204,6 +204,7 @@ public:
virtual void selectWatchData(const QByteArray &iname);
virtual void startDebugger(DebuggerRunControl *runControl);
virtual void prepareForRestart() {}
virtual void watchPoint(const QPoint &);

View File

@@ -4300,6 +4300,14 @@ void GdbEngine::notifyInferiorSetupFailed()
DebuggerEngine::notifyInferiorSetupFailed();
}
void GdbEngine::prepareForRestart()
{
m_rerunPending = false;
m_commandsDoneCallback = 0;
m_commandForToken.clear();
m_flagsForToken.clear();
}
void GdbEngine::handleInferiorPrepared()
{
const DebuggerRunParameters &rp = runParameters();

View File

@@ -71,6 +71,7 @@ private: ////////// General Interface //////////
virtual void handleGdbStartFailed();
void notifyInferiorSetupFailed() override;
void prepareForRestart() override;
bool hasCapability(unsigned) const override;
void detachDebugger() override;

View File

@@ -87,19 +87,6 @@ LldbEngine::LldbEngine(const DebuggerRunParameters &startParameters)
m_lastAgentId = 0;
setObjectName(QLatin1String("LldbEngine"));
if (startParameters.useTerminal) {
#ifdef Q_OS_WIN
// Windows up to xp needs a workaround for attaching to freshly started processes. see proc_stub_win
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
m_stubProc.setMode(ConsoleProcess::Suspend);
else
m_stubProc.setMode(ConsoleProcess::Debug);
#else
m_stubProc.setMode(ConsoleProcess::Debug);
m_stubProc.setSettings(ICore::settings());
#endif
}
connect(action(AutoDerefPointers), &SavedAction::valueChanged,
this, &LldbEngine::updateLocals);
connect(action(CreateFullBacktrace), &QAction::triggered,
@@ -192,7 +179,26 @@ bool LldbEngine::prepareCommand()
void LldbEngine::setupEngine()
{
// FIXME: We can't handle terminals yet.
if (runParameters().useTerminal) {
qWarning("Run in Terminal is not supported yet with the LLDB backend");
showMessage(tr("Run in Terminal is not supported yet with the LLDB backend"), AppError);
runParameters().useTerminal = false;
}
if (runParameters().useTerminal) {
QTC_CHECK(false); // See above.
#ifdef Q_OS_WIN
// Windows up to xp needs a workaround for attaching to freshly started processes. see proc_stub_win
if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA)
m_stubProc.setMode(ConsoleProcess::Suspend);
else
m_stubProc.setMode(ConsoleProcess::Debug);
#else
m_stubProc.setMode(ConsoleProcess::Debug);
m_stubProc.setSettings(ICore::settings());
#endif
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
showMessage(_("TRYING TO START ADAPTER"));

View File

@@ -79,6 +79,10 @@ void QbsLogSink::doPrintMessage(qbs::LoggerLevel level, const QString &message,
{
QMutexLocker l(&m_mutex);
if (level <= qbs::LoggerWarning) {
doPrintWarning(qbs::ErrorInfo(message));
return;
}
m_messages.append(qbs::logLevelTag(level) + message);
}
QMetaObject::invokeMethod(this, "sendMessages", Qt::QueuedConnection);

View File

@@ -77,7 +77,7 @@ QbsManager::QbsManager() : m_defaultPropertyProvider(new DefaultPropertyProvider
this, &QbsManager::updateAllProfiles);
m_logSink = new QbsLogSink(this);
int level = qbs::LoggerWarning;
int level = qbs::LoggerInfo;
const QString levelEnv = QString::fromLocal8Bit(qgetenv("QBS_LOG_LEVEL"));
if (!levelEnv.isEmpty()) {
bool ok = false;

View File

@@ -59,18 +59,18 @@ QbsProjectParser::QbsProjectParser(QbsProject *project, QFutureInterface<bool> *
QbsProjectParser::~QbsProjectParser()
{
if (m_qbsSetupProjectJob) {
m_qbsSetupProjectJob->disconnect(this);
m_qbsSetupProjectJob->cancel();
m_qbsSetupProjectJob->deleteLater();
m_qbsSetupProjectJob = 0;
}
if (m_ruleExecutionJob) {
m_ruleExecutionJob->disconnect(this);
m_ruleExecutionJob->cancel();
m_ruleExecutionJob->deleteLater();
m_ruleExecutionJob = 0;
}
const auto deleteJob = [this](qbs::AbstractJob *job) {
if (!job)
return;
if (job->state() == qbs::AbstractJob::StateFinished) {
job->deleteLater();
return;
}
connect(job, &qbs::AbstractJob::finished, job, &qbs::AbstractJob::deleteLater);
job->cancel();
};
deleteJob(m_qbsSetupProjectJob);
deleteJob(m_ruleExecutionJob);
m_fi = 0; // we do not own m_fi, do not delete
}
@@ -93,7 +93,8 @@ void QbsProjectParser::parse(const QVariantMap &config, const Environment &env,
// Some people don't like it when files are created as a side effect of opening a project,
// so do not store the build graph if the build directory does not exist yet.
params.setDryRun(!QFileInfo::exists(dir));
m_dryRun = !QFileInfo::exists(dir);
params.setDryRun(m_dryRun);
params.setBuildRoot(dir);
params.setProjectFilePath(m_projectFilePath);
@@ -151,6 +152,7 @@ void QbsProjectParser::handleQbsParsingDone(bool success)
void QbsProjectParser::startRuleExecution()
{
qbs::BuildOptions options;
options.setDryRun(m_dryRun);
options.setExecuteRulesOnly(true);
m_ruleExecutionJob = m_project.buildAllProducts(
options, qbs::Project::ProductSelectionWithNonDefault, this);

View File

@@ -74,6 +74,7 @@ private:
qbs::BuildJob *m_ruleExecutionJob;
qbs::ErrorInfo m_error;
qbs::Project m_project;
bool m_dryRun;
QFutureInterface<bool> *m_fi;
int m_currentProgressBase;

View File

@@ -127,7 +127,8 @@ QObject *FlameGraph::appendChild(QObject *parentObject, QQuickItem *parentItem,
}
int FlameGraph::buildNode(const QModelIndex &parentIndex, QObject *parentObject, int depth)
int FlameGraph::buildNode(const QModelIndex &parentIndex, QObject *parentObject, int depth,
int maximumDepth)
{
qreal position = 0;
qreal skipped = 0;
@@ -136,18 +137,23 @@ int FlameGraph::buildNode(const QModelIndex &parentIndex, QObject *parentObject,
QQmlContext *context = qmlContext(this);
int rowCount = m_model->rowCount(parentIndex);
int childrenDepth = depth;
for (int row = 0; row < rowCount; ++row) {
QModelIndex childIndex = m_model->index(row, 0, parentIndex);
qreal size = m_model->data(childIndex, m_sizeRole).toReal();
if (size / m_model->data(QModelIndex(), m_sizeRole).toReal() < m_sizeThreshold) {
skipped += size;
continue;
}
if (depth == maximumDepth - 1) {
skipped = parentSize;
} else {
for (int row = 0; row < rowCount; ++row) {
QModelIndex childIndex = m_model->index(row, 0, parentIndex);
qreal size = m_model->data(childIndex, m_sizeRole).toReal();
if (size / m_model->data(QModelIndex(), m_sizeRole).toReal() < m_sizeThreshold) {
skipped += size;
continue;
}
QObject *childObject = appendChild(parentObject, parentItem, context, childIndex,
position / parentSize, size / parentSize);
position += size;
childrenDepth = qMax(childrenDepth, buildNode(childIndex, childObject, depth + 1));
QObject *childObject = appendChild(parentObject, parentItem, context, childIndex,
position / parentSize, size / parentSize);
position += size;
childrenDepth = qMax(childrenDepth, buildNode(childIndex, childObject, depth + 1,
maximumDepth));
}
}
if (skipped > 0) {
@@ -170,7 +176,7 @@ void FlameGraph::rebuild()
return;
}
m_depth = buildNode(QModelIndex(), this, 0);
m_depth = buildNode(QModelIndex(), this, 0, m_maximumDepth);
emit depthChanged(m_depth);
}

View File

@@ -108,6 +108,8 @@ class FlameGraph : public QQuickItem
Q_PROPERTY(int sizeRole READ sizeRole WRITE setSizeRole NOTIFY sizeRoleChanged)
Q_PROPERTY(qreal sizeThreshold READ sizeThreshold WRITE setSizeThreshold
NOTIFY sizeThresholdChanged)
Q_PROPERTY(int maximumDepth READ maximumDepth WRITE setMaximumDepth
NOTIFY maximumDepthChanged)
Q_PROPERTY(int depth READ depth NOTIFY depthChanged)
public:
@@ -127,6 +129,19 @@ public:
int depth() const;
int maximumDepth() const
{
return m_maximumDepth;
}
void setMaximumDepth(int maximumDepth)
{
if (maximumDepth != m_maximumDepth) {
m_maximumDepth = maximumDepth;
emit maximumDepthChanged();
}
}
static FlameGraphAttached *qmlAttachedProperties(QObject *object);
signals:
@@ -135,6 +150,7 @@ signals:
void sizeRoleChanged(int role);
void sizeThresholdChanged(qreal threshold);
void depthChanged(int depth);
void maximumDepthChanged();
private slots:
void rebuild();
@@ -145,8 +161,10 @@ private:
int m_sizeRole = 0;
int m_depth = 0;
qreal m_sizeThreshold = 0;
int m_maximumDepth = std::numeric_limits<int>::max();
int buildNode(const QModelIndex &parentIndex, QObject *parentObject, int depth);
int buildNode(const QModelIndex &parentIndex, QObject *parentObject, int depth,
int maximumDepth);
QObject *appendChild(QObject *parentObject, QQuickItem *parentItem, QQmlContext *context,
const QModelIndex &childIndex, qreal position, qreal size);
};

View File

@@ -61,6 +61,7 @@ ScrollView {
model: flameGraphModel
sizeRole: FlameGraphModel.DurationRole
sizeThreshold: 0.002
maximumDepth: 25
y: flickable.height > height ? flickable.height - height : 0
delegate: Item {