diff options
author | Chris Johns <chrisj@rtems.org> | 2016-12-07 17:20:38 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2016-12-14 09:07:16 +1100 |
commit | c6eead1353e03542e5bad9efda3b6553125520d8 (patch) | |
tree | f2495a17c8d001a8249b0e6f785c3428df721a1d /testsuites/libtests/dl05/dl-o5.cpp | |
parent | score: Prevent thread_dispatch_disable_level < 0. (diff) | |
download | rtems-c6eead1353e03542e5bad9efda3b6553125520d8.tar.bz2 |
libdl: Add C++ exception support to loaded modules.
This has been tested on SPARC, i386, PowerPC and ARM.
Closes #2767.
Diffstat (limited to 'testsuites/libtests/dl05/dl-o5.cpp')
-rw-r--r-- | testsuites/libtests/dl05/dl-o5.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/testsuites/libtests/dl05/dl-o5.cpp b/testsuites/libtests/dl05/dl-o5.cpp index 6e8476d5e2..5918e8f2d5 100644 --- a/testsuites/libtests/dl05/dl-o5.cpp +++ b/testsuites/libtests/dl05/dl-o5.cpp @@ -1,12 +1,20 @@ #include <cstdio> #include <stdexcept> #include "dl-load.h" /* make the symbol a C linkage */ -void exception_dl(void) +void exception_dl(bool throw_runtime) { + printf("exception_dl: begin\n"); try { - printf("exception_dl: throwing\n"); - throw std::runtime_error("exception_dl throw"); + 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) { @@ -16,4 +24,5 @@ void exception_dl(void) { printf("%s: caught: unknown\n", __func__); } + printf("exception_dl: end\n"); } |