summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/dl05/dl-cpp.cc
blob: 0e2005713ee34f4a021297e5ff18d3d2e70d5b98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * 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__);
}