1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 4 // Copyright (c) 2008, 2010 Google Inc. All Rights Reserved. 5 // 6 // Redistribution and use in source and binary forms, with or without 7 // modification, are permitted provided that the following conditions are 8 // met: 9 // 10 // * Redistributions of source code must retain the above copyright 11 // notice, this list of conditions and the following disclaimer. 12 // * Redistributions in binary form must reproduce the above 13 // copyright notice, this list of conditions and the following disclaimer 14 // in the documentation and/or other materials provided with the 15 // distribution. 16 // * Neither the name of Google Inc. nor the names of its 17 // contributors may be used to endorse or promote products derived from 18 // this software without specific prior written permission. 19 // 20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 32 // CFI reader author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com> 33 34 // This file is derived from the following file in 35 // toolkit/crashreporter/google-breakpad: 36 // src/common/dwarf/dwarf2enums.h 37 38 #ifndef LulDwarfInt_h 39 #define LulDwarfInt_h 40 41 #include "LulCommonExt.h" 42 #include "LulDwarfExt.h" 43 44 namespace lul { 45 46 // These enums do not follow the google3 style only because they are 47 // known universally (specs, other implementations) by the names in 48 // exactly this capitalization. 49 // Tag names and codes. 50 51 // Call Frame Info instructions. 52 enum DwarfCFI 53 { 54 DW_CFA_advance_loc = 0x40, 55 DW_CFA_offset = 0x80, 56 DW_CFA_restore = 0xc0, 57 DW_CFA_nop = 0x00, 58 DW_CFA_set_loc = 0x01, 59 DW_CFA_advance_loc1 = 0x02, 60 DW_CFA_advance_loc2 = 0x03, 61 DW_CFA_advance_loc4 = 0x04, 62 DW_CFA_offset_extended = 0x05, 63 DW_CFA_restore_extended = 0x06, 64 DW_CFA_undefined = 0x07, 65 DW_CFA_same_value = 0x08, 66 DW_CFA_register = 0x09, 67 DW_CFA_remember_state = 0x0a, 68 DW_CFA_restore_state = 0x0b, 69 DW_CFA_def_cfa = 0x0c, 70 DW_CFA_def_cfa_register = 0x0d, 71 DW_CFA_def_cfa_offset = 0x0e, 72 DW_CFA_def_cfa_expression = 0x0f, 73 DW_CFA_expression = 0x10, 74 DW_CFA_offset_extended_sf = 0x11, 75 DW_CFA_def_cfa_sf = 0x12, 76 DW_CFA_def_cfa_offset_sf = 0x13, 77 DW_CFA_val_offset = 0x14, 78 DW_CFA_val_offset_sf = 0x15, 79 DW_CFA_val_expression = 0x16, 80 81 // Opcodes in this range are reserved for user extensions. 82 DW_CFA_lo_user = 0x1c, 83 DW_CFA_hi_user = 0x3f, 84 85 // SGI/MIPS specific. 86 DW_CFA_MIPS_advance_loc8 = 0x1d, 87 88 // GNU extensions. 89 DW_CFA_GNU_window_save = 0x2d, 90 DW_CFA_GNU_args_size = 0x2e, 91 DW_CFA_GNU_negative_offset_extended = 0x2f 92 }; 93 94 // Exception handling 'z' augmentation letters. 95 enum DwarfZAugmentationCodes { 96 // If the CFI augmentation string begins with 'z', then the CIE and FDE 97 // have an augmentation data area just before the instructions, whose 98 // contents are determined by the subsequent augmentation letters. 99 DW_Z_augmentation_start = 'z', 100 101 // If this letter is present in a 'z' augmentation string, the CIE 102 // augmentation data includes a pointer encoding, and the FDE 103 // augmentation data includes a language-specific data area pointer, 104 // represented using that encoding. 105 DW_Z_has_LSDA = 'L', 106 107 // If this letter is present in a 'z' augmentation string, the CIE 108 // augmentation data includes a pointer encoding, followed by a pointer 109 // to a personality routine, represented using that encoding. 110 DW_Z_has_personality_routine = 'P', 111 112 // If this letter is present in a 'z' augmentation string, the CIE 113 // augmentation data includes a pointer encoding describing how the FDE's 114 // initial location, address range, and DW_CFA_set_loc operands are 115 // encoded. 116 DW_Z_has_FDE_address_encoding = 'R', 117 118 // If this letter is present in a 'z' augmentation string, then code 119 // addresses covered by FDEs that cite this CIE are signal delivery 120 // trampolines. Return addresses of frames in trampolines should not be 121 // adjusted as described in section 6.4.4 of the DWARF 3 spec. 122 DW_Z_is_signal_trampoline = 'S' 123 }; 124 125 // Expression opcodes 126 enum DwarfExpressionOpcodes { 127 DW_OP_addr = 0x03, 128 DW_OP_deref = 0x06, 129 DW_OP_const1s = 0x09, 130 DW_OP_const2u = 0x0a, 131 DW_OP_const2s = 0x0b, 132 DW_OP_const4u = 0x0c, 133 DW_OP_const4s = 0x0d, 134 DW_OP_const8u = 0x0e, 135 DW_OP_const8s = 0x0f, 136 DW_OP_constu = 0x10, 137 DW_OP_consts = 0x11, 138 DW_OP_dup = 0x12, 139 DW_OP_drop = 0x13, 140 DW_OP_over = 0x14, 141 DW_OP_pick = 0x15, 142 DW_OP_swap = 0x16, 143 DW_OP_rot = 0x17, 144 DW_OP_xderef = 0x18, 145 DW_OP_abs = 0x19, 146 DW_OP_and = 0x1a, 147 DW_OP_div = 0x1b, 148 DW_OP_minus = 0x1c, 149 DW_OP_mod = 0x1d, 150 DW_OP_mul = 0x1e, 151 DW_OP_neg = 0x1f, 152 DW_OP_not = 0x20, 153 DW_OP_or = 0x21, 154 DW_OP_plus = 0x22, 155 DW_OP_plus_uconst = 0x23, 156 DW_OP_shl = 0x24, 157 DW_OP_shr = 0x25, 158 DW_OP_shra = 0x26, 159 DW_OP_xor = 0x27, 160 DW_OP_skip = 0x2f, 161 DW_OP_bra = 0x28, 162 DW_OP_eq = 0x29, 163 DW_OP_ge = 0x2a, 164 DW_OP_gt = 0x2b, 165 DW_OP_le = 0x2c, 166 DW_OP_lt = 0x2d, 167 DW_OP_ne = 0x2e, 168 DW_OP_lit0 = 0x30, 169 DW_OP_lit31 = 0x4f, 170 DW_OP_reg0 = 0x50, 171 DW_OP_reg31 = 0x6f, 172 DW_OP_breg0 = 0x70, 173 DW_OP_breg31 = 0x8f, 174 DW_OP_regx = 0x90, 175 DW_OP_fbreg = 0x91, 176 DW_OP_bregx = 0x92, 177 DW_OP_piece = 0x93, 178 DW_OP_deref_size = 0x94, 179 DW_OP_xderef_size = 0x95, 180 DW_OP_nop = 0x96, 181 DW_OP_push_object_address = 0x97, 182 DW_OP_call2 = 0x98, 183 DW_OP_call4 = 0x99, 184 DW_OP_call_ref = 0x9a, 185 DW_OP_form_tls_address = 0x9b, 186 DW_OP_call_frame_cfa = 0x9c, 187 DW_OP_bit_piece = 0x9d, 188 DW_OP_lo_user = 0xe0, 189 DW_OP_hi_user = 0xff 190 }; 191 192 } // namespace lul 193 194 #endif // LulDwarfInt_h 195