diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index 5ac1b6be1bf..84f322d260d 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -32,6 +32,7 @@ #include "debuggeractions.h" #include "debuggercore.h" +#include "debuggerengine.h" #include "debuggerstringutils.h" #include @@ -312,10 +313,8 @@ void BreakHandler::updateMarker(BreakpointId id) BreakpointMarker *marker = it->marker; if (marker && (data.m_markerFileName != marker->fileName() - || data.m_markerLineNumber != marker->lineNumber())) { - removeMarker(id); - marker = 0; - } + || data.m_markerLineNumber != marker->lineNumber())) + it->destroyMarker(); if (!marker && !data.m_markerFileName.isEmpty() && data.m_markerLineNumber > 0) { marker = new BreakpointMarker(id, data.m_markerFileName, data.m_markerLineNumber); @@ -323,14 +322,6 @@ void BreakHandler::updateMarker(BreakpointId id) } } -void BreakHandler::removeMarker(BreakpointId id) -{ - Iterator it = m_storage.find(id); - BreakpointMarker *marker = it->marker; - it->marker = 0; - delete marker; -} - QVariant BreakHandler::headerData(int section, Qt::Orientation orientation, int role) const { @@ -462,7 +453,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const } if (role == Qt::ToolTipRole) return debuggerCore()->boolSetting(UseToolTipsInBreakpointsView) - ? data.toToolTip() : QVariant(); + ? QVariant(it->toToolTip()) : QVariant(); return QVariant(); } @@ -799,7 +790,7 @@ void BreakHandler::cleanupBreakpoint(BreakpointId id) { QTC_ASSERT(state(id) == BreakpointDead, /**/); BreakpointItem item = m_storage.take(id); - item.destroy(); + item.destroyMarker(); } BreakpointResponse BreakHandler::response(BreakpointId id) const @@ -836,10 +827,110 @@ void BreakHandler::notifyBreakpointAdjusted(BreakpointId id) } #endif -void BreakHandler::BreakpointItem::destroy() +void BreakHandler::BreakpointItem::destroyMarker() { - delete marker; + BreakpointMarker *m = marker; marker = 0; + delete m; +} + +static void formatAddress(QTextStream &str, quint64 address) +{ + if (address) { + str << "0x"; + str.setIntegerBase(16); + str << address; + str.setIntegerBase(10); + } +} + +QString BreakHandler::BreakpointItem::toToolTip() const +{ + QString t; + + switch (data.type()) { + case BreakpointByFileAndLine: + t = tr("Breakpoint by File and Line"); + break; + case BreakpointByFunction: + t = tr("Breakpoint by Function"); + break; + case BreakpointByAddress: + t = tr("Breakpoint by Address"); + break; + case Watchpoint: + t = tr("Watchpoint"); + break; + case UnknownType: + t = tr("Unknown Breakpoint Type"); + } + + QString rc; + QTextStream str(&rc); + str << "" + //<< "" + << "" + << "" + << "" + << "" + << "" + << "" + << "" + << "
" << tr("Id:") << "" << m_id << "
" << tr("State:") + << "" << state << "
" << tr("Engine:") + << "" << (engine ? engine->objectName() : "0") << "
" << tr("Marker File:") + << "" << QDir::toNativeSeparators(data.m_markerFileName) << "
" << tr("Marker Line:") + << "" << data.m_markerLineNumber << "
" << tr("Breakpoint Number:") + << "" << response.bpNumber << "
" << tr("Breakpoint Type:") + << "" << t << "
" << tr("State:") + << "" << response.bpState << "


