I'm struggling to get exception handling to work in Sierra Wireless
Developer Studio. It uses the gcc version 4.7.4 toolchain for ARM. It is
something specific to this environment - either the linker script or the
way my code is called from their OS. The chip in question is a Sierra
Wireless SL6087 which I believe contains an ARM 946.
Exceptions are not caught at all, but the termination handler is called.
I used std::set_terminate to install my own and in there, I can get the
exception that was thrown using __cxa_current_exception_type (from
cxxabi.h).
I've spend the last week reading several posts on the topic and most
point towards missing or incorrect sections in the linker script. I've
used arm-none-eabi-objdump.exe to compare the headers with one from
another environment (with the same toolchain) where exception handling
is working and I cannot see any major differences.
Here is my code:
1 | try
|
2 | {
|
3 | tout << TraceLevel::Information << "[Application::Main] throwing" << TraceEnd;
|
4 | throw runtime_error("Test");
|
5 | }
|
6 | catch(runtime_error &e)
|
7 | {
|
8 | tout << TraceLevel::Information << "[Application::Main] Correct exception: " << e.what() << TraceEnd;
|
9 | }
|
10 | catch(const::exception &e)
|
11 | {
|
12 | tout << TraceLevel::Information << "[Application::Main] Correct exception: " << e.what() << TraceEnd;
|
13 | }
|
14 | catch(...)
|
15 | {
|
16 | tout << TraceLevel::Information << "[Application::Main] General catch" << TraceEnd;
|
17 | }
|
The linker script is automatically generated by the tool, but I've made
several changes to try an resolve the problem. Here is one of my
attempts:
1 | .ARM.extab :
|
2 | {
|
3 | *(.ARM.extab* .gnu.linkonce.armextab.*)
|
4 | } > ROM_MAP :appli_code
|
5 |
|
6 | .ARM :
|
7 | {
|
8 | __exidx_start = .;
|
9 | *(.ARM.exidx*)
|
10 | __exidx_end = .;
|
11 | } > ROM_MAP :appli_code
|
12 |
|
13 | .gcc_except_table :
|
14 | {
|
15 | *(.gcc_except_table .gcc_except_table.*)
|
16 | } > ROM_MAP :appli_code
|
I've seen many references to eh_frame_hdr and eh_frame, but since the
object files don't seem to include them, having them in the linker
scripts has no effect.
Anything else I can try?