Qt 4.8
|
The QScriptDebuggerBackend class is the base class of debugger back-ends. More...
#include <qscriptdebuggerbackend_p.h>
Public Functions | |
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... | |
QScriptDebuggerCommandExecutor * | commandExecutor () const |
QScriptContext * | context (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< qint64 > | contextIds () 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... | |
QScriptEngine * | engine () 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 |
virtual void | resume ()=0 |
This function is called when control should be returned back to the back-end, i. More... | |
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... | |
QScriptObjectSnapshot * | scriptObjectSnapshot (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... | |
QScriptValueIterator * | scriptValueIterator (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 | |
virtual void | event (const QScriptDebuggerEvent &event)=0 |
This function is called when the back-end has generated the given event. More... | |
QScriptDebuggerBackend (QScriptDebuggerBackendPrivate &dd) | |
Protected Variables | |
QScopedPointer< QScriptDebuggerBackendPrivate > | d_ptr |
The QScriptDebuggerBackend class is the base class of debugger back-ends.
QScriptDebuggerBackend builds on the QScriptDebuggerAgent class.
This class is usually used together with the QScriptDebuggerFrontend class, in order to form a (front-end, back-end) pair.
Call attachTo() to attach to a QScriptEngine object. Call detach() to detach from the current engine.
Call stepInto() to step into the next script statement; call stepOver() to step over the next script statement; and call stepOut() to step out of the currently executing script function. An event() will be generated when the stepping is completed.
Call runToLocation() to execute script statements until a certain location has been reached. An event() will be generated when the location has been reached.
Call interruptEvaluation() to request that evaluation should be interrupted. An event() will be generated upon the next script statement that is reached.
Call continueEvalution() to allow script evaluation to continue.
Call setBreakpoint() to set a breakpoint. A breakpoint event() will be generated when a breakpoint is hit. Call deleteBreakpoint() to delete a breakpoint. Call modifyBreakpoint() to change the state of an existing breakpoint.
Call contextCount() to obtain the number of active contexts (frames). Call context() to obtain a pointer to a QScriptContext.
When subclassing QScriptDebuggerBackend, you must implement the pure virtual event() function. This function typically forwards the event to a QScriptDebuggerFrontend object. For most type of events, event() should block until the back-end is instructed to resume execution (e.g. until continueEvalution() is called). You must implement resume(), which is responsible for making event() return.
Definition at line 78 of file qscriptdebuggerbackend_p.h.
QScriptDebuggerBackend::QScriptDebuggerBackend | ( | ) |
Creates a QScriptDebuggerBackend object.
Definition at line 378 of file qscriptdebuggerbackend.cpp.
|
virtual |
Destroys this QScriptDebuggerBackend.
Definition at line 387 of file qscriptdebuggerbackend.cpp.
|
protected |
Definition at line 395 of file qscriptdebuggerbackend.cpp.
QScriptValue QScriptDebuggerBackend::assertFunction | ( | ) | const |
Definition at line 928 of file qscriptdebuggerbackend.cpp.
void QScriptDebuggerBackend::attachTo | ( | QScriptEngine * | engine | ) |
Attaches this backend to the given engine.
The backend automatically detaches from the old engine, if any.
This function installs its own agent on the engine using QScriptEngine::setAgent(); any existing agent will be replaced.
Definition at line 410 of file qscriptdebuggerbackend.cpp.
QStringList QScriptDebuggerBackend::backtrace | ( | ) | const |
Returns a backtrace of the current execution.
Definition at line 834 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptBreakpointData QScriptDebuggerBackend::breakpointData | ( | int | id | ) | const |
Returns the data associated with the breakpoint identified by the given id.
Definition at line 708 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptBreakpointMap QScriptDebuggerBackend::breakpoints | ( | ) | const |
Returns this backend's breakpoints.
Definition at line 733 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptDebuggerCommandExecutor * QScriptDebuggerBackend::commandExecutor | ( | ) | const |
Definition at line 952 of file qscriptdebuggerbackend.cpp.
QScriptContext * QScriptDebuggerBackend::context | ( | int | index | ) | const |
Returns the context for the frame with the given index.
Definition at line 817 of file qscriptdebuggerbackend.cpp.
Referenced by doPendingEvaluate(), and QScriptDebuggerCommandExecutor::execute().
int QScriptDebuggerBackend::contextCount | ( | ) | const |
Returns the number of contexts (frames).
Definition at line 807 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
Definition at line 841 of file qscriptdebuggerbackend.cpp.
Referenced by contextCount(), and QScriptDebuggerCommandExecutor::execute().
QScriptContextsDelta QScriptDebuggerBackend::contextsCheckpoint | ( | ) |
Definition at line 849 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::continueEvalution | ( | ) |
Continues script evaluation.
Evaluation will proceed without interruption until either 1) an uncaught exception occurs, 2) a breakpoint is triggered, or 3) interruptEvaluation() is called. In each case, a proper event() will be generated.
Definition at line 527 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::deleteAllBreakpoints | ( | ) |
Deletes all breakpoints.
Definition at line 697 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
bool QScriptDebuggerBackend::deleteBreakpoint | ( | int | id | ) |
Deletes the breakpoint identified by the given id.
Returns true if the breakpoint was deleted (i.e. the id was valid), otherwise returns false.
Definition at line 686 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::deleteScriptObjectSnapshot | ( | int | id | ) |
Definition at line 872 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::deleteScriptValueIterator | ( | int | id | ) |
Definition at line 894 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::detach | ( | ) |
Detaches this backend from the current script engine.
The backend's state (including breakpoints and information on loaded scripts) will be invalidated.
Definition at line 435 of file qscriptdebuggerbackend.cpp.
Referenced by attachTo(), and ~QScriptDebuggerBackend().
void QScriptDebuggerBackend::doPendingEvaluate | ( | bool | postEvent | ) |
Executes the pending evaluate, if any.
Definition at line 605 of file qscriptdebuggerbackend.cpp.
Referenced by evaluate(), and QScriptEngineDebuggerBackend::event().
QScriptEngine * QScriptDebuggerBackend::engine | ( | ) | const |
Returns the script engine that this backend is attached to, or 0 if the backend is not attached to an engine.
Definition at line 474 of file qscriptdebuggerbackend.cpp.
Referenced by assertFunction(), backtrace(), context(), contextCount(), doPendingEvaluate(), evaluate(), QScriptDebuggerCommandExecutor::execute(), fileNameFunction(), lineNumberFunction(), and traceFunction().
void QScriptDebuggerBackend::evaluate | ( | int | contextIndex, |
const QString & | program, | ||
const QString & | fileName, | ||
int | lineNumber | ||
) |
Evaluates the given program.
When evaluation is complete, an event() is generated.
Definition at line 588 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
|
protectedpure virtual |
This function is called when the back-end has generated the given event.
Subclasses must reimplement this function to handle the event. Typically the event is forwarded to a QScriptDebuggerFrontend, which will in turn forward it to its QScriptDebuggerClient. The client may then query the front-end for information about the execution state, and call e.g. continueEvalution() to resume execution. This function should block until resume() is called.
Implemented in QScriptEngineDebuggerBackend.
Referenced by doPendingEvaluate().
QScriptValue QScriptDebuggerBackend::fileNameFunction | ( | ) | const |
Definition at line 936 of file qscriptdebuggerbackend.cpp.
Referenced by attachTo().
bool QScriptDebuggerBackend::ignoreExceptions | ( | ) | const |
Definition at line 901 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::interruptEvaluation | ( | ) |
Interrupts script evaluation.
When the next script statement is reached, an event() will be generated.
Definition at line 540 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptValue QScriptDebuggerBackend::lineNumberFunction | ( | ) | const |
Definition at line 944 of file qscriptdebuggerbackend.cpp.
Referenced by attachTo().
int QScriptDebuggerBackend::newScriptObjectSnapshot | ( | ) |
Definition at line 857 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
int QScriptDebuggerBackend::newScriptValueIterator | ( | const QScriptValue & | object | ) |
Definition at line 879 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
Definition at line 796 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
|
pure virtual |
This function is called when control should be returned back to the back-end, i.
e. when script evaluation should be resumed after an event has been delivered.
Subclasses must reimplement this function to make event() return.
Implemented in QScriptEngineDebuggerBackend.
Referenced by continueEvalution(), evaluate(), QScriptDebuggerCommandExecutor::execute(), returnToCaller(), runToLocation(), stepInto(), stepOut(), and stepOver().
void QScriptDebuggerBackend::returnToCaller | ( | int | contextIndex, |
const QScriptValue & | value | ||
) |
Definition at line 575 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::runToLocation | ( | const QString & | fileName, |
int | lineNumber | ||
) |
Continues evaluation until the location defined by the given fileName and lineNumber is reached.
When the location is reached, an event() will be generated.
Definition at line 552 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::runToLocation | ( | qint64 | scriptId, |
int | lineNumber | ||
) |
Continues evaluation until the location defined by the given scriptId and lineNumber is reached.
When the location is reached, an event() will be generated.
Definition at line 566 of file qscriptdebuggerbackend.cpp.
QScriptScriptData QScriptDebuggerBackend::scriptData | ( | qint64 | id | ) | const |
Returns the data for the script identified by the given id.
Definition at line 759 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptObjectSnapshot * QScriptDebuggerBackend::scriptObjectSnapshot | ( | int | id | ) | const |
Definition at line 866 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptScriptMap QScriptDebuggerBackend::scripts | ( | ) | const |
Returns the scripts that this backend knows about.
Definition at line 746 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::scriptsCheckpoint | ( | ) |
Makes a checkpoint of the currently loaded scripts.
Definition at line 772 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptScriptsDelta QScriptDebuggerBackend::scriptsDelta | ( | ) | const |
Returns the difference between the latest scripts checkpoint and the previous checkpoint.
The first item in the pair is a list containing the identifiers of the scripts that were added. The second item in the pair is a list containing the identifiers of the scripts that were removed.
Definition at line 788 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptValueIterator * QScriptDebuggerBackend::scriptValueIterator | ( | int | id | ) | const |
Definition at line 888 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
int QScriptDebuggerBackend::setBreakpoint | ( | const QScriptBreakpointData & | data | ) |
Sets a breakpoint defined by the given data, and returns a unique identifier for the new breakpoint.
If the conditions of the breakpoint is satisfied at some point during script evaluation, a breakpoint event() will be generated.
Definition at line 669 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
bool QScriptDebuggerBackend::setBreakpointData | ( | int | id, |
const QScriptBreakpointData & | data | ||
) |
Sets the data associated with the breakpoint identified by the given id.
Definition at line 720 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::setCommandExecutor | ( | QScriptDebuggerCommandExecutor * | executor | ) |
Definition at line 962 of file qscriptdebuggerbackend.cpp.
void QScriptDebuggerBackend::setIgnoreExceptions | ( | bool | ignore | ) |
Definition at line 907 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::stepInto | ( | int | count = 1 | ) |
Steps into the next script statement.
When stepping is complete, an event() will be generated.
Definition at line 486 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::stepOut | ( | ) |
Steps out of the current script function.
When stepping is complete, an event() will be generated.
Definition at line 512 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
void QScriptDebuggerBackend::stepOver | ( | int | count = 1 | ) |
Steps over the next script statement.
When stepping is complete, an event() will be generated.
Definition at line 499 of file qscriptdebuggerbackend.cpp.
Referenced by QScriptDebuggerCommandExecutor::execute().
QScriptValue QScriptDebuggerBackend::traceFunction | ( | ) | const |
Returns a trace function.
The trace function has similar semantics to the built-in print() function; however, instead of writing text to standard output, it generates a trace event containing the text.
Definition at line 918 of file qscriptdebuggerbackend.cpp.
Referenced by attachTo().
|
protected |
Definition at line 147 of file qscriptdebuggerbackend_p.h.
Referenced by QScriptDebuggerBackend().