Qt 4.8
Signals | Public Functions | Properties | Friends | List of all members
QJSDebuggerAgent Class Reference

#include <qjsdebuggeragent_p.h>

Inheritance diagram for QJSDebuggerAgent:
QObject QScriptEngineAgent

Signals

void stopped (bool becauseOfException, const QString &exception)
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 

Public Functions

QList< JSAgentStackDatabacktrace ()
 
void contextPop ()
 Reimplemented Function More...
 
void contextPush ()
 Reimplemented Function More...
 
void continueExecution ()
 
void exceptionCatch (qint64 scriptId, const QScriptValue &exception)
 Reimplemented Function More...
 
void exceptionThrow (qint64 scriptId, const QScriptValue &exception, bool hasHandler)
 Reimplemented Function More...
 
JSAgentWatchData executeExpression (const QString &expr)
 
QList< JSAgentWatchDataexpandObjectById (quint64 objectId)
 
QVariant extension (Extension extension, const QVariant &argument=QVariant())
 This virtual function can be reimplemented in a QScriptEngineAgent subclass to provide support for extensions. More...
 
void functionEntry (qint64 scriptId)
 Reimplemented Function More...
 
void functionExit (qint64 scriptId, const QScriptValue &returnValue)
 Reimplemented Function More...
 
bool isInitialized () const
 Indicates whether the agent got the list of breakpoints. More...
 
QList< JSAgentWatchDatalocals ()
 
QList< JSAgentWatchDatalocalsAtFrame (int frameId)
 
void positionChange (qint64 scriptId, int lineNumber, int columnNumber)
 Reimplemented Function More...
 
 QJSDebuggerAgent (QScriptEngine *engine, QObject *parent=0)
 Constructs a new agent for the given engine. More...
 
 QJSDebuggerAgent (QDeclarativeEngine *engine, QObject *parent=0)
 
void scriptLoad (qint64 id, const QString &program, const QString &fileName, int baseLineNumber)
 Reimplemented Function More...
 
void scriptUnload (qint64 id)
 Reimplemented Function More...
 
void setBreakpoints (const JSAgentBreakpoints &)
 
void setCoverageEnabled (bool enabled)
 
void setProperty (qint64 objectId, const QString &property, const QString &value)
 
void setWatchExpressions (const QStringList &)
 
void stepInto ()
 
void stepOut ()
 
void stepOver ()
 
bool supportsExtension (Extension extension) const
 Returns true if the QScriptEngineAgent supports the given extension; otherwise, false is returned. More...
 
QList< JSAgentWatchDatawatches ()
 
 ~QJSDebuggerAgent ()
 Destroys this QJSDebuggerAgent. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 
- Public Functions inherited from QScriptEngineAgent
QScriptEngineengine () const
 Returns the QScriptEngine that this agent is associated with. More...
 
 QScriptEngineAgent (QScriptEngine *engine)
 Constructs a QScriptEngineAgent object for the given engine. More...
 
virtual ~QScriptEngineAgent ()
 Destroys this QScriptEngineAgent. More...
 

Properties

QJSDebuggerAgentPrivated
 

Friends

class QJSDebuggerAgentPrivate
 

Additional Inherited Members

- Public Types inherited from QScriptEngineAgent
enum  Extension { DebuggerInvocationRequest }
 This enum specifies the possible extensions to a QScriptEngineAgent. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Functions inherited from QScriptEngineAgent
 QScriptEngineAgent (QScriptEngineAgentPrivate &dd, QScriptEngine *engine)
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Variables inherited from QScriptEngineAgent
QScopedPointer< QScriptEngineAgentPrivated_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 161 of file qjsdebuggeragent_p.h.

Constructors and Destructors

◆ QJSDebuggerAgent() [1/2]

QJSDebuggerAgent::QJSDebuggerAgent ( QScriptEngine engine,
QObject parent = 0 
)

Constructs a new agent for the given engine.

The agent will report debugging-related events (e.g. step completion) to the given backend.

Definition at line 233 of file qjsdebuggeragent.cpp.

