Files
rtems/testsuites/libtests/dl05/dl-cpp.cpp
Chris Johns c6eead1353 libdl: Add C++ exception support to loaded modules.
This has been tested on SPARC, i386, PowerPC and ARM.

Closes #2767.
2016-12-14 09:07:16 +11:00

31 lines
649 B
C++

/*
* The base image needs this to include the RTTI data.
*/
#include <cstdio>
#include <stdexcept>
#include "dl-load.h"
void exception_base(bool throw_runtime)
{
printf("%s: begin\n", __func__);
try
{
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__);
}