comparison runtime/internal/eh.d @ 557:aef77ae1d32c

Enable unwind code on darwin.
author Christian Kamm <kamm incasoftware de>
date Fri, 29 Aug 2008 14:16:18 +0200
parents d94655ccbe4d
children 6aaa3d3c1183
comparison
equal deleted inserted replaced
556:c23f4cfe4f2b 557:aef77ae1d32c
7 import util.console; 7 import util.console;
8 import llvmdc.cstdarg; 8 import llvmdc.cstdarg;
9 9
10 // debug = EH_personality; 10 // debug = EH_personality;
11 11
12 // current EH implementation works on x86 linux only 12 // current EH implementation works on x86
13 version(X86) version(linux) version=X86_LINUX; 13 // if it has a working unwind runtime
14 version(X86) {
15 version(linux) version=X86_UNWIND;
16 version(darwin) version=X86_UNWIND;
17 }
14 18
15 private extern(C) void abort(); 19 private extern(C) void abort();
16 private extern(C) int printf(char*, ...); 20 private extern(C) int printf(char*, ...);
17 private extern(C) int vprintf(char*, va_list va); 21 private extern(C) int vprintf(char*, va_list va);
18 22
55 _Unwind_Exception_Cleanup_Fn exception_cleanup; 59 _Unwind_Exception_Cleanup_Fn exception_cleanup;
56 int private_1; 60 int private_1;
57 int private_2; 61 int private_2;
58 } 62 }
59 63
60 version(X86_LINUX) 64 version(X86_UNWIND)
61 { 65 {
62 void _Unwind_Resume(_Unwind_Exception*); 66 void _Unwind_Resume(_Unwind_Exception*);
63 _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception*); 67 _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception*);
64 ulong _Unwind_GetLanguageSpecificData(_Unwind_Context_Ptr context); 68 ulong _Unwind_GetLanguageSpecificData(_Unwind_Context_Ptr context);
65 ulong _Unwind_GetIP(_Unwind_Context_Ptr context); 69 ulong _Unwind_GetIP(_Unwind_Context_Ptr context);
159 //TODO: This may be the wrong way around 163 //TODO: This may be the wrong way around
160 char[8] _d_exception_class = "LLDCD1\0\0"; 164 char[8] _d_exception_class = "LLDCD1\0\0";
161 165
162 166
163 // 167 //
164 // x86 Linux specific implementation of personality function 168 // x86 unwind specific implementation of personality function
165 // and helpers 169 // and helpers
166 // 170 //
167 version(X86_LINUX) 171 version(X86_UNWIND)
168 { 172 {
169 173
170 // the personality routine gets called by the unwind handler and is responsible for 174 // the personality routine gets called by the unwind handler and is responsible for
171 // reading the EH tables and deciding what to do 175 // reading the EH tables and deciding what to do
172 extern(C) _Unwind_Reason_Code _d_eh_personality(int ver, _Unwind_Action actions, ulong exception_class, _Unwind_Exception* exception_info, _Unwind_Context_Ptr context) 176 extern(C) _Unwind_Reason_Code _d_eh_personality(int ver, _Unwind_Action actions, ulong exception_class, _Unwind_Exception* exception_info, _Unwind_Context_Ptr context)