xref: /minix3/lib/libexecinfo/unwind.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: unwind.h,v 1.3 2014/10/22 16:30:21 christos Exp $	*/
284d9c625SLionel Sambuc 
384d9c625SLionel Sambuc /*-
484d9c625SLionel Sambuc  * Copyright (c) 2012 The NetBSD Foundation, Inc.
584d9c625SLionel Sambuc  * All rights reserved.
684d9c625SLionel Sambuc  *
784d9c625SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
884d9c625SLionel Sambuc  * modification, are permitted provided that the following conditions
984d9c625SLionel Sambuc  * are met:
1084d9c625SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
1184d9c625SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
1284d9c625SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
1384d9c625SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
1484d9c625SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
1584d9c625SLionel Sambuc  *
1684d9c625SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
1784d9c625SLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1884d9c625SLionel Sambuc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1984d9c625SLionel Sambuc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2084d9c625SLionel Sambuc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2184d9c625SLionel Sambuc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2284d9c625SLionel Sambuc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2384d9c625SLionel Sambuc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2484d9c625SLionel Sambuc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2584d9c625SLionel Sambuc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2684d9c625SLionel Sambuc  * POSSIBILITY OF SUCH DAMAGE.
2784d9c625SLionel Sambuc  */
2884d9c625SLionel Sambuc #ifndef _UNWIND_H_
2984d9c625SLionel Sambuc #define _UNWIND_H_
3084d9c625SLionel Sambuc 
31*0a6a1f1dSLionel Sambuc #include <sys/cdefs.h>
32*0a6a1f1dSLionel Sambuc 
3384d9c625SLionel Sambuc __BEGIN_DECLS
3484d9c625SLionel Sambuc struct _Unwind_Context;
3584d9c625SLionel Sambuc struct _Unwind_Exception;
3684d9c625SLionel Sambuc typedef int _Unwind_Reason_Code;
3784d9c625SLionel Sambuc typedef void *_Unwind_Ptr;
3884d9c625SLionel Sambuc typedef long _Unwind_Word;
3984d9c625SLionel Sambuc 
40*0a6a1f1dSLionel Sambuc #define	_URC_NO_REASON			0
41*0a6a1f1dSLionel Sambuc #define	_URC_FOREIGN_EXCEPTION_CAUGHT	1
42*0a6a1f1dSLionel Sambuc #define	_URC_FATAL_PHASE2_ERROR		2
43*0a6a1f1dSLionel Sambuc #define	_URC_FATAL_PHASE1_ERROR		3
44*0a6a1f1dSLionel Sambuc #define	_URC_NORMAL_STOP		4
45*0a6a1f1dSLionel Sambuc #define	_URC_END_OF_STACK		5
46*0a6a1f1dSLionel Sambuc #define	_URC_HANDLER_FOUND		6
47*0a6a1f1dSLionel Sambuc #define	_URC_INSTALL_CONTEXT		7
48*0a6a1f1dSLionel Sambuc #define	_URC_CONTINUE_UNWIND		8
49*0a6a1f1dSLionel Sambuc 
5084d9c625SLionel Sambuc typedef _Unwind_Reason_Code
5184d9c625SLionel Sambuc     (*_Unwind_Trace_Fn)(struct _Unwind_Context *, void *);
5284d9c625SLionel Sambuc #ifdef notyet
5384d9c625SLionel Sambuc typedef _Unwind_Reason_Code
5484d9c625SLionel Sambuc     (*_Unwind_Stop_Fn)(struct _Unwind_Context *, void *);
5584d9c625SLionel Sambuc #endif
5684d9c625SLionel Sambuc 
5784d9c625SLionel Sambuc _Unwind_Reason_Code	 _Unwind_Backtrace(_Unwind_Trace_Fn, void *);
5884d9c625SLionel Sambuc void 			 _Unwind_DeleteException(struct _Unwind_Exception *);
5984d9c625SLionel Sambuc void 	       		*_Unwind_FindEnclosingFunction(void *);
6084d9c625SLionel Sambuc #ifdef notyet
6184d9c625SLionel Sambuc _Unwind_Reason_Code 	 _Unwind_ForcedUnwind(struct _Unwind_Exception *,
6284d9c625SLionel Sambuc     _Unwind_Stop_fn, void *);
6384d9c625SLionel Sambuc #endif
6484d9c625SLionel Sambuc _Unwind_Word		 _Unwind_GetCFA(struct _Unwind_Context *);
6584d9c625SLionel Sambuc _Unwind_Ptr		 _Unwind_GetDataRelBase(struct _Unwind_Context *);
6684d9c625SLionel Sambuc _Unwind_Word 		 _Unwind_GetGR(struct _Unwind_Context *, int);
6784d9c625SLionel Sambuc _Unwind_Ptr		 _Unwind_GetIP(struct _Unwind_Context *);
6884d9c625SLionel Sambuc _Unwind_Ptr		 _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
69*0a6a1f1dSLionel Sambuc _Unwind_Ptr		 _Unwind_GetLanguageSpecificData(
7084d9c625SLionel Sambuc     struct _Unwind_Context *);
7184d9c625SLionel Sambuc _Unwind_Ptr		 _Unwind_GetRegionStart(struct _Unwind_Context *);
7284d9c625SLionel Sambuc _Unwind_Ptr		 _Unwind_GetTextRelBase(struct _Unwind_Context *);
7384d9c625SLionel Sambuc _Unwind_Reason_Code	 _Unwind_RaiseException(struct _Unwind_Exception *);
7484d9c625SLionel Sambuc void			 _Unwind_Resume(struct _Unwind_Exception *);
7584d9c625SLionel Sambuc _Unwind_Reason_Code	 _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *);
7684d9c625SLionel Sambuc void			 _Unwind_SetGR(struct _Unwind_Context *, int,
7784d9c625SLionel Sambuc     _Unwind_Ptr);
7884d9c625SLionel Sambuc void			 _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Ptr);
7984d9c625SLionel Sambuc __END_DECLS
8084d9c625SLionel Sambuc #endif /* _UNWIND_H_ */
81