1*349cc55cSDimitry Andric //===----------------------------------------------------------------------===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric 100b57cec5SDimitry Andric /* 110b57cec5SDimitry Andric These constants were taken from version 3 of the DWARF standard, 120b57cec5SDimitry Andric which is Copyright (c) 2005 Free Standards Group, and 130b57cec5SDimitry Andric Copyright (c) 1992, 1993 UNIX International, Inc. 140b57cec5SDimitry Andric */ 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #ifndef __DWARF2__ 170b57cec5SDimitry Andric #define __DWARF2__ 180b57cec5SDimitry Andric 190b57cec5SDimitry Andric // DWARF unwind instructions 200b57cec5SDimitry Andric enum { 210b57cec5SDimitry Andric DW_CFA_nop = 0x0, 220b57cec5SDimitry Andric DW_CFA_set_loc = 0x1, 230b57cec5SDimitry Andric DW_CFA_advance_loc1 = 0x2, 240b57cec5SDimitry Andric DW_CFA_advance_loc2 = 0x3, 250b57cec5SDimitry Andric DW_CFA_advance_loc4 = 0x4, 260b57cec5SDimitry Andric DW_CFA_offset_extended = 0x5, 270b57cec5SDimitry Andric DW_CFA_restore_extended = 0x6, 280b57cec5SDimitry Andric DW_CFA_undefined = 0x7, 290b57cec5SDimitry Andric DW_CFA_same_value = 0x8, 300b57cec5SDimitry Andric DW_CFA_register = 0x9, 310b57cec5SDimitry Andric DW_CFA_remember_state = 0xA, 320b57cec5SDimitry Andric DW_CFA_restore_state = 0xB, 330b57cec5SDimitry Andric DW_CFA_def_cfa = 0xC, 340b57cec5SDimitry Andric DW_CFA_def_cfa_register = 0xD, 350b57cec5SDimitry Andric DW_CFA_def_cfa_offset = 0xE, 360b57cec5SDimitry Andric DW_CFA_def_cfa_expression = 0xF, 370b57cec5SDimitry Andric DW_CFA_expression = 0x10, 380b57cec5SDimitry Andric DW_CFA_offset_extended_sf = 0x11, 390b57cec5SDimitry Andric DW_CFA_def_cfa_sf = 0x12, 400b57cec5SDimitry Andric DW_CFA_def_cfa_offset_sf = 0x13, 410b57cec5SDimitry Andric DW_CFA_val_offset = 0x14, 420b57cec5SDimitry Andric DW_CFA_val_offset_sf = 0x15, 430b57cec5SDimitry Andric DW_CFA_val_expression = 0x16, 440b57cec5SDimitry Andric DW_CFA_advance_loc = 0x40, // high 2 bits are 0x1, lower 6 bits are delta 450b57cec5SDimitry Andric DW_CFA_offset = 0x80, // high 2 bits are 0x2, lower 6 bits are register 460b57cec5SDimitry Andric DW_CFA_restore = 0xC0, // high 2 bits are 0x3, lower 6 bits are register 470b57cec5SDimitry Andric 480b57cec5SDimitry Andric // GNU extensions 490b57cec5SDimitry Andric DW_CFA_GNU_window_save = 0x2D, 500b57cec5SDimitry Andric DW_CFA_GNU_args_size = 0x2E, 510b57cec5SDimitry Andric DW_CFA_GNU_negative_offset_extended = 0x2F, 520b57cec5SDimitry Andric 530b57cec5SDimitry Andric // AARCH64 extensions 540b57cec5SDimitry Andric DW_CFA_AARCH64_negate_ra_state = 0x2D 550b57cec5SDimitry Andric }; 560b57cec5SDimitry Andric 570b57cec5SDimitry Andric 580b57cec5SDimitry Andric // FSF exception handling Pointer-Encoding constants 590b57cec5SDimitry Andric // Used in CFI augmentation by GCC 600b57cec5SDimitry Andric enum { 610b57cec5SDimitry Andric DW_EH_PE_ptr = 0x00, 620b57cec5SDimitry Andric DW_EH_PE_uleb128 = 0x01, 630b57cec5SDimitry Andric DW_EH_PE_udata2 = 0x02, 640b57cec5SDimitry Andric DW_EH_PE_udata4 = 0x03, 650b57cec5SDimitry Andric DW_EH_PE_udata8 = 0x04, 660b57cec5SDimitry Andric DW_EH_PE_signed = 0x08, 670b57cec5SDimitry Andric DW_EH_PE_sleb128 = 0x09, 680b57cec5SDimitry Andric DW_EH_PE_sdata2 = 0x0A, 690b57cec5SDimitry Andric DW_EH_PE_sdata4 = 0x0B, 700b57cec5SDimitry Andric DW_EH_PE_sdata8 = 0x0C, 710b57cec5SDimitry Andric DW_EH_PE_absptr = 0x00, 720b57cec5SDimitry Andric DW_EH_PE_pcrel = 0x10, 730b57cec5SDimitry Andric DW_EH_PE_textrel = 0x20, 740b57cec5SDimitry Andric DW_EH_PE_datarel = 0x30, 750b57cec5SDimitry Andric DW_EH_PE_funcrel = 0x40, 760b57cec5SDimitry Andric DW_EH_PE_aligned = 0x50, 770b57cec5SDimitry Andric DW_EH_PE_indirect = 0x80, 780b57cec5SDimitry Andric DW_EH_PE_omit = 0xFF 790b57cec5SDimitry Andric }; 800b57cec5SDimitry Andric 810b57cec5SDimitry Andric 820b57cec5SDimitry Andric // DWARF expressions 830b57cec5SDimitry Andric enum { 840b57cec5SDimitry Andric DW_OP_addr = 0x03, // constant address (size target specific) 850b57cec5SDimitry Andric DW_OP_deref = 0x06, 860b57cec5SDimitry Andric DW_OP_const1u = 0x08, // 1-byte constant 870b57cec5SDimitry Andric DW_OP_const1s = 0x09, // 1-byte constant 880b57cec5SDimitry Andric DW_OP_const2u = 0x0A, // 2-byte constant 890b57cec5SDimitry Andric DW_OP_const2s = 0x0B, // 2-byte constant 900b57cec5SDimitry Andric DW_OP_const4u = 0x0C, // 4-byte constant 910b57cec5SDimitry Andric DW_OP_const4s = 0x0D, // 4-byte constant 920b57cec5SDimitry Andric DW_OP_const8u = 0x0E, // 8-byte constant 930b57cec5SDimitry Andric DW_OP_const8s = 0x0F, // 8-byte constant 940b57cec5SDimitry Andric DW_OP_constu = 0x10, // ULEB128 constant 950b57cec5SDimitry Andric DW_OP_consts = 0x11, // SLEB128 constant 960b57cec5SDimitry Andric DW_OP_dup = 0x12, 970b57cec5SDimitry Andric DW_OP_drop = 0x13, 980b57cec5SDimitry Andric DW_OP_over = 0x14, 990b57cec5SDimitry Andric DW_OP_pick = 0x15, // 1-byte stack index 1000b57cec5SDimitry Andric DW_OP_swap = 0x16, 1010b57cec5SDimitry Andric DW_OP_rot = 0x17, 1020b57cec5SDimitry Andric DW_OP_xderef = 0x18, 1030b57cec5SDimitry Andric DW_OP_abs = 0x19, 1040b57cec5SDimitry Andric DW_OP_and = 0x1A, 1050b57cec5SDimitry Andric DW_OP_div = 0x1B, 1060b57cec5SDimitry Andric DW_OP_minus = 0x1C, 1070b57cec5SDimitry Andric DW_OP_mod = 0x1D, 1080b57cec5SDimitry Andric DW_OP_mul = 0x1E, 1090b57cec5SDimitry Andric DW_OP_neg = 0x1F, 1100b57cec5SDimitry Andric DW_OP_not = 0x20, 1110b57cec5SDimitry Andric DW_OP_or = 0x21, 1120b57cec5SDimitry Andric DW_OP_plus = 0x22, 1130b57cec5SDimitry Andric DW_OP_plus_uconst = 0x23, // ULEB128 addend 1140b57cec5SDimitry Andric DW_OP_shl = 0x24, 1150b57cec5SDimitry Andric DW_OP_shr = 0x25, 1160b57cec5SDimitry Andric DW_OP_shra = 0x26, 1170b57cec5SDimitry Andric DW_OP_xor = 0x27, 1180b57cec5SDimitry Andric DW_OP_skip = 0x2F, // signed 2-byte constant 1190b57cec5SDimitry Andric DW_OP_bra = 0x28, // signed 2-byte constant 1200b57cec5SDimitry Andric DW_OP_eq = 0x29, 1210b57cec5SDimitry Andric DW_OP_ge = 0x2A, 1220b57cec5SDimitry Andric DW_OP_gt = 0x2B, 1230b57cec5SDimitry Andric DW_OP_le = 0x2C, 1240b57cec5SDimitry Andric DW_OP_lt = 0x2D, 1250b57cec5SDimitry Andric DW_OP_ne = 0x2E, 1260b57cec5SDimitry Andric DW_OP_lit0 = 0x30, // Literal 0 1270b57cec5SDimitry Andric DW_OP_lit1 = 0x31, // Literal 1 1280b57cec5SDimitry Andric DW_OP_lit2 = 0x32, // Literal 2 1290b57cec5SDimitry Andric DW_OP_lit3 = 0x33, // Literal 3 1300b57cec5SDimitry Andric DW_OP_lit4 = 0x34, // Literal 4 1310b57cec5SDimitry Andric DW_OP_lit5 = 0x35, // Literal 5 1320b57cec5SDimitry Andric DW_OP_lit6 = 0x36, // Literal 6 1330b57cec5SDimitry Andric DW_OP_lit7 = 0x37, // Literal 7 1340b57cec5SDimitry Andric DW_OP_lit8 = 0x38, // Literal 8 1350b57cec5SDimitry Andric DW_OP_lit9 = 0x39, // Literal 9 1360b57cec5SDimitry Andric DW_OP_lit10 = 0x3A, // Literal 10 1370b57cec5SDimitry Andric DW_OP_lit11 = 0x3B, // Literal 11 1380b57cec5SDimitry Andric DW_OP_lit12 = 0x3C, // Literal 12 1390b57cec5SDimitry Andric DW_OP_lit13 = 0x3D, // Literal 13 1400b57cec5SDimitry Andric DW_OP_lit14 = 0x3E, // Literal 14 1410b57cec5SDimitry Andric DW_OP_lit15 = 0x3F, // Literal 15 1420b57cec5SDimitry Andric DW_OP_lit16 = 0x40, // Literal 16 1430b57cec5SDimitry Andric DW_OP_lit17 = 0x41, // Literal 17 1440b57cec5SDimitry Andric DW_OP_lit18 = 0x42, // Literal 18 1450b57cec5SDimitry Andric DW_OP_lit19 = 0x43, // Literal 19 1460b57cec5SDimitry Andric DW_OP_lit20 = 0x44, // Literal 20 1470b57cec5SDimitry Andric DW_OP_lit21 = 0x45, // Literal 21 1480b57cec5SDimitry Andric DW_OP_lit22 = 0x46, // Literal 22 1490b57cec5SDimitry Andric DW_OP_lit23 = 0x47, // Literal 23 1500b57cec5SDimitry Andric DW_OP_lit24 = 0x48, // Literal 24 1510b57cec5SDimitry Andric DW_OP_lit25 = 0x49, // Literal 25 1520b57cec5SDimitry Andric DW_OP_lit26 = 0x4A, // Literal 26 1530b57cec5SDimitry Andric DW_OP_lit27 = 0x4B, // Literal 27 1540b57cec5SDimitry Andric DW_OP_lit28 = 0x4C, // Literal 28 1550b57cec5SDimitry Andric DW_OP_lit29 = 0x4D, // Literal 29 1560b57cec5SDimitry Andric DW_OP_lit30 = 0x4E, // Literal 30 1570b57cec5SDimitry Andric DW_OP_lit31 = 0x4F, // Literal 31 1580b57cec5SDimitry Andric DW_OP_reg0 = 0x50, // Contents of reg0 1590b57cec5SDimitry Andric DW_OP_reg1 = 0x51, // Contents of reg1 1600b57cec5SDimitry Andric DW_OP_reg2 = 0x52, // Contents of reg2 1610b57cec5SDimitry Andric DW_OP_reg3 = 0x53, // Contents of reg3 1620b57cec5SDimitry Andric DW_OP_reg4 = 0x54, // Contents of reg4 1630b57cec5SDimitry Andric DW_OP_reg5 = 0x55, // Contents of reg5 1640b57cec5SDimitry Andric DW_OP_reg6 = 0x56, // Contents of reg6 1650b57cec5SDimitry Andric DW_OP_reg7 = 0x57, // Contents of reg7 1660b57cec5SDimitry Andric DW_OP_reg8 = 0x58, // Contents of reg8 1670b57cec5SDimitry Andric DW_OP_reg9 = 0x59, // Contents of reg9 1680b57cec5SDimitry Andric DW_OP_reg10 = 0x5A, // Contents of reg10 1690b57cec5SDimitry Andric DW_OP_reg11 = 0x5B, // Contents of reg11 1700b57cec5SDimitry Andric DW_OP_reg12 = 0x5C, // Contents of reg12 1710b57cec5SDimitry Andric DW_OP_reg13 = 0x5D, // Contents of reg13 1720b57cec5SDimitry Andric DW_OP_reg14 = 0x5E, // Contents of reg14 1730b57cec5SDimitry Andric DW_OP_reg15 = 0x5F, // Contents of reg15 1740b57cec5SDimitry Andric DW_OP_reg16 = 0x60, // Contents of reg16 1750b57cec5SDimitry Andric DW_OP_reg17 = 0x61, // Contents of reg17 1760b57cec5SDimitry Andric DW_OP_reg18 = 0x62, // Contents of reg18 1770b57cec5SDimitry Andric DW_OP_reg19 = 0x63, // Contents of reg19 1780b57cec5SDimitry Andric DW_OP_reg20 = 0x64, // Contents of reg20 1790b57cec5SDimitry Andric DW_OP_reg21 = 0x65, // Contents of reg21 1800b57cec5SDimitry Andric DW_OP_reg22 = 0x66, // Contents of reg22 1810b57cec5SDimitry Andric DW_OP_reg23 = 0x67, // Contents of reg23 1820b57cec5SDimitry Andric DW_OP_reg24 = 0x68, // Contents of reg24 1830b57cec5SDimitry Andric DW_OP_reg25 = 0x69, // Contents of reg25 1840b57cec5SDimitry Andric DW_OP_reg26 = 0x6A, // Contents of reg26 1850b57cec5SDimitry Andric DW_OP_reg27 = 0x6B, // Contents of reg27 1860b57cec5SDimitry Andric DW_OP_reg28 = 0x6C, // Contents of reg28 1870b57cec5SDimitry Andric DW_OP_reg29 = 0x6D, // Contents of reg29 1880b57cec5SDimitry Andric DW_OP_reg30 = 0x6E, // Contents of reg30 1890b57cec5SDimitry Andric DW_OP_reg31 = 0x6F, // Contents of reg31 1900b57cec5SDimitry Andric DW_OP_breg0 = 0x70, // base register 0 + SLEB128 offset 1910b57cec5SDimitry Andric DW_OP_breg1 = 0x71, // base register 1 + SLEB128 offset 1920b57cec5SDimitry Andric DW_OP_breg2 = 0x72, // base register 2 + SLEB128 offset 1930b57cec5SDimitry Andric DW_OP_breg3 = 0x73, // base register 3 + SLEB128 offset 1940b57cec5SDimitry Andric DW_OP_breg4 = 0x74, // base register 4 + SLEB128 offset 1950b57cec5SDimitry Andric DW_OP_breg5 = 0x75, // base register 5 + SLEB128 offset 1960b57cec5SDimitry Andric DW_OP_breg6 = 0x76, // base register 6 + SLEB128 offset 1970b57cec5SDimitry Andric DW_OP_breg7 = 0x77, // base register 7 + SLEB128 offset 1980b57cec5SDimitry Andric DW_OP_breg8 = 0x78, // base register 8 + SLEB128 offset 1990b57cec5SDimitry Andric DW_OP_breg9 = 0x79, // base register 9 + SLEB128 offset 2000b57cec5SDimitry Andric DW_OP_breg10 = 0x7A, // base register 10 + SLEB128 offset 2010b57cec5SDimitry Andric DW_OP_breg11 = 0x7B, // base register 11 + SLEB128 offset 2020b57cec5SDimitry Andric DW_OP_breg12 = 0x7C, // base register 12 + SLEB128 offset 2030b57cec5SDimitry Andric DW_OP_breg13 = 0x7D, // base register 13 + SLEB128 offset 2040b57cec5SDimitry Andric DW_OP_breg14 = 0x7E, // base register 14 + SLEB128 offset 2050b57cec5SDimitry Andric DW_OP_breg15 = 0x7F, // base register 15 + SLEB128 offset 2060b57cec5SDimitry Andric DW_OP_breg16 = 0x80, // base register 16 + SLEB128 offset 2070b57cec5SDimitry Andric DW_OP_breg17 = 0x81, // base register 17 + SLEB128 offset 2080b57cec5SDimitry Andric DW_OP_breg18 = 0x82, // base register 18 + SLEB128 offset 2090b57cec5SDimitry Andric DW_OP_breg19 = 0x83, // base register 19 + SLEB128 offset 2100b57cec5SDimitry Andric DW_OP_breg20 = 0x84, // base register 20 + SLEB128 offset 2110b57cec5SDimitry Andric DW_OP_breg21 = 0x85, // base register 21 + SLEB128 offset 2120b57cec5SDimitry Andric DW_OP_breg22 = 0x86, // base register 22 + SLEB128 offset 2130b57cec5SDimitry Andric DW_OP_breg23 = 0x87, // base register 23 + SLEB128 offset 2140b57cec5SDimitry Andric DW_OP_breg24 = 0x88, // base register 24 + SLEB128 offset 2150b57cec5SDimitry Andric DW_OP_breg25 = 0x89, // base register 25 + SLEB128 offset 2160b57cec5SDimitry Andric DW_OP_breg26 = 0x8A, // base register 26 + SLEB128 offset 2170b57cec5SDimitry Andric DW_OP_breg27 = 0x8B, // base register 27 + SLEB128 offset 2180b57cec5SDimitry Andric DW_OP_breg28 = 0x8C, // base register 28 + SLEB128 offset 2190b57cec5SDimitry Andric DW_OP_breg29 = 0x8D, // base register 29 + SLEB128 offset 2200b57cec5SDimitry Andric DW_OP_breg30 = 0x8E, // base register 30 + SLEB128 offset 2210b57cec5SDimitry Andric DW_OP_breg31 = 0x8F, // base register 31 + SLEB128 offset 2220b57cec5SDimitry Andric DW_OP_regx = 0x90, // ULEB128 register 2230b57cec5SDimitry Andric DW_OP_fbreg = 0x91, // SLEB128 offset 2240b57cec5SDimitry Andric DW_OP_bregx = 0x92, // ULEB128 register followed by SLEB128 offset 2250b57cec5SDimitry Andric DW_OP_piece = 0x93, // ULEB128 size of piece addressed 2260b57cec5SDimitry Andric DW_OP_deref_size = 0x94, // 1-byte size of data retrieved 2270b57cec5SDimitry Andric DW_OP_xderef_size = 0x95, // 1-byte size of data retrieved 2280b57cec5SDimitry Andric DW_OP_nop = 0x96, 2290b57cec5SDimitry Andric DW_OP_push_object_addres = 0x97, 2300b57cec5SDimitry Andric DW_OP_call2 = 0x98, // 2-byte offset of DIE 2310b57cec5SDimitry Andric DW_OP_call4 = 0x99, // 4-byte offset of DIE 2320b57cec5SDimitry Andric DW_OP_call_ref = 0x9A, // 4- or 8-byte offset of DIE 2330b57cec5SDimitry Andric DW_OP_lo_user = 0xE0, 2340b57cec5SDimitry Andric DW_OP_APPLE_uninit = 0xF0, 2350b57cec5SDimitry Andric DW_OP_hi_user = 0xFF 2360b57cec5SDimitry Andric }; 2370b57cec5SDimitry Andric 2380b57cec5SDimitry Andric 2390b57cec5SDimitry Andric #endif 240