149d3bc91SRichard Lowe /* 249d3bc91SRichard Lowe 307dc1947SRichard Lowe Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved. 4*4d9fdb46SRobert Mustacchi Portions Copyright (C) 2017 David Anderson. All Rights Reserved. 549d3bc91SRichard Lowe 649d3bc91SRichard Lowe This program is free software; you can redistribute it and/or modify it 7*4d9fdb46SRobert Mustacchi under the terms of version 2.1 of the GNU Lesser General Public License 849d3bc91SRichard Lowe as published by the Free Software Foundation. 949d3bc91SRichard Lowe 1049d3bc91SRichard Lowe This program is distributed in the hope that it would be useful, but 1149d3bc91SRichard Lowe WITHOUT ANY WARRANTY; without even the implied warranty of 12*4d9fdb46SRobert Mustacchi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 1349d3bc91SRichard Lowe 1449d3bc91SRichard Lowe Further, this software is distributed without any warranty that it is 15*4d9fdb46SRobert Mustacchi free of the rightful claim of any third person regarding infringement 16*4d9fdb46SRobert Mustacchi or the like. Any license provided herein, whether implied or 1749d3bc91SRichard Lowe otherwise, applies only to this software file. Patent licenses, if 18*4d9fdb46SRobert Mustacchi any, provided herein do not apply to combinations of this program with 19*4d9fdb46SRobert Mustacchi other software, or any other product whatsoever. 2049d3bc91SRichard Lowe 2107dc1947SRichard Lowe You should have received a copy of the GNU Lesser General Public 2207dc1947SRichard Lowe License along with this program; if not, write the Free Software 2307dc1947SRichard Lowe Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301, 2449d3bc91SRichard Lowe USA. 2549d3bc91SRichard Lowe 2649d3bc91SRichard Lowe */ 2749d3bc91SRichard Lowe 2849d3bc91SRichard Lowe 2949d3bc91SRichard Lowe 3049d3bc91SRichard Lowe /* 3149d3bc91SRichard Lowe Largest register value that can be coded into 3249d3bc91SRichard Lowe the opcode since there are only 6 bits in the 3349d3bc91SRichard Lowe register field. 3449d3bc91SRichard Lowe */ 3549d3bc91SRichard Lowe #define MAX_6_BIT_VALUE 0x3f 3649d3bc91SRichard Lowe 37*4d9fdb46SRobert Mustacchi /* This struct holds debug_frame instructions */ 3849d3bc91SRichard Lowe typedef struct Dwarf_P_Frame_Pgm_s *Dwarf_P_Frame_Pgm; 3949d3bc91SRichard Lowe 4049d3bc91SRichard Lowe struct Dwarf_P_Frame_Pgm_s { 41*4d9fdb46SRobert Mustacchi Dwarf_Ubyte dfp_opcode; /* opcode - includes reg # */ 42*4d9fdb46SRobert Mustacchi char * dfp_args; /* operands */ 43*4d9fdb46SRobert Mustacchi Dwarf_Unsigned dfp_nbytes; /* number of bytes in args */ 4449d3bc91SRichard Lowe Dwarf_P_Frame_Pgm dfp_next; 4549d3bc91SRichard Lowe }; 4649d3bc91SRichard Lowe 4749d3bc91SRichard Lowe 4849d3bc91SRichard Lowe /* 49*4d9fdb46SRobert Mustacchi This struct has cie related information. Used to gather data 50*4d9fdb46SRobert Mustacchi from user program, and later to transform to disk form 5149d3bc91SRichard Lowe */ 5249d3bc91SRichard Lowe struct Dwarf_P_Cie_s { 53*4d9fdb46SRobert Mustacchi Dwarf_Half cie_version; 54*4d9fdb46SRobert Mustacchi 55*4d9fdb46SRobert Mustacchi /* augmentation. The string is an strdup() copy 56*4d9fdb46SRobert Mustacchi and on freeing the Dwarf_P_Cie the string must be freed. */ 57*4d9fdb46SRobert Mustacchi char *cie_aug; 58*4d9fdb46SRobert Mustacchi 59*4d9fdb46SRobert Mustacchi 6049d3bc91SRichard Lowe Dwarf_Ubyte cie_code_align; /* alignment of code */ 6149d3bc91SRichard Lowe Dwarf_Sbyte cie_data_align; 6249d3bc91SRichard Lowe Dwarf_Ubyte cie_ret_reg; /* return register # */ 6349d3bc91SRichard Lowe char *cie_inst; /* initial instruction */ 6449d3bc91SRichard Lowe long cie_inst_bytes; 6549d3bc91SRichard Lowe /* no of init_inst */ 6649d3bc91SRichard Lowe Dwarf_P_Cie cie_next; 6749d3bc91SRichard Lowe }; 6849d3bc91SRichard Lowe 6949d3bc91SRichard Lowe 7049d3bc91SRichard Lowe /* producer fields */ 7149d3bc91SRichard Lowe struct Dwarf_P_Fde_s { 7249d3bc91SRichard Lowe Dwarf_Unsigned fde_unused1; 7349d3bc91SRichard Lowe 7449d3bc91SRichard Lowe /* function/subr die for this fde */ 7549d3bc91SRichard Lowe Dwarf_P_Die fde_die; 7649d3bc91SRichard Lowe 7749d3bc91SRichard Lowe /* index to asso. cie */ 78*4d9fdb46SRobert Mustacchi Dwarf_Unsigned fde_cie; 7949d3bc91SRichard Lowe 80*4d9fdb46SRobert Mustacchi /* Address of first location of the code this frame applies to If 81*4d9fdb46SRobert Mustacchi fde_end_symbol non-zero, this represents the offset from the 82*4d9fdb46SRobert Mustacchi symbol indicated by fde_r_symidx */ 8349d3bc91SRichard Lowe Dwarf_Addr fde_initloc; 8449d3bc91SRichard Lowe 85*4d9fdb46SRobert Mustacchi /* Relocation symbol for address of the code this frame applies to. */ 8649d3bc91SRichard Lowe Dwarf_Unsigned fde_r_symidx; 8749d3bc91SRichard Lowe 8849d3bc91SRichard Lowe /* Bytes of instr for this fde, if known */ 8949d3bc91SRichard Lowe Dwarf_Unsigned fde_addr_range; 9049d3bc91SRichard Lowe 9149d3bc91SRichard Lowe /* linked list of instructions we will put in fde. */ 9249d3bc91SRichard Lowe Dwarf_P_Frame_Pgm fde_inst; 9349d3bc91SRichard Lowe 9449d3bc91SRichard Lowe /* number of instructions in fde */ 95*4d9fdb46SRobert Mustacchi Dwarf_Signed fde_n_inst; 9649d3bc91SRichard Lowe 9749d3bc91SRichard Lowe /* number of bytes of inst in fde */ 98*4d9fdb46SRobert Mustacchi Dwarf_Signed fde_n_bytes; 9949d3bc91SRichard Lowe 10049d3bc91SRichard Lowe /* offset into exception table for this function. */ 10149d3bc91SRichard Lowe Dwarf_Signed fde_offset_into_exception_tables; 10249d3bc91SRichard Lowe 10349d3bc91SRichard Lowe /* The symbol for the exception table elf section. */ 10449d3bc91SRichard Lowe Dwarf_Unsigned fde_exception_table_symbol; 10549d3bc91SRichard Lowe 10649d3bc91SRichard Lowe /* pointer to last inst */ 10749d3bc91SRichard Lowe Dwarf_P_Frame_Pgm fde_last_inst; 10849d3bc91SRichard Lowe 10949d3bc91SRichard Lowe Dwarf_P_Fde fde_next; 11049d3bc91SRichard Lowe 111*4d9fdb46SRobert Mustacchi /* The symbol and offset of the end symbol. When fde_end_symbol is 112*4d9fdb46SRobert Mustacchi non-zero we must represent the */ 11349d3bc91SRichard Lowe Dwarf_Addr fde_end_symbol_offset; 11449d3bc91SRichard Lowe Dwarf_Unsigned fde_end_symbol; 11549d3bc91SRichard Lowe 11649d3bc91SRichard Lowe int fde_uwordb_size; 11707dc1947SRichard Lowe Dwarf_P_Debug fde_dbg; 11807dc1947SRichard Lowe 119*4d9fdb46SRobert Mustacchi /* If fde_block is non-null, then it is the set of instructions. 120*4d9fdb46SRobert Mustacchi so we should use it rather than fde_inst. */ 12107dc1947SRichard Lowe Dwarf_Unsigned fde_inst_block_size; 12207dc1947SRichard Lowe void *fde_block; 12349d3bc91SRichard Lowe }; 124