xref: /aoo42x/main/sal/osl/unx/backtrace.h (revision 550d0be8)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #if defined (FREEBSD) || defined (SOLARIS)
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /* backtrace function with same behaviour as defined in GNU libc */
32 
33 int backtrace( void **buffer, int max_frames );
34 
35 void backtrace_symbols_fd( void **buffer, int size, int fd );
36 
37 /* no frame.h on FreeBSD */
38 #if defined FREEBSD
39 struct frame {
40 	struct frame *fr_savfp;
41 	long	fr_savpc;
42 };
43 #endif
44 
45 
46 #ifdef __cplusplus
47 } /* extern "C" */
48 #endif
49 
50 #endif /* defined SOLARIS || FREEBSD */
51 
52 #if defined (LINUX) && defined (SPARC)
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /* backtrace function with same behaviour as defined in GNU libc */
58 
59 int backtrace( void **buffer, int max_frames );
60 
61 void backtrace_symbols_fd( void **buffer, int size, int fd );
62 
63 /* no frame.h on linux sparc */
64 struct frame {
65 	long	arg0[8];
66 	long	arg1[6];
67 	struct frame *fr_savfp;
68 	long	fr_savpc;
69 };
70 
71 #ifdef __cplusplus
72 } /* extern "C" */
73 #endif
74 
75 #endif /* defined LINUX && SPARC */
76 
77 #if defined (MACOSX)
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83 /* backtrace function with same behaviour as defined in GNU libc */
84 
85 int backtrace( void **buffer, int max_frames );
86 
87 void backtrace_symbols_fd( void **buffer, int size, int fd );
88 
89 #ifdef __cplusplus
90 } /* extern "C" */
91 #endif
92 
93 #endif /* defined MACOSX */
94