source: rtems/testsuites/libtests/dl05/dl-o5.cpp @ 62119d2

5
Last change on this file since 62119d2 was 62119d2, checked in by Sebastian Huber <sebastian.huber@…>, on 11/15/17 at 06:55:43

dl01, dl02, dl05: Fix unresolved printf symbol

The link time wrap of printf leads to unresolved symbols in the loadable
modules. This resulted in infinite loops and test timeouts. Use
rtems_printf() for output.

Update #3199.

  • Property mode set to 100644
File size: 760 bytes
Line 
1#include "dl-load.h" /* make the symbol a C linkage */
2
3#include <stdexcept>
4
5#include <rtems/test.h>
6
7#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
8
9void exception_dl(bool throw_runtime)
10{
11  printf("exception_dl: begin\n");
12  try
13  {
14    printf("exception_dl: throwing...\n");
15    if (throw_runtime)
16      throw std::runtime_error("throw std::runtime_error object");
17    else
18      throw dl_test_throw_me("throw dl_test_throw_me object");
19  }
20  catch (dl_test_throw_me const& e)
21  {
22    printf("%s: caught: %s\n", __func__, e.what());
23  }
24  catch (std::exception const& e)
25  {
26    printf("%s: caught: %s\n", __func__, e.what());
27  }
28  catch (...)
29  {
30    printf("%s: caught: unknown\n", __func__);
31  }
32  printf("exception_dl: end\n");
33}
Note: See TracBrowser for help on using the repository browser.