4.11
Last change
on this file since d2e31f7 was
d2e31f7,
checked in by Chris Johns <chrisj@…>, on 03/28/17 at 06:23:05
|
libdl: Back port C++ exception throw and catch from 4.12.
Closes #2956.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2016 Chris Johns <chrisj@rtems.org>. All rights reserved. |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | */ |
---|
8 | |
---|
9 | #ifdef HAVE_CONFIG_H |
---|
10 | #include "config.h" |
---|
11 | #endif |
---|
12 | |
---|
13 | #include "tmacros.h" |
---|
14 | |
---|
15 | #include <stdio.h> |
---|
16 | |
---|
17 | #include <dlfcn.h> |
---|
18 | |
---|
19 | #include <rtems/rtl/rtl-trace.h> |
---|
20 | |
---|
21 | #include "dl-load.h" |
---|
22 | |
---|
23 | int dl_load_test(void) |
---|
24 | { |
---|
25 | void* handle; |
---|
26 | const char* err; |
---|
27 | void (*func)(bool ); |
---|
28 | #if __i386__ |
---|
29 | /* |
---|
30 | * std::runtime_error destructor locks up in atomics. |
---|
31 | */ |
---|
32 | bool throw_runtime = false; |
---|
33 | #else |
---|
34 | bool throw_runtime = true; |
---|
35 | #endif |
---|
36 | |
---|
37 | rtems_rtl_trace_set_mask(RTEMS_RTL_TRACE_ALL); |
---|
38 | |
---|
39 | handle = dlopen("/dl-o5.o", RTLD_GLOBAL | RTLD_NOW); |
---|
40 | if (handle == NULL) |
---|
41 | { |
---|
42 | err = dlerror(); |
---|
43 | if (err != NULL) |
---|
44 | printf("dlopen: %s\n", err); |
---|
45 | } |
---|
46 | rtems_test_assert(handle != NULL); |
---|
47 | |
---|
48 | func = dlsym(handle, "exception_dl"); |
---|
49 | if (func == NULL) { |
---|
50 | err = dlerror (); |
---|
51 | if (err) |
---|
52 | printf ("dlsym: %s\n", err); |
---|
53 | } |
---|
54 | rtems_test_assert(func != NULL); |
---|
55 | |
---|
56 | exception_base(throw_runtime); |
---|
57 | |
---|
58 | func(throw_runtime); |
---|
59 | |
---|
60 | rtems_test_assert(dlclose(handle) == 0); |
---|
61 | |
---|
62 | return 0; |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.