To answer the second question first, to get frame pointers to work, you need to compile KOS with frame pointers enabled, as well as your program. Open up your environ script, and make the default KOS_CFLAGS something like this:
Code: Select all
export KOS_CFLAGS="-O2 -DFRAME_POINTERS -fno-omit-frame-pointer"
Then do a "make clean" and a "make" on KOS itself, then your own code too.
And now, to answer the second question, the easiest thing to do is to use sh-elf-addr2line on the elf file you're debugging. Check the PC, PR, and all of the frame pointer addresses that look sane and hopefully that'll help you out.
Also, looking up the event code in the SH4 programming manual can be helpful too. In your case, evt 00e0 corresponds to an address error on a read access. Usually, that means you've attempted to read something from an unaligned address (so, attempting to read a 32-bit value from an address that isn't divisible by 4 or a 16-bit value from an odd address). For reference, evt 0100 is the same thing, but for a write access. Those are probably the two most common exceptions you'll see.