Forum Discussion
Altera_Forum
Honored Contributor
15 years agoAbout exceptions: Is try, catch and thow supported?
I would like to use try-catch statements, but it does not seems to work for me. I work with Quartus II 11.0sp1 and nios II (the fpga includes a vic). When I debug what happens in my throw state...
Altera_Forum
Honored Contributor
14 years agoSuccess! FWIW, I resolved this issue and now the basic RTEMS C++ exceptions tests pass w/o issues. It turns out that there were no issues so far with the Altera extensions to gcc for nios2, but instead with the RTEMS specific configurations of the nios2 cross gcc. I needed only to add "builtin_define ("__USE_INIT_FINI__");" to "<gcc>/gcc/config/nios2/rtems.h" to make the C++ exception unwinding work correctly.
I should add that the combination of ddd with nios2-elf-gdb works very nicely for debugging rtems startup issues. Initially I was confused about what location in the source was failing because the optimized gcc startup code was integrating/optimizing away inline functions. With ddd I can see both the source window and the machine instruction window simultaneously and then its easy to see what is happening!