forked from qt-creator/qt-creator
febugger: prepare for saner handling of changed breakpoints
This commit is contained in:
@@ -1092,21 +1092,21 @@ void BreakHandler::setResponse(BreakpointId id,
|
|||||||
updateMarker(id);
|
updateMarker(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakHandler::setBreakpointData(BreakpointId id,
|
void BreakHandler::changeBreakpointData(BreakpointId id,
|
||||||
const BreakpointParameters &data)
|
const BreakpointParameters &data, BreakpointParts parts)
|
||||||
{
|
{
|
||||||
Iterator it = m_storage.find(id);
|
Iterator it = m_storage.find(id);
|
||||||
QTC_ASSERT(it != m_storage.end(), return);
|
QTC_ASSERT(it != m_storage.end(), return);
|
||||||
if (data == it->data)
|
if (data == it->data)
|
||||||
return;
|
return;
|
||||||
it->data = data;
|
it->data = data;
|
||||||
if (it->needsChange() && it->engine && it->state != BreakpointNew) {
|
if (parts == NoParts) {
|
||||||
setState(id, BreakpointChangeRequested);
|
|
||||||
scheduleSynchronization();
|
|
||||||
} else {
|
|
||||||
it->destroyMarker();
|
it->destroyMarker();
|
||||||
updateMarker(id);
|
updateMarker(id);
|
||||||
layoutChanged();
|
layoutChanged();
|
||||||
|
} else if (it->needsChange() && it->engine && it->state != BreakpointNew) {
|
||||||
|
setState(id, BreakpointChangeRequested);
|
||||||
|
scheduleSynchronization();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,8 @@ public:
|
|||||||
quint64 address(BreakpointId id) const;
|
quint64 address(BreakpointId id) const;
|
||||||
void setAddress(BreakpointId id, const quint64 &address);
|
void setAddress(BreakpointId id, const quint64 &address);
|
||||||
int lineNumber(BreakpointId id) const;
|
int lineNumber(BreakpointId id) const;
|
||||||
void setBreakpointData(BreakpointId id, const BreakpointParameters &data);
|
void changeBreakpointData(BreakpointId id, const BreakpointParameters &data,
|
||||||
|
BreakpointParts parts);
|
||||||
const BreakpointParameters &breakpointData(BreakpointId id) const;
|
const BreakpointParameters &breakpointData(BreakpointId id) const;
|
||||||
BreakpointState state(BreakpointId id) const;
|
BreakpointState state(BreakpointId id) const;
|
||||||
bool isEnabled(BreakpointId id) const;
|
bool isEnabled(BreakpointId id) const;
|
||||||
|
|||||||
@@ -58,21 +58,42 @@ BreakpointParameters::BreakpointParameters(BreakpointType t)
|
|||||||
tracepoint(false)
|
tracepoint(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
BreakpointParts BreakpointParameters::differencesTo
|
||||||
|
(const BreakpointParameters &rhs) const
|
||||||
|
{
|
||||||
|
BreakpointParts parts = BreakpointParts();
|
||||||
|
if (type != rhs.type)
|
||||||
|
parts |= TypePart;
|
||||||
|
if (enabled != rhs.enabled)
|
||||||
|
parts |= EnabledPart;
|
||||||
|
if (pathUsage != rhs.pathUsage)
|
||||||
|
parts |= PathUsagePart;
|
||||||
|
if (fileName != rhs.fileName)
|
||||||
|
parts |= FileAndLinePart;
|
||||||
|
if (conditionsMatch(rhs.condition))
|
||||||
|
parts |= ConditionPart;
|
||||||
|
if (ignoreCount != rhs.ignoreCount)
|
||||||
|
parts |= IgnoreCountPart;
|
||||||
|
if (lineNumber != rhs.lineNumber)
|
||||||
|
parts |= FileAndLinePart;
|
||||||
|
if (address != rhs.address)
|
||||||
|
parts |= AddressPart;
|
||||||
|
if (threadSpec != rhs.threadSpec)
|
||||||
|
parts |= ThreadSpecPart;
|
||||||
|
if (functionName != rhs.functionName)
|
||||||
|
parts |= FunctionPart;
|
||||||
|
if (tracepoint != rhs.tracepoint)
|
||||||
|
parts |= TracePointPart;
|
||||||
|
if (module != rhs.module)
|
||||||
|
parts |= ModulePart;
|
||||||
|
if (command != rhs.command)
|
||||||
|
parts |= CommandPart;
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
|
bool BreakpointParameters::equals(const BreakpointParameters &rhs) const
|
||||||
{
|
{
|
||||||
return type == rhs.type
|
return !differencesTo(rhs);
|
||||||
&& enabled == rhs.enabled
|
|
||||||
&& pathUsage == rhs.pathUsage
|
|
||||||
&& fileName == rhs.fileName
|
|
||||||
&& conditionsMatch(rhs.condition)
|
|
||||||
&& ignoreCount == rhs.ignoreCount
|
|
||||||
&& lineNumber == rhs.lineNumber
|
|
||||||
&& address == rhs.address
|
|
||||||
&& threadSpec == rhs.threadSpec
|
|
||||||
&& functionName == rhs.functionName
|
|
||||||
&& tracepoint == rhs.tracepoint
|
|
||||||
&& module == rhs.module
|
|
||||||
&& command == rhs.command;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
|
bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
|
||||||
|
|||||||
@@ -88,10 +88,40 @@ enum BreakpointPathUsage
|
|||||||
BreakpointUseShortPath //!< Use filename only, in case source files are relocated.
|
BreakpointUseShortPath //!< Use filename only, in case source files are relocated.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum BreakpointParts
|
||||||
|
{
|
||||||
|
NoParts = 0,
|
||||||
|
FileAndLinePart = 0x1,
|
||||||
|
FunctionPart = 0x2,
|
||||||
|
AddressPart = 0x4,
|
||||||
|
ConditionPart = 0x8,
|
||||||
|
IgnoreCountPart = 0x10,
|
||||||
|
ThreadSpecPart = 0x20,
|
||||||
|
AllConditionParts = ConditionPart|IgnoreCountPart|ThreadSpecPart,
|
||||||
|
ModulePart = 0x40,
|
||||||
|
TracePointPart = 0x80,
|
||||||
|
|
||||||
|
EnabledPart = 0x100,
|
||||||
|
TypePart = 0x200,
|
||||||
|
PathUsagePart = 0x400,
|
||||||
|
CommandPart = 0x400,
|
||||||
|
|
||||||
|
AllParts = FileAndLinePart|FunctionPart|AddressPart|ConditionPart
|
||||||
|
|IgnoreCountPart|ThreadSpecPart|ModulePart|TracePointPart
|
||||||
|
|EnabledPart|TypePart|PathUsagePart|CommandPart
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void operator|=(BreakpointParts &p, BreakpointParts r)
|
||||||
|
{
|
||||||
|
p = BreakpointParts(int(p) | int(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class BreakpointParameters
|
class BreakpointParameters
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit BreakpointParameters(BreakpointType = UnknownType);
|
explicit BreakpointParameters(BreakpointType = UnknownType);
|
||||||
|
BreakpointParts differencesTo(const BreakpointParameters &rhs) const;
|
||||||
bool equals(const BreakpointParameters &rhs) const;
|
bool equals(const BreakpointParameters &rhs) const;
|
||||||
bool conditionsMatch(const QByteArray &other) const;
|
bool conditionsMatch(const QByteArray &other) const;
|
||||||
bool isWatchpoint() const { return type == Watchpoint; }
|
bool isWatchpoint() const { return type == Watchpoint; }
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class BreakpointDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BreakpointDialog(unsigned engineCapabilities, QWidget *parent = 0);
|
explicit BreakpointDialog(unsigned engineCapabilities, QWidget *parent = 0);
|
||||||
bool showDialog(BreakpointParameters *data);
|
bool showDialog(BreakpointParameters *data, BreakpointParts *parts);
|
||||||
|
|
||||||
void setParameters(const BreakpointParameters &data);
|
void setParameters(const BreakpointParameters &data);
|
||||||
BreakpointParameters parameters() const;
|
BreakpointParameters parameters() const;
|
||||||
@@ -385,7 +385,8 @@ void BreakpointDialog::typeChanged(int)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BreakpointDialog::showDialog(BreakpointParameters *data)
|
bool BreakpointDialog::showDialog(BreakpointParameters *data,
|
||||||
|
BreakpointParts *parts)
|
||||||
{
|
{
|
||||||
setParameters(*data);
|
setParameters(*data);
|
||||||
if (exec() != QDialog::Accepted)
|
if (exec() != QDialog::Accepted)
|
||||||
@@ -393,7 +394,8 @@ bool BreakpointDialog::showDialog(BreakpointParameters *data)
|
|||||||
|
|
||||||
// Check if changed.
|
// Check if changed.
|
||||||
const BreakpointParameters newParameters = parameters();
|
const BreakpointParameters newParameters = parameters();
|
||||||
if (data->equals(newParameters))
|
*parts = data->differencesTo(newParameters);
|
||||||
|
if (!*parts)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
*data = newParameters;
|
*data = newParameters;
|
||||||
@@ -651,17 +653,19 @@ void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent)
|
|||||||
unsigned engineCapabilities = AllDebuggerCapabilities;
|
unsigned engineCapabilities = AllDebuggerCapabilities;
|
||||||
if (const DebuggerEngine *engine = breakHandler()->engine(id))
|
if (const DebuggerEngine *engine = breakHandler()->engine(id))
|
||||||
engineCapabilities = engine->debuggerCapabilities();
|
engineCapabilities = engine->debuggerCapabilities();
|
||||||
|
BreakpointParts parts = NoParts;
|
||||||
BreakpointDialog dialog(engineCapabilities, parent);
|
BreakpointDialog dialog(engineCapabilities, parent);
|
||||||
if (dialog.showDialog(&data))
|
if (dialog.showDialog(&data, &parts))
|
||||||
breakHandler()->setBreakpointData(id, data);
|
breakHandler()->changeBreakpointData(id, data, parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::addBreakpoint()
|
void BreakWindow::addBreakpoint()
|
||||||
{
|
{
|
||||||
BreakpointParameters data(BreakpointByFileAndLine);
|
BreakpointParameters data(BreakpointByFileAndLine);
|
||||||
|
BreakpointParts parts = NoParts;
|
||||||
BreakpointDialog dialog(AllDebuggerCapabilities, this);
|
BreakpointDialog dialog(AllDebuggerCapabilities, this);
|
||||||
dialog.setWindowTitle(tr("Add Breakpoint"));
|
dialog.setWindowTitle(tr("Add Breakpoint"));
|
||||||
if (dialog.showDialog(&data))
|
if (dialog.showDialog(&data, &parts))
|
||||||
breakHandler()->appendBreakpoint(data);
|
breakHandler()->appendBreakpoint(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user