# _CP_debug

_CP_debug is equivalent to the debug BASIC statement.

## Syntax

```
int _CP_debug(int expression)
```

## Description

The C function differs slightly,
however. The expression passed to _CP_debug displays
as a pseudo line number within the BASIC/FlashBASIC debugger. Variables
within the C program are not known to the BASIC/FlashBASIC debugger.
For access to these, the user should use a system debugger such as
dbx or sdb. The _CP_debug statement is useful however,
as it can be used to set breakpoints in FlashBASIC subroutines that
will be called later.

This function returns -1 if an error occurs.
The error code is contained in _CP_errno.

## Example(s)

When run, the user can enter
breakpoints for the not-yet-executed subroutine `mysub`. For example, to stop when `mysub` reaches line number
3, the user should type `mysub:b$=3` followed by `g` at the debugger prompts. The BASIC/FlashBASIC debugger
then breaks within `mysub` at line number 3.

```
/* Enters the BASIC/FlashBASIC debugger and then calls routine "mysub". */

CPSTR * s = _CP_mkstr("mysub");
int i = -1;

_CP_debug(1);
_CP_call(&i,s,0);
```

## See also

- [C functions overview](https://d3codex.com/cfunctions/c-functions-overview/)

---
Source: https://d3codex.com/cfunctions/cp-debug/ - part of the D3Codex reference.
