JsDebugger Class
Receives the execution events of the scripts of an engine, to build a debugger, a code coverage tool or an execution inspector. Set it in JsEngineOptions.Debugger before the code is compiled.
public abstract class JsDebuggerRemarks
The code compiled by an engine that has a debugger (the scripts, the modules, eval and new Function) raises an event before each statement. The code of an engine without debugger has no instruction for it, so the debugging costs nothing when it is not used. A JsPreparedScript is compiled again when an engine that has a debugger runs it.
The events are raised on the thread of the engine, while the script waits: a debugger pauses the script by not returning (e.g. it waits for the user to resume). The callbacks can use the engine, for instance to read the properties of an object, call a function or evaluate code: the code they run raises no event. The time and the allocations of the callbacks do not count in JsEngineOptions.Timeout and JsEngineOptions.MemoryLimit; JsEngineOptions.CancellationToken still stops the script once the callback returns. An exception thrown by a callback is thrown at the statement: throw a JsTerminationException to stop the script.
The statements of a generator or an async function raise their events when the function runs: after a yield or an await, the events come from the code that resumes it (e.g. JsEngine.RunJobs), with the call depth of that code.
Constructors
| Name | Description |
|---|---|
| JsDebugger() |
JsDebugger()
protected JsDebugger()No documentation is available.
Methods
| Name | Description |
|---|---|
| OnDebuggerStatement(JsDebugEvent) | Called when a debugger statement runs. |
| OnStatement(JsDebugEvent) | Called before a statement runs. |
OnDebuggerStatement(JsDebugEvent)
JsDebugger.csCalled when a debugger statement runs.
protected internal virtual void OnDebuggerStatement(JsDebugEvent debugEvent)Parameters
debugEventJsDebugEvent- The statement. It is valid until the method returns.
OnStatement(JsDebugEvent)
JsDebugger.csCalled before a statement runs.
protected internal virtual void OnStatement(JsDebugEvent debugEvent)Parameters
debugEventJsDebugEvent- The statement. It is valid until the method returns.