234  : QObject(parent)
235  , QScriptEngineAgent(engine)
236  , d(new QJSDebuggerAgentPrivate(this))
237 {
239 }
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
friend class QJSDebuggerAgentPrivate
QScriptEngineAgent(QScriptEngine *engine)
Constructs a QScriptEngineAgent object for the given engine.
QJSDebuggerAgentPrivate * d
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753
void setAgent(QScriptEngineAgent *agent)
Installs the given agent on this engine.

◆ QJSDebuggerAgent() [2/2]

QJSDebuggerAgent::QJSDebuggerAgent ( QDeclarativeEngine engine,
QObject parent = 0 
)

Definition at line 241 of file qjsdebuggeragent.cpp.

242  : QObject(parent)
244  , d(new QJSDebuggerAgentPrivate(this))
245 {
247 }
static QScriptEngine * getScriptEngine(QDeclarativeEngine *engine)
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
friend class QJSDebuggerAgentPrivate
QScriptEngineAgent(QScriptEngine *engine)
Constructs a QScriptEngineAgent object for the given engine.
QJSDebuggerAgentPrivate * d
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753
void setAgent(QScriptEngineAgent *agent)
Installs the given agent on this engine.

◆ ~QJSDebuggerAgent()

QJSDebuggerAgent::~QJSDebuggerAgent ( )

Destroys this QJSDebuggerAgent.

Definition at line 252 of file qjsdebuggeragent.cpp.

253 {
254  engine()->setAgent(0);
255  delete d;
256 }
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
QJSDebuggerAgentPrivate * d
void setAgent(QScriptEngineAgent *agent)
Installs the given agent on this engine.

Functions

◆ backtrace()

QList< JSAgentStackData > QJSDebuggerAgent::backtrace ( )

Definition at line 357 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::executionStopped().

358 {
359  SetupExecEnv execEnv(d);
360 
362 
363  for (QScriptContext *ctx = engine()->currentContext(); ctx; ctx = ctx->parentContext()) {
365 
366  JSAgentStackData frame;
367  frame.functionName = info.functionName().toUtf8();
368  if (frame.functionName.isEmpty()) {
369  if (ctx->parentContext()) {
370  switch (info.functionType()) {
372  frame.functionName = "<anonymous>";
373  break;
375  frame.functionName = "<native>";
376  break;
379  frame.functionName = "<native slot>";
380  break;
381  }
382  } else {
383  frame.functionName = "<global>";
384  }
385  }
386  frame.lineNumber = info.lineNumber();
387  // if the line number is unknown, fallback to the function line number
388  if (frame.lineNumber == -1)
389  frame.lineNumber = info.functionStartLineNumber();
390 
391  frame.fileUrl = info.fileName().toUtf8();
392  backtrace.append(frame);
393  }
394 
395  return backtrace;
396 }
The QScriptContext class represents a Qt Script function invocation.
static mach_timebase_info_data_t info
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QJSDebuggerAgentPrivate * d
QList< JSAgentStackData > backtrace()
The QScriptContextInfo class provides additional information about a QScriptContext.
#define ctx
Definition: qgl.cpp:6094
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ contextPop()

void QJSDebuggerAgent::contextPop ( )
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 458 of file qjsdebuggeragent.cpp.

459 {
460 }

◆ contextPush()

void QJSDebuggerAgent::contextPush ( )
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 451 of file qjsdebuggeragent.cpp.

452 {
453 }

◆ continueExecution()

void QJSDebuggerAgent::continueExecution ( )

Definition at line 309 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

310 {
311  d->state = NoState;
312  d->continueExec();
313 }
QJSDebuggerAgentPrivate * d

◆ exceptionCatch()

void QJSDebuggerAgent::exceptionCatch ( qint64  scriptId,
const QScriptValue exception 
)
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 576 of file qjsdebuggeragent.cpp.

