Forum: ARM programming with GCC/GNU tools Exception not caught

Author: Pierre-Andre V. (pierreandre_v)
Posted on:

Rate this post
0 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 

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:
      tout << TraceLevel::Information << "[Application::Main] throwing" << TraceEnd;
      throw runtime_error("Test");
    catch(runtime_error &e)
      tout << TraceLevel::Information << "[Application::Main] Correct exception: " << e.what() << TraceEnd;
    catch(const::exception &e)
      tout << TraceLevel::Information << "[Application::Main] Correct exception: " << e.what() << TraceEnd;
      tout << TraceLevel::Information << "[Application::Main] General catch" << TraceEnd;
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 
    .ARM.extab : 
    *(.ARM.extab* .gnu.linkonce.armextab.*) 
    } > ROM_MAP :appli_code
    .ARM :
      __exidx_start = .;
      __exidx_end = .;
    } > ROM_MAP :appli_code
    .gcc_except_table : 
      *(.gcc_except_table .gcc_except_table.*) 
    } > 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?


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.