Commit c395680e authored by dt's avatar dt

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

Conflicts:
	src/plugins/debugger/gdbengine.cpp
parents e8d990e7 c0b13863
......@@ -700,7 +700,7 @@
\section1 Usage
You can find the version control menu entires in a sub-menu of the
You can find the version control menu entries in a sub-menu of the
\gui{Tools} menu. The version control system displayed here is the system
that manages the current project.
......
......@@ -114,8 +114,6 @@ public:
QObject *instance();
static QObjectList staticInstances();
bool load();
bool unload();
bool isLoaded() const;
......@@ -831,9 +829,6 @@ QString PatchedPluginLoader::errorString() const
return (!d || d->errorString.isEmpty()) ? QLibrary::tr("Unknown error") : d->errorString;
}
typedef QList<QtPluginInstanceFunction> StaticInstanceFunctionList;
Q_GLOBAL_STATIC(StaticInstanceFunctionList, staticInstanceFunctionList)
void PatchedPluginLoader::setLoadHints(QLibrary::LoadHints loadHints)
{
if (!d) {
......@@ -853,24 +848,6 @@ QLibrary::LoadHints PatchedPluginLoader::loadHints() const
return d->loadHints;
}
void qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function)
{
staticInstanceFunctionList()->append(function);
}
QObjectList PatchedPluginLoader::staticInstances()
{
QObjectList instances;
StaticInstanceFunctionList *functions = staticInstanceFunctionList();
if (functions) {
for (int i = 0; i < functions->count(); ++i)
instances.append((*functions)[i]());
}
return instances;
}
......
......@@ -628,6 +628,7 @@ QList<IFile *> EditorManager::filesForEditors(QList<IEditor *> editors) const
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
{
m_d->m_editorModel->removeAllRestoredEditors();
return closeEditors(openedEditors(), askAboutModifiedEditors);
}
......
......@@ -181,6 +181,17 @@ void EditorModel::removeEditor(IEditor *editor)
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
}
void EditorModel::removeAllRestoredEditors()
{
for (int i = m_editors.count()-1; i >= 0; --i) {
if (!m_editors.at(i).editor) {
beginRemoveRows(QModelIndex(), i, i);
m_editors.removeAt(i);
endRemoveRows();
}
}
}
bool EditorModel::isDuplicate(IEditor *editor) const
{
return m_duplicateEditors.contains(editor);
......
......@@ -86,6 +86,7 @@ public:
QList<Entry> entries() const { return m_editors; }
void removeEditor(IEditor *editor);
void removeAllRestoredEditors();
void emitDataChanged(IEditor *editor);
QList<IEditor *> editors() const;
......
......@@ -1138,13 +1138,12 @@ void MainWindow::aboutToShowRecentFiles()
ActionContainer *aci =
m_actionManager->actionContainer(Constants::M_FILE_RECENTFILES);
aci->menu()->clear();
m_recentFilesActions.clear();
bool hasRecentFiles = false;
foreach (QString s, m_fileManager->recentFiles()) {
foreach (const QString &fileName, m_fileManager->recentFiles()) {
hasRecentFiles = true;
QAction *action = aci->menu()->addAction(s);
m_recentFilesActions.insert(action, s);
QAction *action = aci->menu()->addAction(fileName);
action->setData(fileName);
connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
}
aci->menu()->setEnabled(hasRecentFiles);
......@@ -1152,9 +1151,12 @@ void MainWindow::aboutToShowRecentFiles()
void MainWindow::openRecentFile()
{
QAction *a = qobject_cast<QAction*>(sender());
if (m_recentFilesActions.contains(a)) {
editorManager()->openEditor(m_recentFilesActions.value(a));
QAction *action = qobject_cast<QAction*>(sender());
if (!action)
return;
QString fileName = action->data().toString();
if (!fileName.isEmpty()) {
editorManager()->openEditor(fileName);
editorManager()->ensureEditorManagerVisible();
}
}
......
......@@ -191,8 +191,6 @@ private:
GeneralSettings *m_generalSettings;
ShortcutSettings *m_shortcutSettings;
QMap<QAction*, QString> m_recentFilesActions;
// actions
QShortcut *m_focusToEditor;
QAction *m_newAction;
......
......@@ -534,7 +534,7 @@ void BreakHandler::loadSessionData()
updateMarkers();
}
void BreakHandler::activateBreakPoint(int index)
void BreakHandler::activateBreakpoint(int index)
{
const BreakpointData *data = at(index);
//qDebug() << "BREAKPOINT ACTIVATED: " << data->fileName;
......
......@@ -134,7 +134,7 @@ public:
public slots:
void setBreakpoint(const QString &fileName, int lineNumber);
void breakByFunction(const QString &functionName);
void activateBreakPoint(int index);
void activateBreakpoint(int index);
void removeBreakpoint(int index);
signals:
......
......@@ -85,18 +85,23 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
QMenu menu;
QModelIndex index = indexAt(ev->pos());
QAction *act0 = new QAction("Delete breakpoint", &menu);
act0->setEnabled(index.isValid());
QAction *act1 = new QAction("Adjust column widths to contents", &menu);
QAction *act2 = new QAction("Always adjust column widths to contents", &menu);
QAction *act3 = new QAction("Edit condition...", &menu);
act2->setCheckable(true);
act2->setChecked(m_alwaysResizeColumnsToContents);
if (index.isValid()) {
menu.addAction(act0);
menu.addAction(act3);
menu.addSeparator();
}
QAction *act3 = new QAction("Edit condition...", &menu);
act0->setEnabled(index.isValid());
QAction *act4 = new QAction("Syncronize breakpoints", &menu);
QAction *act5 = new QAction("Debugger properties...", &menu);
menu.addAction(act0);
menu.addAction(act3);
menu.addSeparator();
menu.addAction(act1);
menu.addAction(act2);
menu.addAction(act4);
menu.addAction(act5);
QAction *act = menu.exec(ev->globalPos());
......@@ -108,6 +113,10 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents);
else if (act == act3)
editCondition(index);
else if (act == act4)
emit breakpointSynchronizationRequested();
else if (act == act5)
emit settingsDialogRequested();
}
void BreakWindow::deleteBreakpoint(const QModelIndex &idx)
......@@ -116,7 +125,7 @@ void BreakWindow::deleteBreakpoint(const QModelIndex &idx)
if (row == model()->rowCount() - 1)
--row;
setCurrentIndex(idx.sibling(row, 0));
emit breakPointDeleted(idx.row());
emit breakpointDeleted(idx.row());
}
void BreakWindow::editCondition(const QModelIndex &idx)
......@@ -158,6 +167,6 @@ void BreakWindow::setAlwaysResizeColumnsToContents(bool on)
void BreakWindow::rowActivated(const QModelIndex &index)
{
emit breakPointActivated(index.row());
emit breakpointActivated(index.row());
}
......@@ -47,8 +47,10 @@ public slots:
void setAlwaysResizeColumnsToContents(bool on);
signals:
void breakPointDeleted(int index);
void breakPointActivated(int index);
void breakpointDeleted(int index);
void breakpointActivated(int index);
void breakpointSynchronizationRequested();
void settingsDialogRequested();
private slots:
void rowActivated(const QModelIndex &index);
......
......@@ -60,6 +60,7 @@
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QTextStream>
#include <QtCore/QTime>
#include <QtCore/QTimer>
......@@ -94,6 +95,30 @@ DebuggerSettings::DebuggerSettings()
m_debugDumpers = false;
m_useToolTips = false;
m_useCustomDumpers = true;
m_listSourceFiles = false;
}
QString DebuggerSettings::dump()
{
QString out;
QTextStream ts(&out);
ts << "Debugger settings: "
<< " gdbCmd: " << m_gdbCmd
<< " gdbEnv: " << m_gdbEnv
<< " autoRun: " << m_autoRun
<< " autoQuit: " << m_autoQuit
<< " useCustomDumpers: " << m_useCustomDumpers
<< " skipKnownFrames: " << m_skipKnownFrames
<< " debugDumpers: " << m_debugDumpers
<< " useToolTips: " << m_useToolTips
<< " listSourceFiles: " << m_listSourceFiles
<< " scriptFile: " << m_scriptFile
<< " pluginAllBreakpoints: " << m_pluginAllBreakpoints
<< " pluginSelectedBreakpoints: " << m_pluginSelectedBreakpoints
<< " pluginNoBreakpoints: " << m_pluginNoBreakpoints
<< " pluginSelectedBreakpointsPattern: " << m_pluginSelectedBreakpointsPattern;
return out;
}
///////////////////////////////////////////////////////////////////////
......@@ -209,10 +234,14 @@ void DebuggerManager::init()
QAbstractItemView *breakView =
qobject_cast<QAbstractItemView *>(m_breakWindow);
breakView->setModel(m_breakHandler->model());
connect(breakView, SIGNAL(breakPointActivated(int)),
m_breakHandler, SLOT(activateBreakPoint(int)));
connect(breakView, SIGNAL(breakPointDeleted(int)),
connect(breakView, SIGNAL(breakpointActivated(int)),
m_breakHandler, SLOT(activateBreakpoint(int)));
connect(breakView, SIGNAL(breakpointDeleted(int)),
m_breakHandler, SLOT(removeBreakpoint(int)));
connect(breakView, SIGNAL(settingsDialogRequested()),
this, SIGNAL(settingsDialogRequested()));
connect(breakView, SIGNAL(breakpointSynchronizationRequested()),
this, SLOT(attemptBreakpointSynchronization()));
connect(m_breakHandler, SIGNAL(gotoLocation(QString,int,bool)),
this, SLOT(gotoLocation(QString,int,bool)));
connect(m_breakHandler, SIGNAL(sessionValueRequested(QString,QVariant*)),
......@@ -231,6 +260,8 @@ void DebuggerManager::init()
this, SLOT(loadSymbols(QString)));
connect(modulesView, SIGNAL(loadAllSymbolsRequested()),
this, SLOT(loadAllSymbols()));
connect(modulesView, SIGNAL(fileOpenRequested(QString)),
this, SLOT(fileOpen(QString)));
// Source Files
//m_sourceFilesHandler = new SourceFilesHandler;
......@@ -239,6 +270,8 @@ void DebuggerManager::init()
//sourceFileView->setModel(m_stackHandler->stackModel());
connect(sourceFilesView, SIGNAL(reloadSourceFilesRequested()),
this, SLOT(reloadSourceFiles()));
connect(sourceFilesView, SIGNAL(fileOpenRequested(QString)),
this, SLOT(fileOpen(QString)));
// Registers
QAbstractItemView *registerView =
......@@ -635,6 +668,7 @@ void DebuggerManager::shutdown()
delete m_outputWindow;
delete m_registerWindow;
delete m_stackWindow;
delete m_sourceFilesWindow;
delete m_threadsWindow;
delete m_tooltipWindow;
delete m_watchersWindow;
......@@ -646,6 +680,7 @@ void DebuggerManager::shutdown()
m_outputWindow = 0;
m_registerWindow = 0;
m_stackWindow = 0;
m_sourceFilesWindow = 0;
m_threadsWindow = 0;
m_tooltipWindow = 0;
m_watchersWindow = 0;
......@@ -701,6 +736,11 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber)
m_engine->attemptBreakpointSynchronization();
}
void DebuggerManager::attemptBreakpointSynchronization()
{
m_engine->attemptBreakpointSynchronization();
}
void DebuggerManager::setToolTipExpression(const QPoint &pos, const QString &exp)
{
QTC_ASSERT(m_engine, return);
......@@ -960,6 +1000,7 @@ void DebuggerManager::cleanupViews()
disassemblerHandler()->removeAll();
modulesHandler()->removeAll();
watchHandler()->cleanup();
m_sourceFilesWindow->removeAll();
}
void DebuggerManager::exitDebugger()
......@@ -1215,6 +1256,7 @@ void DebuggerManager::setBusyCursor(bool busy)
m_outputWindow->setCursor(cursor);
m_registerWindow->setCursor(cursor);
m_stackWindow->setCursor(cursor);
m_sourceFilesWindow->setCursor(cursor);
m_threadsWindow->setCursor(cursor);
m_tooltipWindow->setCursor(cursor);
m_watchersWindow->setCursor(cursor);
......@@ -1352,6 +1394,13 @@ void DebuggerManager::gotoLocation(const QString &fileName, int line,
emit gotoLocationRequested(fileName, line, setMarker);
}
void DebuggerManager::fileOpen(const QString &fileName)
{
// connected to the plugin
emit gotoLocationRequested(fileName, 1, false);
}
//////////////////////////////////////////////////////////////////////
//
......
......@@ -164,6 +164,7 @@ private:
virtual bool debugDumpers() const = 0;
virtual bool useCustomDumpers() const = 0;
virtual bool wantsSourceFileList() const = 0;
virtual bool wantsAllPluginBreakpoints() const = 0;
virtual bool wantsSelectedPluginBreakpoints() const = 0;
virtual bool wantsNoPluginBreakpoints() const = 0;
......@@ -184,6 +185,7 @@ class DebuggerSettings
{
public:
DebuggerSettings();
QString dump();
public:
QString m_gdbCmd;
......@@ -194,8 +196,8 @@ public:
bool m_useCustomDumpers;
bool m_skipKnownFrames;
bool m_debugDumpers;
bool m_useFastStart;
bool m_useToolTips;
bool m_listSourceFiles;
QString m_scriptFile;
......@@ -243,6 +245,7 @@ public slots:
QVariant sessionValue(const QString &name);
void gotoLocation(const QString &file, int line, bool setLocationMarker);
void fileOpen(const QString &file);
void resetLocation();
void interruptDebuggingRequest();
......@@ -307,6 +310,7 @@ private slots:
void registerDockToggled(bool on);
void setStatus(int status);
void clearStatusMessage();
void attemptBreakpointSynchronization();
private:
//
......@@ -324,6 +328,8 @@ private:
bool skipKnownFrames() const;
bool debugDumpers() const;
bool useCustomDumpers() const;
bool wantsSourceFileList() const
{ return m_settings.m_listSourceFiles; }
bool wantsAllPluginBreakpoints() const
{ return m_settings.m_pluginAllBreakpoints; }
bool wantsSelectedPluginBreakpoints() const
......
......@@ -283,6 +283,7 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
m_ui.lineEditSelectedPluginBreakpointsPattern->
setEnabled(m_settings.m_pluginSelectedBreakpoints);
m_ui.checkBoxListSourceFiles->setChecked(m_settings.m_listSourceFiles);
m_ui.checkBoxSkipKnownFrames->setChecked(m_settings.m_skipKnownFrames);
m_ui.checkBoxDebugDumpers->setChecked(m_settings.m_debugDumpers);
m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers);
......@@ -321,6 +322,7 @@ void GdbOptionPage::apply()
m_settings.m_scriptFile = m_ui.scriptFileChooser->path();
m_settings.m_skipKnownFrames = m_ui.checkBoxSkipKnownFrames->isChecked();
m_settings.m_listSourceFiles = m_ui.checkBoxListSourceFiles->isChecked();
m_settings.m_debugDumpers = m_ui.checkBoxDebugDumpers->isChecked();
m_settings.m_useCustomDumpers = m_ui.checkBoxUseCustomDumpers->isChecked();
m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked();
......@@ -907,6 +909,7 @@ void DebuggerPlugin::writeSettings() const
s->setValue("UseToolTips", m->m_useToolTips);
s->setValue("UseCustomDumpers", m->m_useCustomDumpers);
s->setValue("ListSourceFiles", m->m_listSourceFiles);
s->setValue("SkipKnowFrames", m->m_skipKnownFrames);
s->setValue("DebugDumpers", m->m_debugDumpers);
......@@ -945,6 +948,7 @@ void DebuggerPlugin::readSettings()
m->m_debugDumpers = s->value("DebugDumpers", false).toBool();
m->m_useCustomDumpers = s->value("UseCustomDumpers", true).toBool();
m->m_useToolTips = s->value("UseToolTips", false).toBool();
m->m_listSourceFiles = s->value("ListSourceFiles", false).toBool();
m->m_pluginAllBreakpoints =
s->value("AllPluginBreakpoints", true).toBool();
......
......@@ -1140,7 +1140,8 @@ void GdbEngine::handleAqcuiredInferior()
#if defined(Q_OS_MAC)
sendCommand("info pid", GdbInfoProc, QVariant(), NeedsStop);
#endif
//reloadSourceFiles();
if (qq->wantsSourceFileList())
reloadSourceFiles();
tryLoadCustomDumpers();
#ifndef Q_OS_MAC
......@@ -1297,7 +1298,12 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
frame.findChild("func").data() + '%';
QApplication::alert(q->mainWindow(), 3000);
<<<<<<< HEAD:src/plugins/debugger/gdbengine.cpp
//reloadSourceFiles();
=======
if (qq->wantsSourceFileList())
reloadSourceFiles();
>>>>>>> c0b1386361695fca7865a79af193c74c3d2ac495:src/plugins/debugger/gdbengine.cpp
sendCommand("-break-list", BreakList);
QVariant var = QVariant::fromValue<GdbMi>(data);
sendCommand("p 0", GdbAsyncOutput2, var); // dummy
......@@ -1556,6 +1562,7 @@ int GdbEngine::currentFrame() const
bool GdbEngine::startDebugger()
{
debugMessage(q->settings()->dump());
QStringList gdbArgs;
if (m_gdbProc.state() != QProcess::NotRunning) {
......
......@@ -141,7 +141,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
......@@ -152,7 +152,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QCheckBox" name="checkBoxUseToolTips">
<property name="toolTip">
<string>Checking this will make enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string>
......@@ -162,7 +162,7 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="checkBoxDebugDumpers">
<property name="toolTip">
<string notr="true">This is an internal tool to make debugging the Custom Data Dumper code easier. Using this action is in general not needed unless you want do debug Qt Creator itself.</string>
......@@ -172,7 +172,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -185,6 +185,16 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxListSourceFiles">
<property name="toolTip">
<string>Checking this will populate the source file view automatically but might slow down debugger startup considerably.</string>
</property>
<property name="text">
<string>Populate source file view automatically</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
......
......@@ -48,6 +48,16 @@ ModulesWindow::ModulesWindow(QWidget *parent)
setAlternatingRowColors(true);
setRootIsDecorated(false);
setIconSize(QSize(10, 10));
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(moduleActivated(QModelIndex)));
}
void ModulesWindow::moduleActivated(const QModelIndex &index)
{
qDebug() << "ACTIVATED: " << index.row() << index.column()
<< model()->data(index);
emit fileOpenRequested(model()->data(index).toString());
}
void ModulesWindow::resizeEvent(QResizeEvent *event)
......@@ -73,19 +83,30 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
QString name = model()->data(index).toString();
QMenu menu;
QAction *act0 = new QAction("Update module list", &menu);
QAction *act1 = new QAction("Adjust column widths to contents", &menu);
QAction *act2 = new QAction("Always adjust column widths to contents", &menu);
QAction *act0 = new QAction(tr("Update module list"), &menu);
QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu);
QAction *act2 = new QAction(tr("Always adjust column widths to contents"), &menu);
act2->setCheckable(true);
act2->setChecked(m_alwaysResizeColumnsToContents);
QAction *act3 = new QAction("Show source files for module " + name, &menu);
QAction *act4 = new QAction("Load symbols for all modules", &menu);
QAction *act5 = new QAction("Load symbols for module " + name, &menu);
QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name),
&menu);
QAction *act4 = new QAction(tr("Load symbols for all modules"), &menu);
QAction *act5 = 0;
QAction *act6 = 0;
if (name.isEmpty()) {
act5 = new QAction(tr("Load symbols for module"), &menu);
act6 = new QAction(tr("Edit file"), &menu);
} else {
act5 = new QAction(tr("Load symbols for module \"%1\"").arg(name), &menu);
act6 = new QAction(tr("Edit file \"%1\"").arg(name), &menu);
}
act5->setDisabled(name.isEmpty());
act6->setDisabled(name.isEmpty());
menu.addAction(act0);
menu.addAction(act4);
menu.addAction(act5);
menu.addAction(act6);
menu.addSeparator();
menu.addAction(act1);
menu.addAction(act2);
......@@ -104,6 +125,8 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
emit loadAllSymbolsRequested();
else if (act == act5)
emit loadSymbolsRequested(name);
else if (act == act6)
emit fileOpenRequested(name);
}
void ModulesWindow::resizeColumnsToContents()
......
......@@ -47,17 +47,18 @@ signals:
void displaySourceRequested(const QString &modulesName);
void loadSymbolsRequested(const QString &modulesName);
void loadAllSymbolsRequested();
void fileOpenRequested(QString);
public slots:
void resizeColumnsToContents();
void setAlwaysResizeColumnsToContents(bool on);
void moduleActivated(const QModelIndex &);
protected:
private:
void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
void setModel(QAbstractItemModel *model);
private:
bool m_alwaysResizeColumnsToContents;
};
......
......@@ -178,28 +178,40 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)