summaryrefslogtreecommitdiff
path: root/testsuites/libtests/dl05/dl05-o5.cc
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/libtests/dl05/dl05-o5.cc')
-rw-r--r--testsuites/libtests/dl05/dl05-o5.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuites/libtests/dl05/dl05-o5.cc b/testsuites/libtests/dl05/dl05-o5.cc
new file mode 100644
index 0000000000..b70790ea7b
--- /dev/null
+++ b/testsuites/libtests/dl05/dl05-o5.cc
@@ -0,0 +1,33 @@
+#include "dl-load.h" /* make the symbol a C linkage */
+
+#include <stdexcept>
+
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+void exception_dl(bool throw_runtime)
+{
+ printf("exception_dl: begin\n");
+ try
+ {
+ printf("exception_dl: throwing...\n");
+ if (throw_runtime)
+ throw std::runtime_error("throw std::runtime_error object");
+ else
+ throw dl_test_throw_me("throw dl_test_throw_me object");
+ }
+ catch (dl_test_throw_me const& e)
+ {
+ printf("%s: caught: %s\n", __func__, e.what());
+ }
+ catch (std::exception const& e)
+ {
+ printf("%s: caught: %s\n", __func__, e.what());
+ }
+ catch (...)
+ {
+ printf("%s: caught: unknown\n", __func__);
+ }
+ printf("exception_dl: end\n");
+}