Qt 4.8
Public Functions | Protected Functions | List of all members
QScriptEngineDebuggerBackend Class Reference
Inheritance diagram for QScriptEngineDebuggerBackend:
QScriptDebuggerBackend

Public Functions

void processCommand (int id, const QScriptDebuggerCommand &command)
 
 QScriptEngineDebuggerBackend (QScriptEngineDebuggerFrontendPrivate *frontend)
 Creates a new QScriptEngineDebuggerBackend object for the given engine. More...
 
void resume ()
 Reimplemented Function More...
 
 ~QScriptEngineDebuggerBackend ()
 
- Public Functions inherited from QScriptDebuggerBackend
QScriptValue assertFunction () const
 
void attachTo (QScriptEngine *engine)
 Attaches this backend to the given engine. More...
 
QStringList backtrace () const
 Returns a backtrace of the current execution. More...
 
QScriptBreakpointData breakpointData (int id) const
 Returns the data associated with the breakpoint identified by the given id. More...
 
QScriptBreakpointMap breakpoints () const
 Returns this backend's breakpoints. More...
 
QScriptDebuggerCommandExecutorcommandExecutor () const
 
QScriptContextcontext (int index) const
 Returns the context for the frame with the given index. More...
 
int contextCount () const
 Returns the number of contexts (frames). More...
 
QList< qint64contextIds () const
 
QScriptContextsDelta contextsCheckpoint ()
 
void continueEvalution ()
 Continues script evaluation. More...
 
void deleteAllBreakpoints ()
 Deletes all breakpoints. More...
 
bool deleteBreakpoint (int id)
 Deletes the breakpoint identified by the given id. More...
 
void deleteScriptObjectSnapshot (int id)
 
void deleteScriptValueIterator (int id)
 
void detach ()
 Detaches this backend from the current script engine. More...
 
void doPendingEvaluate (bool postEvent)
 Executes the pending evaluate, if any. More...
 
QScriptEngineengine () const
 Returns the script engine that this backend is attached to, or 0 if the backend is not attached to an engine. More...
 
void evaluate (int contextIndex, const QString &program, const QString &fileName, int lineNumber)
 Evaluates the given program. More...
 
QScriptValue fileNameFunction () const
 
bool ignoreExceptions () const
 
void interruptEvaluation ()
 Interrupts script evaluation. More...
 
QScriptValue lineNumberFunction () const
 
int newScriptObjectSnapshot ()
 
int newScriptValueIterator (const QScriptValue &object)
 
 QScriptDebuggerBackend ()
 Creates a QScriptDebuggerBackend object. More...
 
qint64 resolveScript (const QString &fileName) const
 
void returnToCaller (int contextIndex, const QScriptValue &value)
 
void runToLocation (const QString &fileName, int lineNumber)
 Continues evaluation until the location defined by the given fileName and lineNumber is reached. More...
 
void runToLocation (qint64 scriptId, int lineNumber)
 Continues evaluation until the location defined by the given scriptId and lineNumber is reached. More...
 
QScriptScriptData scriptData (qint64 id) const
 Returns the data for the script identified by the given id. More...
 
QScriptObjectSnapshotscriptObjectSnapshot (int id) const
 
QScriptScriptMap scripts () const
 Returns the scripts that this backend knows about. More...
 
void scriptsCheckpoint ()
 Makes a checkpoint of the currently loaded scripts. More...
 
QScriptScriptsDelta scriptsDelta () const
 Returns the difference between the latest scripts checkpoint and the previous checkpoint. More...
 
QScriptValueIteratorscriptValueIterator (int id) const
 
int setBreakpoint (const QScriptBreakpointData &data)
 Sets a breakpoint defined by the given data, and returns a unique identifier for the new breakpoint. More...
 
bool setBreakpointData (int id, const QScriptBreakpointData &data)
 Sets the data associated with the breakpoint identified by the given id. More...
 
void setCommandExecutor (QScriptDebuggerCommandExecutor *executor)
 
void setIgnoreExceptions (bool ignore)
 
void stepInto (int count=1)
 Steps into the next script statement. More...
 
void stepOut ()
 Steps out of the current script function. More...
 
void stepOver (int count=1)
 Steps over the next script statement. More...
 
