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