Qt 4.8
qjsdebuggeragent_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QJSDEBUGGERAGENT_P_H
43 #define QJSDEBUGGERAGENT_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists purely as an
50 // implementation detail. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include <QtScript/qscriptengineagent.h>
57 #include <QtCore/qset.h>
58 
60 class QScriptValue;
61 class QDeclarativeEngine;
63 
65 
67 
68 QT_MODULE(Declarative)
69 
71 
73 {
79 };
80 
88 
90 };
91 
93 {
100 };
101 
103 {
104  return s << data.exp << data.name << data.value
105  << data.type << data.hasChildren << data.objectId;
106 }
107 
109 {
110  return s >> data.exp >> data.name >> data.value
111  >> data.type >> data.hasChildren >> data.objectId;
112 }
113 
115 {
119 };
120 
122 {
123  return s << data.functionName << data.fileUrl << data.lineNumber;
124 }
125 
127 {
128  return s >> data.functionName >> data.fileUrl >> data.lineNumber;
129 }
130 
132 {
136 };
137 
139 
141 {
142  return s << data.functionName << data.fileUrl << data.lineNumber;
143 }
144 
146 {
147  return s >> data.functionName >> data.fileUrl >> data.lineNumber;
148 }
149 
150 inline bool operator==(const JSAgentBreakpointData &b1, const JSAgentBreakpointData &b2)
151 {
152  return b1.lineNumber == b2.lineNumber && b1.fileUrl == b2.fileUrl;
153 }
154 
156 {
157  return b.lineNumber ^ qHash(b.fileUrl);
158 }
159 
160 
162 {
163  Q_OBJECT
164 
165 public:
166  QJSDebuggerAgent(QScriptEngine *engine, QObject *parent = 0);
167  QJSDebuggerAgent(QDeclarativeEngine *engine, QObject *parent = 0);
168  ~QJSDebuggerAgent();
169 
170  bool isInitialized() const;
171 
172  void setBreakpoints(const JSAgentBreakpoints &);
173  void setWatchExpressions(const QStringList &);
174 
175  void stepOver();
176  void stepInto();
177  void stepOut();
178  void continueExecution();
179  void setCoverageEnabled(bool enabled);
180 
181  JSAgentWatchData executeExpression(const QString &expr);
182  QList<JSAgentWatchData> expandObjectById(quint64 objectId);
183  QList<JSAgentWatchData> locals();
184  QList<JSAgentWatchData> localsAtFrame(int frameId);
185  QList<JSAgentStackData> backtrace();
186  QList<JSAgentWatchData> watches();
187  void setProperty(qint64 objectId,
188  const QString &property,
189  const QString &value);
190 
191  // reimplemented
192  void scriptLoad(qint64 id, const QString &program,
193  const QString &fileName, int baseLineNumber);
194  void scriptUnload(qint64 id);
195 
196  void contextPush();
197  void contextPop();
198 
199  void functionEntry(qint64 scriptId);
200  void functionExit(qint64 scriptId,
201  const QScriptValue &returnValue);
202 
203  void positionChange(qint64 scriptId,
204  int lineNumber, int columnNumber);
205 
206  void exceptionThrow(qint64 scriptId,
207  const QScriptValue &exception,
208  bool hasHandler);
209  void exceptionCatch(qint64 scriptId,
210  const QScriptValue &exception);
211 
212  bool supportsExtension(Extension extension) const;
213  QVariant extension(Extension extension,
214  const QVariant &argument = QVariant());
215 
216 Q_SIGNALS:
217  void stopped(bool becauseOfException,
218  const QString &exception);
219 
220 private:
223 };
224 
226 
228 
229 #endif // QJSDEBUGGERAGENT_P_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int qint32
Definition: qglobal.h:937
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
uint qHash(const JSAgentBreakpointData &b)
JSCoverageMessage
QDataStream & operator>>(QDataStream &s, JSAgentWatchData &data)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
JSDebuggerState
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_SIGNALS
Definition: qobjectdefs.h:72
The QScriptEngine class provides an environment for evaluating Qt Script code.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QSet< JSAgentBreakpointData > JSAgentBreakpoints
unsigned __int64 quint64
Definition: qglobal.h:943
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
__int64 qint64
Definition: qglobal.h:942
QJSDebuggerAgentPrivate * d
#define Q_OBJECT
Definition: qobjectdefs.h:157
QDataStream & operator<<(QDataStream &s, const JSAgentWatchData &data)
The QDeclarativeEngine class provides an environment for instantiating QML components.
const char * property
Definition: qwizard.cpp:138
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
bool operator==(const JSAgentBreakpointData &b1, const JSAgentBreakpointData &b2)
Extension
This enum specifies the possible extensions to a QScriptEngineAgent.
#define QT_END_HEADER
Definition: qglobal.h:137
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
static QString fileName(const QString &fileUrl)
The QScriptEngineAgent class provides an interface to report events pertaining to QScriptEngine execu...
#define enabled
The QList class is a template class that provides lists.
Definition: qdatastream.h:62