xref: /titanic_52/usr/src/lib/libdwarf/common/pro_frame.h (revision 7fd791373689a6af05e27efec3b1ab556e02aa23)
1*7fd79137SRobert Mustacchi /*
2*7fd79137SRobert Mustacchi 
3*7fd79137SRobert Mustacchi   Copyright (C) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
4*7fd79137SRobert Mustacchi 
5*7fd79137SRobert Mustacchi   This program is free software; you can redistribute it and/or modify it
6*7fd79137SRobert Mustacchi   under the terms of version 2.1 of the GNU Lesser General Public License
7*7fd79137SRobert Mustacchi   as published by the Free Software Foundation.
8*7fd79137SRobert Mustacchi 
9*7fd79137SRobert Mustacchi   This program is distributed in the hope that it would be useful, but
10*7fd79137SRobert Mustacchi   WITHOUT ANY WARRANTY; without even the implied warranty of
11*7fd79137SRobert Mustacchi   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12*7fd79137SRobert Mustacchi 
13*7fd79137SRobert Mustacchi   Further, this software is distributed without any warranty that it is
14*7fd79137SRobert Mustacchi   free of the rightful claim of any third person regarding infringement
15*7fd79137SRobert Mustacchi   or the like.  Any license provided herein, whether implied or
16*7fd79137SRobert Mustacchi   otherwise, applies only to this software file.  Patent licenses, if
17*7fd79137SRobert Mustacchi   any, provided herein do not apply to combinations of this program with
18*7fd79137SRobert Mustacchi   other software, or any other product whatsoever.
19*7fd79137SRobert Mustacchi 
20*7fd79137SRobert Mustacchi   You should have received a copy of the GNU Lesser General Public
21*7fd79137SRobert Mustacchi   License along with this program; if not, write the Free Software
22*7fd79137SRobert Mustacchi   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
23*7fd79137SRobert Mustacchi   USA.
24*7fd79137SRobert Mustacchi 
25*7fd79137SRobert Mustacchi   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
26*7fd79137SRobert Mustacchi   Mountain View, CA 94043, or:
27*7fd79137SRobert Mustacchi 
28*7fd79137SRobert Mustacchi   http://www.sgi.com
29*7fd79137SRobert Mustacchi 
30*7fd79137SRobert Mustacchi   For further information regarding this notice, see:
31*7fd79137SRobert Mustacchi 
32*7fd79137SRobert Mustacchi   http://oss.sgi.com/projects/GenInfo/NoticeExplan
33*7fd79137SRobert Mustacchi 
34*7fd79137SRobert Mustacchi */
35*7fd79137SRobert Mustacchi 
36*7fd79137SRobert Mustacchi 
37*7fd79137SRobert Mustacchi 
38*7fd79137SRobert Mustacchi /*
39*7fd79137SRobert Mustacchi     Largest register value that can be coded into
40*7fd79137SRobert Mustacchi     the opcode since there are only 6 bits in the
41*7fd79137SRobert Mustacchi     register field.
42*7fd79137SRobert Mustacchi */
43*7fd79137SRobert Mustacchi #define MAX_6_BIT_VALUE		0x3f
44*7fd79137SRobert Mustacchi 
45*7fd79137SRobert Mustacchi /*
46*7fd79137SRobert Mustacchi 	This struct holds debug_frame instructions
47*7fd79137SRobert Mustacchi */
48*7fd79137SRobert Mustacchi typedef struct Dwarf_P_Frame_Pgm_s *Dwarf_P_Frame_Pgm;
49*7fd79137SRobert Mustacchi 
50*7fd79137SRobert Mustacchi struct Dwarf_P_Frame_Pgm_s {
51*7fd79137SRobert Mustacchi     Dwarf_Ubyte dfp_opcode;	/* opcode - includes reg # */
52*7fd79137SRobert Mustacchi     char *dfp_args;		/* operands */
53*7fd79137SRobert Mustacchi     int dfp_nbytes;		/* number of bytes in args */
54*7fd79137SRobert Mustacchi #if 0
55*7fd79137SRobert Mustacchi     Dwarf_Unsigned dfp_sym_index;	/* 0 unless reloc needed */
56*7fd79137SRobert Mustacchi #endif
57*7fd79137SRobert Mustacchi     Dwarf_P_Frame_Pgm dfp_next;
58*7fd79137SRobert Mustacchi };
59*7fd79137SRobert Mustacchi 
60*7fd79137SRobert Mustacchi 
61*7fd79137SRobert Mustacchi /*
62*7fd79137SRobert Mustacchi 	This struct has cie related information. Used to gather data
63*7fd79137SRobert Mustacchi 	from user program, and later to transform to disk form
64*7fd79137SRobert Mustacchi */
65*7fd79137SRobert Mustacchi struct Dwarf_P_Cie_s {
66*7fd79137SRobert Mustacchi     Dwarf_Ubyte cie_version;
67*7fd79137SRobert Mustacchi     char *cie_aug;		/* augmentation */
68*7fd79137SRobert Mustacchi     Dwarf_Ubyte cie_code_align;	/* alignment of code */
69*7fd79137SRobert Mustacchi     Dwarf_Sbyte cie_data_align;
70*7fd79137SRobert Mustacchi     Dwarf_Ubyte cie_ret_reg;	/* return register # */
71*7fd79137SRobert Mustacchi     char *cie_inst;		/* initial instruction */
72*7fd79137SRobert Mustacchi     long cie_inst_bytes;
73*7fd79137SRobert Mustacchi     /* no of init_inst */
74*7fd79137SRobert Mustacchi     Dwarf_P_Cie cie_next;
75*7fd79137SRobert Mustacchi };
76*7fd79137SRobert Mustacchi 
77*7fd79137SRobert Mustacchi 
78*7fd79137SRobert Mustacchi /* producer fields */
79*7fd79137SRobert Mustacchi struct Dwarf_P_Fde_s {
80*7fd79137SRobert Mustacchi     Dwarf_Unsigned fde_unused1;
81*7fd79137SRobert Mustacchi 
82*7fd79137SRobert Mustacchi     /* function/subr die for this fde */
83*7fd79137SRobert Mustacchi     Dwarf_P_Die fde_die;
84*7fd79137SRobert Mustacchi 
85*7fd79137SRobert Mustacchi     /* index to asso. cie */
86*7fd79137SRobert Mustacchi     Dwarf_Word fde_cie;
87*7fd79137SRobert Mustacchi 
88*7fd79137SRobert Mustacchi     /* Address of first location of the code this frame applies to If
89*7fd79137SRobert Mustacchi        fde_end_symbol non-zero, this represents the offset from the
90*7fd79137SRobert Mustacchi        symbol indicated by fde_r_symidx */
91*7fd79137SRobert Mustacchi     Dwarf_Addr fde_initloc;
92*7fd79137SRobert Mustacchi 
93*7fd79137SRobert Mustacchi     /* Relocation symbol for address of the code this frame applies to.
94*7fd79137SRobert Mustacchi      */
95*7fd79137SRobert Mustacchi     Dwarf_Unsigned fde_r_symidx;
96*7fd79137SRobert Mustacchi 
97*7fd79137SRobert Mustacchi     /* Bytes of instr for this fde, if known */
98*7fd79137SRobert Mustacchi     Dwarf_Unsigned fde_addr_range;
99*7fd79137SRobert Mustacchi 
100*7fd79137SRobert Mustacchi     /* linked list of instructions we will put in fde. */
101*7fd79137SRobert Mustacchi     Dwarf_P_Frame_Pgm fde_inst;
102*7fd79137SRobert Mustacchi 
103*7fd79137SRobert Mustacchi     /* number of instructions in fde */
104*7fd79137SRobert Mustacchi     long fde_n_inst;
105*7fd79137SRobert Mustacchi 
106*7fd79137SRobert Mustacchi     /* number of bytes of inst in fde */
107*7fd79137SRobert Mustacchi     long fde_n_bytes;
108*7fd79137SRobert Mustacchi 
109*7fd79137SRobert Mustacchi     /* offset into exception table for this function. */
110*7fd79137SRobert Mustacchi     Dwarf_Signed fde_offset_into_exception_tables;
111*7fd79137SRobert Mustacchi 
112*7fd79137SRobert Mustacchi     /* The symbol for the exception table elf section. */
113*7fd79137SRobert Mustacchi     Dwarf_Unsigned fde_exception_table_symbol;
114*7fd79137SRobert Mustacchi 
115*7fd79137SRobert Mustacchi     /* pointer to last inst */
116*7fd79137SRobert Mustacchi     Dwarf_P_Frame_Pgm fde_last_inst;
117*7fd79137SRobert Mustacchi 
118*7fd79137SRobert Mustacchi     Dwarf_P_Fde fde_next;
119*7fd79137SRobert Mustacchi 
120*7fd79137SRobert Mustacchi     /* The symbol and offset of the end symbol. When fde_end_symbol is
121*7fd79137SRobert Mustacchi        non-zero we must represent the */
122*7fd79137SRobert Mustacchi     Dwarf_Addr fde_end_symbol_offset;
123*7fd79137SRobert Mustacchi     Dwarf_Unsigned fde_end_symbol;
124*7fd79137SRobert Mustacchi 
125*7fd79137SRobert Mustacchi     int fde_uwordb_size;
126*7fd79137SRobert Mustacchi     Dwarf_P_Debug fde_dbg;
127*7fd79137SRobert Mustacchi 
128*7fd79137SRobert Mustacchi     /* If fde_block is non-null, then it is the set of instructions.
129*7fd79137SRobert Mustacchi        so we should use it rather than fde_inst. */
130*7fd79137SRobert Mustacchi     Dwarf_Unsigned fde_inst_block_size;
131*7fd79137SRobert Mustacchi     void *fde_block;
132*7fd79137SRobert Mustacchi };
133