577 {
578  Q_UNUSED(scriptId);
579  Q_UNUSED(exception);
580 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ exceptionThrow()

void QJSDebuggerAgent::exceptionThrow ( qint64  scriptId,
const QScriptValue exception,
bool  hasHandler 
)
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 559 of file qjsdebuggeragent.cpp.

562 {
563  Q_UNUSED(scriptId);
564  Q_UNUSED(exception);
565  Q_UNUSED(hasHandler);
566 // qDebug() << Q_FUNC_INFO << exception.toString() << hasHandler;
567 #if 0 //sometimes, we get exceptions that we should just ignore.
568  if (!hasHandler && state != StoppedState)
569  stopped(true, exception);
570 #endif
571 }
void stopped(bool becauseOfException, const QString &exception)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ executeExpression()

JSAgentWatchData QJSDebuggerAgent::executeExpression ( const QString expr)

Definition at line 315 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

316 {
317  SetupExecEnv execEnv(d);
318 
319  JSAgentWatchData data = fromScriptValue(expr, engine()->evaluate(expr));
320  d->knownObjectIds << data.objectId;
321  return data;
322 }
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
static const char * data(const QByteArray &arr)
QJSDebuggerAgentPrivate * d
static JSAgentWatchData fromScriptValue(const QString &expression, const QScriptValue &value)

◆ expandObjectById()

QList< JSAgentWatchData > QJSDebuggerAgent::expandObjectById ( quint64  objectId)

Definition at line 324 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

325 {
326  SetupExecEnv execEnv(d);
327 
328  QScriptValue v;
329  if (d->knownObjectIds.contains(objectId))
330  v = engine()->objectById(objectId);
331 
333  d->recordKnownObjects(result);
334  return result;
335 }
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
QScriptValue objectById(qint64 id) const
Returns the object with the given id, or an invalid QScriptValue if there is no object with that id...
void recordKnownObjects(const QList< JSAgentWatchData > &)
bool contains(const T &value) const
Definition: qset.h:91
static QList< JSAgentWatchData > expandObject(const QScriptValue &object)
QJSDebuggerAgentPrivate * d
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ extension()

QVariant QJSDebuggerAgent::extension ( Extension  extension,
const QVariant argument = QVariant() 
)
virtual

This virtual function can be reimplemented in a QScriptEngineAgent subclass to provide support for extensions.

The optional argument can be provided as input to the extension; the result must be returned in the form of a QVariant. You can call supportsExtension() to check if an extension is supported by the QScriptEngineAgent. By default, no extensions are supported, and this function returns an invalid QVariant.

If you implement the DebuggerInvocationRequest extension, Qt Script will call this function when a debugger statement is encountered in a script. The argument is a QVariantList containing three items: The first item is the scriptId (a qint64), the second item is the line number (an int), and the third item is the column number (an int).

See also
supportsExtension()

Reimplemented from QScriptEngineAgent.

Definition at line 587 of file qjsdebuggeragent.cpp.

588 {
590  d->stopped();
591  return QVariant();
592  }
593  return QScriptEngineAgent::extension(extension, argument);
594 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QVariant extension(Extension extension, const QVariant &argument=QVariant())
This virtual function can be reimplemented in a QScriptEngineAgent subclass to provide support for ex...
virtual QVariant extension(Extension extension, const QVariant &argument=QVariant())
This virtual function can be reimplemented in a QScriptEngineAgent subclass to provide support for ex...
QJSDebuggerAgentPrivate * d

◆ functionEntry()

void QJSDebuggerAgent::functionEntry ( qint64  scriptId)
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 465 of file qjsdebuggeragent.cpp.

466 {
467  d->stepDepth++;
468 
469  if (d->coverageEnabled) {
471  scriptId, QString(), QString(), 0, 0, 0, QString()};
474  }
475 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
void processMessage(const JSAgentCoverageData &message)
qint64 restart()
Restarts the timer and returns the time elapsed since the previous start.
QElapsedTimer m_timer
QJSDebuggerAgentPrivate * d
static QJSDebugService * instance()

◆ functionExit()

void QJSDebuggerAgent::functionExit ( qint64  scriptId,
const QScriptValue returnValue 
)
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 480 of file qjsdebuggeragent.cpp.

481 {
482  d->stepDepth--;
483 
484  if (d->coverageEnabled) {
486  scriptId, QString(), QString(), 0, 0, 0, returnValue.toString()};
488  }
489 }
QString toString() const
Returns the string value of this QScriptValue, as defined in ECMA-262 section 9.8, "ToString".
The QString class provides a Unicode character string.
Definition: qstring.h:83
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
void processMessage(const JSAgentCoverageData &message)
QElapsedTimer m_timer
QJSDebuggerAgentPrivate * d
static QJSDebugService * instance()

