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-cpp.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-cpp.cpp')
-rw-r--r-- | testsuites/libtests/dl05/dl-cpp.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/testsuites/libtests/dl05/dl-cpp.cpp b/testsuites/libtests/dl05/dl-cpp.cpp index fcb9e0af06..0e2005713e 100644 --- a/testsuites/libtests/dl05/dl-cpp.cpp +++ b/testsuites/libtests/dl05/dl-cpp.cpp @@ -4,11 +4,27 @@ #include <cstdio> #include <stdexcept> #include "dl-load.h" -void exception_base(bool istrue) +void exception_base(bool throw_runtime) { - printf("exception_base called\n"); - if (istrue) + printf("%s: begin\n", __func__); + try { - throw std::runtime_error("dummy call to link in symbols"); + if (throw_runtime) + throw std::runtime_error("eb: throw std::runtime_error"); + else + throw dl_test_throw_me("eb: throw me"); } + catch (std::exception const& e) + { + printf("%s: caught: %s\n", __func__, e.what()); + } + catch (dl_test_throw_me const& e) + { + printf("%s: caught: %s\n", __func__, e.what()); + } + catch (...) + { + printf("%s: caught: unknown\n", __func__); + } + printf("%s: end\n", __func__); } |