5.14.3 Debug Macros Generated
MPLAB X IDE generates debug macros for use with Microchip language tools. Macros passed to Microchip compilers and assemblers are shown in the table below. See MPLAB XC C compiler documentation for more information.
Macro Name | Assoc. Tool | Function |
---|---|---|
__DEBUG |
All | specifies that this is a debug build |
__MPLAB_<toolname>__ where
|
XC8 | specifies the hardware debug tool in use |
__MPLAB_DEBUGGER_<toolname> where
|
XC16, XC-DSC, XC32 | specifies the hardware debug tool in use |
__MPLAB_DEBUGGER_<skname> where
|
XC32 | specifies the starter kit in use |
You can use these macros in your own code. For example:
#ifdef __DEBUG
fprintf(stderr,"This is a debugging message\n");
#endif