◆ isInitialized()

bool QJSDebuggerAgent::isInitialized ( ) const

Indicates whether the agent got the list of breakpoints.

Definition at line 261 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::addEngine().

262 {
263  return d->isInitialized;
264 }
QJSDebuggerAgentPrivate * d

◆ locals()

QList< JSAgentWatchData > QJSDebuggerAgent::locals ( )

Definition at line 337 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::executionStopped().

338 {
339  SetupExecEnv execEnv(d);
340  return d->getLocals(engine()->currentContext());
341 }
QList< JSAgentWatchData > getLocals(QScriptContext *)
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
QJSDebuggerAgentPrivate * d

◆ localsAtFrame()

QList< JSAgentWatchData > QJSDebuggerAgent::localsAtFrame ( int  frameId)

Definition at line 343 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

344 {
345  SetupExecEnv execEnv(d);
346 
347  int deep = 0;
349  while (ctx && deep < frameId) {
350  ctx = ctx->parentContext();
351  deep++;
352  }
353 
354  return d->getLocals(ctx);
355 }
The QScriptContext class represents a Qt Script function invocation.
QList< JSAgentWatchData > getLocals(QScriptContext *)
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
QJSDebuggerAgentPrivate * d
#define ctx
Definition: qgl.cpp:6094
QScriptContext * currentContext() const
Returns the current context.
QScriptContext * parentContext() const
Returns the parent context of this QScriptContext.

◆ positionChange()

void QJSDebuggerAgent::positionChange ( qint64  scriptId,
int  lineNumber,
int  columnNumber 
)
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 494 of file qjsdebuggeragent.cpp.

495 {
496  d->positionChange(scriptId, lineNumber, columnNumber);
497 
498  if (d->coverageEnabled) {
500  scriptId, QString(), QString(), 0, lineNumber, columnNumber, QString()};
502  }
503 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
void positionChange(qint64 scriptId, int lineNumber, int columnNumber)
void processMessage(const JSAgentCoverageData &message)
QElapsedTimer m_timer
QJSDebuggerAgentPrivate * d
static QJSDebugService * instance()

◆ scriptLoad()

void QJSDebuggerAgent::scriptLoad ( qint64  id,
const QString program,
const QString fileName,
int  baseLineNumber 
)
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 427 of file qjsdebuggeragent.cpp.

429 {
430  d->filenames.insert(id, fileName);
431 
432  if (d->coverageEnabled) {
434  id, program, fileName, baseLineNumber,
435  0, 0, QString()};
437  }
438 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
void processMessage(const JSAgentCoverageData &message)
QHash< qint64, QString > filenames
QElapsedTimer m_timer
QJSDebuggerAgentPrivate * d
static QJSDebugService * instance()

◆ scriptUnload()

void QJSDebuggerAgent::scriptUnload ( qint64  id)
virtual

Reimplemented Function

Reimplemented from QScriptEngineAgent.

Definition at line 443 of file qjsdebuggeragent.cpp.

444 {
445  d->filenames.remove(id);
446 }
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
QHash< qint64, QString > filenames
QJSDebuggerAgentPrivate * d

◆ setBreakpoints()

void QJSDebuggerAgent::setBreakpoints ( const JSAgentBreakpoints breakpoints)

Definition at line 272 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

