aboutsummaryrefslogtreecommitdiffstats
path: root/main/uclibc++/900-dependent_exception.patch
blob: 3a5cb7dbca40af2f248e3bcfeaeda950e8894375 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- a/src/eh_alloc.cpp	2007-06-03 23:51:13.000000000 +0100
+++ b/src/eh_alloc.cpp	2009-07-13 09:42:39.000000000 +0100
@@ -42,4 +42,21 @@
 	free( (char *)(vptr) - sizeof(__cxa_exception) );
 }
 
+#if __GNUC__ * 100 + __GNUC_MINOR__ >= 404
+extern "C" __cxa_dependent_exception* __cxa_allocate_dependent_exception() throw(){
+	__cxa_dependent_exception *retval;
+
+	retval = static_cast<__cxa_dependent_exception*>(malloc(sizeof(__cxa_dependent_exception)));
+	if(0 == retval){
+		std::terminate();
+	}
+	memset (retval, 0, sizeof(__cxa_dependent_exception));
+	return retval ;
+}
+
+extern "C" void __cxa_free_dependent_exception(__cxa_dependent_exception *vptr) throw(){
+	free( vptr );
+}
+#endif
+
 }
--- a/include/unwind-cxx.h	2009-07-13 10:01:11.000000000 +0100
+++ b/include/unwind-cxx.h	2009-07-13 10:14:08.000000000 +0100
@@ -79,6 +79,41 @@
   _Unwind_Exception unwindHeader;
 };
 
+#if __GNUC__ * 100 + __GNUC_MINOR__ >= 404
+// A dependent C++ exception object consists of a wrapper around an unwind
+// object header with additional C++ specific information, containing a pointer
+// to a primary exception object.
+
+struct __cxa_dependent_exception
+{
+  // The primary exception this thing depends on.
+  void *primaryException;
+
+  // The C++ standard has entertaining rules wrt calling set_terminate
+  // and set_unexpected in the middle of the exception cleanup process.
+  std::unexpected_handler unexpectedHandler;
+  std::terminate_handler terminateHandler;
+
+  // The caught exception stack threads through here.
+  __cxa_exception *nextException;
+
+  // How many nested handlers have caught this exception.  A negated
+  // value is a signal that this object has been rethrown.
+  int handlerCount;
+
+  // Cache parsed handler data from the personality routine Phase 1
+  // for Phase 2 and __cxa_call_unexpected.
+  int handlerSwitchValue;
+  const unsigned char *actionRecord;
+  const unsigned char *languageSpecificData;
+  _Unwind_Ptr catchTemp;
+  void *adjustedPtr;
+
+  // The generic exception header.  Must be last.
+  _Unwind_Exception unwindHeader;
+};
+
+#endif
 // Each thread in a C++ program has access to a __cxa_eh_globals object.
 struct __cxa_eh_globals
 {