" + << "" + << "" + << "" + << "" + << "" + << "" + // << "" + << "" + << "" + << "" + << "
" << tr("Property") + << "" << tr("Requested") + << "" << tr("Obtained") << "
" << tr("Internal Number:") + << "" << response.bpNumber << "
" << tr("File Name:") + << "" << QDir::toNativeSeparators(data.m_fileName) + << "" << QDir::toNativeSeparators(response.bpFileName) + << "
" << tr("Function Name:") + << "" << data.m_functionName + << "" << response.bpFuncName << "
" << tr("Line Number:") << ""; + if (data.m_lineNumber) + str << data.m_lineNumber; + str << ""; + if (response.bpLineNumber) + str << response.bpLineNumber; + str << "
" << tr("Breakpoint Address:") + << ""; + formatAddress(str, data.m_address); + str << ""; + formatAddress(str, response.bpAddress); + //str << "
" << tr("Corrected Line Number:") + // << "-"; + //if (response.bpCorrectedLineNumber > 0) + // str << response.bpCorrectedLineNumber; + //else + // str << '-'; + str << "
" << tr("Condition:") + << "" << data.m_condition + << "" << response.bpCondition << "
" << tr("Ignore Count:") << ""; + if (data.m_ignoreCount) + str << data.m_ignoreCount; + str << ""; + if (response.bpIgnoreCount) + str << response.bpIgnoreCount; + str << "
" << tr("Thread Specification:") + << "" << data.m_threadSpec + << "" << response.bpThreadSpec << "
"; + return rc; } } // namespace Internal diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 569055c2ac6..3da660fdb62 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -79,7 +79,6 @@ public: void setWatchpointByAddress(quint64 address); bool hasWatchpointAt(quint64 address) const; void updateMarkers(); - void removeMarker(BreakpointId id); QIcon breakpointIcon() const { return m_breakpointIcon; } QIcon disabledBreakpointIcon() const { return m_disabledBreakpointIcon; } @@ -139,6 +138,7 @@ public: void notifyBreakpointRemoveFailed(BreakpointId id); void notifyBreakpointReleased(BreakpointId id); + public: // FIXME: Make private. void setState(BreakpointId id, BreakpointState state); @@ -171,9 +171,10 @@ private: struct BreakpointItem { BreakpointItem() : state(BreakpointNew), engine(0), marker(0) {} - void destroy(); + void destroyMarker(); bool isPending() const { return state == BreakpointPending || state == BreakpointNew; } + QString toToolTip() const; BreakpointData data; BreakpointState state; // Current state of breakpoint. diff --git a/src/plugins/debugger/breakpoint.cpp b/src/plugins/debugger/breakpoint.cpp index 097e1bfa262..3ca98104f3c 100644 --- a/src/plugins/debugger/breakpoint.cpp +++ b/src/plugins/debugger/breakpoint.cpp @@ -28,15 +28,9 @@ **************************************************************************/ #include "breakpoint.h" -#include "stackframe.h" - -#include #include #include -#include -#include -#include namespace Debugger { namespace Internal { @@ -113,102 +107,6 @@ bool BreakpointData::setCondition(const QByteArray &cond) #undef SETIT -static void formatAddress(QTextStream &str, quint64 address) -{ - if (address) { - str << "0x"; - str.setIntegerBase(16); - str << address; - str.setIntegerBase(10); - } -} - -QString BreakpointData::toToolTip() const -{ - QString t; - switch (m_type) { - case BreakpointByFileAndLine: - t = tr("Breakpoint by File and Line"); - break; - case BreakpointByFunction: - t = tr("Breakpoint by Function"); - break; - case BreakpointByAddress: - t = tr("Breakpoint by Address"); - break; - case Watchpoint: - t = tr("Watchpoint"); - break; - case UnknownType: - t = tr("Unknown Breakpoint Type"); - } - - QString rc; - QTextStream str(&rc); - str << "" - //<< "" - //<< "" - //<< "" - << "" - << "" - //<< "" - << "" - << "" - << "
" << tr("Id:") - //<< "" << m_id << "
" << tr("State:") - //<< "" << m_state << "
" << tr("Engine:") - //<< "" << m_engine << "
" << tr("Marker File:") - << "" << QDir::toNativeSeparators(m_markerFileName) << "
" << tr("Marker Line:") - << "" << m_markerLineNumber << "
" << tr("Breakpoint Number:") - //<< "" << bpNumber << "
" << tr("Breakpoint Type:") - << "" << t << "
" << tr("State:") - //<< "" << bpState << "


" - << "" - << "" - << "" - << "" - << "" - << "" - // << "" - << "" - << "" - << "" - << "
" << tr("Property") - << "" << tr("Requested") - << "" << tr("Obtained") << "
" << tr("Internal Number:") - //<< "" << bpNumber << "
" << tr("File Name:") - << "" << QDir::toNativeSeparators(m_fileName) - //<< "" << QDir::toNativeSeparators(bpFileName) << "
" << tr("Function Name:") - << "" << m_functionName // << "" << bpFuncName << "
" << tr("Line Number:") << ""; - if (m_lineNumber) - str << m_lineNumber; - //str << ""; - //if (bpLineNumber) - // str << bpLineNumber; - str << "
" << tr("Breakpoint Address:") - << ""; - formatAddress(str, m_address); - str << ""; - //formatAddress(str, bpAddress); - //str << "
" << tr("Corrected Line Number:") - // << "-"; - //if (bpCorrectedLineNumber > 0) { - // str << bpCorrectedLineNumber; - // } else { - // str << '-'; - // } - str << "
" << tr("Condition:") - // << "" << m_condition << "" << bpCondition << "
" << tr("Ignore Count:") << ""; - if (m_ignoreCount) - str << m_ignoreCount; - str << ""; - //if (bpIgnoreCount) - // str << bpIgnoreCount; - str << "
" << tr("Thread Specification:") - // << "" << m_threadSpec << "" << bpThreadSpec << "
"; - return rc; -} - // Compare file names case insensitively on Windows. static inline bool fileNameMatch(const QString &f1, const QString &f2) { @@ -219,7 +117,7 @@ static inline bool fileNameMatch(const QString &f1, const QString &f2) #endif } -bool BreakpointData::isLocatedAt(const QString &fileName, int lineNumber, +bool BreakpointData::isLocatedAt(const QString &fileName, int lineNumber, bool useMarkerPosition) const { int line = useMarkerPosition ? m_markerLineNumber : m_lineNumber; diff --git a/src/plugins/debugger/breakpoint.h b/src/plugins/debugger/breakpoint.h index 312cb1e5f91..81e3da214af 100644 --- a/src/plugins/debugger/breakpoint.h +++ b/src/plugins/debugger/breakpoint.h @@ -95,7 +95,6 @@ public: BreakpointType type() const { return m_type; } quint64 address() const { return m_address; } bool useFullPath() const { return m_useFullPath; } - QString toToolTip() const; QString toString() const; bool isLocatedAt(const QString &fileName, int lineNumber,