summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-13 13:41:04 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-14 10:47:36 +0200
commit656765c74b39064298eb16fdaf5f8b9f8ebfc01b (patch)
treead0a11c78c5ed4438a531d3e73e35c24997bc3e4 /testsuites
parentspextensions01: Fix assertion (diff)
downloadrtems-656765c74b39064298eb16fdaf5f8b9f8ebfc01b.tar.bz2
cdtest: Restrict exceptions during sysinit
Exceptions during system initialization work only on targets which do not need a registration of exception frames during the global construction. In particular, targets which use the DWARF2 unwinder cannot use exceptions during system initialization.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/samples/cdtest/main.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/testsuites/samples/cdtest/main.cc b/testsuites/samples/cdtest/main.cc
index 44cdaf84bb..1c5057a32b 100644
--- a/testsuites/samples/cdtest/main.cc
+++ b/testsuites/samples/cdtest/main.cc
@@ -238,6 +238,17 @@ rtems_task main_task(
exit(0);
}
+/*
+ * Exceptions during system initialization work only on targets which do not
+ * need a registration of exception frames during the global construction. In
+ * particular, targets which use the DWARF2 unwinder cannot use exceptions
+ * during system initialization.
+ */
+#if defined(__arm__)
+#define CAN_DO_EXCEPTIONS_DURING_SYSINIT
+#endif
+
+#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT
static void early_exception()
{
try
@@ -250,11 +261,13 @@ static void early_exception()
throw "early exception 2";
}
}
+#endif
static void test_exceptions_during_system_init()
{
TEST_BEGIN();
+#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT
try
{
early_exception();
@@ -263,6 +276,7 @@ static void test_exceptions_during_system_init()
{
rtems_test_assert(strcmp(e, "early exception 2") == 0);
}
+#endif
}
RTEMS_SYSINIT_ITEM(