Quirrel4.41.0

Debug interface

The hooks a debugger, profiler or coverage tool attaches to.

sq_setdebughook installs a callback the VM calls as execution moves: on entering and leaving a call, and on each new source line when line hooks are enabled. This hook is enough to build a stepping debugger. sq_stackinfos fills in one frame of the call stack. A stack trace is assembled from these frames.

Line information costs something to emit, so a release build usually leaves it off.

SQRESULT sq_stackinfos(HSQUIRRELVM v, SQInteger level, SQStackInfos *si)

Retrieve the calls stack informations of a ceratain level in the calls stack.

void sq_setdebughook(HSQUIRRELVM v)

Pops a closure from the stack and sets it as the debug hook, replacing any hook already set, native or not. A null disables it.

void sq_setnativedebughook(HSQUIRRELVM v, SQDEBUGHOOK hook)

Sets the native debug hook. When a native hook is set it overrides any previously set native or non native hooks. if the hook is NULL the debug hook will be disabled.

SQGETTHREAD sq_set_thread_id_function(HSQUIRRELVM v, SQGETTHREAD func)

Tells the VM how to obtain the current OS thread id, which the thread access checks need.

SQSQCALLHOOK sq_set_sq_call_hook(HSQUIRRELVM v, SQSQCALLHOOK hook)

Sets a callback invoked around every script call, for profilers.

SQCOMPILELINEHOOK sq_set_compile_line_hook(HSQUIRRELVM v, SQCOMPILELINEHOOK hook)

Sets a callback the compiler calls per source line, for coverage tools.

void sq_forbidglobalconstrewrite(HSQUIRRELVM v, SQBool on)

Makes redefining an existing global constant an error.