forked from qt-creator/qt-creator
debugger: reenable disabling of breakpoints in editor context menu
This commit is contained in:
@@ -572,15 +572,6 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
|||||||
static const QString empty = QString(QLatin1Char('-'));
|
static const QString empty = QString(QLatin1Char('-'));
|
||||||
|
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case RequestFindSimilarBreakpointRole: {
|
|
||||||
// Complain if data/setData are not used alternately.
|
|
||||||
QTC_ASSERT(m_lastFoundQueried, return false);
|
|
||||||
QVariant value = QVariant::fromValue(m_lastFound);
|
|
||||||
m_lastFoundQueried = false;
|
|
||||||
m_lastFound = 0; // Reset for "safety".
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
case CurrentThreadIdRole:
|
case CurrentThreadIdRole:
|
||||||
QTC_ASSERT(m_engine, return QVariant());
|
QTC_ASSERT(m_engine, return QVariant());
|
||||||
return m_engine->threadsHandler()->currentThreadId();
|
return m_engine->threadsHandler()->currentThreadId();
|
||||||
@@ -714,16 +705,6 @@ Qt::ItemFlags BreakHandler::flags(const QModelIndex &index) const
|
|||||||
bool BreakHandler::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool BreakHandler::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case RequestFindSimilarBreakpointRole: {
|
|
||||||
// Complain if data/setData are not used alternately.
|
|
||||||
QTC_ASSERT(!m_lastFoundQueried, return false);
|
|
||||||
BreakpointData *needle = value.value<BreakpointData *>();
|
|
||||||
QTC_ASSERT(needle, return false);
|
|
||||||
m_lastFound = findSimilarBreakpoint(needle);
|
|
||||||
m_lastFoundQueried = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestActivateBreakpointRole: {
|
case RequestActivateBreakpointRole: {
|
||||||
const BreakpointData *data = at(value.toInt());
|
const BreakpointData *data = at(value.toInt());
|
||||||
QTC_ASSERT(data, return false);
|
QTC_ASSERT(data, return false);
|
||||||
@@ -739,14 +720,6 @@ bool BreakHandler::setData(const QModelIndex &index, const QVariant &value, int
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case RequestUpdateBreakpointRole: {
|
|
||||||
BreakpointData *data = value.value<BreakpointData *>();
|
|
||||||
QTC_ASSERT(data, return false);
|
|
||||||
QTC_ASSERT(m_engine, return false);
|
|
||||||
m_engine->attemptBreakpointSynchronization();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestSynchronizeBreakpointsRole:
|
case RequestSynchronizeBreakpointsRole:
|
||||||
QTC_ASSERT(m_engine, return false);
|
QTC_ASSERT(m_engine, return false);
|
||||||
m_engine->attemptBreakpointSynchronization();
|
m_engine->attemptBreakpointSynchronization();
|
||||||
@@ -884,14 +857,12 @@ void BreakHandler::removeBreakpoint(int index)
|
|||||||
return;
|
return;
|
||||||
removeBreakpointHelper(index);
|
removeBreakpointHelper(index);
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
//saveBreakpoints();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakHandler::removeBreakpoint(BreakpointData *data)
|
void BreakHandler::removeBreakpoint(BreakpointData *data)
|
||||||
{
|
{
|
||||||
removeBreakpointHelper(m_bp.indexOf(data));
|
removeBreakpointHelper(m_bp.indexOf(data));
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
//saveBreakpoints();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakHandler::toggleBreakpointEnabled(BreakpointData *data)
|
void BreakHandler::toggleBreakpointEnabled(BreakpointData *data)
|
||||||
@@ -905,7 +876,6 @@ void BreakHandler::toggleBreakpointEnabled(BreakpointData *data)
|
|||||||
m_enabled.removeAll(data);
|
m_enabled.removeAll(data);
|
||||||
m_disabled.append(data);
|
m_disabled.append(data);
|
||||||
}
|
}
|
||||||
//saveBreakpoints();
|
|
||||||
updateMarkers();
|
updateMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -913,7 +883,7 @@ void BreakHandler::appendBreakpoint(BreakpointData *data)
|
|||||||
{
|
{
|
||||||
append(data);
|
append(data);
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
saveBreakpoints();
|
saveBreakpoints(); // FIXME: remove?
|
||||||
updateMarkers();
|
updateMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -922,27 +892,40 @@ void BreakHandler::removeAllBreakpoints()
|
|||||||
for (int index = size(); --index >= 0;)
|
for (int index = size(); --index >= 0;)
|
||||||
removeBreakpointHelper(index);
|
removeBreakpointHelper(index);
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
//saveBreakpoints();
|
|
||||||
updateMarkers();
|
updateMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BreakpointData *BreakHandler::findBreakpoint(const QString &fileName, int lineNumber)
|
||||||
|
{
|
||||||
|
foreach (BreakpointData *data, m_bp)
|
||||||
|
if (data->isLocatedAt(fileName, lineNumber))
|
||||||
|
return data;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void BreakHandler::toggleBreakpoint(const QString &fileName, int lineNumber)
|
void BreakHandler::toggleBreakpoint(const QString &fileName, int lineNumber)
|
||||||
{
|
{
|
||||||
for (int index = size(); --index >= 0;) {
|
BreakpointData *data = findBreakpoint(fileName, lineNumber);
|
||||||
BreakpointData *data = m_bp.at(index);
|
if (data) {
|
||||||
if (data->isLocatedAt(fileName, lineNumber)) {
|
removeBreakpoint(data);
|
||||||
removeBreakpointHelper(index);
|
} else {
|
||||||
emit layoutChanged();
|
data = new BreakpointData;
|
||||||
return;
|
data->fileName = fileName;
|
||||||
}
|
data->lineNumber = QByteArray::number(lineNumber);
|
||||||
|
data->pending = true;
|
||||||
|
data->setMarkerFileName(fileName);
|
||||||
|
data->setMarkerLineNumber(lineNumber);
|
||||||
|
appendBreakpoint(data);
|
||||||
|
m_engine->attemptBreakpointSynchronization();
|
||||||
}
|
}
|
||||||
BreakpointData *data = new BreakpointData;
|
}
|
||||||
data->fileName = fileName;
|
|
||||||
data->lineNumber = QByteArray::number(lineNumber);
|
void BreakHandler::toggleBreakpointEnabled(const QString &fileName, int lineNumber)
|
||||||
data->pending = true;
|
{
|
||||||
data->setMarkerFileName(fileName);
|
BreakpointData *data = findBreakpoint(fileName, lineNumber);
|
||||||
data->setMarkerLineNumber(lineNumber);
|
QTC_ASSERT(data, return);
|
||||||
appendBreakpoint(data);
|
data->enabled = !data->enabled;
|
||||||
|
data->updateMarker();
|
||||||
m_engine->attemptBreakpointSynchronization();
|
m_engine->attemptBreakpointSynchronization();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -88,6 +88,8 @@ public:
|
|||||||
void initializeFromTemplate(BreakHandler *other);
|
void initializeFromTemplate(BreakHandler *other);
|
||||||
void storeToTemplate(BreakHandler *other);
|
void storeToTemplate(BreakHandler *other);
|
||||||
void toggleBreakpoint(const QString &fileName, int lineNumber);
|
void toggleBreakpoint(const QString &fileName, int lineNumber);
|
||||||
|
void toggleBreakpointEnabled(const QString &fileName, int lineNumber);
|
||||||
|
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void appendBreakpoint(BreakpointData *data);
|
void appendBreakpoint(BreakpointData *data);
|
||||||
|
@@ -411,22 +411,6 @@ void BreakWindow::rowActivated(const QModelIndex &index)
|
|||||||
setModelData(RequestActivateBreakpointRole, index.row());
|
setModelData(RequestActivateBreakpointRole, index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
BreakpointData *BreakWindow::findSimilarBreakpoint(const BreakpointData *needle0)
|
|
||||||
{
|
|
||||||
BreakpointData *needle = const_cast<BreakpointData *>(needle0);
|
|
||||||
QVariant v = QVariant::fromValue<BreakpointData *>(needle);
|
|
||||||
setModelData(RequestFindSimilarBreakpointRole, v);
|
|
||||||
QTC_ASSERT(model(), return false);
|
|
||||||
v = model()->data(QModelIndex(), RequestFindSimilarBreakpointRole);
|
|
||||||
return v.value<BreakpointData *>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BreakWindow::updateBreakpoint(BreakpointData *data)
|
|
||||||
{
|
|
||||||
QVariant v = QVariant::fromValue<BreakpointData *>(data);
|
|
||||||
setModelData(RequestUpdateBreakpointRole, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BreakWindow::setModelData
|
void BreakWindow::setModelData
|
||||||
(int role, const QVariant &value, const QModelIndex &index)
|
(int role, const QVariant &value, const QModelIndex &index)
|
||||||
{
|
{
|
||||||
|
@@ -45,17 +45,10 @@ public:
|
|||||||
explicit BreakWindow(QWidget *parent = 0);
|
explicit BreakWindow(QWidget *parent = 0);
|
||||||
~BreakWindow();
|
~BreakWindow();
|
||||||
|
|
||||||
BreakpointData *findSimilarBreakpoint(const BreakpointData *needle);
|
private slots:
|
||||||
void updateBreakpoint(BreakpointData *data);
|
|
||||||
//void appendBreakpoint(BreakpointData *data);
|
|
||||||
//void removeBreakpoint(BreakpointData *data);
|
|
||||||
QVariant modelData(int role, int index);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void resizeColumnsToContents();
|
void resizeColumnsToContents();
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
void setAlwaysResizeColumnsToContents(bool on);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void rowActivated(const QModelIndex &index);
|
void rowActivated(const QModelIndex &index);
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
||||||
void showAddressColumn(bool on);
|
void showAddressColumn(bool on);
|
||||||
|
@@ -194,9 +194,9 @@ enum ModelRoles
|
|||||||
RequestSynchronizeBreakpointsRole,
|
RequestSynchronizeBreakpointsRole,
|
||||||
RequestBreakByFunctionRole,
|
RequestBreakByFunctionRole,
|
||||||
RequestBreakByFunctionMainRole,
|
RequestBreakByFunctionMainRole,
|
||||||
RequestFindSimilarBreakpointRole,
|
|
||||||
RequestUpdateBreakpointRole,
|
|
||||||
RequestToggleBreakpointRole,
|
RequestToggleBreakpointRole,
|
||||||
|
RequestToggleBreakpointEnabledRole,
|
||||||
|
RequestContextMenuRole,
|
||||||
|
|
||||||
// Locals and Watchers
|
// Locals and Watchers
|
||||||
LocalsINameRole,
|
LocalsINameRole,
|
||||||
|
@@ -72,6 +72,7 @@
|
|||||||
#include <QtGui/QAbstractItemView>
|
#include <QtGui/QAbstractItemView>
|
||||||
#include <QtGui/QStandardItemModel>
|
#include <QtGui/QStandardItemModel>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QPlainTextEdit>
|
#include <QtGui/QPlainTextEdit>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
@@ -197,8 +198,10 @@ bool CommandHandler::setData(const QModelIndex &, const QVariant &value, int rol
|
|||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class DebuggerEnginePrivate
|
class DebuggerEnginePrivate : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerEnginePrivate(DebuggerEngine *engine, const DebuggerStartParameters &sp)
|
DebuggerEnginePrivate(DebuggerEngine *engine, const DebuggerStartParameters &sp)
|
||||||
: m_engine(engine),
|
: m_engine(engine),
|
||||||
@@ -217,6 +220,11 @@ public:
|
|||||||
m_disassemblerViewAgent(engine)
|
m_disassemblerViewAgent(engine)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void breakpointSetRemoveMarginActionTriggered();
|
||||||
|
void breakpointEnableDisableMarginActionTriggered();
|
||||||
|
void handleContextMenuRequest(const QVariant ¶meters);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerEngine *m_engine; // Not owned.
|
DebuggerEngine *m_engine; // Not owned.
|
||||||
DebuggerRunControl *m_runControl; // Not owned.
|
DebuggerRunControl *m_runControl; // Not owned.
|
||||||
@@ -238,6 +246,85 @@ public:
|
|||||||
DisassemblerViewAgent m_disassemblerViewAgent;
|
DisassemblerViewAgent m_disassemblerViewAgent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void DebuggerEnginePrivate::breakpointSetRemoveMarginActionTriggered()
|
||||||
|
{
|
||||||
|
QAction *act = qobject_cast<QAction *>(sender());
|
||||||
|
QTC_ASSERT(act, return);
|
||||||
|
QList<QVariant> list = act->data().toList();
|
||||||
|
QTC_ASSERT(list.size() == 2, return);
|
||||||
|
const QString fileName = list.at(0).toString();
|
||||||
|
const int lineNumber = list.at(1).toInt();
|
||||||
|
m_breakHandler.toggleBreakpoint(fileName, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerEnginePrivate::breakpointEnableDisableMarginActionTriggered()
|
||||||
|
{
|
||||||
|
QAction *act = qobject_cast<QAction *>(sender());
|
||||||
|
QTC_ASSERT(act, return);
|
||||||
|
QList<QVariant> list = act->data().toList();
|
||||||
|
QTC_ASSERT(list.size() == 2, return);
|
||||||
|
const QString fileName = list.at(0).toString();
|
||||||
|
const int lineNumber = list.at(1).toInt();
|
||||||
|
m_breakHandler.toggleBreakpointEnabled(fileName, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerEnginePrivate::handleContextMenuRequest(const QVariant ¶meters)
|
||||||
|
{
|
||||||
|
const QList<QVariant> list = parameters.toList();
|
||||||
|
QTC_ASSERT(list.size() == 3, return);
|
||||||
|
TextEditor::ITextEditor *editor =
|
||||||
|
(TextEditor::ITextEditor *)(list.at(0).value<quint64>());
|
||||||
|
int lineNumber = list.at(1).toInt();
|
||||||
|
QMenu *menu = (QMenu *)(list.at(2).value<quint64>());
|
||||||
|
|
||||||
|
BreakpointData *data = 0;
|
||||||
|
QString position;
|
||||||
|
QString fileName;
|
||||||
|
if (editor->property("DisassemblerView").toBool()) {
|
||||||
|
fileName = editor->file()->fileName();
|
||||||
|
QString line = editor->contents()
|
||||||
|
.section('\n', lineNumber - 1, lineNumber - 1);
|
||||||
|
position = _("*") + fileName;
|
||||||
|
BreakpointData needle;
|
||||||
|
needle.bpAddress = line.left(line.indexOf(QLatin1Char(' '))).toLatin1();
|
||||||
|
needle.bpLineNumber = "-1";
|
||||||
|
data = m_breakHandler.findSimilarBreakpoint(&needle);
|
||||||
|
} else {
|
||||||
|
fileName = editor->file()->fileName();
|
||||||
|
position = fileName + QString(":%1").arg(lineNumber);
|
||||||
|
data = m_breakHandler.findBreakpoint(fileName, lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(fileName);
|
||||||
|
args.append(lineNumber);
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
// existing breakpoint
|
||||||
|
QAction *act = new QAction(tr("Remove Breakpoint"), menu);
|
||||||
|
act->setData(args);
|
||||||
|
connect(act, SIGNAL(triggered()),
|
||||||
|
this, SLOT(breakpointSetRemoveMarginActionTriggered()));
|
||||||
|
menu->addAction(act);
|
||||||
|
|
||||||
|
QAction *act2;
|
||||||
|
if (data->enabled)
|
||||||
|
act2 = new QAction(tr("Disable Breakpoint"), menu);
|
||||||
|
else
|
||||||
|
act2 = new QAction(tr("Enable Breakpoint"), menu);
|
||||||
|
act2->setData(args);
|
||||||
|
connect(act2, SIGNAL(triggered()),
|
||||||
|
this, SLOT(breakpointEnableDisableMarginActionTriggered()));
|
||||||
|
menu->addAction(act2);
|
||||||
|
} else {
|
||||||
|
// non-existing
|
||||||
|
QAction *act = new QAction(tr("Set Breakpoint"), menu);
|
||||||
|
act->setData(args);
|
||||||
|
connect(act, SIGNAL(triggered()),
|
||||||
|
this, SLOT(breakpointSetRemoveMarginActionTriggered()));
|
||||||
|
menu->addAction(act);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -340,15 +427,6 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
|
|||||||
executeDebuggerCommand(value.toString());
|
executeDebuggerCommand(value.toString());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RequestToolTipByExpressionRole: {
|
|
||||||
QList<QVariant> list = value.toList();
|
|
||||||
QTC_ASSERT(list.size() == 3, break);
|
|
||||||
setToolTipExpression(list.at(0).value<QPoint>(),
|
|
||||||
(TextEditor::ITextEditor *)(list.at(1).value<quint64>()),
|
|
||||||
list.at(2).toInt()); // Eeks.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case RequestToggleBreakpointRole: {
|
case RequestToggleBreakpointRole: {
|
||||||
QList<QVariant> list = value.toList();
|
QList<QVariant> list = value.toList();
|
||||||
QTC_ASSERT(list.size() == 2, break);
|
QTC_ASSERT(list.size() == 2, break);
|
||||||
@@ -357,8 +435,25 @@ void DebuggerEngine::handleCommand(int role, const QVariant &value)
|
|||||||
breakHandler()->toggleBreakpoint(fileName, lineNumber);
|
breakHandler()->toggleBreakpoint(fileName, lineNumber);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
case RequestToolTipByExpressionRole: {
|
||||||
|
QList<QVariant> list = value.toList();
|
||||||
|
QTC_ASSERT(list.size() == 3, break);
|
||||||
|
QPoint point = list.at(0).value<QPoint>();
|
||||||
|
TextEditor::ITextEditor *editor = // Eeks.
|
||||||
|
(TextEditor::ITextEditor *)(list.at(1).value<quint64>());
|
||||||
|
int pos = list.at(2).toInt();
|
||||||
|
setToolTipExpression(point, editor, pos);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case RequestContextMenuRole: {
|
||||||
|
QList<QVariant> list = value.toList();
|
||||||
|
QTC_ASSERT(list.size() == 3, break);
|
||||||
|
d->handleContextMenuRequest(list);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerEngine::showModuleSymbols
|
void DebuggerEngine::showModuleSymbols
|
||||||
@@ -960,3 +1055,5 @@ bool DebuggerEngine::isReverseDebugging() const
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
|
#include "debuggerengine.moc"
|
||||||
|
@@ -815,8 +815,6 @@ public slots:
|
|||||||
void activateDebugMode();
|
void activateDebugMode();
|
||||||
void toggleBreakpoint();
|
void toggleBreakpoint();
|
||||||
void toggleBreakpoint(const QString &fileName, int lineNumber);
|
void toggleBreakpoint(const QString &fileName, int lineNumber);
|
||||||
void breakpointSetRemoveMarginActionTriggered();
|
|
||||||
void breakpointEnableDisableMarginActionTriggered();
|
|
||||||
void onModeChanged(Core::IMode *mode);
|
void onModeChanged(Core::IMode *mode);
|
||||||
void showSettingsDialog();
|
void showSettingsDialog();
|
||||||
|
|
||||||
@@ -1785,51 +1783,11 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditor::ITextEditor *editor,
|
|||||||
if (!isDebuggable(editor))
|
if (!isDebuggable(editor))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BreakpointData *data = 0;
|
QList<QVariant> list;
|
||||||
QString position;
|
list.append(quint64(editor));
|
||||||
if (editor->property("DisassemblerView").toBool()) {
|
list.append(lineNumber);
|
||||||
QString fileName = editor->file()->fileName();
|
list.append(quint64(menu));
|
||||||
QString line = editor->contents()
|
notifyCurrentEngine(RequestContextMenuRole, list);
|
||||||
.section('\n', lineNumber - 1, lineNumber - 1);
|
|
||||||
position = _("*") + fileName;
|
|
||||||
BreakpointData needle;
|
|
||||||
needle.bpAddress = line.left(line.indexOf(QLatin1Char(' '))).toLatin1();
|
|
||||||
needle.bpLineNumber = "-1";
|
|
||||||
data = m_breakWindow->findSimilarBreakpoint(&needle);
|
|
||||||
} else {
|
|
||||||
QString fileName = editor->file()->fileName();
|
|
||||||
position = fileName + QString(":%1").arg(lineNumber);
|
|
||||||
BreakpointData needle;
|
|
||||||
needle.bpFileName = fileName;
|
|
||||||
needle.bpLineNumber = QByteArray::number(lineNumber);
|
|
||||||
data = m_breakWindow->findSimilarBreakpoint(&needle);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data) {
|
|
||||||
// existing breakpoint
|
|
||||||
QAction *act = new QAction(tr("Remove Breakpoint"), menu);
|
|
||||||
act->setData(position);
|
|
||||||
connect(act, SIGNAL(triggered()),
|
|
||||||
this, SLOT(breakpointSetRemoveMarginActionTriggered()));
|
|
||||||
menu->addAction(act);
|
|
||||||
|
|
||||||
QAction *act2;
|
|
||||||
if (data->enabled)
|
|
||||||
act2 = new QAction(tr("Disable Breakpoint"), menu);
|
|
||||||
else
|
|
||||||
act2 = new QAction(tr("Enable Breakpoint"), menu);
|
|
||||||
act2->setData(position);
|
|
||||||
connect(act2, SIGNAL(triggered()),
|
|
||||||
this, SLOT(breakpointEnableDisableMarginActionTriggered()));
|
|
||||||
menu->addAction(act2);
|
|
||||||
} else {
|
|
||||||
// non-existing
|
|
||||||
QAction *act = new QAction(tr("Set Breakpoint"), menu);
|
|
||||||
act->setData(position);
|
|
||||||
connect(act, SIGNAL(triggered()),
|
|
||||||
this, SLOT(breakpointSetRemoveMarginActionTriggered()));
|
|
||||||
menu->addAction(act);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::toggleBreakpoint()
|
void DebuggerPluginPrivate::toggleBreakpoint()
|
||||||
@@ -1849,31 +1807,6 @@ void DebuggerPluginPrivate::toggleBreakpoint(const QString &fileName, int lineNu
|
|||||||
notifyCurrentEngine(RequestToggleBreakpointRole, list);
|
notifyCurrentEngine(RequestToggleBreakpointRole, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPluginPrivate::breakpointSetRemoveMarginActionTriggered()
|
|
||||||
{
|
|
||||||
QAction *act = qobject_cast<QAction *>(sender());
|
|
||||||
QTC_ASSERT(act, return);
|
|
||||||
QString str = act->data().toString();
|
|
||||||
int pos = str.lastIndexOf(':');
|
|
||||||
toggleBreakpoint(str.left(pos), str.mid(pos + 1).toInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::breakpointEnableDisableMarginActionTriggered()
|
|
||||||
{
|
|
||||||
QAction *act = qobject_cast<QAction *>(sender());
|
|
||||||
QTC_ASSERT(act, return);
|
|
||||||
|
|
||||||
QString str = act->data().toString();
|
|
||||||
int pos = str.lastIndexOf(':');
|
|
||||||
BreakpointData needle;
|
|
||||||
needle.bpFileName = str.left(pos);
|
|
||||||
needle.bpLineNumber = str.mid(pos + 1).toLatin1();
|
|
||||||
BreakpointData *data = m_breakWindow->findSimilarBreakpoint(&needle);
|
|
||||||
QTC_ASSERT(data, return);
|
|
||||||
data->enabled = !data->enabled;
|
|
||||||
m_breakWindow->updateBreakpoint(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerPluginPrivate::requestMark(ITextEditor *editor, int lineNumber)
|
void DebuggerPluginPrivate::requestMark(ITextEditor *editor, int lineNumber)
|
||||||
{
|
{
|
||||||
if (isDebuggable(editor))
|
if (isDebuggable(editor))
|
||||||
|
Reference in New Issue
Block a user