2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-06-17 00:01:27 +10:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef DEBUGGER_BREAKHANDLER_H
|
|
|
|
|
#define DEBUGGER_BREAKHANDLER_H
|
|
|
|
|
|
2010-05-07 15:16:31 +02:00
|
|
|
#include "breakpoint.h"
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtCore/QObject>
|
2009-10-01 11:22:44 +02:00
|
|
|
#include <QtCore/QAbstractTableModel>
|
2010-07-13 17:16:31 +02:00
|
|
|
|
2010-02-10 10:47:34 +01:00
|
|
|
#include <QtGui/QIcon>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
class DebuggerEngine;
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// BreakHandler
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2009-10-01 11:22:44 +02:00
|
|
|
class BreakHandler : public QAbstractTableModel
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-06-16 11:08:54 +02:00
|
|
|
explicit BreakHandler(DebuggerEngine *engine);
|
2008-12-04 11:37:43 +01:00
|
|
|
~BreakHandler();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
void removeAllBreakpoints();
|
|
|
|
|
void loadSessionData();
|
|
|
|
|
void saveSessionData();
|
|
|
|
|
|
|
|
|
|
QAbstractItemModel *model() { return this; }
|
|
|
|
|
|
2010-03-26 08:52:49 +01:00
|
|
|
BreakpointData *at(int index) const;
|
2010-10-13 17:43:53 +02:00
|
|
|
int size() const;
|
2009-04-08 16:37:41 +02:00
|
|
|
bool hasPendingBreakpoints() const;
|
2010-03-26 08:52:49 +01:00
|
|
|
void removeAt(int index); // This also deletes the marker.
|
|
|
|
|
void clear(); // This also deletes all the marker.
|
2010-10-13 17:43:53 +02:00
|
|
|
int indexOf(BreakpointData *data);
|
2010-06-16 11:08:54 +02:00
|
|
|
// Find a breakpoint matching approximately the data in needle.
|
|
|
|
|
BreakpointData *findSimilarBreakpoint(const BreakpointData *needle) const;
|
2010-05-10 10:33:52 +02:00
|
|
|
BreakpointData *findBreakpointByNumber(int bpNumber) const;
|
2010-09-21 14:26:45 +02:00
|
|
|
int findWatchPointIndexByAddress(quint64 address) const;
|
2010-05-20 19:35:34 +02:00
|
|
|
bool watchPointAt(quint64 address) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
void updateMarkers();
|
2010-07-13 17:16:31 +02:00
|
|
|
bool isActive() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
Breakpoints takeRemovedBreakpoints(); // Owned.
|
|
|
|
|
Breakpoints takeEnabledBreakpoints(); // Not owned.
|
|
|
|
|
Breakpoints takeDisabledBreakpoints(); // Not owned.
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-07-13 17:16:31 +02:00
|
|
|
QIcon breakpointIcon() const { return m_breakpointIcon; }
|
2010-02-10 10:47:34 +01:00
|
|
|
QIcon disabledBreakpointIcon() const { return m_disabledBreakpointIcon; }
|
2010-07-13 17:16:31 +02:00
|
|
|
QIcon pendingBreakPointIcon() const { return m_pendingBreakPointIcon; }
|
|
|
|
|
QIcon emptyIcon() const { return m_emptyIcon; }
|
2010-02-10 10:47:34 +01:00
|
|
|
|
2010-06-16 11:08:54 +02:00
|
|
|
void initializeFromTemplate(BreakHandler *other);
|
2010-06-22 15:37:27 +02:00
|
|
|
void storeToTemplate(BreakHandler *other);
|
2010-09-21 14:26:45 +02:00
|
|
|
void toggleBreakpoint(const QString &fileName, int lineNumber, quint64 address = 0);
|
2010-06-25 16:06:48 +02:00
|
|
|
void toggleBreakpointEnabled(const QString &fileName, int lineNumber);
|
2010-09-08 09:54:40 +02:00
|
|
|
BreakpointData *findBreakpoint(const QString &fileName, int lineNumber,
|
|
|
|
|
bool useMarkerPosition = true);
|
2010-09-21 14:26:45 +02:00
|
|
|
BreakpointData *findBreakpoint(quint64 address) const;
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public slots:
|
2010-04-09 15:19:10 +02:00
|
|
|
void appendBreakpoint(BreakpointData *data);
|
2010-09-28 13:14:14 +02:00
|
|
|
void reinsertBreakpoint(BreakpointData *data);
|
2009-04-28 15:08:52 +02:00
|
|
|
void toggleBreakpointEnabled(BreakpointData *data);
|
2008-12-02 12:01:29 +01:00
|
|
|
void breakByFunction(const QString &functionName);
|
|
|
|
|
void removeBreakpoint(int index);
|
2010-05-12 16:48:04 +02:00
|
|
|
void removeBreakpoint(BreakpointData *data);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
friend class BreakpointMarker;
|
|
|
|
|
|
|
|
|
|
// QAbstractItemModel
|
|
|
|
|
int columnCount(const QModelIndex &parent) const;
|
|
|
|
|
int rowCount(const QModelIndex &parent) const;
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
2010-06-16 11:08:54 +02:00
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
2008-12-02 12:01:29 +01:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
2009-04-28 15:08:52 +02:00
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
void markerUpdated(BreakpointMarker *, int lineNumber);
|
|
|
|
|
void loadBreakpoints();
|
|
|
|
|
void saveBreakpoints();
|
|
|
|
|
void removeBreakpointHelper(int index);
|
2010-09-28 13:14:14 +02:00
|
|
|
void append(BreakpointData *data);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-02-10 10:47:34 +01:00
|
|
|
const QIcon m_breakpointIcon;
|
|
|
|
|
const QIcon m_disabledBreakpointIcon;
|
|
|
|
|
const QIcon m_pendingBreakPointIcon;
|
2010-07-13 17:16:31 +02:00
|
|
|
const QIcon m_emptyIcon;
|
2010-05-07 15:16:31 +02:00
|
|
|
const QIcon m_watchpointIcon;
|
2010-02-10 10:47:34 +01:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
Debugger::DebuggerEngine *m_engine; // Not owned.
|
2010-06-16 11:08:54 +02:00
|
|
|
Breakpoints m_inserted; // Lately inserted breakpoints.
|
|
|
|
|
Breakpoints m_removed; // Lately removed breakpoints.
|
|
|
|
|
Breakpoints m_enabled; // Lately enabled breakpoints.
|
|
|
|
|
Breakpoints m_disabled; // Lately disabled breakpoints.
|
|
|
|
|
|
|
|
|
|
// Hack for BreakWindow::findSimilarBreakpoint
|
|
|
|
|
mutable BreakpointData *m_lastFound;
|
|
|
|
|
mutable bool m_lastFoundQueried;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
#endif // DEBUGGER_BREAKHANDLER_H
|