Commit bcdad219 authored by dt's avatar dt
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 00951b6b d4de7d47
......@@ -988,13 +988,16 @@ void CppModelManager::parse(QFutureInterface<void> &future,
Core::MimeType cSourceTy = db->findByType(QLatin1String("text/x-csrc"));
Core::MimeType cppSourceTy = db->findByType(QLatin1String("text/x-c++src"));
Core::MimeType cHeaderTy = db->findByType(QLatin1String("text/x-hdr"));
Core::MimeType cppHeaderTy = db->findByType(QLatin1String("text/x-c++hdr"));
foreach (const QString &file, files) {
const QFileInfo fileInfo(file);
if (cSourceTy.matchesFile(fileInfo) || cppSourceTy.matchesFile(fileInfo))
sources.append(file);
else
else if (cHeaderTy.matchesFile(fileInfo) || cppHeaderTy.matchesFile(fileInfo))
headers.append(file);
}
......
......@@ -296,6 +296,8 @@ void DebuggerManager::init()
this, SLOT(watchExpression(QString)));
connect(localsView, SIGNAL(settingsDialogRequested()),
this, SIGNAL(settingsDialogRequested()));
connect(localsView, SIGNAL(requestRecheckCustomDumperAvailability()),
this, SLOT(recheckCustomDumperAvailability()));
// Watchers
QTreeView *watchersView = qobject_cast<QTreeView *>(m_watchersWindow);
......@@ -316,6 +318,8 @@ void DebuggerManager::init()
this, SIGNAL(setSessionValueRequested(QString,QVariant)));
connect(watchersView, SIGNAL(settingsDialogRequested()),
this, SIGNAL(settingsDialogRequested()));
connect(watchersView, SIGNAL(requestRecheckCustomDumperAvailability()),
this, SLOT(recheckCustomDumperAvailability()));
// Tooltip
QTreeView *tooltipView = qobject_cast<QTreeView *>(m_tooltipWindow);
......@@ -791,18 +795,6 @@ QVariant DebuggerManager::sessionValue(const QString &name)
return value;
}
void DebuggerManager::querySessionValue(const QString &name, QVariant *value)
{
// this is answered by the plugin
emit sessionValueRequested(name, value);
}
void DebuggerManager::setSessionValue(const QString &name, const QVariant &value)
{
// this is answered by the plugin
emit setSessionValueRequested(name, value);
}
QVariant DebuggerManager::configValue(const QString &name)
{
// this is answered by the plugin
......@@ -993,13 +985,13 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
qDebug() << m_executable << type;
setDebuggerType(type);
setBusyCursor(false);
setStatus(DebuggerProcessStartingUp);
if (!m_engine->startDebugger()) {
setStatus(DebuggerProcessNotReady);
return false;
}
m_busy = false;
return true;
}
......@@ -1199,6 +1191,18 @@ void DebuggerManager::breakAtMain()
#endif
}
static bool isAllowedTransition(int from, int to)
{
return (from == -1)
|| (from == DebuggerProcessNotReady && to == DebuggerProcessStartingUp)
|| (from == DebuggerProcessStartingUp && to == DebuggerInferiorStopped)
|| (from == DebuggerInferiorStopped && to == DebuggerInferiorRunningRequested)
|| (from == DebuggerInferiorRunningRequested && to == DebuggerInferiorRunning)
|| (from == DebuggerInferiorRunning && to == DebuggerInferiorStopRequested)
|| (from == DebuggerInferiorStopRequested && to == DebuggerInferiorStopped)
|| (to == DebuggerProcessNotReady);
}
void DebuggerManager::setStatus(int status)
{
if (Debugger::Constants::Internal::debug)
......@@ -1207,6 +1211,10 @@ void DebuggerManager::setStatus(int status)
if (status == m_status)
return;
if (!isAllowedTransition(m_status, status))
qDebug() << "UNEXPECTED TRANSITION: " << m_status << status;
m_status = status;
const bool started = status == DebuggerInferiorRunning
......@@ -1255,9 +1263,9 @@ void DebuggerManager::setStatus(int status)
void DebuggerManager::setBusyCursor(bool busy)
{
//qDebug() << "BUSY FROM: " << m_busy << " TO: " << m_busy;
if (busy == m_busy)
return;
//qDebug() << "BUSY: " << busy;
m_busy = busy;
QCursor cursor(busy ? Qt::BusyCursor : Qt::ArrowCursor);
......@@ -1413,6 +1421,16 @@ void DebuggerManager::fileOpen(const QString &fileName)
}
//////////////////////////////////////////////////////////////////////
//
// Watch specific stuff
//
//////////////////////////////////////////////////////////////////////
void DebuggerManager::recheckCustomDumperAvailability()
{
m_engine->recheckCustomDumperAvailability();
}
//////////////////////////////////////////////////////////////////////
//
......
......@@ -237,8 +237,6 @@ public slots:
void setBusyCursor(bool on);
void queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **ed);
void querySessionValue(const QString &name, QVariant *value);
void setSessionValue(const QString &name, const QVariant &value);
QVariant configValue(const QString &name);
void queryConfigValue(const QString &name, QVariant *value);
void setConfigValue(const QString &name, const QVariant &value);
......@@ -311,6 +309,7 @@ private slots:
void setStatus(int status);
void clearStatusMessage();
void attemptBreakpointSynchronization();
void recheckCustomDumperAvailability();
private:
//
......
......@@ -395,10 +395,10 @@ void DebuggerPlugin::shutdown()
m_manager = 0;
}
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_message)
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
Q_UNUSED(arguments);
Q_UNUSED(error_message);
Q_UNUSED(errorMessage);
m_manager = new DebuggerManager;
......
......@@ -112,8 +112,7 @@ enum GdbCommandType
GdbInfoShared,
GdbInfoProc,
GdbInfoThreads,
GdbQueryDataDumper1,
GdbQueryDataDumper2,
GdbQueryDataDumper,
GdbTemporaryContinue,
GdbTargetCore,
......@@ -799,11 +798,8 @@ void GdbEngine::handleResult(const GdbResultRecord & record, int type,
case GdbInfoShared:
handleInfoShared(record);
break;
case GdbQueryDataDumper1:
handleQueryDataDumper1(record);
break;
case GdbQueryDataDumper2:
handleQueryDataDumper2(record);
case GdbQueryDataDumper:
handleQueryDataDumper(record);
break;
case GdbTemporaryContinue:
continueInferior();
......@@ -1570,7 +1566,7 @@ bool GdbEngine::startDebugger()
gdbArgs.prepend(QLatin1String("mi"));
gdbArgs.prepend(QLatin1String("-i"));
if (q->startMode() == AttachCore) {
if (q->startMode() == AttachCore || q->startMode() == AttachExternal) {
// nothing to do
} else if (q->m_useTerminal) {
m_stubProc.stop(); // We leave the console open, so recycle it now.
......@@ -1778,6 +1774,7 @@ void GdbEngine::handleAttach()
handleAqcuiredInferior();
q->resetLocation();
recheckCustomDumperAvailability();
//
// Stack
......@@ -3520,14 +3517,9 @@ void GdbEngine::updateWatchModel2()
}
}
void GdbEngine::handleQueryDataDumper1(const GdbResultRecord &record)
{
Q_UNUSED(record);
}
void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
void GdbEngine::handleQueryDataDumper(const GdbResultRecord &record)
{
//qDebug() << "DATA DUMPER TRIAL:" << record.toString();
qDebug() << "DATA DUMPER TRIAL:" << record.toString();
GdbMi output = record.data.findChild("consolestreamoutput");
QByteArray out = output.data();
out = out.mid(out.indexOf('"') + 2); // + 1 is success marker
......@@ -3568,6 +3560,8 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
);
} else {
m_dataDumperState = DataDumperAvailable;
q->showStatusMessage(tr("%1 custom dumpers found")
.arg(m_availableSimpleDumpers.size()));
}
//qDebug() << "DATA DUMPERS AVAILABLE" << m_availableSimpleDumpers;
}
......@@ -4274,9 +4268,8 @@ void GdbEngine::tryLoadCustomDumpers()
if (m_dataDumperState == DataDumperLoadTried) {
// retreive list of dumpable classes
sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)",
GdbQueryDataDumper1);
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper2);
sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)");
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper);
} else {
debugMessage(QString("DEBUG HELPER LIBRARY IS NOT USABLE: "
" %1 EXISTS: %2, EXECUTABLE: %3").arg(lib)
......@@ -4285,6 +4278,12 @@ void GdbEngine::tryLoadCustomDumpers()
}
}
void GdbEngine::recheckCustomDumperAvailability()
{
// retreive list of dumpable classes
sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)");
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper);
}
IDebuggerEngine *createGdbEngine(DebuggerManager *parent)
{
......
......@@ -304,6 +304,7 @@ private:
void maybeHandleInferiorPidChanged(const QString &pid);
void tryLoadCustomDumpers();
Q_SLOT void recheckCustomDumperAvailability();
void runCustomDumper(const WatchData &data, bool dumpChildren);
void runDirectDumper(const WatchData &data, bool dumpChildren);
bool isCustomValueDumperAvailable(const QString &type) const;
......@@ -317,8 +318,7 @@ private:
const WatchData &cookie);
void handleToolTip(const GdbResultRecord &record,
const QString &cookie);
void handleQueryDataDumper1(const GdbResultRecord &record);
void handleQueryDataDumper2(const GdbResultRecord &record);
void handleQueryDataDumper(const GdbResultRecord &record);
void handleDumpCustomValue1(const GdbResultRecord &record,
const WatchData &cookie);
void handleDumpCustomValue2(const GdbResultRecord &record,
......
......@@ -83,6 +83,7 @@ public:
virtual void reloadRegisters() = 0;
virtual void setDebugDumpers(bool on) = 0;
virtual void setUseCustomDumpers(bool on) = 0;
virtual void recheckCustomDumperAvailability() = 0;
virtual void reloadSourceFiles() = 0;
};
......
......@@ -99,6 +99,7 @@ private:
void setDebugDumpers(bool) {}
void setUseCustomDumpers(bool) {}
void recheckCustomDumperAvailability() {}
void assignValueInDebugger(const QString &expr, const QString &value);
void executeDebuggerCommand(const QString & command);
......
......@@ -105,6 +105,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *act3 = 0;
QAction *act4 = 0;
QAction *act5 = new QAction("Debugger properties...", &menu);
QAction *act6 = new QAction("Re-check availability of custom dumpers", &menu);
menu.addAction(act1);
menu.addAction(act2);
......@@ -130,6 +131,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
// FIXME: menu.addAction(act4);
}
menu.addSeparator();
menu.addAction(act6);
menu.addAction(act5);
QAction *act = menu.exec(ev->globalPos());
......@@ -149,6 +151,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
model()->setData(mi0, !visual, VisualRole);
else if (act == act5)
emit settingsDialogRequested();
else if (act == act6)
emit requestRecheckCustomDumperAvailability();
}
void WatchWindow::resizeColumnsToContents()
......
......@@ -63,6 +63,7 @@ signals:
void requestAssignValue(const QString &exp, const QString &value);
void requestExpandChildren(const QModelIndex &idx);
void requestCollapseChildren(const QModelIndex &idx);
void requestRecheckCustomDumperAvailability();
void settingsDialogRequested();
private slots:
......
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/x-generic-project">
<sub-class-of type="text/plain"/>
<comment>Generic Qt Creator Project file</comment>
<glob pattern="*.creator"/>
</mime-type>
<mime-type type="application/vnd.nokia.qt.generic.files">
<sub-class-of type="text/plain"/>
<comment>Generic Project Files</comment>
<glob pattern="*.files"/>
</mime-type>
<mime-type type="application/vnd.nokia.qt.generic.includes">
<sub-class-of type="text/plain"/>
<comment>Generic Project Include Paths</comment>
<glob pattern="*.includes"/>
</mime-type>
<mime-type type="application/vnd.nokia.qt.generic.config">
<sub-class-of type="text/plain"/>
<comment>Generic Project Configuration File</comment>
<glob pattern="*.config"/>
</mime-type>
</mime-info>
<plugin name="GenericProjectManager" version="1.0.80" compatVersion="1.0.80">
<vendor>Nokia Corporation</vendor>
<copyright>(C) 2008-2009 Nokia Corporation</copyright>
<license>
Commercial Usage
Licensees holding valid Qt Commercial licenses may use this plugin in
accordance with the Qt Commercial License Agreement provided with the
Software or, alternatively, in accordance with the terms contained in
a written agreement between you and Nokia.
GNU Lesser General Public License Usage
Alternatively, this plugin may be used under the terms of the GNU Lesser
General Public License version 2.1 as published by the Free Software
Foundation. Please review the following information to
ensure the GNU Lesser General Public License version 2.1 requirements
will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<description>Generic support</description>
<url>http://www.qtsoftware.com</url>
<dependencyList>
<dependency name="TextEditor" version="1.0.80"/>
<dependency name="ProjectExplorer" version="1.0.80"/>
<dependency name="CppTools" version="1.0.80"/>
<dependency name="CppEditor" version="1.0.80"/>
<dependency name="Help" version="1.0.80"/>
</dependencyList>
</plugin>
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "genericproject.h"
#include "genericprojectconstants.h"
#include "genericprojectnodes.h"
#include "makestep.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <QtCore/QtDebug>
#include <QtCore/QDir>
#include <QtCore/QSettings>
#include <QtCore/QProcess>
#include <QtGui/QFormLayout>
#include <QtGui/QMainWindow>
#include <QtGui/QComboBox>
#include <QtGui/QStringListModel>
#include <QtGui/QListWidget>
#include <QtGui/QPushButton>
using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal;
////////////////////////////////////////////////////////////////////////////////////
// GenericProject
////////////////////////////////////////////////////////////////////////////////////
namespace {
class ListModel: public QStringListModel
{
public:
ListModel(QObject *parent)
: QStringListModel(parent) {}
virtual ~ListModel() {}
virtual int rowCount(const QModelIndex &parent) const
{ return 1 + QStringListModel::rowCount(parent); }
virtual Qt::ItemFlags flags(const QModelIndex &index) const
{ return QStringListModel::flags(index) | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; }
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
{
if (row == stringList().size())
return createIndex(row, column);
return QStringListModel::index(row, column, parent);
}
virtual QVariant data(const QModelIndex &index, int role) const
{
if (role == Qt::DisplayRole || role == Qt::EditRole) {
if (index.row() == stringList().size())
return tr("<new>");
}
return QStringListModel::data(index, role);
}
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
{
if (role == Qt::EditRole && index.row() == stringList().size())
insertRow(index.row(), QModelIndex());
return QStringListModel::setData(index, value, role);
}
};
} // end of anonymous namespace
GenericProject::GenericProject(Manager *manager, const QString &fileName)
: _manager(manager),
_fileName(fileName),
_toolChain(0)
{
QFileInfo fileInfo(_fileName);
const QString projectBaseName = fileInfo.baseName();
QDir dir = fileInfo.dir();
_filesFileName = QFileInfo(dir, projectBaseName + QLatin1String(".files")).absoluteFilePath();
_includesFileName = QFileInfo(dir, projectBaseName + QLatin1String(".includes")).absoluteFilePath();
_configFileName = QFileInfo(dir, projectBaseName + QLatin1String(".config")).absoluteFilePath();
_file = new GenericProjectFile(this, fileName);
_rootNode = new GenericProjectNode(this, _file);
_manager->registerProject(this);
}
GenericProject::~GenericProject()
{
_manager->unregisterProject(this);
delete _rootNode;
delete _toolChain;
}
QString GenericProject::filesFileName() const
{ return _filesFileName; }
QString GenericProject::includesFileName() const
{ return _includesFileName; }
QString GenericProject::configFileName() const
{ return _configFileName; }
QStringList GenericProject::readLines(const QString &absoluteFileName) const
{
QStringList lines;
QFile file(absoluteFileName);
if (file.open(QFile::ReadOnly)) {
QTextStream stream(&file);
forever {
QString line = stream.readLine();
if (line.isNull())
break;
line = line.trimmed();
if (line.isEmpty())
continue;
lines.append(line);
}
}
return lines;
}
void GenericProject::parseProject()
{
const QFileInfo projectFileInfo(_fileName);
QSettings projectInfo(_fileName, QSettings::IniFormat);
_files = convertToAbsoluteFiles(readLines(filesFileName()));
_files.removeDuplicates();
_projectIncludePaths = readLines(includesFileName());
_projectIncludePaths.removeDuplicates();
_generated = convertToAbsoluteFiles(projectInfo.value(QLatin1String("generated")).toStringList());
_defines.clear();
QFile configFn(configFileName());
if (configFn.open(QFile::ReadOnly))
_defines = configFn.readAll();
emit fileListChanged();
}
void GenericProject::refresh()
{
parseProject();
_rootNode->refresh();
CppTools::CppModelManagerInterface *modelManager =
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
if (_toolChain && modelManager) {
const QByteArray predefinedMacros = _toolChain->predefinedMacros();
const QList<ProjectExplorer::HeaderPath> systemHeaderPaths = _toolChain->systemHeaderPaths();
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelManager->projectInfo(this);
pinfo.defines = predefinedMacros;
pinfo.defines += '\n';
pinfo.defines += _defines;
QStringList allIncludePaths, allFrameworkPaths;
foreach (const ProjectExplorer::HeaderPath &headerPath, _toolChain->systemHeaderPaths()) {
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
allFrameworkPaths.append(headerPath.path());
else
allIncludePaths.append(headerPath.path());
}
allIncludePaths += this->allIncludePaths();
pinfo.frameworkPaths = allFrameworkPaths;
pinfo.includePaths = allIncludePaths;
// ### add _defines.
pinfo.sourceFiles = files();
pinfo.sourceFiles += generated();