forked from qt-creator/qt-creator
debugger: looks like the BreakpointData layer is going to be unneeded.
This commit is contained in:
@@ -168,18 +168,12 @@ BreakpointId BreakHandler::findBreakpointByFileAndLine(const QString &fileName,
|
|||||||
return BreakpointId(-1);
|
return BreakpointId(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const BreakpointData *BreakHandler::breakpointById(BreakpointId id) const
|
const BreakpointParameters &BreakHandler::breakpointData(BreakpointId id) const
|
||||||
{
|
{
|
||||||
|
static BreakpointParameters dummy;
|
||||||
ConstIterator it = m_storage.find(id);
|
ConstIterator it = m_storage.find(id);
|
||||||
QTC_ASSERT(it != m_storage.end(), return 0);
|
QTC_ASSERT(it != m_storage.end(), return dummy);
|
||||||
return &it->data;
|
return it->data.parameters();
|
||||||
}
|
|
||||||
|
|
||||||
BreakpointData *BreakHandler::breakpointById(BreakpointId id)
|
|
||||||
{
|
|
||||||
Iterator it = m_storage.find(id);
|
|
||||||
QTC_ASSERT(it != m_storage.end(), return 0);
|
|
||||||
return &it->data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BreakpointId BreakHandler::findWatchpointByAddress(quint64 address) const
|
BreakpointId BreakHandler::findWatchpointByAddress(quint64 address) const
|
||||||
@@ -626,9 +620,9 @@ void BreakHandler::appendBreakpoint(const BreakpointParameters &data)
|
|||||||
|
|
||||||
BreakpointId id(++currentId);
|
BreakpointId id(++currentId);
|
||||||
BreakpointItem item;
|
BreakpointItem item;
|
||||||
BreakpointData d;
|
item.data.m_parameters = data;
|
||||||
d.m_parameters = data;
|
item.markerFileName = data.fileName;
|
||||||
item.data = d;
|
item.markerLineNumber = data.lineNumber;
|
||||||
m_storage.insert(id, item);
|
m_storage.insert(id, item);
|
||||||
scheduleSynchronization();
|
scheduleSynchronization();
|
||||||
}
|
}
|
||||||
@@ -855,7 +849,7 @@ void BreakHandler::setResponse(BreakpointId id, const BreakpointResponse &data)
|
|||||||
updateMarker(id);
|
updateMarker(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakHandler::setData(BreakpointId id, const BreakpointParameters &data)
|
void BreakHandler::setBreakpointData(BreakpointId id, const BreakpointParameters &data)
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
@@ -92,15 +92,11 @@ public:
|
|||||||
BreakpointId findBreakpointByFileAndLine(const QString &fileName,
|
BreakpointId findBreakpointByFileAndLine(const QString &fileName,
|
||||||
int lineNumber, bool useMarkerPosition = true);
|
int lineNumber, bool useMarkerPosition = true);
|
||||||
BreakpointId findBreakpointByAddress(quint64 address) const;
|
BreakpointId findBreakpointByAddress(quint64 address) const;
|
||||||
const BreakpointData *breakpointById(BreakpointId id) const;
|
|
||||||
BreakpointData *breakpointById(BreakpointId id); // FIXME: For breakwindow.
|
|
||||||
|
|
||||||
void breakByFunction(const QString &functionName);
|
void breakByFunction(const QString &functionName);
|
||||||
void removeBreakpoint(BreakpointId id);
|
void removeBreakpoint(BreakpointId id);
|
||||||
QIcon icon(BreakpointId id) const;
|
QIcon icon(BreakpointId id) const;
|
||||||
|
|
||||||
void gotoLocation(BreakpointId id) const;
|
void gotoLocation(BreakpointId id) const;
|
||||||
void setData(BreakpointId id, const BreakpointParameters &data);
|
|
||||||
|
|
||||||
// Getter retrieves property value.
|
// Getter retrieves property value.
|
||||||
// Setter sets property value and triggers update if changed.
|
// Setter sets property value and triggers update if changed.
|
||||||
@@ -120,13 +116,14 @@ public:
|
|||||||
PROPERTY(quint64, address, setAddress);
|
PROPERTY(quint64, address, setAddress);
|
||||||
PROPERTY(int, lineNumber, setLineNumber);
|
PROPERTY(int, lineNumber, setLineNumber);
|
||||||
#undef PROPERTY
|
#undef PROPERTY
|
||||||
|
void setBreakpointData(BreakpointId id, const BreakpointParameters &data);
|
||||||
|
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;
|
||||||
void setEnabled(BreakpointId id, bool on);
|
void setEnabled(BreakpointId id, bool on);
|
||||||
void updateLineNumberFromMarker(BreakpointId id, int lineNumber);
|
void updateLineNumberFromMarker(BreakpointId id, int lineNumber);
|
||||||
void setMarkerFileAndLine(BreakpointId id,
|
void setMarkerFileAndLine(BreakpointId id,
|
||||||
const QString &fileName, int lineNumber);
|
const QString &fileName, int lineNumber);
|
||||||
|
|
||||||
DebuggerEngine *engine(BreakpointId id) const;
|
DebuggerEngine *engine(BreakpointId id) const;
|
||||||
void setEngine(BreakpointId id, DebuggerEngine *engine);
|
void setEngine(BreakpointId id, DebuggerEngine *engine);
|
||||||
const BreakpointResponse &response(BreakpointId id) const;
|
const BreakpointResponse &response(BreakpointId id) const;
|
||||||
|
@@ -119,10 +119,10 @@ bool BreakpointData::setCondition(const QByteArray &cond)
|
|||||||
|
|
||||||
#undef SETIT
|
#undef SETIT
|
||||||
|
|
||||||
bool BreakpointData::conditionsMatch(const QByteArray &other) const
|
bool BreakpointParameters::conditionsMatch(const QByteArray &other) const
|
||||||
{
|
{
|
||||||
// Some versions of gdb "beautify" the passed condition.
|
// Some versions of gdb "beautify" the passed condition.
|
||||||
QByteArray s1 = m_parameters.condition;
|
QByteArray s1 = condition;
|
||||||
s1.replace(' ', "");
|
s1.replace(' ', "");
|
||||||
QByteArray s2 = other;
|
QByteArray s2 = other;
|
||||||
s2.replace(' ', "");
|
s2.replace(' ', "");
|
||||||
|
@@ -84,6 +84,7 @@ class BreakpointParameters
|
|||||||
public:
|
public:
|
||||||
explicit BreakpointParameters(BreakpointType = UnknownType);
|
explicit BreakpointParameters(BreakpointType = UnknownType);
|
||||||
bool equals(const BreakpointParameters &rhs) const;
|
bool equals(const BreakpointParameters &rhs) const;
|
||||||
|
bool conditionsMatch(const QByteArray &other) const;
|
||||||
|
|
||||||
BreakpointType type; // Type of breakpoint.
|
BreakpointType type; // Type of breakpoint.
|
||||||
bool enabled; // Should we talk to the debugger engine?
|
bool enabled; // Should we talk to the debugger engine?
|
||||||
@@ -118,7 +119,6 @@ public:
|
|||||||
bool useFullPath() const { return m_parameters.useFullPath; }
|
bool useFullPath() const { return m_parameters.useFullPath; }
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
|
|
||||||
bool conditionsMatch(const QByteArray &other) const;
|
|
||||||
QString functionName() const { return m_parameters.functionName; }
|
QString functionName() const { return m_parameters.functionName; }
|
||||||
QString fileName() const { return m_parameters.fileName; }
|
QString fileName() const { return m_parameters.fileName; }
|
||||||
int lineNumber() const { return m_parameters.lineNumber; }
|
int lineNumber() const { return m_parameters.lineNumber; }
|
||||||
|
@@ -417,9 +417,9 @@ void BreakWindow::deleteBreakpoints(const QModelIndexList &list)
|
|||||||
void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent)
|
void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent)
|
||||||
{
|
{
|
||||||
BreakpointDialog dialog(parent);
|
BreakpointDialog dialog(parent);
|
||||||
BreakpointParameters data = breakHandler()->breakpointById(id)->parameters();
|
BreakpointParameters data = breakHandler()->breakpointData(id);
|
||||||
if (dialog.showDialog(&data))
|
if (dialog.showDialog(&data))
|
||||||
breakHandler()->setData(id, data);
|
breakHandler()->setBreakpointData(id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::addBreakpoint()
|
void BreakWindow::addBreakpoint()
|
||||||
|
@@ -2156,32 +2156,30 @@ static QByteArray addressSpec(quint64 address)
|
|||||||
QByteArray GdbEngine::breakpointLocation(BreakpointId id)
|
QByteArray GdbEngine::breakpointLocation(BreakpointId id)
|
||||||
{
|
{
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
const BreakpointData *data = handler->breakpointById(id);
|
const BreakpointParameters &data = handler->breakpointData(id);
|
||||||
QTC_ASSERT(data, return QByteArray());
|
QTC_ASSERT(data.type != UnknownType, return QByteArray());
|
||||||
const BreakpointParameters parameters = data->parameters();
|
|
||||||
// FIXME: Non-GCC-runtime
|
// FIXME: Non-GCC-runtime
|
||||||
if (parameters.type == BreakpointAtThrow)
|
if (data.type == BreakpointAtThrow)
|
||||||
return "__cxa_throw";
|
return "__cxa_throw";
|
||||||
if (parameters.type == BreakpointAtCatch)
|
if (data.type == BreakpointAtCatch)
|
||||||
return "__cxa_begin_catch";
|
return "__cxa_begin_catch";
|
||||||
if (parameters.type == BreakpointAtMain)
|
if (data.type == BreakpointAtMain)
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
return "qMain";
|
return "qMain";
|
||||||
#else
|
#else
|
||||||
return "main";
|
return "main";
|
||||||
#endif
|
#endif
|
||||||
const QByteArray functionName = parameters.functionName.toUtf8();
|
const QByteArray functionName = data.functionName.toUtf8();
|
||||||
if (!functionName.isEmpty())
|
if (!functionName.isEmpty())
|
||||||
return functionName;
|
return functionName;
|
||||||
if (const quint64 address = handler->address(id))
|
if (const quint64 address = data.address)
|
||||||
return addressSpec(address);
|
return addressSpec(address);
|
||||||
// In this case, data->funcName is something like '*0xdeadbeef'
|
// In this case, data->funcName is something like '*0xdeadbeef'
|
||||||
const int lineNumber = handler->lineNumber(id);
|
const int lineNumber = data.lineNumber;
|
||||||
if (lineNumber == 0)
|
if (lineNumber == 0)
|
||||||
return functionName;
|
return functionName;
|
||||||
const QString fileName = parameters.useFullPath ?
|
const QString fileName = data.useFullPath
|
||||||
breakLocation(parameters.fileName) :
|
? breakLocation(data.fileName) : data.fileName;
|
||||||
parameters.fileName;
|
|
||||||
// The argument is simply a C-quoted version of the argument to the
|
// The argument is simply a C-quoted version of the argument to the
|
||||||
// non-MI "break" command, including the "original" quoting it wants.
|
// non-MI "break" command, including the "original" quoting it wants.
|
||||||
return "\"\\\"" + GdbMi::escapeCString(fileName).toLocal8Bit() + "\\\":"
|
return "\"\\\"" + GdbMi::escapeCString(fileName).toLocal8Bit() + "\\\":"
|
||||||
@@ -2622,32 +2620,31 @@ void GdbEngine::insertBreakpoint(BreakpointId id)
|
|||||||
|
|
||||||
void GdbEngine::changeBreakpoint(BreakpointId id)
|
void GdbEngine::changeBreakpoint(BreakpointId id)
|
||||||
{
|
{
|
||||||
const BreakpointData *data0 = breakHandler()->breakpointById(id);
|
const BreakpointParameters &data = breakHandler()->breakpointData(id);
|
||||||
QTC_ASSERT(data0, return);
|
QTC_ASSERT(data.type != UnknownType, return);
|
||||||
const BreakpointData &data = *data0;
|
|
||||||
const BreakpointResponse &response = breakHandler()->response(id);
|
const BreakpointResponse &response = breakHandler()->response(id);
|
||||||
QTC_ASSERT(response.number > 0, return);
|
QTC_ASSERT(response.number > 0, return);
|
||||||
const QByteArray bpnr = QByteArray::number(response.number);
|
const QByteArray bpnr = QByteArray::number(response.number);
|
||||||
|
|
||||||
if (data.condition() != response.condition
|
if (data.condition != response.condition
|
||||||
&& !data.conditionsMatch(response.condition)) {
|
&& !data.conditionsMatch(response.condition)) {
|
||||||
// Update conditions if needed.
|
// Update conditions if needed.
|
||||||
postCommand("condition " + bpnr + ' ' + data.condition(),
|
postCommand("condition " + bpnr + ' ' + data.condition,
|
||||||
NeedsStop | RebuildBreakpointModel,
|
NeedsStop | RebuildBreakpointModel,
|
||||||
CB(handleBreakCondition), id);
|
CB(handleBreakCondition), id);
|
||||||
}
|
}
|
||||||
if (data.ignoreCount() != response.ignoreCount) {
|
if (data.ignoreCount != response.ignoreCount) {
|
||||||
// Update ignorecount if needed.
|
// Update ignorecount if needed.
|
||||||
postCommand("ignore " + bpnr + ' ' + QByteArray::number(data.ignoreCount()),
|
postCommand("ignore " + bpnr + ' ' + QByteArray::number(data.ignoreCount),
|
||||||
NeedsStop | RebuildBreakpointModel,
|
NeedsStop | RebuildBreakpointModel,
|
||||||
CB(handleBreakIgnore), id);
|
CB(handleBreakIgnore), id);
|
||||||
}
|
}
|
||||||
if (!data.isEnabled() && response.enabled) {
|
if (!data.enabled && response.enabled) {
|
||||||
postCommand("-break-disable " + bpnr,
|
postCommand("-break-disable " + bpnr,
|
||||||
NeedsStop | RebuildBreakpointModel,
|
NeedsStop | RebuildBreakpointModel,
|
||||||
CB(handleBreakDisable), id);
|
CB(handleBreakDisable), id);
|
||||||
}
|
}
|
||||||
if (data.isEnabled() && !response.enabled) {
|
if (data.enabled && !response.enabled) {
|
||||||
postCommand("-break-enable " + bpnr,
|
postCommand("-break-enable " + bpnr,
|
||||||
NeedsStop | RebuildBreakpointModel,
|
NeedsStop | RebuildBreakpointModel,
|
||||||
CB(handleBreakEnable), id);
|
CB(handleBreakEnable), id);
|
||||||
|
Reference in New Issue
Block a user