Results
Part 1. Error 1 (Illegal Address Exception - main.c - line 168 executed)
LED LD1 will light up, to indicate the occurrence of this exception:

In MPLAB X, open the Watches Window window and add the Status, Cause, and EPC CP0 registers to the view:
The Status register reads 0x05000002. Ignore the leading 0x05 for now and focus on the last nibble 0x2 (StatusEXL= 1). Per the PIC32 Datasheet, this indicates that we've encountered an error.
StatusEXL:
Exception Level: Set by the processor when any exception other than Reset, Soft Reset, NMI, or Cache Error exception is taken
The Cause register reads 0x00800014. Ignore the leading 0x0080 for now. The LSB value of 0x14 is tricky since it isn't properly aligned within the LSB to directly represent the EXCCODE value. We need to convert this number to the true value of the structure within CauseEXCCODE.
Right shift 0x14 twice, and we get the value 0x05. Looking at the exception cause table in the "PIC32MZ CPU Family Reference Manual", we see that this equates to ADDRESS ERROR EXCEPTION (STORE):
CauseEXCCODE<4:0>:
Exception Code Bits: Indicates what kind of exception happened. Used by the _general_exception_handler() to determine the cause of the exception and branch to the appropriate handler code.
Note: On PIC32MZ, Interrupt Exceptions all have their own dedicated entry point and therefore, their handlers do not need to need to consult CauseEXCCODE.
The EPC register reads 0x9D000630. This is the address of the instruction which the CPU will resume processing after returning from the exception. We can confirm this by displaying the disassembly listing file (in MPLAB X, select Window»Output»Disassembly Listing File):
This is an example of a precise exception, whereby the EPC value identifies the instruction that caused the exception.
Part 2. Error 2 (Trap Exception - main.c - line 169 executed)
LED LD2 will light up, to indicate the occurrence of this exception:
In MPLAB X, open the Watches Window window and add the Status, Cause and EPC CP0 register to the view:
The Status register reads 0x05000002. Ignore the leading 0x05 for now and focus on the last nibble 0x2 (StatusEXL= 1). Per the PIC32 Datasheet, this indicates that we've encountered an error.
The Cause register reads 0x00800034. Right shift the LSB 0x34 twice, and we get the value 0x0D. Looking at the exception cause table in the "PIC32MZ CPU Family Reference Manual", we see that this equates to a TRAP EXCEPTION.
The EPC register reads 0x9D000634. This is the address of the instruction which the CPU will resume processing after returning from exception. We can confirm this by displaying the disassembly listing file (in MPLAB X, select Window»Output»Disassembly Listing File):
This is an example of an imprecise exception, whereby the EPC value does not identify the instruction that caused the exception.
In this example, the divide operation is carried out by the Multiply-Divide Unit which runs in parallel to the main CPU. The EPC value points to the CPU instruction that was interrupted by the MDU exception.





