Commit 3a100e8d authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Debugger: Make breakpoint capabilities more fine-grained.

Handle in editBreakpoint().

Acked-by: hjk
parent 8239ca44
...@@ -534,10 +534,18 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const ...@@ -534,10 +534,18 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
return displayFromThreadSpec(data.threadSpec); return displayFromThreadSpec(data.threadSpec);
break; break;
} }
if (role == Qt::ToolTipRole) switch (role) {
return debuggerCore()->boolSetting(UseToolTipsInBreakpointsView) case Qt::ToolTipRole:
? QVariant(it->toToolTip()) : QVariant(); if (debuggerCore()->boolSetting(UseToolTipsInBreakpointsView))
return QVariant(it->toToolTip());
break;
case EngineCapabilitiesRole: {
const unsigned caps = it.value().engine ?
it.value().engine->debuggerCapabilities() :
unsigned(AllDebuggerCapabilities);
return QVariant(caps);
}
}
return QVariant(); return QVariant();
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "breakwindow.h" #include "breakwindow.h"
#include "breakhandler.h" #include "breakhandler.h"
#include "debuggerengine.h"
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggercore.h" #include "debuggercore.h"
#include "ui_breakpoint.h" #include "ui_breakpoint.h"
...@@ -70,7 +70,7 @@ class BreakpointDialog : public QDialog ...@@ -70,7 +70,7 @@ class BreakpointDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BreakpointDialog(QWidget *parent); explicit BreakpointDialog(unsigned engineCapabilities = AllDebuggerCapabilities, QWidget *parent = 0);
bool showDialog(BreakpointParameters *data); bool showDialog(BreakpointParameters *data);
void setParameters(const BreakpointParameters &data); void setParameters(const BreakpointParameters &data);
...@@ -97,15 +97,22 @@ private: ...@@ -97,15 +97,22 @@ private:
void setType(BreakpointType type); void setType(BreakpointType type);
BreakpointType type() const; BreakpointType type() const;
unsigned m_enabledParts;
Ui::BreakpointDialog m_ui; Ui::BreakpointDialog m_ui;
BreakpointParameters m_savedParameters; BreakpointParameters m_savedParameters;
BreakpointType m_previousType; BreakpointType m_previousType;
bool m_firstTypeChange; bool m_firstTypeChange;
}; };
BreakpointDialog::BreakpointDialog(QWidget *parent) BreakpointDialog::BreakpointDialog(unsigned engineCapabilities, QWidget *parent)
: QDialog(parent), m_previousType(UnknownType), m_firstTypeChange(true) : QDialog(parent), m_enabledParts(-1), m_previousType(UnknownType),
m_firstTypeChange(true)
{ {
if (!(engineCapabilities & BreakConditionCapability))
m_enabledParts &= ~ConditionPart;
if (!(engineCapabilities & BreakModuleCapability))
m_enabledParts &= ~ModulePart;
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
// Match BreakpointType (omitting unknown type). // Match BreakpointType (omitting unknown type).
m_ui.setupUi(this); m_ui.setupUi(this);
...@@ -164,6 +171,7 @@ BreakpointParameters BreakpointDialog::parameters() const ...@@ -164,6 +171,7 @@ BreakpointParameters BreakpointDialog::parameters() const
void BreakpointDialog::setPartsEnabled(unsigned partsMask) void BreakpointDialog::setPartsEnabled(unsigned partsMask)
{ {
partsMask &= m_enabledParts;
m_ui.labelFileName->setEnabled(partsMask & FileAndLinePart); m_ui.labelFileName->setEnabled(partsMask & FileAndLinePart);
m_ui.pathChooserFileName->setEnabled(partsMask & FileAndLinePart); m_ui.pathChooserFileName->setEnabled(partsMask & FileAndLinePart);
m_ui.labelLineNumber->setEnabled(partsMask & FileAndLinePart); m_ui.labelLineNumber->setEnabled(partsMask & FileAndLinePart);
...@@ -350,7 +358,7 @@ bool BreakpointDialog::showDialog(BreakpointParameters *data) ...@@ -350,7 +358,7 @@ bool BreakpointDialog::showDialog(BreakpointParameters *data)
class MultiBreakPointsDialog : public QDialog { class MultiBreakPointsDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit MultiBreakPointsDialog(QWidget *parent = 0); explicit MultiBreakPointsDialog(unsigned engineCapabilities = AllDebuggerCapabilities, QWidget *parent = 0);
QString condition() const { return m_ui.lineEditCondition->text(); } QString condition() const { return m_ui.lineEditCondition->text(); }
int ignoreCount() const { return m_ui.spinBoxIgnoreCount->value(); } int ignoreCount() const { return m_ui.spinBoxIgnoreCount->value(); }
...@@ -366,7 +374,7 @@ private: ...@@ -366,7 +374,7 @@ private:
Ui::BreakCondition m_ui; Ui::BreakCondition m_ui;
}; };
MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) : MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities,QWidget *parent) :
QDialog(parent) QDialog(parent)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
...@@ -374,6 +382,10 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) : ...@@ -374,6 +382,10 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(QWidget *parent) :
setWindowTitle(tr("Edit Breakpoint Properties")); setWindowTitle(tr("Edit Breakpoint Properties"));
m_ui.spinBoxIgnoreCount->setMinimum(0); m_ui.spinBoxIgnoreCount->setMinimum(0);
m_ui.spinBoxIgnoreCount->setMaximum(2147483647); m_ui.spinBoxIgnoreCount->setMaximum(2147483647);
if (!(engineCapabilities & BreakConditionCapability)) {
m_ui.labelCondition->setEnabled(false);
m_ui.lineEditCondition->setEnabled(false);
}
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
...@@ -464,8 +476,10 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -464,8 +476,10 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
BreakpointIds selectedIds = handler->findBreakpointsByIndex(selectedIndices); BreakpointIds selectedIds = handler->findBreakpointsByIndex(selectedIndices);
const int rowCount = model()->rowCount(); const int rowCount = model()->rowCount();
const unsigned engineCapabilities = BreakOnThrowAndCatchCapability; unsigned engineCapabilities = AllDebuggerCapabilities;
// FIXME BP: model()->data(QModelIndex(), EngineCapabilitiesRole).toUInt(); if (!selectedIndices.isEmpty())
if (const unsigned ec = model()->data(selectedIndices.front(), EngineCapabilitiesRole).toUInt())
engineCapabilities = ec;
QAction *deleteAction = new QAction(tr("Delete Breakpoint"), &menu); QAction *deleteAction = new QAction(tr("Delete Breakpoint"), &menu);
deleteAction->setEnabled(!selectedIds.isEmpty()); deleteAction->setEnabled(!selectedIds.isEmpty());
...@@ -606,8 +620,11 @@ void BreakWindow::deleteBreakpoints(const BreakpointIds &ids) ...@@ -606,8 +620,11 @@ void BreakWindow::deleteBreakpoints(const BreakpointIds &ids)
void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent) void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent)
{ {
BreakpointDialog dialog(parent);
BreakpointParameters data = breakHandler()->breakpointData(id); BreakpointParameters data = breakHandler()->breakpointData(id);
unsigned engineCapabilities = AllDebuggerCapabilities;
if (const DebuggerEngine *engine = breakHandler()->engine(id))
engineCapabilities = engine->debuggerCapabilities();
BreakpointDialog dialog(engineCapabilities, parent);
if (dialog.showDialog(&data)) if (dialog.showDialog(&data))
breakHandler()->setBreakpointData(id, data); breakHandler()->setBreakpointData(id, data);
} }
...@@ -615,7 +632,7 @@ void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent) ...@@ -615,7 +632,7 @@ void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent)
void BreakWindow::addBreakpoint() void BreakWindow::addBreakpoint()
{ {
BreakpointParameters data(BreakpointByFileAndLine); BreakpointParameters data(BreakpointByFileAndLine);
BreakpointDialog dialog(this); BreakpointDialog dialog(AllDebuggerCapabilities, this);
dialog.setWindowTitle(tr("Add Breakpoint")); dialog.setWindowTitle(tr("Add Breakpoint"));
if (dialog.showDialog(&data)) if (dialog.showDialog(&data))
breakHandler()->appendBreakpoint(data); breakHandler()->appendBreakpoint(data);
...@@ -633,8 +650,11 @@ void BreakWindow::editBreakpoints(const BreakpointIds &ids) ...@@ -633,8 +650,11 @@ void BreakWindow::editBreakpoints(const BreakpointIds &ids)
} }
// This allows to change properties of multiple breakpoints at a time. // This allows to change properties of multiple breakpoints at a time.
MultiBreakPointsDialog dialog;
BreakHandler *handler = breakHandler(); BreakHandler *handler = breakHandler();
unsigned engineCapabilities = AllDebuggerCapabilities;
if (const DebuggerEngine *engine = breakHandler()->engine(id))
engineCapabilities = engine->debuggerCapabilities();
MultiBreakPointsDialog dialog(engineCapabilities);
const QString oldCondition = QString::fromLatin1(handler->condition(id)); const QString oldCondition = QString::fromLatin1(handler->condition(id));
dialog.setCondition(oldCondition); dialog.setCondition(oldCondition);
const int oldIgnoreCount = handler->ignoreCount(id); const int oldIgnoreCount = handler->ignoreCount(id);
......
...@@ -950,7 +950,8 @@ unsigned CdbEngine::debuggerCapabilities() const ...@@ -950,7 +950,8 @@ unsigned CdbEngine::debuggerCapabilities() const
{ {
return DisassemblerCapability | RegisterCapability | ShowMemoryCapability return DisassemblerCapability | RegisterCapability | ShowMemoryCapability
|WatchpointCapability|JumpToLineCapability|AddWatcherCapability |WatchpointCapability|JumpToLineCapability|AddWatcherCapability
|BreakOnThrowAndCatchCapability; // Sort-of: Can break on throw(). |BreakOnThrowAndCatchCapability // Sort-of: Can break on throw().
|BreakModuleCapability;
} }
void CdbEngine::executeStep() void CdbEngine::executeStep()
......
...@@ -168,11 +168,14 @@ enum DebuggerCapabilities ...@@ -168,11 +168,14 @@ enum DebuggerCapabilities
ReloadModuleCapability = 0x80, ReloadModuleCapability = 0x80,
ReloadModuleSymbolsCapability = 0x100, ReloadModuleSymbolsCapability = 0x100,
BreakOnThrowAndCatchCapability = 0x200, BreakOnThrowAndCatchCapability = 0x200,
ReturnFromFunctionCapability = 0x400, BreakConditionCapability = 0x400, //!< Conditional Breakpoints
CreateFullBacktraceCapability = 0x800, BreakModuleCapability = 0x800, //!< Breakpoint specification includes module
AddWatcherCapability = 0x1000, ReturnFromFunctionCapability = 0x1000,
WatchpointCapability = 0x2000, CreateFullBacktraceCapability = 0x2000,
ShowModuleSymbolsCapability = 0x4000 AddWatcherCapability = 0x4000,
WatchpointCapability = 0x8000,
ShowModuleSymbolsCapability = 0x10000,
AllDebuggerCapabilities = 0xFFFFFFFF
}; };
enum LogChannel enum LogChannel
......
...@@ -1847,6 +1847,7 @@ unsigned GdbEngine::debuggerCapabilities() const ...@@ -1847,6 +1847,7 @@ unsigned GdbEngine::debuggerCapabilities() const
| ReloadModuleCapability | ReloadModuleCapability
| ReloadModuleSymbolsCapability | ReloadModuleSymbolsCapability
| BreakOnThrowAndCatchCapability | BreakOnThrowAndCatchCapability
| BreakConditionCapability
| ReturnFromFunctionCapability | ReturnFromFunctionCapability
| CreateFullBacktraceCapability | CreateFullBacktraceCapability
| WatchpointCapability | WatchpointCapability
......
...@@ -832,7 +832,7 @@ void PdbEngine::handleListLocals(const PdbResponse &response) ...@@ -832,7 +832,7 @@ void PdbEngine::handleListLocals(const PdbResponse &response)
unsigned PdbEngine::debuggerCapabilities() const unsigned PdbEngine::debuggerCapabilities() const
{ {
return ReloadModuleCapability; return ReloadModuleCapability|BreakConditionCapability;
} }
DebuggerEngine *createPdbEngine(const DebuggerStartParameters &startParameters) DebuggerEngine *createPdbEngine(const DebuggerStartParameters &startParameters)
......
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