4.9.11 Debug Source Directive

The DEBUG_SOURCE action directive controls whether the object-code generated by the assembler should favors debugging assembly or C sources. The allowable actions are shown in Table 4-8.

Table 4-8. Debug Source Actions
Action Purpose
C Favor debugging C source.
asm Favor debugging assembly source.
pop Retrieves the state of the assembler debug source setting.
push Saves the state of the assembler debug source setting.

This directive controls the generation of information that might affect debugging, for example the debug information associated with labels, which can restrict the full expansion of assembly macros shown in the MPLAB X IDE Disassembly View. The directive only affects how the code is debugged; it does not affect the operation of assembled code.

If this directive is not specified, the asm setting is employed. Use this setting for projects built with the PIC Assembler or around assembly code using macros that is part of a C project. The c setting will automatically be used in assembly output from the MPLAB XC8 C compiler for assembly generated from, C code.

The DEBUG_SOURCE push and DEBUG_SOURCE pop directives allow the state of the debug source setting to be saved onto a stack of states and then restored at a later time. They are useful when you need to set a particular debug source state for a small section of code, but you do not know what state the debug source setting had previously been.

For example:
DEBUG_SOURCE push    ;store the state of the debug source setting
DEBUG_SOURCE asm     ;ensure proper debugging of the macro used below
    MY_UNLOCK_MACRO  ;this should expand in the Disassembly View 
DEBUG_SOURCE pop     ;restore state of the debug source setting