debug_interface.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .. _api_ref_debug_interface:
  2. ===============
  3. Debug interface
  4. ===============
  5. .. _sq_getfunctioninfo:
  6. .. c:function:: SQRESULT sq_getfunctioninfo(HSQUIRRELVM v, SQInteger level, SQFunctionInfo * fi)
  7. :param HSQUIRRELVM v: the target VM
  8. :param SQInteger level: calls stack level
  9. :param SQFunctionInfo * fi: pointer to the SQFunctionInfo structure that will store the closure informations
  10. :returns: a SQRESULT.
  11. :remarks: the member 'funcid' of the returned SQFunctionInfo structure is a unique identifier of the function; this can be useful to identify a specific piece of squirrel code in an application like for instance a profiler. this method will fail if the closure in the stack is a native C closure.
  12. *.eg*
  13. ::
  14. typedef struct tagSQFunctionInfo {
  15. SQUserPointer funcid; //unique idetifier for a function (all it's closures will share the same funcid)
  16. const SQChar *name; //function name
  17. const SQChar *source; //function source file name
  18. }SQFunctionInfo;
  19. .. _sq_setdebughook:
  20. .. c:function:: void sq_setdebughook(HSQUIRRELVM v)
  21. :param HSQUIRRELVM v: the target VM
  22. :remarks: In order to receive a 'per line' callback, is necessary to compile the scripts with the line informations. Without line informations activated, only the 'call/return' callbacks will be invoked.
  23. pops a closure from the stack an sets it as debug hook. When a debug hook is set it overrides any previously set native or non native hooks. if the hook is null the debug hook will be disabled.
  24. .. _sq_setnativedebughook:
  25. .. c:function:: void sq_setnativedebughook(HSQUIRRELVM v, SQDEBUGHOOK hook)
  26. :param HSQUIRRELVM v: the target VM
  27. :param SQDEBUGHOOK hook: the native hook function
  28. :remarks: In order to receive a 'per line' callback, is necessary to compile the scripts with the line informations. Without line informations activated, only the 'call/return' callbacks will be invoked.
  29. 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.
  30. .. _sq_stackinfos:
  31. .. c:function:: SQRESULT sq_stackinfos(HSQUIRRELVM v, SQInteger level, SQStackInfos * si)
  32. :param HSQUIRRELVM v: the target VM
  33. :param SQInteger level: calls stack level
  34. :param SQStackInfos * si: pointer to the SQStackInfos structure that will store the stack informations
  35. :returns: a SQRESULT.
  36. retrieve the calls stack informations of a ceratain level in the calls stack.