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