KJS::Debugger Class Reference

List of all members.

Detailed Description

Definition at line 52 of file debugger.h.


Public Member Functions

 Debugger ()
virtual ~Debugger ()
DebuggerImpimp () const
void attach (Interpreter *interp)
void detach (Interpreter *interp)
virtual bool sourceParsed (ExecState *exec, int sourceId, const UString &source, int errorLine)
virtual bool sourceUnused (ExecState *exec, int sourceId)
virtual bool exception (ExecState *exec, const Value &value, bool inTryCatch)
virtual bool atStatement (ExecState *exec)
virtual bool enterContext (ExecState *exec)
virtual bool exitContext (ExecState *exec, const Completion &completion)

Constructor & Destructor Documentation

Debugger::Debugger (  ) 

Creates a new debugger.

Definition at line 46 of file debugger.cpp.

Debugger::~Debugger (  )  [virtual]

Destroys the debugger.

If the debugger is attached to any interpreters, it is automatically detached.

Definition at line 51 of file debugger.cpp.


Member Function Documentation

void Debugger::attach ( Interpreter interp  ) 

Attaches the debugger to specified interpreter.

This will cause this object to receive notification of events from the interpreter.

If the interpreter is deleted, the debugger will automatically be detached.

Note: only one debugger can be attached to an interpreter at a time. Attaching another debugger to the same interpreter will cause the original debugger to be detached from that interpreter.

Parameters:
interp The interpreter to attach to
See also:
detach()

Definition at line 60 of file debugger.cpp.

void Debugger::detach ( Interpreter interp  ) 

Detach the debugger from an interpreter.

Parameters:
interp The interpreter to detach from. If 0, the debugger will be detached from all interpreters to which it is attached.
See also:
attach()

Definition at line 79 of file debugger.cpp.

bool Debugger::sourceParsed ( ExecState exec,
int  sourceId,
const UString source,
int  errorLine 
) [virtual]

Called to notify the debugger that some javascript source code has been parsed.

For calls to Interpreter::evaluate(), this will be called with the supplied source code before any other code is parsed. Other situations in which this may be called include creation of a function using the Function() constructor, or the eval() function.

The default implementation does nothing. Override this method if you want to process this event.

Parameters:
exec The current execution state
sourceId The ID of the source code (corresponds to the sourceId supplied in other functions such as atStatement()
source The source code that was parsed
errorLine The line number at which parsing encountered an error, or -1 if the source code was valid and parsed successfully
Returns:
true if execution should be continue, false if it should be aborted

Definition at line 105 of file debugger.cpp.

bool Debugger::sourceUnused ( ExecState exec,
int  sourceId 
) [virtual]

Called when all functions/programs associated with a particular sourceId have been deleted.

After this function has been called for a particular sourceId, that sourceId will not be used again.

The default implementation does nothing. Override this method if you want to process this event.

Parameters:
exec The current execution state
sourceId The ID of the source code (corresponds to the sourceId supplied in other functions such as atLine()
Returns:
true if execution should be continue, false if it should be aborted

Definition at line 111 of file debugger.cpp.

bool Debugger::exception ( ExecState exec,
const Value value,
bool  inTryCatch 
) [virtual]

Called when an exception is thrown during script execution.

The default implementation does nothing. Override this method if you want to process this event.

Parameters:
exec The current execution state
value The value of the exception
inTryCatch Whether or not the exception will be caught by the script
Returns:
true if execution should be continue, false if it should be aborted

Definition at line 116 of file debugger.cpp.

bool Debugger::atStatement ( ExecState exec  )  [virtual]

Called when a line of the script is reached (before it is executed).

The exec pointer's Context object can be inspected to determine the line number and sourceId of the statement.

The default implementation does nothing. Override this method if you want to process this event.

Parameters:
exec The current execution state
Returns:
true if execution should be continue, false if it should be aborted

Definition at line 122 of file debugger.cpp.

bool Debugger::enterContext ( ExecState exec  )  [virtual]

Called when the interpreter enters a new execution context (stack frame).

This can happen in three situations:

  • A call to Interpreter::evaluate(). This has a codeType of GlobalCode, and the sourceId is the id of the code passed to evaluate(). The lineno here is always 0 since execution starts at the beginning of the script.
  • A call to the builtin eval() function. The sourceId corresponds to the code passed in to eval. This has a codeType of EvalCode. The lineno here is always 0 since execution starts at the beginning of the script.
  • A function call. This only occurs for functions defined in ECMAScript code, whether via the normal function() { ... } syntax or a call to the built-in Function() constructor (anonymous functions). In the former case, the sourceId and lineno indicate the location at which the function was defined. For anonymous functions, the sourceId corresponds to the code passed into the Function() constructor.

enterContext() is not called for functions implemented in the native code, since these do not use an execution context.

Parameters:
exec The current execution state (corresponding to the new stack frame)

Definition at line 127 of file debugger.cpp.

bool Debugger::exitContext ( ExecState exec,
const Completion completion 
) [virtual]

Called when the inteprreter exits an execution context.

This always corresponds to a previous call to enterContext()

Parameters:
exec The current execution state (corresponding to the stack frame being exited from)
completion The result of execution of the context. Can be used to inspect exceptions and return values

Definition at line 132 of file debugger.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys