No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / bfd / pef-traceback.h
blobe7db82364d7898531c516a680e8c2d6c935c6f24
1 /* PowerPC traceback table support for BFD.
2 Copyright 1993, 1998, 1999, 2000, 2001, 2002, 2005
3 Free Software Foundation, Inc.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
21 /* Originally written by Ira Ruben, 06/28/93 */
23 /* This is a compiler independent representation of the AIX Version 3 traceback table (in
24 sys/debug.h), which occurs, usually, one per procedure (routine). The table is marked by
25 a multiple of 4 32-bit word of zeroes in the instruction space. The traceback table is
26 also referred to as "procedure-end table".
28 The AIX traceback table representation on which this header is based is defined as a
29 series of bit field struct specifications. Bit fields are compiler dependent! Thus,
30 the definitions presented here follow the original header and the existing documentation
31 (such as it is), but define the fields as BIT MASKS and other macros. The mask names,
32 however, where chosen as the original field names to give some compatibility with the
33 original header and to agree with the documentation. */
35 #ifndef __TRACEBACK__
36 #define __TRACEBACK__
38 #define TB_C 0U /* C */
39 #define TB_FORTRAN 1U /* FORTRAN */
40 #define TB_PASCAL 2U /* Pascal */
41 #define TB_ADA 3U /* ADA */
42 #define TB_PL1 4U /* PL1 */
43 #define TB_BASIC 5U /* Basic */
44 #define TB_LISP 6U /* Lisp */
45 #define TB_COBOL 7U /* eCobol */
46 #define TB_MODULA2 8U /* Modula2 */
47 #define TB_CPLUSPLUS 9U /* C++ */
48 #define TB_RPG 10U /* RPG */
49 #define TB_PL8 11U /* PL8 */
50 #define TB_ASM 12U /* Asm */
52 /* Flags 1. */
54 #define TB_GLOBALLINK 0x80U /* Routine is Global Linkage. */
55 #define TB_is_eprol 0x40U /* Out-of-line prolog or epilog routine. */
56 #define TB_HAS_TBOFF 0x20U /* tb_offset set (extension field). */
57 #define TB_INT_PROC 0x10U /* Internal leaf routine. */
58 #define TB_HAS_CTL 0x08U /* Has controlled automatic storage. */
59 #define TB_TOCLESS 0X04U /* Routine has no TOC. */
60 #define TB_FP_PRESENT 0x02U /* Routine has floating point ops. */
61 #define TB_LOG_ABORT 0x01U /* fp_present && log/abort compiler opt. */
63 /* Flags 2. */
65 #define TB_INT_HNDL 0x80U /* Routine is an interrupt handler. */
66 #define TB_NAME_PRESENT 0x40U /* Name_len/name set (extension field). */
67 #define TB_USES_ALLOCA 0x20U /* Uses alloca() to allocate storage. */
68 #define TB_CL_DIS_inv 0x1CU /* On-condition directives (see below). */
69 #define TB_SAVES_CR 0x02U /* Routine saves the CR. */
70 #define TB_SAVES_LR 0x01U /* Routine saves the LR. */
72 /* cl_dis_inv "on condition" settings: */
74 #define TB_CL_DIS_INV(x) (((x) & cl_dis_inv) >> 2U)
76 #define TB_WALK_ONCOND 0U /* Walk stack without restoring state. */
77 #define TB_DISCARD_ONCOND 1U /* Walk stack and discard. */
78 #define TB_INVOKE_ONCOND 2U /* Invoke a specific system routine. */
80 /* Flags 3. */
82 #define TB_STORES_BC 0x80U /* Routine saves frame ptr of caller. */
83 #define TB_SPARE2 0X40U /* Spare bit. */
84 #define TB_FPR_SAVED 0x3fU /* Number of FPRs saved (max of 32). */
85 /* (Last reg saved is ALWAYS fpr31). */
87 #define TB_NUM_FPR_SAVED(x) ((x) & fpr_saved)
89 /* Flags 4. */
91 #define TB_HAS_VEC_INFO 0x80U /* Routine uses vectors. */
92 #define TB_SPARE3 0X40U /* Spare bit. */
93 #define TB_GPR_SAVED 0x3fU /* Number of GPRs saved (max of 32). */
94 /* (Last reg saved is ALWAYS gpr31). */
96 #define TB_NUM_GPR_SAVED(x) ((x) & gpr_saved)
98 /* Flags 5. */
100 #define TB_FLOATPARAMS 0xfeU /* Number of floating point parameters. */
101 #define TB_PARAMSONSTK 0X01U /* All parameters are on the stack. */
103 #define TB_NUM_FLOATPARAMS(X) (((x) & floatparams) >> 1U)
105 /* Traceback_table (fixed portion). */
107 struct traceback_table
109 /* Traceback table layout (fixed portion): */
111 unsigned char version; /* Traceback format version. */
112 unsigned char lang; /* Language indicators: */
113 unsigned char flags1; /* Flag bits #1: */
114 unsigned char flags2; /* Flag bits #2: */
115 unsigned char flags3; /* Flag bits #3: */
116 unsigned char flags4; /* Flag bits #4: */
117 unsigned char fixedparams; /* Number of fixed point parameters. */
118 unsigned char flags5; /* Flag bits #5: */
121 /* traceback_table (optional) extensions. */
123 /* Optional portions exist independently in the order presented below,
124 not as a structure or a union. Whether or not portions exist is
125 determinable from bit-fields within the fixed portion above. */
127 /* The following is present only if fixedparams or floatparams are non
128 zero and it immediately follows the fixed portion of the traceback
129 table... */
131 /* Order and type encoding of parameters: */
132 struct traceback_table_fixedparams
134 unsigned long paraminfo;
137 /* Left-justified bit-encoding as follows: */
138 #define FIXED_PARAM 0 /* '0' ==> fixed param (1 gpr or word). */
139 #define SPFP_PARAM 2 /* '10' ==> single-precision float param. */
140 #define DPFP_PARAM 3 /* '11' ==> double-precision float param. */
142 #define PARAM_ENCODING(x, bit) /* Yields xxx_PARAM as a function of "bit". */ \
143 ((((x)&(1UL<<(31UL-(bit++))))==0UL) /* Values 0:31 (left-to-right). "bit" is */ \
144 ? FIXED_PARAM /* an L-value that's left incremented to */ \
145 : ((((x)&(1UL<<(31UL-(bit++))))==0)/* the next bit position for the next */ \
146 ? SPFP_PARAM /* parameter. This will be 1 or 2 bit */ \
147 : DPFP_PARAM)) /* positions later. */
149 /* The following is present only if has_tboff (in flags1) in fixed part is present... */
151 /* Offset from start of code to TracebackTbl. */
152 struct traceback_table_tboff
154 unsigned long tb_offset;
157 /* The following is present only if int_hndl (in flags2) in fixed part is present ... */
159 /* What interrupts are handled by the routine. */
160 struct traceback_table_interrupts
162 long hand_mask;
165 /* The following are present only if has_ctl (in flags1) in fixed part is present... */
167 /* Controlled automatic storage info: */
168 struct traceback_table_anchors
170 unsigned long ctl_info; /* Number of controlled automatic anchors. */
171 long ctl_info_disp[1]; /* Array of stack displacements where each. */
172 }; /* Anchor is located (array STARTS here). */
174 /* The following are present only if name_present (in flags2) in fixed
175 part is present... */
177 /* Routine name: */
178 struct traceback_table_routine
180 unsigned short name_len; /* Length of name that follows. */
181 char name[1]; /* Name starts here (NOT null terminated). */
184 /* The following are present only if uses_alloca (in flags2) in fixed
185 part is present... */
187 /* Register auto storage when alloca() is used. */
188 struct traceback_table_alloca
190 char alloca_reg;
193 /* The following are present only if has_vec_info (in flags4) in fixed
194 part is present... */
196 /* Vector info: */
197 struct traceback_table_vector
199 unsigned char vec_flags1; /* Vec info bits #1: */
201 #define TB_VR_SAVED 0xFCU /* Number of saved vector registers. */
202 #define TB_SAVES_VRSAVE 0x02U /* Saves VRsave. */
203 #define TB_HAS_VARARGS 0x01U /* Routine has a variable argument list. */
205 #define TB_NUM_VR_SAVED(x) (((x) & TB_VR_SAVED) >> 2U)
207 unsigned char vec_flags2; /* Vec info bits #2: */
209 #define TB_VECTORPARAMS 0xfeU /* Number of vector parameters. */
210 #define TB_VEC_PRESENT 0x01U /* Routine uses at least one vec instr. */
212 #define VECPARAMS(x) (((x) & TB_VECTORPARAMS) >> 1U)
215 #endif