xref: /titanic_44/usr/src/tools/ctf/dwarf/common/pro_frame.h (revision 07dc1947c362e187fb955d283b692f8769dd5def)
149d3bc91SRichard Lowe /*
249d3bc91SRichard Lowe 
3*07dc1947SRichard Lowe   Copyright (C) 2000,2004 Silicon Graphics, Inc.  All Rights Reserved.
449d3bc91SRichard Lowe 
549d3bc91SRichard Lowe   This program is free software; you can redistribute it and/or modify it
649d3bc91SRichard Lowe   under the terms of version 2.1 of the GNU Lesser General Public License
749d3bc91SRichard Lowe   as published by the Free Software Foundation.
849d3bc91SRichard Lowe 
949d3bc91SRichard Lowe   This program is distributed in the hope that it would be useful, but
1049d3bc91SRichard Lowe   WITHOUT ANY WARRANTY; without even the implied warranty of
1149d3bc91SRichard Lowe   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1249d3bc91SRichard Lowe 
1349d3bc91SRichard Lowe   Further, this software is distributed without any warranty that it is
1449d3bc91SRichard Lowe   free of the rightful claim of any third person regarding infringement
1549d3bc91SRichard Lowe   or the like.  Any license provided herein, whether implied or
1649d3bc91SRichard Lowe   otherwise, applies only to this software file.  Patent licenses, if
1749d3bc91SRichard Lowe   any, provided herein do not apply to combinations of this program with
1849d3bc91SRichard Lowe   other software, or any other product whatsoever.
1949d3bc91SRichard Lowe 
2049d3bc91SRichard Lowe   You should have received a copy of the GNU Lesser General Public
2149d3bc91SRichard Lowe   License along with this program; if not, write the Free Software
22*07dc1947SRichard Lowe   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
2349d3bc91SRichard Lowe   USA.
2449d3bc91SRichard Lowe 
25*07dc1947SRichard Lowe   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
2649d3bc91SRichard Lowe   Mountain View, CA 94043, or:
2749d3bc91SRichard Lowe 
2849d3bc91SRichard Lowe   http://www.sgi.com
2949d3bc91SRichard Lowe 
3049d3bc91SRichard Lowe   For further information regarding this notice, see:
3149d3bc91SRichard Lowe 
3249d3bc91SRichard Lowe   http://oss.sgi.com/projects/GenInfo/NoticeExplan
3349d3bc91SRichard Lowe 
3449d3bc91SRichard Lowe */
3549d3bc91SRichard Lowe 
3649d3bc91SRichard Lowe 
3749d3bc91SRichard Lowe 
3849d3bc91SRichard Lowe /*
3949d3bc91SRichard Lowe     Largest register value that can be coded into
4049d3bc91SRichard Lowe     the opcode since there are only 6 bits in the
4149d3bc91SRichard Lowe     register field.
4249d3bc91SRichard Lowe */
4349d3bc91SRichard Lowe #define MAX_6_BIT_VALUE		0x3f
4449d3bc91SRichard Lowe 
4549d3bc91SRichard Lowe /*
4649d3bc91SRichard Lowe 	This struct holds debug_frame instructions
4749d3bc91SRichard Lowe */
4849d3bc91SRichard Lowe typedef struct Dwarf_P_Frame_Pgm_s *Dwarf_P_Frame_Pgm;
4949d3bc91SRichard Lowe 
5049d3bc91SRichard Lowe struct Dwarf_P_Frame_Pgm_s {
5149d3bc91SRichard Lowe     Dwarf_Ubyte dfp_opcode;	/* opcode - includes reg # */
5249d3bc91SRichard Lowe     char *dfp_args;		/* operands */
5349d3bc91SRichard Lowe     int dfp_nbytes;		/* number of bytes in args */
5449d3bc91SRichard Lowe #if 0
5549d3bc91SRichard Lowe     Dwarf_Unsigned dfp_sym_index;	/* 0 unless reloc needed */
5649d3bc91SRichard Lowe #endif
5749d3bc91SRichard Lowe     Dwarf_P_Frame_Pgm dfp_next;
5849d3bc91SRichard Lowe };
5949d3bc91SRichard Lowe 
6049d3bc91SRichard Lowe 
6149d3bc91SRichard Lowe /*
6249d3bc91SRichard Lowe 	This struct has cie related information. Used to gather data
6349d3bc91SRichard Lowe 	from user program, and later to transform to disk form
6449d3bc91SRichard Lowe */
6549d3bc91SRichard Lowe struct Dwarf_P_Cie_s {
6649d3bc91SRichard Lowe     Dwarf_Ubyte cie_version;
6749d3bc91SRichard Lowe     char *cie_aug;		/* augmentation */
6849d3bc91SRichard Lowe     Dwarf_Ubyte cie_code_align;	/* alignment of code */
6949d3bc91SRichard Lowe     Dwarf_Sbyte cie_data_align;
7049d3bc91SRichard Lowe     Dwarf_Ubyte cie_ret_reg;	/* return register # */
7149d3bc91SRichard Lowe     char *cie_inst;		/* initial instruction */
7249d3bc91SRichard Lowe     long cie_inst_bytes;
7349d3bc91SRichard Lowe     /* no of init_inst */
7449d3bc91SRichard Lowe     Dwarf_P_Cie cie_next;
7549d3bc91SRichard Lowe };
7649d3bc91SRichard Lowe 
7749d3bc91SRichard Lowe 
7849d3bc91SRichard Lowe /* producer fields */
7949d3bc91SRichard Lowe struct Dwarf_P_Fde_s {
8049d3bc91SRichard Lowe     Dwarf_Unsigned fde_unused1;
8149d3bc91SRichard Lowe 
8249d3bc91SRichard Lowe     /* function/subr die for this fde */
8349d3bc91SRichard Lowe     Dwarf_P_Die fde_die;
8449d3bc91SRichard Lowe 
8549d3bc91SRichard Lowe     /* index to asso. cie */
8649d3bc91SRichard Lowe     Dwarf_Word fde_cie;
8749d3bc91SRichard Lowe 
8849d3bc91SRichard Lowe     /* Address of first location of the code this frame applies to If
8949d3bc91SRichard Lowe        fde_end_symbol non-zero, this represents the offset from the
9049d3bc91SRichard Lowe        symbol indicated by fde_r_symidx */
9149d3bc91SRichard Lowe     Dwarf_Addr fde_initloc;
9249d3bc91SRichard Lowe 
9349d3bc91SRichard Lowe     /* Relocation symbol for address of the code this frame applies to.
9449d3bc91SRichard Lowe      */
9549d3bc91SRichard Lowe     Dwarf_Unsigned fde_r_symidx;
9649d3bc91SRichard Lowe 
9749d3bc91SRichard Lowe     /* Bytes of instr for this fde, if known */
9849d3bc91SRichard Lowe     Dwarf_Unsigned fde_addr_range;
9949d3bc91SRichard Lowe 
10049d3bc91SRichard Lowe     /* linked list of instructions we will put in fde. */
10149d3bc91SRichard Lowe     Dwarf_P_Frame_Pgm fde_inst;
10249d3bc91SRichard Lowe 
10349d3bc91SRichard Lowe     /* number of instructions in fde */
10449d3bc91SRichard Lowe     long fde_n_inst;
10549d3bc91SRichard Lowe 
10649d3bc91SRichard Lowe     /* number of bytes of inst in fde */
10749d3bc91SRichard Lowe     long fde_n_bytes;
10849d3bc91SRichard Lowe 
10949d3bc91SRichard Lowe     /* offset into exception table for this function. */
11049d3bc91SRichard Lowe     Dwarf_Signed fde_offset_into_exception_tables;
11149d3bc91SRichard Lowe 
11249d3bc91SRichard Lowe     /* The symbol for the exception table elf section. */
11349d3bc91SRichard Lowe     Dwarf_Unsigned fde_exception_table_symbol;
11449d3bc91SRichard Lowe 
11549d3bc91SRichard Lowe     /* pointer to last inst */
11649d3bc91SRichard Lowe     Dwarf_P_Frame_Pgm fde_last_inst;
11749d3bc91SRichard Lowe 
11849d3bc91SRichard Lowe     Dwarf_P_Fde fde_next;
11949d3bc91SRichard Lowe 
12049d3bc91SRichard Lowe     /* The symbol and offset of the end symbol. When fde_end_symbol is
12149d3bc91SRichard Lowe        non-zero we must represent the */
12249d3bc91SRichard Lowe     Dwarf_Addr fde_end_symbol_offset;
12349d3bc91SRichard Lowe     Dwarf_Unsigned fde_end_symbol;
12449d3bc91SRichard Lowe 
12549d3bc91SRichard Lowe     int fde_uwordb_size;
126*07dc1947SRichard Lowe     Dwarf_P_Debug fde_dbg;
127*07dc1947SRichard Lowe 
128*07dc1947SRichard Lowe     /* If fde_block is non-null, then it is the set of instructions.
129*07dc1947SRichard Lowe        so we should use it rather than fde_inst. */
130*07dc1947SRichard Lowe     Dwarf_Unsigned fde_inst_block_size;
131*07dc1947SRichard Lowe     void *fde_block;
13249d3bc91SRichard Lowe };
133