ctest() — Start debug tool

Standards

Standards / Extensions C or C++ Dependencies
Language Environment both  

Format

#include <ctest.h>

int ctest(char *command);

General description

Invokes the Debug Tool from your application program. The parameter command is a character pointer to a list of valid Debug Tool commands, that ctest() uses to invoke Debug Tool.

If you choose not to compile your program with hooks, you can use well-placed ctest() function calls instead. (A hook is a conditional exit that transfers control to the debugger, when the code is run under the debugger.) You would create a hook when you compile with the TEST option, causing the exit to be in your generated code waiting to run. A hook has minimal effect on a program that is running without the debugger.

To avoid infringing on the user's name space, this nonstandard function has two names. One name is prefixed with two underscore characters, and one name is not. The name without the prefix underscore characters is exposed only when you use LANGLVL(EXTENDED).

To use this function, you must either invoke the function using its external entry point name (that is, the name that begins with two underscore characters), or compile with LANGLVL(EXTENDED). When you use LANGLVL(EXTENDED) any relevant information in the header is also exposed.

Returned value

If successful, ctest() returns 0.

If unsuccessful, ctest() returns nonzero.

Examples

To let the debug tool gain control of your program, issue the command: ctest(NULL).

To display the call chain from within a program and then let the program continue execution, issue the function call: ctest("list calls; go;"). To set a breakpoint from within a ctest() call, try:
   char *cmd = "at line 17 list my_struct; go;";
   ctest(cmd);

Related information