[PATCH] samples/cdtest: Test execeptions during system init

Chris Johns chrisj at rtems.org
Thu Jul 14 00:31:26 UTC 2022


On 13/7/2022 6:42 pm, Sebastian Huber wrote:
> On 01/07/2022 12:02, Sebastian Huber wrote:
>> +static void early_exception()
>> +{
>> +    try
>> +    {
>> +      throw "early exception";
>> +    }
>> +    catch( const char *e )
>> +    {
>> +      rtems_test_assert(strcmp(e, "early exception") == 0);
>> +      throw "early exception 2";
>> +    }
>> +}
>> +
>> +static void test_exceptions_during_system_init()
>> +{
>> +    TEST_BEGIN();
>> +
>> +    try
>> +    {
>> +      early_exception();
>> +    }
>> +    catch( const char *e )
>> +    {
>> +      rtems_test_assert(strcmp(e, "early exception 2") == 0);
>> +    }
>> +}
>> +
>> +RTEMS_SYSINIT_ITEM(
>> +    test_exceptions_during_system_init,
>> +    RTEMS_SYSINIT_IDLE_THREADS,
>> +    RTEMS_SYSINIT_ORDER_LAST
>> +);
> 
> Actually, on targets which use the DWARF2 unwinder (for example sparc), this
> doesn't work since the exception frames are no yet registered. 

Is the result a terminate with an unknown type of exception of something else?
Kinsey is reporting an issue with aarch64 and cdtest on discord.

What mechanism is being used to initialise the unwinder support?

With libdl the unwind tables are registered as part of the loading.

> They are
> registered during global construction. This also means that C++ exceptions can
> only be used once the global construction completed on these targets.

Has this always been the case? It is part of the well documented RAII principle
so we need this to work.

Chris


More information about the devel mailing list