Commit f5407fb8 authored by dt's avatar dt
Browse files

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

parents ac5736e5 0a803f5e
......@@ -150,6 +150,8 @@ static const char pp_configuration[] =
"#define __imag__\n"
"#define __real__\n"
"#define __builtin_va_arg(a,b) ((b)0)\n"
// ### add macros for win32
"#define __cdecl\n"
"#define QT_WA(x) x\n"
......
......@@ -57,6 +57,7 @@
#endif
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <projectexplorer/toolchain.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
......@@ -95,7 +96,8 @@ QDebug operator<<(QDebug str, const DebuggerStartParameters &p)
<< " attachPID=" << p.attachPID << " useTerminal=" << p.useTerminal
<< " remoteChannel=" << p.remoteChannel
<< " remoteArchitecture=" << p.remoteArchitecture
<< " serverStartScript=" << p.serverStartScript << '\n';
<< " serverStartScript=" << p.serverStartScript
<< " toolchain=" << p.toolChainType << '\n';
return str;
}
} // namespace Internal
......@@ -155,7 +157,8 @@ IDebuggerEngine *createTcfEngine(DebuggerManager *parent, QList<Core::IOptionsPa
DebuggerStartParameters::DebuggerStartParameters() :
attachPID(-1),
useTerminal(false)
useTerminal(false),
toolChainType(ProjectExplorer::ToolChain::UNKNOWN)
{
}
......@@ -173,6 +176,7 @@ void DebuggerStartParameters::clear()
remoteChannel.clear();
remoteArchitecture.clear();
serverStartScript.clear();
toolChainType = ProjectExplorer::ToolChain::UNKNOWN;
}
// --------- DebuggerManager
......@@ -806,17 +810,59 @@ QVariant DebuggerManager::sessionValue(const QString &name)
return value;
}
// Figure out the debugger type of an executable
static inline QString msgEngineNotAvailable(const char *engine)
{
return DebuggerManager::tr("The application requires the debugger engine '%1', which is disabled.").arg(QLatin1String(engine));
}
static IDebuggerEngine *debuggerEngineForToolChain(ProjectExplorer::ToolChain::ToolChainType tc)
{
IDebuggerEngine *rc = 0;
switch (tc) {
case ProjectExplorer::ToolChain::LinuxICC:
case ProjectExplorer::ToolChain::MinGW:
case ProjectExplorer::ToolChain::GCC:
rc = gdbEngine;
break;
case ProjectExplorer::ToolChain::MSVC:
case ProjectExplorer::ToolChain::WINCE:
rc = winEngine;
break;
case ProjectExplorer::ToolChain::OTHER:
case ProjectExplorer::ToolChain::UNKNOWN:
case ProjectExplorer::ToolChain::INVALID:
break;
}
if (Debugger::Constants::Internal::debug)
qDebug() << "Toolchain" << tc << rc;
return rc;
}
// Figure out the debugger type of an executable. Analyze executable
// unless the toolchain provides a hint.
static IDebuggerEngine *determineDebuggerEngine(const QString &executable,
QString *errorMessage,
QString *settingsIdHint)
int toolChainType,
QString *errorMessage,
QString *settingsIdHint)
{
if (executable.endsWith(_(".js")))
if (IDebuggerEngine *tce = debuggerEngineForToolChain(static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType)))
return tce;
if (executable.endsWith(_(".js"))) {
if (!scriptEngine) {
*errorMessage = msgEngineNotAvailable("Script Engine");
return 0;
}
return scriptEngine;
}
#ifndef Q_OS_WIN
Q_UNUSED(errorMessage)
#ifndef Q_OS_WIN
Q_UNUSED(settingsIdHint)
if (!gdbEngine) {
*errorMessage = msgEngineNotAvailable("Gdb Engine");
return 0;
}
return gdbEngine;
#else
// If a file has PDB files, it has been compiled by VS.
......@@ -839,12 +885,25 @@ static IDebuggerEngine *determineDebuggerEngine(const QString &executable,
// Figure out the debugger type of a PID
static IDebuggerEngine *determineDebuggerEngine(int /* pid */,
QString * /*errorMessage*/)
int toolChainType,
QString *errorMessage)
{
if (IDebuggerEngine *tce = debuggerEngineForToolChain(static_cast<ProjectExplorer::ToolChain::ToolChainType>(toolChainType)))
return tce;
#ifdef Q_OS_WIN
// Preferably Windows debugger
return winEngine ? winEngine : gdbEngine;
if (winEngine)
return winEngine;
if (gdbEngine)
return gdbEngine;
*errorMessage = msgEngineNotAvailable("Gdb Engine");
return 0;
#else
if (!gdbEngine) {
*errorMessage = msgEngineNotAvailable("Gdb Engine");
return 0;
}
return gdbEngine;
#endif
}
......@@ -857,21 +916,23 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl, const QSh
m_startParameters = startParameters;
m_inferiorPid = startParameters->attachPID > 0 ? startParameters->attachPID : 0;
m_runControl = runControl;
const QString toolChainName = ProjectExplorer::ToolChain::toolChainName(static_cast<ProjectExplorer::ToolChain::ToolChainType>(m_startParameters->toolChainType));
emit debugModeRequested();
showDebuggerOutput(QLatin1String("status:"), tr("Starting debugger for tool chain '%1'...").arg(toolChainName));
QString errorMessage;
QString settingsIdHint;
switch (startMode()) {
case AttachExternal:
case AttachCrashedExternal:
m_engine = determineDebuggerEngine(m_startParameters->attachPID, &errorMessage);
m_engine = determineDebuggerEngine(m_startParameters->attachPID, m_startParameters->toolChainType, &errorMessage);
break;
case AttachTcf:
m_engine = tcfEngine;
break;
default:
m_engine = determineDebuggerEngine(m_startParameters->executable, &errorMessage, &settingsIdHint);
m_engine = determineDebuggerEngine(m_startParameters->executable, m_startParameters->toolChainType, &errorMessage, &settingsIdHint);
break;
}
......@@ -879,7 +940,8 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl, const QSh
debuggingFinished();
// Create Message box with possibility to go to settings
QAbstractButton *settingsButton = 0;
QMessageBox msgBox(QMessageBox::Warning, tr("Warning"), tr("Cannot debug '%1': %2").arg(m_startParameters->executable, errorMessage), QMessageBox::Ok);
QMessageBox msgBox(QMessageBox::Warning, tr("Warning"), tr("Cannot debug '%1' (tool chain: '%2'): %3").
arg(m_startParameters->executable, toolChainName, errorMessage), QMessageBox::Ok);
if (!settingsIdHint.isEmpty())
settingsButton = msgBox.addButton(tr("Settings..."), QMessageBox::AcceptRole);
msgBox.exec();
......@@ -887,6 +949,7 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl, const QSh
Core::ICore::instance()->showOptionsDialog(_(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY), settingsIdHint);
return;
}
if (Debugger::Constants::Internal::debug)
qDebug() << m_startParameters->executable << m_engine;
......
......@@ -145,6 +145,7 @@ struct DebuggerStartParameters
QString remoteChannel;
QString remoteArchitecture;
QString serverStartScript;
int toolChainType;
};
QDebug operator<<(QDebug str, const DebuggerStartParameters &);
......
......@@ -82,6 +82,14 @@ RunControl* DebuggerRunner::run(RunConfigurationPtr runConfiguration,
ApplicationRunConfigurationPtr rc =
runConfiguration.dynamicCast<ApplicationRunConfiguration>();
Q_ASSERT(!rc.isNull());
switch (sp->toolChainType) {
case ProjectExplorer::ToolChain::UNKNOWN:
case ProjectExplorer::ToolChain::INVALID:
sp->toolChainType = rc->toolChainType();
break;
default:
break;
}
//qDebug() << "***** Debugging" << rc->name() << rc->executable();
DebuggerRunControl *runControl = new DebuggerRunControl(m_manager, startMode, sp, rc);
return runControl;
......
......@@ -40,16 +40,24 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
AllProjectsFilter::AllProjectsFilter(ProjectExplorerPlugin *pe)
: m_projectExplorer(pe), m_filesUpToDate(false)
{
m_projectExplorer = pe;
connect(m_projectExplorer, SIGNAL(fileListChanged()),
this, SLOT(refreshInternally()));
this, SLOT(markFilesAsOutOfDate()));
setShortcutString("a");
setIncludedByDefault(true);
}
void AllProjectsFilter::refreshInternally()
void AllProjectsFilter::markFilesAsOutOfDate()
{
m_filesUpToDate = false;
}
void AllProjectsFilter::updateFiles()
{
if (m_filesUpToDate)
return;
m_filesUpToDate = true;
m_files.clear();
SessionManager *session = m_projectExplorer->session();
if (!session)
......@@ -64,7 +72,7 @@ void AllProjectsFilter::refresh(QFutureInterface<void> &future)
{
Q_UNUSED(future);
// invokeAsyncronouslyOnGuiThread
connect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally()));
connect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
emit invokeRefresh();
disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally()));
disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
}
......@@ -53,12 +53,16 @@ public:
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
void refresh(QFutureInterface<void> &future);
protected:
void updateFiles();
private slots:
void refreshInternally();
void markFilesAsOutOfDate();
signals:
void invokeRefresh();
private:
ProjectExplorerPlugin *m_projectExplorer;
bool m_filesUpToDate;
};
} // namespace Internal
......
......@@ -43,7 +43,7 @@ using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe)
: BaseFileFilter(), m_project(0)
: BaseFileFilter(), m_projectExplorer(pe), m_project(0), m_filesUpToDate(false)
{
m_projectExplorer = pe;
......@@ -53,8 +53,16 @@ CurrentProjectFilter::CurrentProjectFilter(ProjectExplorerPlugin *pe)
setIncludedByDefault(false);
}
void CurrentProjectFilter::refreshInternally()
void CurrentProjectFilter::markFilesAsOutOfDate()
{
m_filesUpToDate = false;
}
void CurrentProjectFilter::updateFiles()
{
if (m_filesUpToDate)
return;
m_filesUpToDate = true;
m_files.clear();
if (!m_project)
return;
......@@ -68,20 +76,20 @@ void CurrentProjectFilter::currentProjectChanged(ProjectExplorer::Project *proje
if (project == m_project)
return;
if (m_project)
disconnect(m_project, SIGNAL(fileListChanged()), this, SLOT(refreshInternally()));
disconnect(m_project, SIGNAL(fileListChanged()), this, SLOT(markFilesAsOutOfDate()));
if (project)
connect(project, SIGNAL(fileListChanged()), this, SLOT(refreshInternally()));
connect(project, SIGNAL(fileListChanged()), this, SLOT(markFilesAsOutOfDate()));
m_project = project;
refreshInternally();
markFilesAsOutOfDate();
}
void CurrentProjectFilter::refresh(QFutureInterface<void> &future)
{
Q_UNUSED(future);
// invokeAsyncronouslyOnGuiThread
connect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally()));
connect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
emit invokeRefresh();
disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(refreshInternally()));
disconnect(this, SIGNAL(invokeRefresh()), this, SLOT(markFilesAsOutOfDate()));
}
......@@ -56,9 +56,12 @@ public:
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
void refresh(QFutureInterface<void> &future);
protected:
void updateFiles();
private slots:
void currentProjectChanged(ProjectExplorer::Project *project);
void refreshInternally();
void markFilesAsOutOfDate();
signals:
void invokeRefresh();
......@@ -67,6 +70,7 @@ private:
ProjectExplorerPlugin *m_projectExplorer;
Project *m_project;
bool m_filesUpToDate;
};
} // namespace Internal
......
......@@ -37,6 +37,7 @@
#include <QtCore/QDir>
#include <QtCore/QTemporaryFile>
#include <QtCore/QString>
#include <QtCore/QCoreApplication>
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
......@@ -102,6 +103,29 @@ QStringList ToolChain::supportedToolChains()
<< QLatin1String("wince");
}
QString ToolChain::toolChainName(ToolChainType tc)
{
switch (tc) {
case GCC:
return QLatin1String("gcc");
case LinuxICC:
return QLatin1String("Linux icc");
case MinGW:
return QLatin1String("MinGW");
case MSVC:
return QLatin1String("MS VC");
case WINCE:
return QLatin1String("Windows CE");
case OTHER:
return QCoreApplication::translate("ToolChain", "Other");
case INVALID:
return QCoreApplication::translate("ToolChain", "<Invalid>");
case UNKNOWN:
break;
};
return QCoreApplication::translate("ToolChain", "<Unknown>");
}
GccToolChain::GccToolChain(const QString &gcc)
: m_gcc(gcc)
{
......
......@@ -96,6 +96,8 @@ public:
static QStringList availableMSVCVersions();
static QStringList supportedToolChains();
static QString toolChainName(ToolChainType tc);
protected:
virtual bool equals(ToolChain *other) const = 0;
};
......
......@@ -43,6 +43,7 @@ BaseFileFilter::BaseFileFilter()
QList<FilterEntry> BaseFileFilter::matchesFor(const QString &origEntry)
{
updateFiles();
QList<FilterEntry> matches;
QList<FilterEntry> badMatches;
QString needle = trimWildcards(origEntry);
......@@ -104,3 +105,7 @@ void BaseFileFilter::generateFileNames()
}
m_forceNewSearchList = true;
}
void BaseFileFilter::updateFiles()
{
}
......@@ -48,6 +48,7 @@ public:
void accept(QuickOpen::FilterEntry selection) const;
protected:
virtual void updateFiles();
void generateFileNames();
QStringList m_files;
......
......@@ -458,14 +458,17 @@ void FontSettingsPage::apply()
const int size = d_ptr->ui.sizeComboBox->currentText().toInt(&ok);
if (ok)
d_ptr->m_value.setFontSize(size);
saveSettings();
}
void FontSettingsPage::saveSettings()
{
if (d_ptr->m_value != d_ptr->m_lastValue) {
d_ptr->m_lastValue = d_ptr->m_value;
if (QSettings *settings = Core::ICore::instance()->settings())
d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, d_ptr->m_descriptions, settings);
d_ptr->m_lastValue = d_ptr->m_value;
if (QSettings *settings = Core::ICore::instance()->settings())
d_ptr->m_value.toSettings(d_ptr->m_settingsGroup, d_ptr->m_descriptions, settings);
QTimer::singleShot(0, this, SLOT(delayedChange()));
QTimer::singleShot(0, this, SLOT(delayedChange()));
}
}
......
......@@ -96,6 +96,8 @@ public:
void apply();
void finish();
void saveSettings();
const FontSettings &fontSettings() const;
signals:
......
......@@ -175,7 +175,7 @@ void TextEditorSettings::fontSizeRequested(int pointSize)
{
FontSettings &fs = const_cast<FontSettings&>(m_fontSettingsPage->fontSettings());
fs.setFontSize(pointSize);
emit fontSettingsChanged(m_fontSettingsPage->fontSettings());
m_fontSettingsPage->saveSettings();
}
FontSettings TextEditorSettings::fontSettings() const
......
......@@ -570,6 +570,8 @@ unsigned DeclarationListAST::lastToken() const
unsigned DeclaratorAST::firstToken() const
{
if (attributes)
return attributes->firstToken();
if (ptr_operators)
return ptr_operators->firstToken();
else if (core_declarator)
......@@ -589,7 +591,7 @@ unsigned DeclaratorAST::lastToken() const
if (initializer)
return initializer->lastToken();
for (SpecifierAST *it = attributes; it; it = it->next) {
for (SpecifierAST *it = post_attributes; it; it = it->next) {
if (! it->next)
return it->lastToken();
}
......@@ -607,6 +609,11 @@ unsigned DeclaratorAST::lastToken() const
return it->lastToken();
}
for (SpecifierAST *it = attributes; it; it = it->next) {
if (! it->next)
return it->lastToken();
}
// ### assert?
return 0;
}
......
......@@ -371,10 +371,11 @@ public:
class CPLUSPLUS_EXPORT DeclaratorAST: public AST
{
public:
SpecifierAST *attributes;
PtrOperatorAST *ptr_operators;
CoreDeclaratorAST *core_declarator;
PostfixDeclaratorAST *postfix_declarators;
SpecifierAST *attributes;
SpecifierAST *post_attributes;
unsigned equals_token;
ExpressionAST *initializer;
......
......@@ -97,10 +97,11 @@ DeclaratorAST *DeclaratorAST::clone(MemoryPool *pool) const
{
DeclaratorAST *ast = new (pool) DeclaratorAST;
// copy DeclaratorAST
if (attributes) ast->attributes = attributes->clone(pool);
if (ptr_operators) ast->ptr_operators = ptr_operators->clone(pool);
if (core_declarator) ast->core_declarator = core_declarator->clone(pool);
if (postfix_declarators) ast->postfix_declarators = postfix_declarators->clone(pool);
if (attributes) ast->attributes = attributes->clone(pool);
if (post_attributes) ast->post_attributes = post_attributes->clone(pool);
ast->equals_token = equals_token;
if (initializer) ast->initializer = initializer->clone(pool);
return ast;
......
......@@ -85,12 +85,14 @@ void DeclaratorAST::accept0(ASTVisitor *visitor)
{
if (visitor->visit(this)) {
// visit DeclaratorAST
for (SpecifierAST *it = attributes; it; it = it->next)
accept(it, visitor);
for (PtrOperatorAST *it = ptr_operators; it; it = it->next)
accept(it, visitor);
accept(core_declarator, visitor);
for (PostfixDeclaratorAST *it = postfix_declarators; it; it = it->next)
accept(it, visitor);
for (SpecifierAST *it = attributes; it; it = it->next)
for (SpecifierAST *it = post_attributes; it; it = it->next)
accept(it, visitor);
accept(initializer, visitor);
}
......
......@@ -671,6 +671,9 @@ bool Parser::parseAsmDefinition(DeclarationAST *&node)
bool Parser::parseAsmOperandList()
{
if (LA() != T_STRING_LITERAL)
return true;
if (parseAsmOperand()) {
while (LA() == T_COMMA) {
consumeToken();
......@@ -678,6 +681,7 @@ bool Parser::parseAsmOperandList()
}
return true;
}
return false;
}
......@@ -949,6 +953,14 @@ bool Parser::parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node)
bool Parser::parseCoreDeclarator(DeclaratorAST *&node)
{
unsigned start = cursor();
SpecifierAST *attributes = 0;
SpecifierAST **attribute_ptr = &attributes;
while (LA() == T___ATTRIBUTE__) {
parseAttributeSpecifier(*attribute_ptr);
attribute_ptr = &(*attribute_ptr)->next;
}
PtrOperatorAST *ptr_operators = 0, **ptr_operators_tail = &ptr_operators;
while (parsePtrOperator(*ptr_operators_tail))
ptr_operators_tail = &(*ptr_operators_tail)->next;
......@@ -960,12 +972,16 @@ bool Parser::parseCoreDeclarator(DeclaratorAST *&node)
DeclaratorIdAST *declarator_id = new (_pool) DeclaratorIdAST;
declarator_id->name = name;
DeclaratorAST *ast = new (_pool) DeclaratorAST;
ast->attributes = attributes;
ast->ptr_operators = ptr_operators;
ast->core_declarator = declarator_id;
node = ast;
return true;
}
} else if (LA() == T_LPAREN) {
if (attributes)
_translationUnit->warning(attributes->firstToken(), "unexpected attribtues");
unsigned lparen_token = consumeToken();
DeclaratorAST *declarator = 0;
if (parseDeclarator(declarator) && LA() == T_RPAREN) {
......@@ -980,6 +996,7 @@ bool Parser::parseCoreDeclarator(DeclaratorAST *&node)
return true;
}
}
rewind(start);
return false;
}
......@@ -1060,7 +1077,7 @@ bool Parser::parseDeclarator(DeclaratorAST *&node, bool stopAtCppInitializer)
break;
}
SpecifierAST **spec_ptr = &node->attributes;
SpecifierAST **spec_ptr = &node->post_attributes;
while (LA() == T___ATTRIBUTE__) {
parseAttributeSpecifier(*spec_ptr);
spec_ptr = &(*spec_ptr)->next;
......
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