]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/coregrind/l4re_helper.c
update
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / coregrind / l4re_helper.c
1 #include <valgrind.h>
2 #include <pub_tool_basics.h>
3 #include <pub_tool_basics_asm.h>
4 #include <pub_tool_libcbase.h>
5 #include <pub_tool_libcprint.h>
6
7 #include <l4re_helper.h>
8 #include <l4/re/env.h>
9
10 #include "pub_l4re.h"
11
12 void *client_env = 0;
13 unsigned int client_env_size = 0;
14
15 /*************************************
16  * Stuff needed for linking Valgrind *
17  * against C++-Libs                  *
18  * ***********************************/
19
20 __extension__ typedef int __guard __attribute__ ((mode(__DI__)));
21 int __cxa_guard_acquire(__guard * g);
22 int __cxa_guard_acquire(__guard * g)
23 {
24     return !*(char *) (g);
25 }
26
27 void __cxa_guard_release(__guard * g);
28 void __cxa_guard_release(__guard * g)
29 {
30     *(char *) g = 1;
31 }
32
33 void __cxa_pure_virtual(void);
34 void __cxa_pure_virtual(void)
35 {
36     VG_(unimplemented)("unimplemented function __cxa_pure_virtual()");
37     while (1);
38 }
39
40 void __gxx_personality_v0(void);
41 void __gxx_personality_v0(void)
42 {
43     VG_(unimplemented)("unimplemented function __gxx_personality_v0()");
44     while (1);
45 }
46
47 void __cxa_call_unexpected(void *ei);
48 void __cxa_call_unexpected(void *ei)
49 {
50     VG_(unimplemented)("unimplemented function __cxa_call_unexpected()");
51     while (1);
52 }
53
54 void _Unwind_Resume(void);
55 void _Unwind_Resume(void)
56 {
57     VG_(unimplemented)("unimplemented function _Unwind_Resume()");
58     while (1);
59 }
60
61
62 void _Unwind_DeleteException(void);
63 void _Unwind_DeleteException(void)
64 {
65     VG_(unimplemented)("unimplemented function _Unwind_DeleteException()");
66     while (1);
67 }
68
69 void _Unwind_RaiseException(void);
70 void _Unwind_RaiseException(void)
71 {
72     VG_(unimplemented)("unimplemented function _Unwind_RaiseException()");
73     while (1);
74 }
75
76
77 void _Unwind_Resume_or_Rethrow(void);
78 void _Unwind_Resume_or_Rethrow(void)
79 {
80     VG_(unimplemented)("unimplemented function _Unwind_Resume_or_Rethrow()");
81     while (1);
82 }
83
84
85 void __stack_chk_fail(void);
86 void __stack_chk_fail(void)
87 {
88     VG_(unimplemented)("unimplemented function __stack_chk_fail()");
89     while (1);
90 }
91
92 /*************************************
93  * Functions needed for linking some *
94  * L4Re-Libs with Valgrind           *
95  *************************************/
96
97 // for libc_backends/lib/file/mmap.cc
98 // for l4util/lib/src/micros2l4to.c
99 // for l4util/lib/src/sleep.c
100 int printf(const char *format, ...);
101 int printf(const char *format, ...)
102 {
103
104     int n;
105     va_list args;
106
107     va_start(args, format);
108     n = VG_(vprintf) (format, args);
109     va_end(args);
110
111     return n;
112 }
113
114 #include <pub_tool_mallocfree.h>
115 // for libc_backends/libc_be_file.h
116 void free(void *ptr);
117 void free(void *ptr)
118 {
119     VG_(free) (ptr);
120 }
121
122 #define size_t int
123 // for l4re/lib/src/log.cc
124 // for l4re/lib/src/namespace.cc
125 size_t strlen(const char *s);
126 size_t strlen(const char *s)
127 {
128     return VG_(strlen) (s);
129 }
130
131 #include <pub_tool_mallocfree.h>
132 // for libc_backends/libc_be_file.h
133 void *malloc(size_t size);
134 void *malloc(size_t size)
135 {
136     return VG_(malloc) ("l4re", size);
137 }
138
139 void *calloc(size_t nmemb, size_t size);
140 void *calloc(size_t nmemb, size_t size)
141 {
142     return VG_(calloc) ("l4re", nmemb, size);
143 }