How do I setup the MPLAB® Real ICE™ In-Circuit Emulator to do a trace?
Step-by-step instructions for setting up the MPLAB® Real ICE™ In-Circuit Emulator to do a trace can be found on Developer Help's "Trace and Profiling Options" page.
For more information, you can read the "MPLAB® REAL ICE™ In-Circuit Emulator User’s Guide For MPLAB X IDE".