Commit 73bb92c5 authored by Eike Ziller's avatar Eike Ziller

Merge remote-tracking branch 'origin/4.0'

Change-Id: I89c52ca2145a43c94d3366367ba72fde605dd577
parents a6683575 7d51d384
......@@ -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));
return a;
});
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;
});
}
// --------------------------------------------------------------------
......
......@@ -1280,6 +1280,7 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
bp.notifyBreakpointReleased();
DebuggerToolTipManager::deregisterEngine(this);
d->m_memoryAgent.handleDebuggerFinished();
prepareForRestart();
}
showMessage(msg, LogDebug);
......
......@@ -204,6 +204,7 @@ public:
virtual void selectWatchData(const QByteArray &iname);
virtual void startDebugger(DebuggerRunControl *runControl);
virtual void prepareForRestart() {}
virtual void watchPoint(const QPoint &);
......
......@@ -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();
......
......@@ -71,6 +71,7 @@ private: ////////// General Interface //////////
virtual void handleGdbStartFailed();
void notifyInferiorSetupFailed() override;
void prepareForRestart() override;
bool hasCapability(unsigned) const override;
void detachDebugger() override;
......
......@@ -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"));
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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,
maximumDepth));
}
QObject *childObject = appendChild(parentObject, parentItem, context, childIndex,
position / parentSize, size / parentSize);
position += size;
childrenDepth = qMax(childrenDepth, buildNode(childIndex, childObject, depth + 1));
}
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);
}
......
......@@ -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);
};
......
......@@ -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 {
......
Subproject commit e936ead98d58e3b54e0b3b3f89b93be2caa5206e
Subproject commit 9d28325c404a87757c61b7dba10f54b43c28cd11
......@@ -179,10 +179,10 @@ def __getMkspecFromQMakeConf__(qmakeConf):
return os.path.basename(mkspec)
def __getMkspecFromQmake__(qmakeCall):
if getOutputFromCmdline("%s -query QT_VERSION" % qmakeCall).strip().startswith("5."):
return getOutputFromCmdline("%s -query QMAKE_XSPEC" % qmakeCall).strip()
if getOutputFromCmdline([qmakeCall, "-query", "QT_VERSION"]).strip().startswith("5."):
return getOutputFromCmdline([qmakeCall, "-query", "QMAKE_XSPEC"]).strip()
else:
QmakeConfPath = getOutputFromCmdline("%s -query QMAKE_MKSPECS" % qmakeCall).strip()
QmakeConfPath = getOutputFromCmdline([qmakeCall, "-query", "QMAKE_MKSPECS"]).strip()
for tmpPath in QmakeConfPath.split(os.pathsep):
tmpPath = tmpPath + os.sep + "default" + os.sep +"qmake.conf"
result = __getMkspecFromQMakeConf__(tmpPath)
......@@ -326,7 +326,7 @@ def __isWinFirewallRunning__():
if not platform.system() in ('Microsoft' 'Windows'):
__isWinFirewallRunning__.fireWallState = False
return False
result = getOutputFromCmdline("netsh firewall show state")
result = getOutputFromCmdline(["netsh", "firewall", "show", "state"])
for line in result.splitlines():
if "Operational mode" in line:
__isWinFirewallRunning__.fireWallState = not "Disable" in line
......
......@@ -277,7 +277,7 @@ def getQtInformationByQMakeCall(qtDir, which):
else:
test.fatal("You're trying to fetch an unknown information (%s)" % which)
return None
return getOutputFromCmdline("%s -query %s" % (qmake, query)).strip()
return getOutputFromCmdline([qmake, "-query", query]).strip()
def invokeContextMenuOnProject(projectName, menuItem):
try:
......
......@@ -118,7 +118,8 @@ def waitForCleanShutdown(timeOut=10):
if not shutdownDone and datetime.utcnow() > endtime:
break
if platform.system() == 'Linux' and JIRA.isBugStillOpen(15749):
pgrepOutput = getOutputFromCmdline('pgrep -f qtcreator_process_stub')
pgrepOutput = getOutputFromCmdline(["pgrep", "-f", "qtcreator_process_stub"],
acceptedError=1)
pids = pgrepOutput.splitlines()
if len(pids):
print("Killing %d qtcreator_process_stub instances" % len(pids))
......
......@@ -139,7 +139,7 @@ def which(program):
command = "where"
else:
command = "which"
foundPath = getOutputFromCmdline(command + " " + program)
foundPath = getOutputFromCmdline([command, program], acceptedError=1)
if foundPath:
return foundPath.splitlines()[0]
else:
......@@ -216,11 +216,12 @@ def logApplicationOutput():
return None
# get the output from a given cmdline call
def getOutputFromCmdline(cmdline):
def getOutputFromCmdline(cmdline, environment=None, acceptedError=0):
try:
return subprocess.check_output(cmdline, shell=True) # TODO: do not use shell=True
return subprocess.check_output(cmdline, env=environment)
except subprocess.CalledProcessError as e:
test.warning("Command '%s' returned %d" % (e.cmd, e.returncode))
if e.returncode != acceptedError:
test.warning("Command '%s' returned %d" % (e.cmd, e.returncode))
return e.output
def selectFromFileDialog(fileName, waitForFile=False):
......
......@@ -224,16 +224,18 @@ class JIRA:
def __tryExternalTools__(self, proxy=None):
global JIRA_URL
if proxy:
cmdAndArgs = { 'curl':'-k --proxy %s' % proxy,
'wget':'-qO-'}
cmdAndArgs = { 'curl':['-k', '--proxy', proxy],
'wget':['-qO-']}
else:
cmdAndArgs = { 'curl':'-k', 'wget':'-qO-' }
cmdAndArgs = { 'curl':['-k'], 'wget':['-qO-']}
for call in cmdAndArgs:
prog = which(call)
if prog:
if call == 'wget' and proxy and os.getenv("https_proxy", None) == None:
test.warning("Missing environment variable https_proxy for using wget with proxy!")
return getOutputFromCmdline('"%s" %s %s/%s-%d' % (prog, cmdAndArgs[call], JIRA_URL, self._bugType, self._number))
cmdline = [prog] + cmdAndArgs[call]
cmdline += ['%s/%s-%d' % (JIRA_URL, self._bugType, self._number)]
return getOutputFromCmdline(cmdline)
return None
# this function crops multiple whitespaces from fetched and searches for expected
......
"0" "1" "6" "11"
"<program>" "" "1" "Main Program"
"main.qml:4" "Create" "2" "QtQuick.Window/Window"
"main.qml:12" "Signal" "2" "onTriggered: { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }"
"main.qml:12" "JavaScript" "2" "onTriggered"
"main.qml:30" "Create" "2" "QtQuick/Text"
"main.qml:15" "Signal" "2" "onTriggered: { runCount += 1; var i; for (i = 1; i < 2500; ++i) { var j = i * i; console.log(j); } }"
"main.qml:15" "JavaScript" "2" "onTriggered"
"main.qml:33" "Create" "2" "QtQuick/Text"
"main.qml:1" "Compile" "1" "main.qml"
"main.qml:7" "Create" "2" "QtQuick/Timer"
"main.qml:32" "Binding" "1" "anchors.centerIn: parent"
"main.qml:23" "Create" "2" "QtQuick/MouseArea"
"main.qml:11" "Binding" "3" "running: runCount < 2"
"main.qml:32" "JavaScript" "1" "expression for centerIn"
"main.qml:24" "Binding" "1" "anchors.fill: parent"
"main.qml:11" "JavaScript" "3" "expression for running"
"main.qml:24" "JavaScript" "1" "expression for fill"
"main.qml:10" "Create" "2" "QtQuick/Timer"
"main.qml:35" "Binding" "1" "anchors.centerIn: parent"
"main.qml:26" "Create" "2" "QtQuick/MouseArea"
"main.qml:14" "Binding" "3" "running: runCount < 2"
"main.qml:35" "JavaScript" "1" "expression for centerIn"
"main.qml:27" "Binding" "1" "anchors.fill: parent"
"main.qml:14" "JavaScript" "3" "expression for running"
"main.qml:27" "JavaScript" "1" "expression for fill"
......@@ -51,7 +51,7 @@ def main():
result = setBreakpointsForCurrentProject(filesAndLines)
if result:
expectedBreakpointsOrder = [{os.path.join(workingDir, projectName, "main.cpp"):8},
{os.path.join(workingDir, projectName, "main.qml"):10}]
{os.path.join(workingDir, projectName, "main.qml"):13}]
# Only use 4.7.4 to work around QTBUG-25187
availableConfigs = iterateBuildConfigs(len(checkedTargets), "Debug")
progressBarWait()
......
......@@ -165,7 +165,7 @@ def __getExpectedCompilers__():
if platform.system() in ('Linux', 'Darwin'):
compilers.extend(["g++-4.0", "g++-4.2", "clang++"])
if platform.system() == 'Darwin':
xcodeClang = getOutputFromCmdline("xcrun --find clang++").strip("\n")
xcodeClang = getOutputFromCmdline(["xcrun", "--find", "clang++"]).strip("\n")
if xcodeClang and os.path.exists(xcodeClang) and xcodeClang not in expected:
expected.append(xcodeClang)
for compiler in compilers:
......@@ -217,7 +217,7 @@ def __getExpectedDebuggers__():
result.extend(filter(lambda s: not ("lldb-platform" in s or "lldb-gdbserver" in s),
findAllFilesInPATH("lldb-*")))
if platform.system() == 'Darwin':
xcodeLLDB = getOutputFromCmdline("xcrun --find lldb").strip("\n")
xcodeLLDB = getOutputFromCmdline(["xcrun", "--find", "lldb"]).strip("\n")
if xcodeLLDB and os.path.exists(xcodeLLDB) and xcodeLLDB not in result:
result.append(xcodeLLDB)
return result
......
......@@ -31,10 +31,10 @@ def main():
return
invokeMenuItem("File", "Open File or Project...")
unsortedFile = os.path.join(os.getcwd(), "testdata", "unsorted.txt")
locale = ""
locale = None
if not platform.system() in ('Windows', 'Microsoft'):
locale = "LC_ALL=C "
sorted = getOutputFromCmdline("%ssort %s" % (locale, unsortedFile)).replace("\r", "")
locale = {"LC_ALL":"C"}
sorted = getOutputFromCmdline(["sort", unsortedFile], locale).replace("\r", "")
selectFromFileDialog(unsortedFile)
editor = waitForObject("{type='TextEditor::TextEditorWidget' unnamed='1' "
"visible='1' window=':Qt Creator_Core::Internal::MainWindow'}", 3000)
......
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