2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02: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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifndef DEBUGGER_WATCHHANDLER_H
|
|
|
|
|
#define DEBUGGER_WATCHHANDLER_H
|
|
|
|
|
|
2010-04-26 18:54:08 +02:00
|
|
|
#include "watchdata.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QHash>
|
|
|
|
|
#include <QSet>
|
|
|
|
|
#include <QStringList>
|
2012-12-13 15:13:33 +01:00
|
|
|
#include <QPointer>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QAbstractItemModel>
|
2009-08-12 11:21:44 +02:00
|
|
|
|
2012-12-13 15:13:33 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QTabWidget)
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Debugger {
|
2012-05-18 02:28:41 +02:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
class DebuggerEngine;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2012-05-18 02:28:41 +02:00
|
|
|
class WatchModel;
|
|
|
|
|
|
|
|
|
|
class UpdateParameters
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
UpdateParameters() { tryPartial = tooltipOnly = false; }
|
|
|
|
|
|
|
|
|
|
bool tryPartial;
|
|
|
|
|
bool tooltipOnly;
|
|
|
|
|
QByteArray varList;
|
|
|
|
|
};
|
|
|
|
|
|
2011-11-07 20:07:14 +01:00
|
|
|
typedef QHash<QString, QStringList> TypeFormats;
|
2009-06-17 16:00:03 +02:00
|
|
|
|
2009-07-06 10:44:08 +02:00
|
|
|
enum IntegerFormat
|
|
|
|
|
{
|
2010-03-12 11:14:50 +01:00
|
|
|
DecimalFormat = 0, // Keep that at 0 as default.
|
2009-07-06 10:44:08 +02:00
|
|
|
HexadecimalFormat,
|
|
|
|
|
BinaryFormat,
|
2010-12-16 12:05:48 +01:00
|
|
|
OctalFormat
|
2009-07-06 10:44:08 +02:00
|
|
|
};
|
|
|
|
|
|
2009-06-17 16:00:03 +02:00
|
|
|
class WatchHandler : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-06-16 11:08:54 +02:00
|
|
|
explicit WatchHandler(DebuggerEngine *engine);
|
2012-05-18 02:28:41 +02:00
|
|
|
~WatchHandler();
|
|
|
|
|
|
|
|
|
|
QAbstractItemModel *model() const;
|
2009-06-17 16:00:03 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void cleanup();
|
2012-08-31 11:34:27 +02:00
|
|
|
void watchExpression(const QString &exp, const QString &name = QString());
|
2012-10-29 12:59:53 +01:00
|
|
|
void watchVariable(const QString &exp);
|
2011-01-14 17:28:37 +01:00
|
|
|
Q_SLOT void clearWatches();
|
2010-02-04 16:23:51 +01:00
|
|
|
|
2010-03-09 17:37:36 +01:00
|
|
|
void updateWatchers(); // Called after locals are fetched
|
2012-04-18 14:20:54 +02:00
|
|
|
|
2009-06-17 16:00:03 +02:00
|
|
|
void showEditValue(const WatchData &data);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-05-18 02:28:41 +02:00
|
|
|
const WatchData *watchData(const QModelIndex &) const;
|
2012-11-23 17:15:29 +01:00
|
|
|
const QModelIndex watchDataIndex(const QByteArray &iname) const;
|
2012-05-18 02:28:41 +02:00
|
|
|
const WatchData *findData(const QByteArray &iname) const;
|
2012-08-31 11:34:27 +02:00
|
|
|
const WatchData *findCppLocalVariable(const QString &name) const;
|
2011-11-25 18:50:54 +01:00
|
|
|
QString displayForAutoTest(const QByteArray &iname) const;
|
2012-05-18 02:28:41 +02:00
|
|
|
bool hasItem(const QByteArray &iname) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-11-23 13:44:37 +01:00
|
|
|
void loadSessionData();
|
|
|
|
|
void saveSessionData();
|
2010-09-15 19:02:12 +02:00
|
|
|
void removeTooltip();
|
2011-02-23 16:09:56 +01:00
|
|
|
void rebuildModel();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-05-18 02:28:41 +02:00
|
|
|
bool isExpandedIName(const QByteArray &iname) const;
|
|
|
|
|
QSet<QByteArray> expandedINames() const;
|
|
|
|
|
|
2010-11-04 18:11:09 +01:00
|
|
|
static QStringList watchedExpressions();
|
2012-03-14 12:26:27 +01:00
|
|
|
static QHash<QByteArray, int> watcherNames();
|
2010-04-27 08:53:18 +02:00
|
|
|
|
|
|
|
|
QByteArray expansionRequests() const;
|
|
|
|
|
QByteArray typeFormatRequests() const;
|
|
|
|
|
QByteArray individualFormatRequests() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-11 18:55:52 +01:00
|
|
|
int format(const QByteArray &iname) const;
|
2009-06-18 10:34:53 +02:00
|
|
|
|
2010-09-01 19:02:56 +02:00
|
|
|
void addTypeFormats(const QByteArray &type, const QStringList &formats);
|
2011-11-07 20:07:14 +01:00
|
|
|
void setTypeFormats(const TypeFormats &typeFormats);
|
|
|
|
|
TypeFormats typeFormats() const;
|
2010-06-25 09:07:14 +02:00
|
|
|
|
2011-08-03 14:36:07 +02:00
|
|
|
void setUnprintableBase(int base);
|
|
|
|
|
static int unprintableBase();
|
2011-02-17 19:00:33 +01:00
|
|
|
|
2010-06-25 14:08:53 +02:00
|
|
|
QByteArray watcherName(const QByteArray &exp);
|
2010-11-04 18:11:09 +01:00
|
|
|
void synchronizeWatchers();
|
2010-11-05 19:38:40 +01:00
|
|
|
QString editorContents();
|
2011-11-07 20:07:14 +01:00
|
|
|
void editTypeFormats(bool includeLocals, const QByteArray &iname);
|
2010-06-25 14:08:53 +02:00
|
|
|
|
2012-01-17 18:44:02 +01:00
|
|
|
void scheduleResetLocation();
|
|
|
|
|
void resetLocation();
|
2012-02-07 15:39:27 +01:00
|
|
|
bool isValidToolTip(const QByteArray &iname) const;
|
2012-01-17 18:44:02 +01:00
|
|
|
|
2012-05-18 02:28:41 +02:00
|
|
|
void setCurrentItem(const QByteArray &iname);
|
|
|
|
|
void updateWatchersWindow();
|
|
|
|
|
|
|
|
|
|
void insertData(const WatchData &data); // Convenience.
|
|
|
|
|
void insertData(const QList<WatchData> &list);
|
|
|
|
|
void insertIncompleteData(const WatchData &data);
|
|
|
|
|
void removeData(const QByteArray &iname);
|
|
|
|
|
void removeChildren(const QByteArray &iname);
|
2012-10-09 16:13:29 +02:00
|
|
|
void removeAllData(bool includeInspectData = false);
|
2012-09-21 16:46:06 +02:00
|
|
|
void resetValueCache();
|
2012-04-18 14:20:54 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private:
|
2012-12-13 15:13:33 +01:00
|
|
|
void removeSeparateWidget(QObject *o);
|
|
|
|
|
void showSeparateWidget(QWidget *w);
|
|
|
|
|
|
2009-07-13 09:11:07 +02:00
|
|
|
friend class WatchModel;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-11-23 13:44:37 +01:00
|
|
|
void saveWatchers();
|
2010-11-04 18:11:09 +01:00
|
|
|
static void loadTypeFormats();
|
|
|
|
|
static void saveTypeFormats();
|
2008-12-17 17:43:01 +01:00
|
|
|
|
2010-09-01 19:02:56 +02:00
|
|
|
void setFormat(const QByteArray &type, int format);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-05-18 02:28:41 +02:00
|
|
|
WatchModel *m_model;
|
2010-06-16 11:08:54 +02:00
|
|
|
DebuggerEngine *m_engine;
|
2012-12-13 15:13:33 +01:00
|
|
|
QPointer<QTabWidget> m_separateWindow;
|
2011-09-08 12:22:13 +02:00
|
|
|
|
|
|
|
|
int m_watcherCounter;
|
2012-01-17 18:44:02 +01:00
|
|
|
|
|
|
|
|
bool m_contentsValid;
|
|
|
|
|
bool m_resetLocationScheduled;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2012-05-18 02:28:41 +02:00
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::UpdateParameters)
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif // DEBUGGER_WATCHHANDLER_H
|