2 Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
3 Permission is hereby granted, free of charge, to any person
4 obtaining a copy of this software and associated documentation
5 files (the "Software"), to deal in the Software without
6 restriction, including without limitation the rights to use,
7 copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following
12 The above copyright notice and this permission notice shall be
13 included in all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef __UWX_SELF_INCLUDED
26 #define __UWX_SELF_INCLUDED 1
30 #ifndef __UWX_INCLUDED
32 #endif /* __UWX_INCLUDED */
34 #if defined(__cplusplus)
35 #define __EXTERN_C extern "C"
37 #define __EXTERN_C extern
42 __EXTERN_C struct uwx_self_info *uwx_self_init_info(struct uwx_env *env);
44 __EXTERN_C int uwx_self_free_info(struct uwx_self_info *info);
46 __EXTERN_C int uwx_self_init_context(struct uwx_env *env);
48 __EXTERN_C int uwx_self_init_from_sigcontext(
50 struct uwx_self_info *info,
51 ucontext_t *ucontext);
53 __EXTERN_C int uwx_self_do_context_frame(
55 struct uwx_self_info *info);
57 __EXTERN_C int uwx_self_copyin(
64 __EXTERN_C int uwx_self_lookupip(
70 #define UWX_SELF_ERR_BADABICONTEXT (-101)
74 #if defined(__cplusplus)
76 class UnwindExpressSelf : public UnwindExpress {
81 info = uwx_self_init_info(env);
82 (void)uwx_register_callbacks(env, (intptr_t)info,
83 uwx_self_copyin, uwx_self_lookupip);
86 ~UnwindExpressSelf() {
88 uwx_self_free_info(info);
93 return uwx_self_init_context(env);
96 int init_context(ucontext_t *ucontext) {
97 return uwx_self_init_from_sigcontext(env, info, ucontext);
100 int do_context_frame() {
101 return uwx_self_do_context_frame(env, info);
106 struct uwx_self_info *info;
110 #endif /* __cplusplus */
112 #endif /* __UWX_SELF_INCLUDED */