4.6.1.6 Debugger Option

The -mdebugger=type option is intended for use in compatibility with development tools that can act as a debugger. xc8-cc supports several debuggers and these are defined in the table below. Failing to select the appropriate debugger can lead to runtime failure.

Table 4-10. Selectable Debuggers
TypeDebugger selected
noneNo debugger (default)
icd2MPLAB® ICD 2
icd3MPLAB ICD 3
icd4MPLAB ICD 4
icd5MPLAB ICD 5
pickit2PICkit 2
pickit3PICkit 3
pickit4PICkit 4
pickit5PICkit 5
realiceMPLAB REAL ICE In-circuit Emulator
ice4MPLAB ICE 4 In-circuit Emulator
snapMPLAB Snap
For example:
xc8-cc -mcpu=16F877AA -mdebugger=icd5 main.c
will ensure that none of the source code is allocated resourced that would be used by the debug executive for an MPLAB ICD 5.

When a debugger is set using this option, a preprocessor macro is defined, allowing your source code to change based on the debugger selection, see Predefined Macros.

If the debugging features of the development tool are not to be used (for example, if the MPLAB ICD 5 is only being used as a programmer), then the debugger option can be set to none, because memory resources will not be used by the tool in that situation.