I'm new to MIPS programming, and I'm working on a program to become more familiar with exception handling.
When an exception occurs, I print out the address of where the exception occurred, followed by the exception occurred. After these messages print, the program hits a break statement:
break 100
And then terminates the program.
My question is, is there a way I can print out this instruction when it gets hit? What I want to print out would be something like:
*exception address* Cause: *exception type* break 100
Register $14 in coprocessor 0 holds the break code. Load that instruction into memory, then load that word. You need to shift past the first 6 bits to get the break code.
mfc0 $a0, $14
lw $a0, ($a0)
srl $a0, $a0, 6
li $v0, 1
syscall
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.