Commit 341de778 authored by hjk's avatar hjk
Browse files

Fixes: debugger: make loading list of source files optional

parent 711d73fa
......@@ -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);
......
......@@ -94,6 +94,7 @@ DebuggerSettings::DebuggerSettings()
m_debugDumpers = false;
m_useToolTips = false;
m_useCustomDumpers = true;
m_listSourceFiles = false;
}
///////////////////////////////////////////////////////////////////////
......@@ -209,10 +210,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*)),
......@@ -635,6 +640,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 +652,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 +708,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 +972,7 @@ void DebuggerManager::cleanupViews()
disassemblerHandler()->removeAll();
modulesHandler()->removeAll();
watchHandler()->cleanup();
m_sourceFilesWindow->removeAll();
}
void DebuggerManager::exitDebugger()
......@@ -1215,6 +1228,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);
......
......@@ -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;
......@@ -196,6 +197,7 @@ public:
bool m_debugDumpers;
bool m_useFastStart;
bool m_useToolTips;
bool m_listSourceFiles;
QString m_scriptFile;
......@@ -307,6 +309,7 @@ private slots:
void registerDockToggled(bool on);
void setStatus(int status);
void clearStatusMessage();
void attemptBreakpointSynchronization();
private:
//
......@@ -324,6 +327,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,8 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
frame.findChild("func").data() + '%';
QApplication::alert(q->mainWindow(), 3000);
reloadSourceFiles();
if (qq->wantsSourceFileList())
reloadSourceFiles();
sendCommand("-break-list", BreakList);
QVariant var = QVariant::fromValue<GdbMi>(data);
sendCommand("p 0", GdbAsyncOutput2, var); // dummy
......
......@@ -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>
......
......@@ -207,3 +207,10 @@ void SourceFilesWindow::setSourceFiles(const QMap<QString, QString> &sourceFiles
m_model->setSourceFiles(sourceFiles);
header()->setResizeMode(0, QHeaderView::ResizeToContents);
}
void SourceFilesWindow::removeAll()
{
m_model->setSourceFiles(QMap<QString, QString>());
header()->setResizeMode(0, QHeaderView::ResizeToContents);
}
......@@ -53,6 +53,7 @@ public:
~SourceFilesWindow();
void setSourceFiles(const QMap<QString, QString> &sourceFiles);
void removeAll();
signals:
void reloadSourceFilesRequested();
......
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