This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data abort while handling C++ exception

Hello, 

I am working on embedded RTOS for ARMv8M chipset. I have recently added C++ support for my OS. When I try to handle exceptions in my C++ application, my system is crashing with an imprecise Data abort exception. I am not able to pin point the exact instruction which caused the issue, but I think the issue is happening either in memcpy or verbose_terminate_handler API's.

Below is the abort call stack which I am getting. 

_ZTSSt12out_of_range
_ZNK3Foo9print_addEi                                                     /home/apps/examples/cxxtest/cxxtest_main.cxx:120
memcpy /home/os/include/string.h:321
d_growable_string_callback_adapter
_ZN9__gnu_cxx27__verbose_terminate_handlerEv
_ZTISt13runtime_error
_ZNSt13runtime_errorD2Ev                                               /home/external/libcxx/stdexcept.cxx:99
_ZTISt13runtime_error
_ZN10__cxxabiv111__terminateEPFvvE
_ZSt9terminatev
__cxa_throw
cxxtest_main                                                                       /home/apps/examples/cxxtest/cxxtest_main.cxx:502

I am using the LLVM C++ library and linking the libsupc++.a  from the toolchain. 

Toolchain version: arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]

I am using the same configuration for an ARMv7M based chipset and everything is working just fine. Exceptions are caught and proper error messages are printed. 

I found some information related to similar issues and I have tried the following:

1. I tried to build the gcc toolchain from source by disabling --disable-libstdcxx-verbose to avoid verbose exception prints

2. Build my code with -mno-unaligned-access and use memcpy implementation from my own code

But, the above methods have not worked out. Any help would be highly appreciated!!