static DebuggerPlugin *plugin() { return DebuggerPlugin::instance(); }
+static Breakpoints m_bp;
+
//////////////////////////////////////////////////////////////////
//
// BreakHandler
//m_emptyIcon(_(":/debugger/images/debugger_empty_14.png")),
m_watchpointIcon(_(":/debugger/images/watchpoint.png")),
m_engine(engine),
- m_bp(0),
- m_masterList(false),
m_lastFound(0),
m_lastFoundQueried(false)
{
BreakHandler::~BreakHandler()
{
- if (m_bp && m_masterList) {
- qDeleteAll(*m_bp);
- m_bp->clear();
- delete m_bp;
- }
clear();
}
BreakpointData *BreakHandler::at(int index) const
{
QTC_ASSERT(index < size(), return 0);
- QTC_ASSERT(m_bp,/**/);
- return m_bp->at(index);
+ return m_bp.at(index);
}
void BreakHandler::removeAt(int index)
{
- QTC_ASSERT(m_bp,/**/);
BreakpointData *data = at(index);
- m_bp->removeAt(index);
+ QTC_ASSERT(data, return);
+ m_bp.removeAt(index);
delete data;
}
BreakpointData *BreakHandler::findSimilarBreakpoint(const BreakpointData *needle) const
{
- QTC_ASSERT(m_bp, /**/);
// Search a breakpoint we might refer to.
for (int index = 0; index != size(); ++index) {
- BreakpointData *data = (*m_bp)[index];
+ BreakpointData *data = m_bp[index];
if (data->isSimilarTo(needle))
return data;
}
void BreakHandler::append(BreakpointData *data)
{
- QTC_ASSERT(m_bp, return);
data->m_handler = this;
- m_bp->append(data);
+ m_bp.append(data);
}
Breakpoints BreakHandler::takeRemovedBreakpoints()
void BreakHandler::removeBreakpointHelper(int index)
{
- QTC_ASSERT(m_bp, return);
- BreakpointData *data = m_bp->at(index);
- m_bp->removeAt(index);
+ BreakpointData *data = at(index);
+ QTC_ASSERT(data, return);
+ m_bp.removeAt(index);
data->removeMarker();
m_removed.append(data);
}
void BreakHandler::removeBreakpoint(BreakpointData *data)
{
- QTC_ASSERT(m_bp, return);
- removeBreakpointHelper(m_bp->indexOf(data));
+ removeBreakpointHelper(indexOf(data));
emit layoutChanged();
}
BreakpointData *BreakHandler::findBreakpoint(quint64 address) const
{
- QTC_ASSERT(m_bp, return 0);
- foreach (BreakpointData *data, *m_bp)
+ foreach (BreakpointData *data, m_bp)
if (data->address == address)
return data;
return 0;
BreakpointData *BreakHandler::findBreakpoint(const QString &fileName,
int lineNumber, bool useMarkerPosition)
{
- QTC_ASSERT(m_bp, return 0);
- foreach (BreakpointData *data, *m_bp)
+ foreach (BreakpointData *data, m_bp)
if (data->isLocatedAt(fileName, lineNumber, useMarkerPosition))
return data;
return 0;
saveBreakpoints();
}
-void BreakHandler::initMasterList()
-{
- if (m_bp) {
- qDeleteAll(*m_bp);
- delete m_bp;
- }
- m_masterList = true;
- m_bp = new Breakpoints;
-}
-
void BreakHandler::loadSessionData()
{
QTC_ASSERT(m_engine->isSessionEngine(), return);
- initMasterList();
+ qDeleteAll(m_bp);
+ m_bp.clear();
loadBreakpoints();
updateMarkers();
}
return m_engine->isActive();
}
-bool BreakHandler::isMasterList() const
-{
- return m_masterList;
-}
-
void BreakHandler::initializeFromTemplate(BreakHandler *other)
{
- QTC_ASSERT(other->isMasterList(), return);
- QTC_ASSERT(!isMasterList(), return);
- QTC_ASSERT(other->m_bp, return);
-
- m_bp = other->m_bp;
m_inserted.clear();
- foreach(BreakpointData *data, *m_bp) {
+ foreach(BreakpointData *data, m_bp) {
if (m_engine->acceptsBreakpoint(data)) {
data->m_handler = this;
m_inserted.append(data);
void BreakHandler::storeToTemplate(BreakHandler *other)
{
- QTC_ASSERT(m_bp, return);
- foreach (BreakpointData *data, *m_bp) {
+ foreach (BreakpointData *data, m_bp) {
data->m_handler = other;
data->clear();
}
- m_bp = 0;
-
other->saveSessionData();
}
+int BreakHandler::size() const
+{
+ return m_bp.size();
+}
+
+int BreakHandler::indexOf(BreakpointData *data)
+{
+ return m_bp.indexOf(data);
+}
+
} // namespace Internal
} // namespace Debugger
QAbstractItemModel *model() { return this; }
BreakpointData *at(int index) const;
- int size() const { return m_bp?m_bp->size():0; }
+ int size() const;
bool hasPendingBreakpoints() const;
void removeAt(int index); // This also deletes the marker.
void clear(); // This also deletes all the marker.
- int indexOf(BreakpointData *data) { return m_bp?m_bp->indexOf(data):-1; }
+ int indexOf(BreakpointData *data);
// Find a breakpoint matching approximately the data in needle.
BreakpointData *findSimilarBreakpoint(const BreakpointData *needle) const;
BreakpointData *findBreakpointByNumber(int bpNumber) const;
bool watchPointAt(quint64 address) const;
void updateMarkers();
bool isActive() const;
- bool isMasterList() const;
Breakpoints takeRemovedBreakpoints(); // Owned.
Breakpoints takeEnabledBreakpoints(); // Not owned.
void removeBreakpointHelper(int index);
void append(BreakpointData *data);
- void initMasterList();
-
const QIcon m_breakpointIcon;
const QIcon m_disabledBreakpointIcon;
const QIcon m_pendingBreakPointIcon;
const QIcon m_watchpointIcon;
Debugger::DebuggerEngine *m_engine; // Not owned.
- Breakpoints *m_bp;
Breakpoints m_inserted; // Lately inserted breakpoints.
Breakpoints m_removed; // Lately removed breakpoints.
Breakpoints m_enabled; // Lately enabled breakpoints.
Breakpoints m_disabled; // Lately disabled breakpoints.
- bool m_masterList;
-
// Hack for BreakWindow::findSimilarBreakpoint
mutable BreakpointData *m_lastFound;
mutable bool m_lastFoundQueried;