/packages/libndsfpc/examples/debugging/exceptionTest/exceptionTest.pp

https://github.com/slibre/freepascal · Puppet · 24 lines · 17 code · 7 blank · 0 comment · 1 complexity · c3f25609653d793479363f415542d5f4 MD5 · raw file

  1. program exceptionTest;
  2. {$mode objfpc}
  3. uses
  4. ctypes, nds9;
  5. // The default exception handler displays the exception type - data abort or undefined instruction
  6. // you can relate the exception to your code using arm-eabi-addr2line -e <elf file> <address>
  7. // assuming you built with debug info this will display a source file and a line number
  8. // The address of the instruction is shown as pc, beside the address which faulted
  9. // the rest of the screen is a dump of the registers.
  10. begin
  11. // install the default exception handler
  12. defaultExceptionHandler();
  13. // generate an exception
  14. pu32(8192)^ := 100;
  15. while true do
  16. swiWaitForVBlank();
  17. end.