// This file originally from https://github.com/philipc/rust-dwarf/ and // distributed under either MIT or Apache 2.0 licenses. // // Copyright 2016 The rust-dwarf Developers // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License.
//! Constant definitions. //! //! The DWARF spec's `DW_AT_*` type is represented as `struct DwAt(u16)`, //! `DW_FORM_*` as `DwForm(u16)`, etc. //! //! There are also exported const definitions for each constant.
dw!( /// The section type field in a `.dwp` unit index. /// /// This is used for version 5 and later. /// /// See Section 7.3.5.
DwSect(u32) {
DW_SECT_INFO = 1,
DW_SECT_ABBREV = 3,
DW_SECT_LINE = 4,
DW_SECT_LOCLISTS = 5,
DW_SECT_STR_OFFSETS = 6,
DW_SECT_MACRO = 7,
DW_SECT_RNGLISTS = 8,
});
dw!( /// The section type field in a `.dwp` unit index with version 2.
DwSectV2(u32) {
DW_SECT_V2_INFO = 1,
DW_SECT_V2_TYPES = 2,
DW_SECT_V2_ABBREV = 3,
DW_SECT_V2_LINE = 4,
DW_SECT_V2_LOC = 5,
DW_SECT_V2_STR_OFFSETS = 6,
DW_SECT_V2_MACINFO = 7,
DW_SECT_V2_MACRO = 8,
});
dw!( /// The unit type field in a unit header. /// /// See Section 7.5.1, Table 7.2.
DwUt(u8) {
DW_UT_compile = 0x01,
DW_UT_type = 0x02,
DW_UT_partial = 0x03,
DW_UT_skeleton = 0x04,
DW_UT_split_compile = 0x05,
DW_UT_split_type = 0x06,
DW_UT_lo_user = 0x80,
DW_UT_hi_user = 0xff,
});
dw!( /// The opcode for a call frame instruction. /// /// Section 7.24: /// > Call frame instructions are encoded in one or more bytes. The primary /// > opcode is encoded in the high order two bits of the first byte (that is, /// > opcode = byte >> 6). An operand or extended opcode may be encoded in the /// > low order 6 bits. Additional operands are encoded in subsequent bytes.
DwCfa(u8) {
DW_CFA_advance_loc = 0x01 << 6,
DW_CFA_offset = 0x02 << 6,
DW_CFA_restore = 0x03 << 6,
DW_CFA_nop = 0,
DW_CFA_set_loc = 0x01,
DW_CFA_advance_loc1 = 0x02,
DW_CFA_advance_loc2 = 0x03,
DW_CFA_advance_loc4 = 0x04,
DW_CFA_offset_extended = 0x05,
DW_CFA_restore_extended = 0x06,
DW_CFA_undefined = 0x07,
DW_CFA_same_value = 0x08,
DW_CFA_register = 0x09,
DW_CFA_remember_state = 0x0a,
DW_CFA_restore_state = 0x0b,
DW_CFA_def_cfa = 0x0c,
DW_CFA_def_cfa_register = 0x0d,
DW_CFA_def_cfa_offset = 0x0e,
DW_CFA_def_cfa_expression = 0x0f,
DW_CFA_expression = 0x10,
DW_CFA_offset_extended_sf = 0x11,
DW_CFA_def_cfa_sf = 0x12,
DW_CFA_def_cfa_offset_sf = 0x13,
DW_CFA_val_offset = 0x14,
DW_CFA_val_offset_sf = 0x15,
DW_CFA_val_expression = 0x16,
dw!( /// The encodings of the constants used in location list entries. /// /// See Section 7.7.3, Table 7.10.
DwLle(u8) {
DW_LLE_end_of_list = 0x00,
DW_LLE_base_addressx = 0x01,
DW_LLE_startx_endx = 0x02,
DW_LLE_startx_length = 0x03,
DW_LLE_offset_pair = 0x04,
DW_LLE_default_location = 0x05,
DW_LLE_base_address = 0x06,
DW_LLE_start_end = 0x07,
DW_LLE_start_length = 0x08,
DW_LLE_GNU_view_pair = 0x09,
});
dw!( /// The encodings of the constants used in the `DW_AT_decimal_sign` attribute. /// /// See Section 7.8, Table 7.12.
DwDs(u8) {
DW_DS_unsigned = 0x01,
DW_DS_leading_overpunch = 0x02,
DW_DS_trailing_overpunch = 0x03,
DW_DS_leading_separate = 0x04,
DW_DS_trailing_separate = 0x05,
});
dw!( /// The encodings of the constants used in the `DW_AT_endianity` attribute. /// /// See Section 7.8, Table 7.13.
DwEnd(u8) {
DW_END_default = 0x00,
DW_END_big = 0x01,
DW_END_little = 0x02,
DW_END_lo_user = 0x40,
DW_END_hi_user = 0xff,
});
dw!( /// The encodings of the constants used in the `DW_AT_accessibility` attribute. /// /// See Section 7.9, Table 7.14.
DwAccess(u8) {
DW_ACCESS_public = 0x01,
DW_ACCESS_protected = 0x02,
DW_ACCESS_private = 0x03,
});
dw!( /// The encodings of the constants used in the `DW_AT_visibility` attribute. /// /// See Section 7.10, Table 7.15.
DwVis(u8) {
DW_VIS_local = 0x01,
DW_VIS_exported = 0x02,
DW_VIS_qualified = 0x03,
});
dw!( /// The encodings of the constants used in the `DW_AT_virtuality` attribute. /// /// See Section 7.11, Table 7.16.
DwVirtuality(u8) {
DW_VIRTUALITY_none = 0x00,
DW_VIRTUALITY_virtual = 0x01,
DW_VIRTUALITY_pure_virtual = 0x02,
});
dw!( /// The encodings of the constants used in the `DW_AT_address_class` attribute. /// /// There is only one value that is common to all target architectures. /// See Section 7.13.
DwAddr(u64) {
DW_ADDR_none = 0x00,
});
dw!( /// The encodings of the constants used in the `DW_AT_identifier_case` attribute. /// /// See Section 7.14, Table 7.18.
DwId(u8) {
DW_ID_case_sensitive = 0x00,
DW_ID_up_case = 0x01,
DW_ID_down_case = 0x02,
DW_ID_case_insensitive = 0x03,
});
dw!( /// The encodings of the constants used in the `DW_AT_calling_convention` attribute. /// /// See Section 7.15, Table 7.19.
DwCc(u8) {
DW_CC_normal = 0x01,
DW_CC_program = 0x02,
DW_CC_nocall = 0x03,
DW_CC_pass_by_reference = 0x04,
DW_CC_pass_by_value = 0x05,
DW_CC_lo_user = 0x40,
DW_CC_hi_user = 0xff,
});
dw!( /// The encodings of the constants used in the `DW_AT_inline` attribute. /// /// See Section 7.16, Table 7.20.
DwInl(u8) {
DW_INL_not_inlined = 0x00,
DW_INL_inlined = 0x01,
DW_INL_declared_not_inlined = 0x02,
DW_INL_declared_inlined = 0x03,
});
dw!( /// The encodings of the constants used in the `DW_AT_ordering` attribute. /// /// See Section 7.17, Table 7.17.
DwOrd(u8) {
DW_ORD_row_major = 0x00,
DW_ORD_col_major = 0x01,
});
dw!( /// The encodings of the constants used in the `DW_AT_discr_list` attribute. /// /// See Section 7.18, Table 7.22.
DwDsc(u8) {
DW_DSC_label = 0x00,
DW_DSC_range = 0x01,
});
dw!( /// The encodings of the constants used in the `DW_AT_defaulted` attribute. /// /// See Section 7.20, Table 7.24.
DwDefaulted(u8) {
DW_DEFAULTED_no = 0x00,
DW_DEFAULTED_in_class = 0x01,
DW_DEFAULTED_out_of_class = 0x02,
});
dw!( /// The encodings for the standard opcodes for line number information. /// /// See Section 7.22, Table 7.25.
DwLns(u8) {
DW_LNS_copy = 0x01,
DW_LNS_advance_pc = 0x02,
DW_LNS_advance_line = 0x03,
DW_LNS_set_file = 0x04,
DW_LNS_set_column = 0x05,
DW_LNS_negate_stmt = 0x06,
DW_LNS_set_basic_block = 0x07,
DW_LNS_const_add_pc = 0x08,
DW_LNS_fixed_advance_pc = 0x09,
DW_LNS_set_prologue_end = 0x0a,
DW_LNS_set_epilogue_begin = 0x0b,
DW_LNS_set_isa = 0x0c,
});
dw!( /// The encodings for the extended opcodes for line number information. /// /// See Section 7.22, Table 7.26.
DwLne(u8) {
DW_LNE_end_sequence = 0x01,
DW_LNE_set_address = 0x02,
DW_LNE_define_file = 0x03,
DW_LNE_set_discriminator = 0x04,
DW_LNE_lo_user = 0x80,
DW_LNE_hi_user = 0xff,
});
dw!( /// The encodings for the line number header entry formats. /// /// See Section 7.22, Table 7.27.
DwLnct(u16) {
DW_LNCT_path = 0x1,
DW_LNCT_directory_index = 0x2,
DW_LNCT_timestamp = 0x3,
DW_LNCT_size = 0x4,
DW_LNCT_MD5 = 0x5,
DW_LNCT_lo_user = 0x2000,
DW_LNCT_hi_user = 0x3fff,
});
// "Unsigned value is encoded using the Little Endian Base 128"
DW_EH_PE_uleb128 = 0x1, // "A 2 bytes unsigned value."
DW_EH_PE_udata2 = 0x2, // "A 4 bytes unsigned value."
DW_EH_PE_udata4 = 0x3, // "An 8 bytes unsigned value."
DW_EH_PE_udata8 = 0x4, // "Signed value is encoded using the Little Endian Base 128"
DW_EH_PE_sleb128 = 0x9, // "A 2 bytes signed value."
DW_EH_PE_sdata2 = 0x0a, // "A 4 bytes signed value."
DW_EH_PE_sdata4 = 0x0b, // "An 8 bytes signed value."
DW_EH_PE_sdata8 = 0x0c,
// How the pointer encoding should be applied.
// `DW_EH_PE_pcrel` pointers are relative to their own location.
DW_EH_PE_pcrel = 0x10, // "Value is relative to the beginning of the .text section."
DW_EH_PE_textrel = 0x20, // "Value is relative to the beginning of the .got or .eh_frame_hdr section."
DW_EH_PE_datarel = 0x30, // "Value is relative to the beginning of the function."
DW_EH_PE_funcrel = 0x40, // "Value is aligned to an address unit sized boundary."
DW_EH_PE_aligned = 0x50,
// This bit can be set for any of the above encoding applications. When set, // the encoded value is the address of the real pointer result, not the // pointer result itself. // // This isn't defined in the DWARF or the `.eh_frame` standards, but is // generated by both GNU/Linux and macOS tooling.
DW_EH_PE_indirect = 0x80,
// These constants apply to both the lower and upper bits.
// "The Value is a literal pointer whose size is determined by the // architecture."
DW_EH_PE_absptr = 0x0, // The absence of a pointer and encoding.
DW_EH_PE_omit = 0xff,
});
impl DwEhPe { /// Get the pointer encoding's format. #[inline] pubfn format(self) -> DwEhPe {
DwEhPe(self.0 & DW_EH_PE_FORMAT_MASK)
}
/// Get the pointer encoding's application. #[inline] pubfn application(self) -> DwEhPe {
DwEhPe(self.0 & DW_EH_PE_APPLICATION_MASK)
}
/// Is this encoding the absent pointer encoding? #[inline] pubfn is_absent(self) -> bool { self == DW_EH_PE_omit
}
/// Is this coding indirect? If so, its encoded value is the address of the /// real pointer result, not the pointer result itself. #[inline] pubfn is_indirect(self) -> bool { self.0 & DW_EH_PE_indirect.0 != 0
}
/// Is this a known, valid pointer encoding? pubfn is_valid_encoding(self) -> bool { ifself.is_absent() { returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.