[PATCH] samples/cdtest: Test execeptions during system init
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Jul 13 08:42:46 UTC 2022
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. They
are registered during global construction. This also means that C++
exceptions can only be used once the global construction completed on
these targets.
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
More information about the devel
mailing list