Exception not caught

OP #3687537
Rate this post
• ▲ useful
▼ not useful
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?

Reply

A question of your own? This thread is over 12 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.