QScriptValue traceFunction () const
 Returns a trace function. More...
 
virtual ~QScriptDebuggerBackend ()
 Destroys this QScriptDebuggerBackend. More...
 

Protected Functions

void event (const QScriptDebuggerEvent &event)
 Reimplemented Function More...
 
- Protected Functions inherited from QScriptDebuggerBackend
 QScriptDebuggerBackend (QScriptDebuggerBackendPrivate &dd)
 

Additional Inherited Members

- Protected Variables inherited from QScriptDebuggerBackend
QScopedPointer< QScriptDebuggerBackendPrivated_ptr
 

Detailed Description

Definition at line 104 of file qscriptenginedebuggerfrontend.cpp.

Constructors and Destructors

◆ QScriptEngineDebuggerBackend()

QScriptEngineDebuggerBackend::QScriptEngineDebuggerBackend ( QScriptEngineDebuggerFrontendPrivate frontend)

Creates a new QScriptEngineDebuggerBackend object for the given engine.

Warning
This function is not part of the public interface.

The back-end will forward events to the given frontend.

Definition at line 195 of file qscriptenginedebuggerfrontend.cpp.

198 {
200  d->frontend = frontend;
201 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
QScriptDebuggerBackend()
Creates a QScriptDebuggerBackend object.

◆ ~QScriptEngineDebuggerBackend()

QScriptEngineDebuggerBackend::~QScriptEngineDebuggerBackend ( )

Definition at line 203 of file qscriptenginedebuggerfrontend.cpp.

204 {
205 }

Functions

◆ event()

void QScriptEngineDebuggerBackend::event ( const QScriptDebuggerEvent event)
protectedvirtual

Reimplemented Function

Implements QScriptDebuggerBackend.

Definition at line 216 of file qscriptenginedebuggerfrontend.cpp.

217 {
219  if (d->eventLoopPool.isEmpty())
220  d->eventLoopPool.append(new QEventLoop());
221  QEventLoop *eventLoop = d->eventLoopPool.takeFirst();
222  Q_ASSERT(!eventLoop->isRunning());
223  d->eventLoopStack.prepend(eventLoop);
224 
225  d->frontend->postEvent(new QScriptDebuggerEventEvent(event));
226 
227  // Run an event loop until resume() is called.
228  // This effectively stalls script execution and makes it possible
229  // for the debugger to inspect the execution state in the meantime.
230  eventLoop->exec();
231 
232  if (!d->eventLoopStack.isEmpty()) {
233  // the event loop was quit directly (i.e. not via resume())
234  d->eventLoopStack.takeFirst();
235  }
236  d->eventLoopPool.append(eventLoop);
237  doPendingEvaluate(/*postEvent=*/false);
238 }
double d
Definition: qnumeric_p.h:62
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
The QEventLoop class provides a means of entering and leaving an event loop.
Definition: qeventloop.h:55
void doPendingEvaluate(bool postEvent)
Executes the pending evaluate, if any.
bool isRunning() const
Returns true if the event loop is running; otherwise returns false.
Definition: qeventloop.cpp:306
int exec(ProcessEventsFlags flags=AllEvents)
Enters the main event loop and waits until exit() is called.
Definition: qeventloop.cpp:181

◆ processCommand()

void QScriptEngineDebuggerBackend::processCommand ( int  id,
const QScriptDebuggerCommand command 
)

◆ resume()

void QScriptEngineDebuggerBackend::resume ( )
virtual

Reimplemented Function

Implements QScriptDebuggerBackend.

Definition at line 243 of file qscriptenginedebuggerfrontend.cpp.

244 {
246  // quitting the event loops will cause event() to return (see above)
247  while (!d->eventLoopStack.isEmpty()) {
248  QEventLoop *eventLoop = d->eventLoopStack.takeFirst();
249  if (eventLoop->isRunning())
250  eventLoop->quit();
251  }
252 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QEventLoop class provides a means of entering and leaving an event loop.
Definition: qeventloop.h:55
void quit()
Tells the event loop to exit normally.
Definition: qeventloop.cpp:332
bool isRunning() const
Returns true if the event loop is running; otherwise returns false.
Definition: qeventloop.cpp:306

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