273 {
274  d->breakpoints = breakpoints;
275 
277  foreach (const JSAgentBreakpointData &bp, breakpoints)
279 
280  d->isInitialized = true;
281 }
void clear()
Removes all items from the hash.
Definition: qhash.h:574
QHash< QString, JSAgentBreakpointData > fileNameToBreakpoints
JSAgentBreakpoints breakpoints
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
QJSDebuggerAgentPrivate * d
iterator insertMulti(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:772
static QString fileName(const QString &fileUrl)

◆ setCoverageEnabled()

void QJSDebuggerAgent::setCoverageEnabled ( bool  enabled)

Definition at line 266 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

267 {
268  d->isInitialized = true;
270 }
QJSDebuggerAgentPrivate * d
#define enabled

◆ setProperty()

void QJSDebuggerAgent::setProperty ( qint64  objectId,
const QString property,
const QString value 
)

Definition at line 409 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

412 {
413  SetupExecEnv execEnv(d);
414 
415  if (d->knownObjectIds.contains(objectId)) {
416  QScriptValue object = engine()->objectById(objectId);
417  if (object.isObject()) {
418  QScriptValue result = engine()->evaluate(value);
419  object.setProperty(property, result);
420  }
421  }
422 }
QScriptValue evaluate(const QString &program, const QString &fileName=QString(), int lineNumber=1)
Evaluates program, using lineNumber as the base line number, and returns the result of the evaluation...
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
QScriptValue objectById(qint64 id) const
Returns the object with the given id, or an invalid QScriptValue if there is no object with that id...
bool contains(const T &value) const
Definition: qset.h:91
QJSDebuggerAgentPrivate * d
void setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags=KeepExistingFlags)
Sets the value of this QScriptValue&#39;s property with the given name to the given value.
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57

◆ setWatchExpressions()

void QJSDebuggerAgent::setWatchExpressions ( const QStringList watchExpressions)

Definition at line 283 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

284 {
285  d->watchExpressions = watchExpressions;
286 }
QJSDebuggerAgentPrivate * d

◆ stepInto()

void QJSDebuggerAgent::stepInto ( )

Definition at line 295 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

◆ stepOut()

void QJSDebuggerAgent::stepOut ( )

Definition at line 302 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

◆ stepOver()

void QJSDebuggerAgent::stepOver ( )

Definition at line 288 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::messageReceived().

◆ stopped

void QJSDebuggerAgent::stopped ( bool  becauseOfException,
const QString exception 
)
signal

◆ supportsExtension()

bool QJSDebuggerAgent::supportsExtension ( Extension  extension) const
virtual

Returns true if the QScriptEngineAgent supports the given extension; otherwise, false is returned.

By default, no extensions are supported.

See also
extension()

Reimplemented from QScriptEngineAgent.

Definition at line 582 of file qjsdebuggeragent.cpp.

583 {
585 }
QVariant extension(Extension extension, const QVariant &argument=QVariant())
This virtual function can be reimplemented in a QScriptEngineAgent subclass to provide support for ex...

◆ watches()

QList< JSAgentWatchData > QJSDebuggerAgent::watches ( )

Definition at line 398 of file qjsdebuggeragent.cpp.

Referenced by QJSDebugService::executionStopped().

399 {
400  SetupExecEnv execEnv(d);
401 
403  foreach (const QString &expr, d->watchExpressions)
404  watches << fromScriptValue(expr, engine()->evaluate(expr));
405  d->recordKnownObjects(watches);
406  return watches;
407 }
QScriptEngine * engine() const
Returns the QScriptEngine that this agent is associated with.
QList< JSAgentWatchData > watches()
The QString class provides a Unicode character string.
Definition: qstring.h:83
void recordKnownObjects(const QList< JSAgentWatchData > &)
QJSDebuggerAgentPrivate * d
static JSAgentWatchData fromScriptValue(const QString &expression, const QScriptValue &value)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

Friends and Related Functions

◆ QJSDebuggerAgentPrivate

Definition at line 221 of file qjsdebuggeragent_p.h.

Properties

◆ d

QJSDebuggerAgentPrivate* QJSDebuggerAgent::d
private

The documentation for this class was generated from the following files: