diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index f5a14f1bdde..e0428f8cf56 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -285,6 +285,9 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
const BreakpointData *data = at(mi.row());
+ if (role == BreakpointRole)
+ return qulonglong(data);
+
if (role == BreakpointUseFullPathRole)
return data->useFullPath;
@@ -502,6 +505,15 @@ bool BreakHandler::setData(const QModelIndex &index, const QVariant &value, int
return false;
}
+void BreakHandler::reinsertBreakpoint(BreakpointData *data)
+{
+ // FIXME: Use some more direct method?
+ appendBreakpoint(data->clone());
+ removeBreakpoint(data);
+ m_engine->attemptBreakpointSynchronization();
+ emit layoutChanged();
+}
+
void BreakHandler::append(BreakpointData *data)
{
data->m_handler = this;
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h
index 432bf0a27a8..9a9aa30289c 100644
--- a/src/plugins/debugger/breakhandler.h
+++ b/src/plugins/debugger/breakhandler.h
@@ -66,7 +66,6 @@ public:
BreakpointData *at(int index) const;
int size() const { return m_bp.size(); }
bool hasPendingBreakpoints() const;
- void append(BreakpointData *data);
void removeAt(int index); // This also deletes the marker.
void clear(); // This also deletes all the marker.
int indexOf(BreakpointData *data) { return m_bp.indexOf(data); }
@@ -99,6 +98,7 @@ public:
public slots:
void appendBreakpoint(BreakpointData *data);
+ void reinsertBreakpoint(BreakpointData *data);
void toggleBreakpointEnabled(BreakpointData *data);
void breakByFunction(const QString &functionName);
void removeBreakpoint(int index);
@@ -119,6 +119,7 @@ private:
void loadBreakpoints();
void saveBreakpoints();
void removeBreakpointHelper(int index);
+ void append(BreakpointData *data);
const QIcon m_breakpointIcon;
const QIcon m_disabledBreakpointIcon;
diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp
index 3d45c972b59..f7dc8a848e2 100644
--- a/src/plugins/debugger/breakpoint.cpp
+++ b/src/plugins/debugger/breakpoint.cpp
@@ -364,6 +364,12 @@ bool BreakpointData::conditionsMatch() const
return s1 == s2;
}
+void BreakpointData::reinsertBreakpoint()
+{
+ QTC_ASSERT(m_handler, return);
+ m_handler->reinsertBreakpoint(this);
+}
+
} // namespace Internal
} // namespace Debugger
diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h
index ffe6a654dd4..7e22ffdb918 100644
--- a/src/plugins/debugger/breakpoint.h
+++ b/src/plugins/debugger/breakpoint.h
@@ -56,6 +56,7 @@ public:
void updateMarker();
QString toToolTip() const;
BreakHandler *handler() { return m_handler; }
+ void reinsertBreakpoint();
bool isLocatedAt(const QString &fileName, int lineNumber,
bool useMarkerPosition) const;
diff --git a/src/plugins/debugger/breakpoint.ui b/src/plugins/debugger/breakpoint.ui
index f9e09010ba3..e8932ce84cf 100644
--- a/src/plugins/debugger/breakpoint.ui
+++ b/src/plugins/debugger/breakpoint.ui
@@ -7,7 +7,7 @@
0
0
382
- 280
+ 302
@@ -46,56 +46,70 @@
-
- -
-
+
-
+
- Function:
+
- -
-
-
- -
-
-
- Condition:
-
-
-
- -
-
-
- -
-
-
- Ignore count:
-
-
-
- -
-
-
- -
-
-
- Thread specification:
-
-
-
- -
-
-
-
+
+
+ Use full path:
+
+
+
+ -
Address:
- -
+
-
+ -
+
+
+ Function:
+
+
+
+ -
+
+
+ -
+
+
+ Condition:
+
+
+
+ -
+
+
+ -
+
+
+ Ignore count:
+
+
+
+ -
+
+
+ -
+
+
+ Thread specification:
+
+
+
+ -
+
+
-
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index 09e885fa622..5492691345d 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -64,7 +64,7 @@ class BreakpointDialog : public QDialog, public Ui::BreakpointDialog
{
Q_OBJECT
public:
- explicit BreakpointDialog(QWidget *parent)
+ explicit BreakpointDialog(QWidget *parent, BreakpointData *data)
: QDialog(parent)
{
setupUi(this);
@@ -72,8 +72,21 @@ public:
comboBoxType->insertItem(1, tr("Function Name"));
comboBoxType->insertItem(2, tr("Function \"main()\""));
comboBoxType->insertItem(3, tr("Address"));
- connect(comboBoxType, SIGNAL(activated(int)),
- SLOT(typeChanged(int)));
+ lineEditFileName->setText(data->fileName);
+ lineEditLineNumber->setText(QByteArray::number(data->lineNumber));
+ lineEditFunction->setText(data->funcName);
+ lineEditCondition->setText(data->condition);
+ lineEditIgnoreCount->setText(QByteArray::number(data->ignoreCount));
+ checkBoxUseFullPath->setChecked(data->useFullPath);
+ if (data->address)
+ lineEditAddress->setText("0x" + QByteArray::number(data->address, 16));
+ int initialType = 0;
+ if (!data->funcName.isEmpty())
+ initialType = lineEditFunction->text() == "main" ? 2 : 1;
+ if (data->address)
+ initialType = 3;
+ typeChanged(initialType);
+ connect(comboBoxType, SIGNAL(activated(int)), SLOT(typeChanged(int)));
}
public slots:
@@ -86,6 +99,8 @@ public slots:
lineEditFileName->setEnabled(isLineVisible);
labelLineNumber->setEnabled(isLineVisible);
lineEditLineNumber->setEnabled(isLineVisible);
+ labelUseFullPath->setEnabled(isLineVisible);
+ checkBoxUseFullPath->setEnabled(isLineVisible);
labelFunction->setEnabled(isFunctionVisible);
lineEditFunction->setEnabled(isFunctionVisible);
labelAddress->setEnabled(isAddressVisible);
@@ -279,16 +294,13 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
pathAction->setEnabled(si.size() > 0);
QAction *addBreakpointAction =
- new QAction(tr("Set Breakpoint..."), this);
- //QAction *breakAtFunctionAction =
- // new QAction(tr("Set Breakpoint at Function..."), this);
- //QAction *breakAtMainAction =
- // new QAction(tr("Set Breakpoint at Function \"main\""), this);
+ new QAction(tr("Add Breakpoint..."), this);
QAction *breakAtThrowAction =
new QAction(tr("Set Breakpoint at \"throw\""), this);
QAction *breakAtCatchAction =
new QAction(tr("Set Breakpoint at \"catch\""), this);
+ menu.addAction(addBreakpointAction);
menu.addAction(deleteAction);
menu.addAction(editBreakpointAction);
menu.addAction(associateBreakpointAction);
@@ -299,11 +311,8 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(deleteByFileAction);
menu.addSeparator();
menu.addAction(synchronizeAction);
- menu.addSeparator();
- //menu.addAction(breakAtFunctionAction);
- //menu.addAction(breakAtMainAction);
- menu.addAction(addBreakpointAction);
if (engineCapabilities & BreakOnThrowAndCatchCapability) {
+ menu.addSeparator();
menu.addAction(breakAtThrowAction);
menu.addAction(breakAtCatchAction);
}
@@ -392,41 +401,58 @@ void BreakWindow::deleteBreakpoints(QList list)
setModelData(RequestSynchronizeBreakpointsRole);
}
-void BreakWindow::addBreakpoint()
+bool BreakWindow::editBreakpoint(BreakpointData *data)
{
- BreakpointDialog dialog(this);
+ BreakpointDialog dialog(this, data);
if (dialog.exec() == QDialog::Rejected)
- return;
- BreakpointData *data = new BreakpointData();
- if (!dialog.lineEditAddress->text().isEmpty()) {
- bool ok = false;
+ return false;
+ bool ok = false;
+ if (!dialog.lineEditAddress->text().isEmpty())
data->address = dialog.lineEditAddress->text().toULongLong(&ok, 0);
- }
+ if (!dialog.lineEditFunction->text().isEmpty())
+ data->funcName = dialog.lineEditFunction->text();
if (!dialog.lineEditFunction->text().isEmpty())
data->funcName = dialog.lineEditFunction->text();
if (!dialog.lineEditFileName->text().isEmpty())
data->fileName = dialog.lineEditFileName->text();
- if (!dialog.lineEditFileName->text().isEmpty())
- data->fileName = dialog.lineEditFileName->text();
+ data->lineNumber = dialog.lineEditLineNumber->text().toInt();
+ data->useFullPath = dialog.checkBoxUseFullPath->isChecked();
if (!dialog.lineEditCondition->text().isEmpty())
data->condition = dialog.lineEditCondition->text().toUtf8();
if (!dialog.lineEditIgnoreCount->text().isEmpty())
data->ignoreCount = dialog.lineEditIgnoreCount->text().toInt();
if (!dialog.lineEditThreadSpec->text().isEmpty())
data->threadSpec = dialog.lineEditThreadSpec->text().toUtf8();
- setModelData(RequestBreakpointRole, QVariant::fromValue(data));
+ return true;
+}
+
+void BreakWindow::addBreakpoint()
+{
+ BreakpointData *data = new BreakpointData();
+ if (editBreakpoint(data))
+ setModelData(RequestBreakpointRole, QVariant::fromValue(data));
+ else
+ delete data;
}
void BreakWindow::editBreakpoints(const QModelIndexList &list)
{
+ if (list.size() == 1) {
+ QVariant var = model()->data(list.at(0), BreakpointRole);
+ BreakpointData *data = (BreakpointData *)var.toULongLong();
+ if (editBreakpoint(data))
+ data->reinsertBreakpoint();
+ return;
+ }
+
+ // This allows to change properties of multiple breakpoints at a time.
QDialog dlg(this);
Ui::BreakCondition ui;
ui.setupUi(&dlg);
QTC_ASSERT(!list.isEmpty(), return);
QModelIndex idx = list.front();
- const int row = idx.row();
- dlg.setWindowTitle(tr("Conditions on Breakpoint %1").arg(row));
+ dlg.setWindowTitle(tr("Edit Breakpoint Properties"));
ui.lineEditFunction->hide();
ui.labelFunction->hide();
ui.lineEditFileName->hide();
@@ -436,7 +462,8 @@ void BreakWindow::editBreakpoints(const QModelIndexList &list)
QAbstractItemModel *m = model();
ui.lineEditCondition->setText(
m->data(idx, BreakpointConditionRole).toString());
- ui.lineEditIgnoreCount->setValidator(new QIntValidator(0, 2147483647, ui.lineEditIgnoreCount));
+ ui.lineEditIgnoreCount->setValidator(
+ new QIntValidator(0, 2147483647, ui.lineEditIgnoreCount));
ui.lineEditIgnoreCount->setText(
m->data(idx, BreakpointIgnoreCountRole).toString());
ui.lineEditThreadSpec->setText(
diff --git a/src/plugins/debugger/breakwindow.h b/src/plugins/debugger/breakwindow.h
index 2a9e41b7a0d..5b6b1cb969b 100644
--- a/src/plugins/debugger/breakwindow.h
+++ b/src/plugins/debugger/breakwindow.h
@@ -62,6 +62,7 @@ private:
void deleteBreakpoints(const QModelIndexList &list);
void deleteBreakpoints(QList rows);
void addBreakpoint();
+ bool editBreakpoint(BreakpointData *data); // Returns 'Accept'.
void editBreakpoints(const QModelIndexList &list);
void associateBreakpoint(const QModelIndexList &list, int thread);
void setBreakpointsEnabled(const QModelIndexList &list, bool enabled);
diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index 6f56ef5dbcc..35e60bcfe45 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -204,6 +204,7 @@ enum ModelRoles
RequestExecuteCommandRole,
// Breakpoints
+ BreakpointRole,
BreakpointEnabledRole,
BreakpointUseFullPathRole,
BreakpointFunctionNameRole,