debugger: silence debug output for unrecognized temporary breakpoints

This commit is contained in:
hjk
2011-04-14 16:10:18 +02:00
parent ab06ebf92f
commit e57f547bfb

View File

@@ -45,6 +45,8 @@
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QTimerEvent> #include <QtCore/QTimerEvent>
#define BREAK_ASSERT(cond, action) if (cond) {} else { action; }
//#define BREAK_ASSERT(cond, action) QTC_ASSERT(cond, action)
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// //
@@ -271,7 +273,7 @@ const BreakpointParameters &BreakHandler::breakpointData(BreakpointId id) const
{ {
static BreakpointParameters dummy; static BreakpointParameters dummy;
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return dummy); BREAK_ASSERT(it != m_storage.end(), return dummy);
return it->data; return it->data;
} }
@@ -396,7 +398,7 @@ void BreakHandler::updateMarkers()
void BreakHandler::updateMarker(BreakpointId id) void BreakHandler::updateMarker(BreakpointId id)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
QString markerFileName = it->markerFileName(); QString markerFileName = it->markerFileName();
int markerLineNumber = it->markerLineNumber(); int markerLineNumber = it->markerLineNumber();
@@ -471,7 +473,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
BreakpointId id = findBreakpointByIndex(mi); BreakpointId id = findBreakpointByIndex(mi);
//qDebug() << "DATA: " << id << role << mi.column(); //qDebug() << "DATA: " << id << role << mi.column();
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return QVariant()); BREAK_ASSERT(it != m_storage.end(), return QVariant());
const BreakpointParameters &data = it->data; const BreakpointParameters &data = it->data;
const BreakpointResponse &response = it->response; const BreakpointResponse &response = it->response;
@@ -611,7 +613,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
type BreakHandler::getter(BreakpointId id) const \ type BreakHandler::getter(BreakpointId id) const \
{ \ { \
ConstIterator it = m_storage.find(id); \ ConstIterator it = m_storage.find(id); \
QTC_ASSERT(it != m_storage.end(), \ BREAK_ASSERT(it != m_storage.end(), \
qDebug() << "ID" << id << "NOT KNOWN"; \ qDebug() << "ID" << id << "NOT KNOWN"; \
return type()); \ return type()); \
return it->data.getter; \ return it->data.getter; \
@@ -621,7 +623,7 @@ type BreakHandler::getter(BreakpointId id) const \
void BreakHandler::setter(BreakpointId id, const type &value) \ void BreakHandler::setter(BreakpointId id, const type &value) \
{ \ { \
Iterator it = m_storage.find(id); \ Iterator it = m_storage.find(id); \
QTC_ASSERT(it != m_storage.end(), \ BREAK_ASSERT(it != m_storage.end(), \
qDebug() << "ID" << id << "NOT KNOWN"; return); \ qDebug() << "ID" << id << "NOT KNOWN"; return); \
if (it->data.getter == value) \ if (it->data.getter == value) \
return; \ return; \
@@ -650,14 +652,14 @@ PROPERTY(int, ignoreCount, setIgnoreCount)
bool BreakHandler::isEnabled(BreakpointId id) const bool BreakHandler::isEnabled(BreakpointId id) const
{ {
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return false); BREAK_ASSERT(it != m_storage.end(), return false);
return it->data.enabled; return it->data.enabled;
} }
void BreakHandler::setEnabled(BreakpointId id, bool on) void BreakHandler::setEnabled(BreakpointId id, bool on)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
//qDebug() << "SET ENABLED: " << id << it->data.isEnabled() << on; //qDebug() << "SET ENABLED: " << id << it->data.isEnabled() << on;
if (it->data.enabled == on) if (it->data.enabled == on)
return; return;
@@ -673,14 +675,14 @@ void BreakHandler::setEnabled(BreakpointId id, bool on)
bool BreakHandler::isTracepoint(BreakpointId id) const bool BreakHandler::isTracepoint(BreakpointId id) const
{ {
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return false); BREAK_ASSERT(it != m_storage.end(), return false);
return it->data.tracepoint; return it->data.tracepoint;
} }
void BreakHandler::setTracepoint(BreakpointId id, bool on) void BreakHandler::setTracepoint(BreakpointId id, bool on)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
if (it->data.tracepoint == on) if (it->data.tracepoint == on)
return; return;
it->data.tracepoint = on; it->data.tracepoint = on;
@@ -697,7 +699,7 @@ void BreakHandler::setMarkerFileAndLine(BreakpointId id,
const QString &fileName, int lineNumber) const QString &fileName, int lineNumber)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), qDebug() << id; return); BREAK_ASSERT(it != m_storage.end(), qDebug() << id; return);
if (it->response.fileName == fileName && it->response.lineNumber == lineNumber) if (it->response.fileName == fileName && it->response.lineNumber == lineNumber)
return; return;
it->response.fileName = fileName; it->response.fileName = fileName;
@@ -710,21 +712,21 @@ void BreakHandler::setMarkerFileAndLine(BreakpointId id,
BreakpointState BreakHandler::state(BreakpointId id) const BreakpointState BreakHandler::state(BreakpointId id) const
{ {
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), qDebug() << id; return BreakpointDead); BREAK_ASSERT(it != m_storage.end(), qDebug() << id; return BreakpointDead);
return it->state; return it->state;
} }
DebuggerEngine *BreakHandler::engine(BreakpointId id) const DebuggerEngine *BreakHandler::engine(BreakpointId id) const
{ {
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), qDebug() << id; return 0); BREAK_ASSERT(it != m_storage.end(), qDebug() << id; return 0);
return it->engine; return it->engine;
} }
void BreakHandler::setEngine(BreakpointId id, DebuggerEngine *value) void BreakHandler::setEngine(BreakpointId id, DebuggerEngine *value)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), qDebug() << id; return); BREAK_ASSERT(it != m_storage.end(), qDebug() << id; return);
QTC_ASSERT(it->state == BreakpointNew, qDebug() << id); QTC_ASSERT(it->state == BreakpointNew, qDebug() << id);
QTC_ASSERT(!it->engine, qDebug() << id; return); QTC_ASSERT(!it->engine, qDebug() << id; return);
it->engine = value; it->engine = value;
@@ -769,7 +771,7 @@ void BreakHandler::setState(BreakpointId id, BreakpointState state)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
//qDebug() << "BREAKPOINT STATE TRANSITION" << id << it->state << state; //qDebug() << "BREAKPOINT STATE TRANSITION" << id << it->state << state;
QTC_ASSERT(it != m_storage.end(), qDebug() << id; return); BREAK_ASSERT(it != m_storage.end(), qDebug() << id; return);
QTC_ASSERT(isAllowedTransition(it->state, state), QTC_ASSERT(isAllowedTransition(it->state, state),
qDebug() << "UNEXPECTED BREAKPOINT STATE TRANSITION" qDebug() << "UNEXPECTED BREAKPOINT STATE TRANSITION"
<< it->state << state); << it->state << state);
@@ -800,7 +802,7 @@ void BreakHandler::notifyBreakpointInsertOk(BreakpointId id)
QTC_ASSERT(state(id) == BreakpointInsertProceeding, qDebug() << state(id)); QTC_ASSERT(state(id) == BreakpointInsertProceeding, qDebug() << state(id));
setState(id, BreakpointInserted); setState(id, BreakpointInserted);
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
} }
void BreakHandler::notifyBreakpointInsertFailed(BreakpointId id) void BreakHandler::notifyBreakpointInsertFailed(BreakpointId id)
@@ -851,7 +853,7 @@ void BreakHandler::notifyBreakpointReleased(BreakpointId id)
{ {
//QTC_ASSERT(state(id) == BreakpointChangeProceeding, qDebug() << state(id)); //QTC_ASSERT(state(id) == BreakpointChangeProceeding, qDebug() << state(id));
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
it->state = BreakpointNew; it->state = BreakpointNew;
it->engine = 0; it->engine = 0;
it->response = BreakpointResponse(); it->response = BreakpointResponse();
@@ -866,7 +868,7 @@ void BreakHandler::notifyBreakpointAdjusted(BreakpointId id,
{ {
QTC_ASSERT(state(id) == BreakpointInserted, qDebug() << state(id)); QTC_ASSERT(state(id) == BreakpointInserted, qDebug() << state(id));
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
it->data = data; it->data = data;
//if (it->needsChange()) //if (it->needsChange())
// setState(id, BreakpointChangeRequested); // setState(id, BreakpointChangeRequested);
@@ -876,14 +878,14 @@ void BreakHandler::notifyBreakpointNeedsReinsertion(BreakpointId id)
{ {
QTC_ASSERT(state(id) == BreakpointChangeProceeding, qDebug() << state(id)); QTC_ASSERT(state(id) == BreakpointChangeProceeding, qDebug() << state(id));
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
it->state = BreakpointInsertRequested; it->state = BreakpointInsertRequested;
} }
void BreakHandler::removeBreakpoint(BreakpointId id) void BreakHandler::removeBreakpoint(BreakpointId id)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
switch (it->state) { switch (it->state) {
case BreakpointInserted: case BreakpointInserted:
setState(id, BreakpointRemoveRequested); setState(id, BreakpointRemoveRequested);
@@ -965,8 +967,7 @@ void BreakHandler::breakByFunction(const QString &functionName)
QIcon BreakHandler::icon(BreakpointId id) const QIcon BreakHandler::icon(BreakpointId id) const
{ {
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), BREAK_ASSERT(it != m_storage.end(), qDebug() << "NO ICON FOR ID" << id;
qDebug() << "NO ICON FOR ID" << id;
return pendingBreakpointIcon()); return pendingBreakpointIcon());
return it->icon(); return it->icon();
} }
@@ -989,7 +990,7 @@ void BreakHandler::timerEvent(QTimerEvent *event)
void BreakHandler::gotoLocation(BreakpointId id) const void BreakHandler::gotoLocation(BreakpointId id) const
{ {
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
DebuggerEngine *engine = debuggerCore()->currentEngine(); DebuggerEngine *engine = debuggerCore()->currentEngine();
if (it->data.type == BreakpointByAddress) { if (it->data.type == BreakpointByAddress) {
if (engine) if (engine)
@@ -1005,7 +1006,7 @@ void BreakHandler::updateLineNumberFromMarker(BreakpointId id, int lineNumber)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
it->response.pending = false; it->response.pending = false;
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
if (it->response.lineNumber != lineNumber) { if (it->response.lineNumber != lineNumber) {
// FIXME: Should we tell gdb about the change? // FIXME: Should we tell gdb about the change?
it->response.lineNumber = lineNumber; it->response.lineNumber = lineNumber;
@@ -1057,14 +1058,14 @@ const BreakpointResponse &BreakHandler::response(BreakpointId id) const
{ {
static BreakpointResponse dummy; static BreakpointResponse dummy;
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), qDebug() << id; return dummy); BREAK_ASSERT(it != m_storage.end(), qDebug() << id; return dummy);
return it->response; return it->response;
} }
bool BreakHandler::needsChange(BreakpointId id) const bool BreakHandler::needsChange(BreakpointId id) const
{ {
ConstIterator it = m_storage.find(id); ConstIterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return false); BREAK_ASSERT(it != m_storage.end(), return false);
return it->needsChange(); return it->needsChange();
} }
@@ -1072,7 +1073,7 @@ void BreakHandler::setResponse(BreakpointId id,
const BreakpointResponse &response, bool takeOver) const BreakpointResponse &response, bool takeOver)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
BreakpointItem &item = it.value(); BreakpointItem &item = it.value();
item.response = response; item.response = response;
item.destroyMarker(); item.destroyMarker();
@@ -1093,7 +1094,7 @@ void BreakHandler::setBreakpointData(BreakpointId id,
const BreakpointParameters &data) const BreakpointParameters &data)
{ {
Iterator it = m_storage.find(id); Iterator it = m_storage.find(id);
QTC_ASSERT(it != m_storage.end(), return); BREAK_ASSERT(it != m_storage.end(), return);
if (data == it->data) if (data == it->data)
return; return;
it->data = data; it->data = data;