MPLAB allows you to use this macro:
to detect if a debug or release mode is selected. It is not built in into MPLAB X and will be automatically set when compiling for a debugger.
To forcibly enable it you can also just add this to a global header file when debugging:
#ifndef __DEBUG #define __DEBUG #endif