Imported Upstream version 1.1.11
[platform/upstream/cdrkit.git] / include / stkframe.h
1 /*
2  * This file has been modified for the cdrkit suite.
3  *
4  * The behaviour and appearence of the program code below can differ to a major
5  * extent from the version distributed by the original author(s).
6  *
7  * For details, see Changelog file distributed with the cdrkit package. If you
8  * received this file from another source then ask the distributing person for
9  * a log of modifications.
10  *
11  */
12
13 /* @(#)stkframe.h       1.10 03/06/15 Copyright 1995 J. Schilling */
14 /*
15  * Common definitions for routines that parse the stack frame.
16  *
17  * This file has to be fixed if you want to port routines which use getfp().
18  * Have a look at struct frame below and use it as a sample,
19  * the new struct frame must at least contain a member 'fr_savfp'.
20  */
21 /*
22  * This program is free software; you can redistribute it and/or modify
23  * it under the terms of the GNU General Public License version 2
24  * as published by the Free Software Foundation.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  * GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License along with
32  * this program; see the file COPYING.  If not, write to the Free Software
33  * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34  */
35
36 #ifndef _STKFRAME_H
37 #define _STKFRAME_H
38
39 #ifndef _MCONFIG_H
40 #include <mconfig.h>
41 #endif
42
43 #if defined(sun) && (defined(SVR4) || defined(__SVR4) || defined(__SVR4__))
44         /*
45          * Solaris 2.x aka SunOS 5.x
46          */
47 #       ifdef   i386
48                 /*
49                  * On Solaris 2.1 x86 sys/frame.h is not useful at all
50                  * On Solaris 2.4 x86 sys/frame.h is buggy (fr_savfp is int!!)
51                  */
52 #               ifndef  _INCL_SYS_REG_H
53 #               include <sys/reg.h>
54 #               define  _INCL_SYS_REG_H
55 #               endif
56 #       endif
57 #       ifndef  _INCL_SYS_FRAME_H
58 #       include <sys/frame.h>
59 #       define  _INCL_SYS_FRAME_H
60 #       endif
61
62 #else
63 # if    defined(sun)
64         /*
65          * SunOS 4.x
66          */
67 #       ifndef  _INCL_MACHINE_FRAME_H
68 #       include <machine/frame.h>
69 #       define  _INCL_MACHINE_FRAME_H
70 #       endif
71 # else
72         /*
73          * Anything that is not SunOS
74          */
75
76 #ifdef  __cplusplus
77 extern "C" {
78 #endif
79
80 /*
81  * XXX: I hope this will be useful on other machines (no guarantee)
82  * XXX: It is taken from a sun Motorola system, but should also be useful
83  * XXX: on a i386.
84  * XXX: In general you have to write a sample program, set a breakpoint
85  * XXX: on a small function and inspect the stackframe with adb.
86  */
87
88 struct frame {
89         struct frame    *fr_savfp;      /* saved frame pointer */
90         int             fr_savpc;       /* saved program counter */
91         int             fr_arg[1];      /* array of arguments */
92 };
93
94 #ifdef  __cplusplus
95 }
96 #endif
97
98 # endif /* ! defined (sun) */
99 #endif  /* ! defined (sun) && (defined(SVR4) || defined(__SVR4) || defined(__SVR4__)) */
100
101 #endif  /* _STKFRAME_H */