1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Import/update constants from the DWARF 5 public review draft document.

https://reviews.llvm.org/D26051

llvm-svn: 285421
This commit is contained in:
Adrian Prantl 2016-10-28 17:59:50 +00:00
parent 7322acc850
commit f6faf0b5e5
7 changed files with 170 additions and 31 deletions

View File

@ -14,7 +14,9 @@
// TODO: Add other DW-based macros.
#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_OP || \
defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_CC)
defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
defined HANDLE_DW_CC || defined HANDLE_DW_LNCT || \
defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE)
#error "Missing macro definition of HANDLE_DW*"
#endif
@ -38,10 +40,26 @@
#define HANDLE_DW_VIRTUALITY(ID, NAME)
#endif
#ifndef HANDLE_DW_DEFAULTED
#define HANDLE_DW_DEFAULTED(ID, NAME)
#endif
#ifndef HANDLE_DW_CC
#define HANDLE_DW_CC(ID, NAME)
#endif
#ifndef HANDLE_DW_LNCT
#define HANDLE_DW_LNCT(ID, NAME)
#endif
#ifndef HANDLE_DW_MACRO
#define HANDLE_DW_MACRO(ID, NAME)
#endif
#ifndef HANDLE_DW_RLE
#define HANDLE_DW_RLE(ID, NAME)
#endif
HANDLE_DW_TAG(0x0000, null)
HANDLE_DW_TAG(0x0001, array_type)
HANDLE_DW_TAG(0x0002, class_type)
@ -108,6 +126,11 @@ HANDLE_DW_TAG(0x0043, template_alias)
HANDLE_DW_TAG(0x0044, coarray_type)
HANDLE_DW_TAG(0x0045, generic_subrange)
HANDLE_DW_TAG(0x0046, dynamic_type)
HANDLE_DW_TAG(0x0047, atomic_type)
HANDLE_DW_TAG(0x0048, call_site)
HANDLE_DW_TAG(0x0049, call_site_parameter)
HANDLE_DW_TAG(0x004a, skeleton_unit)
HANDLE_DW_TAG(0x004b, immutable_type)
// User-defined tags.
HANDLE_DW_TAG(0x4081, MIPS_loop)
@ -278,7 +301,18 @@ HANDLE_DW_OP(0x9c, call_frame_cfa)
HANDLE_DW_OP(0x9d, bit_piece)
HANDLE_DW_OP(0x9e, implicit_value)
HANDLE_DW_OP(0x9f, stack_value)
HANDLE_DW_OP(0xa0, implicit_pointer)
HANDLE_DW_OP(0xa1, addrx)
HANDLE_DW_OP(0xa2, constx)
HANDLE_DW_OP(0xa3, entry_value)
HANDLE_DW_OP(0xa4, const_type)
HANDLE_DW_OP(0xa5, regval_type)
HANDLE_DW_OP(0xa6, deref_type)
HANDLE_DW_OP(0xa7, xderef_type)
HANDLE_DW_OP(0xa8, convert)
HANDLE_DW_OP(0xa9, reinterpret)
// Vendor extensions.
// Extensions for GNU-style thread-local storage.
HANDLE_DW_OP(0xe0, GNU_push_tls_address)
@ -324,6 +358,9 @@ HANDLE_DW_LANG(0x0020, Dylan)
HANDLE_DW_LANG(0x0021, C_plus_plus_14)
HANDLE_DW_LANG(0x0022, Fortran03)
HANDLE_DW_LANG(0x0023, Fortran08)
HANDLE_DW_LANG(0x0024, RenderScript)
// Vendor extensions.
HANDLE_DW_LANG(0x8001, Mips_Assembler)
HANDLE_DW_LANG(0x8e57, GOOGLE_RenderScript)
HANDLE_DW_LANG(0xb000, BORLAND_Delphi)
@ -345,16 +382,25 @@ HANDLE_DW_ATE(0x0d, signed_fixed)
HANDLE_DW_ATE(0x0e, unsigned_fixed)
HANDLE_DW_ATE(0x0f, decimal_float)
HANDLE_DW_ATE(0x10, UTF)
HANDLE_DW_ATE(0x11, UCS)
HANDLE_DW_ATE(0x12, ASCII)
// DWARF virtuality codes.
HANDLE_DW_VIRTUALITY(0x00, none)
HANDLE_DW_VIRTUALITY(0x01, virtual)
HANDLE_DW_VIRTUALITY(0x02, pure_virtual)
// DWARF v5 Defaulted Member Encodings.
HANDLE_DW_DEFAULTED(0x00, DW_DEFAULTED_no)
HANDLE_DW_DEFAULTED(0x01, DW_DEFAULTED_in_class)
HANDLE_DW_DEFAULTED(0x02, DW_DEFAULTED_out_of_class)
// DWARF calling convention codes.
HANDLE_DW_CC(0x01, normal)
HANDLE_DW_CC(0x02, program)
HANDLE_DW_CC(0x03, nocall)
HANDLE_DW_CC(0x04, pass_by_reference)
HANDLE_DW_CC(0x05, pass_by_value)
HANDLE_DW_CC(0x41, GNU_borland_fastcall_i386)
HANDLE_DW_CC(0xb0, BORLAND_safecall)
HANDLE_DW_CC(0xb1, BORLAND_stdcall)
@ -365,9 +411,43 @@ HANDLE_DW_CC(0xb5, BORLAND_thiscall)
HANDLE_DW_CC(0xb6, BORLAND_fastcall)
HANDLE_DW_CC(0xc0, LLVM_vectorcall)
// DWARF v5 Line number header entry format.
HANDLE_DW_LNCT(0x01, DW_LNCT_path)
HANDLE_DW_LNCT(0x02, DW_LNCT_directory_index)
HANDLE_DW_LNCT(0x03, DW_LNCT_timestamp)
HANDLE_DW_LNCT(0x04, DW_LNCT_size)
HANDLE_DW_LNCT(0x05, DW_LNCT_MD5)
HANDLE_DW_MACRO(0x01, DW_MACRO_define)
HANDLE_DW_MACRO(0x02, DW_MACRO_undef)
HANDLE_DW_MACRO(0x03, DW_MACRO_start_file)
HANDLE_DW_MACRO(0x04, DW_MACRO_end_file)
HANDLE_DW_MACRO(0x05, DW_MACRO_define_strp)
HANDLE_DW_MACRO(0x06, DW_MACRO_undef_strp)
HANDLE_DW_MACRO(0x07, DW_MACRO_import)
HANDLE_DW_MACRO(0x08, DW_MACRO_define_sup)
HANDLE_DW_MACRO(0x09, DW_MACRO_undef_sup)
HANDLE_DW_MACRO(0x0a, DW_MACRO_import_sup)
HANDLE_DW_MACRO(0x0b, DW_MACRO_define_strx)
HANDLE_DW_MACRO(0x0c, DW_MACRO_undef_strx)
// Range list entry encoding values.
HANDLE_DW_RLE(0x00, DW_RLE_end_of_list)
HANDLE_DW_RLE(0x01, DW_RLE_base_addressx)
HANDLE_DW_RLE(0x02, DW_RLE_startx_endx)
HANDLE_DW_RLE(0x03, DW_RLE_startx_length)
HANDLE_DW_RLE(0x04, DW_RLE_offset_pair)
HANDLE_DW_RLE(0x05, DW_RLE_base_address)
HANDLE_DW_RLE(0x06, DW_RLE_start_end)
HANDLE_DW_RLE(0x07, DW_RLE_start_length)
#undef HANDLE_DW_TAG
#undef HANDLE_DW_OP
#undef HANDLE_DW_LANG
#undef HANDLE_DW_ATE
#undef HANDLE_DW_VIRTUALITY
#undef HANDLE_DW_DEFAULTED
#undef HANDLE_DW_CC
#undef HANDLE_DW_LNCT
#undef HANDLE_DW_MACRO
#undef HANDLE_DW_RLE

View File

@ -191,14 +191,31 @@ enum Attribute : uint16_t {
DW_AT_rank = 0x71,
DW_AT_str_offsets_base = 0x72,
DW_AT_addr_base = 0x73,
DW_AT_ranges_base = 0x74,
DW_AT_dwo_id = 0x75,
DW_AT_rnglists_base = 0x74,
DW_AT_dwo_id = 0x75, ///< Retracted from DWARF 5.
DW_AT_dwo_name = 0x76,
DW_AT_reference = 0x77,
DW_AT_rvalue_reference = 0x78,
DW_AT_macros = 0x79,
DW_AT_call_all_calls = 0x7a,
DW_AT_call_all_source_calls = 0x7b,
DW_AT_call_all_tail_calls = 0x7c,
DW_AT_call_return_pc = 0x7d,
DW_AT_call_value = 0x7e,
DW_AT_call_origin = 0x7f,
DW_AT_call_parameter = 0x80,
DW_AT_call_pc = 0x81,
DW_AT_call_tail_call = 0x82,
DW_AT_call_target = 0x83,
DW_AT_call_target_clobbered = 0x84,
DW_AT_call_data_location = 0x85,
DW_AT_call_data_value = 0x86,
DW_AT_noreturn = 0x87,
DW_AT_alignment = 0x88,
DW_AT_export_symbols = 0x89,
DW_AT_deleted = 0x8a,
DW_AT_defaulted = 0x8b,
DW_AT_loclists_base = 0x8c,
DW_AT_lo_user = 0x2000,
DW_AT_hi_user = 0x3fff,
@ -311,7 +328,18 @@ enum Form : uint16_t {
DW_FORM_sec_offset = 0x17,
DW_FORM_exprloc = 0x18,
DW_FORM_flag_present = 0x19,
// New in DWARF v5.
DW_FORM_strx = 0x1a,
DW_FORM_addrx = 0x1b,
DW_FORM_ref_sup = 0x1c,
DW_FORM_strp_sup = 0x1d,
DW_FORM_data16 = 0x1e,
DW_FORM_line_strp = 0x1f,
DW_FORM_ref_sig8 = 0x20,
DW_FORM_implicit_const = 0x21,
DW_FORM_loclistx = 0x22,
DW_FORM_rnglistx = 0x23,
DW_FORM_lo_user = 0x1f00,
// Extensions for Fission proposal
@ -375,6 +403,12 @@ enum VirtualityAttribute {
DW_VIRTUALITY_max = 0x02
};
enum DefaultedMemberAttribute {
#define HANDLE_DW_DEFAULTED(ID, NAME) DW_DEFAULTED_##NAME = ID,
#include "llvm/Support/Dwarf.def"
DW_DEFAULTED_max = 0x02
};
enum SourceLanguage {
#define HANDLE_DW_LANG(ID, NAME) DW_LANG_##NAME = ID,
#include "llvm/Support/Dwarf.def"
@ -445,6 +479,13 @@ enum LineNumberExtendedOps {
DW_LNE_hi_user = 0xff
};
enum LinerNumberEntryFormat {
#define HANDLE_DW_LNCT(ID, NAME) DW_DEFAULTED_##NAME = ID,
#include "llvm/Support/Dwarf.def"
DW_LNCT_lo_user = 0x2000,
DW_LNCT_hi_user = 0x3fff,
};
enum MacinfoRecordType {
// Macinfo Type Encodings
DW_MACINFO_define = 0x01,
@ -454,24 +495,21 @@ enum MacinfoRecordType {
DW_MACINFO_vendor_ext = 0xff
};
/// DWARF v5 macro information entry type encodings.
enum MacroEntryType {
// Macro Information Entry Type Encodings
DW_MACRO_define = 0x01,
DW_MACRO_undef = 0x02,
DW_MACRO_start_file = 0x03,
DW_MACRO_end_file = 0x04,
DW_MACRO_define_indirect = 0x05,
DW_MACRO_undef_indirect = 0x06,
DW_MACRO_transparent_include = 0x07,
DW_MACRO_define_indirect_sup = 0x08,
DW_MACRO_undef_indirect_sup = 0x09,
DW_MACRO_transparent_include_sup = 0x0a,
DW_MACRO_define_indirectx = 0x0b,
DW_MACRO_undef_indirectx = 0x0c,
#define HANDLE_DW_MACRO(ID, NAME) DW_DEFAULTED_##NAME = ID,
#include "llvm/Support/Dwarf.def"
DW_MACRO_lo_user = 0xe0,
DW_MACRO_hi_user = 0xff
};
/// DWARF v5 range list entry encoding values.
enum RangeListEntries {
#define HANDLE_DW_RLE(ID, NAME) DW_DEFAULTED_##NAME = ID,
#include "llvm/Support/Dwarf.def"
};
enum CallFrameInfo {
// Call frame instruction encodings
DW_CFA_extended = 0x00,
@ -532,13 +570,17 @@ enum Constants {
DW_EH_PE_indirect = 0x80
};
// Constants for debug_loc.dwo in the DWARF5 Split Debug Info Proposal
/// Constants for location lists in DWARF v5.
enum LocationListEntry : unsigned char {
DW_LLE_end_of_list_entry,
DW_LLE_base_address_selection_entry,
DW_LLE_start_end_entry,
DW_LLE_start_length_entry,
DW_LLE_offset_pair_entry
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
};
/// Constants for the DW_APPLE_PROPERTY_attributes attribute.

View File

@ -1523,14 +1523,14 @@ void DwarfDebug::emitDebugLocDWO() {
// rather than two. We could get fancier and try to, say, reuse an
// address we know we've emitted elsewhere (the start of the function?
// The start of the CU or CU subrange that encloses this range?)
Asm->EmitInt8(dwarf::DW_LLE_start_length_entry);
Asm->EmitInt8(dwarf::DW_LLE_startx_length);
unsigned idx = AddrPool.getIndex(Entry.BeginSym);
Asm->EmitULEB128(idx);
Asm->EmitLabelDifference(Entry.EndSym, Entry.BeginSym, 4);
emitDebugLocEntryLocation(Entry);
}
Asm->EmitInt8(dwarf::DW_LLE_end_of_list_entry);
Asm->EmitInt8(dwarf::DW_LLE_end_of_list);
}
}

View File

@ -312,7 +312,7 @@ uint64_t
DWARFDebugInfoEntryMinimal::getRangesBaseAttribute(const DWARFUnit *U,
uint64_t FailValue) const {
uint64_t Result =
getAttributeValueAsSectionOffset(U, DW_AT_ranges_base, -1ULL);
getAttributeValueAsSectionOffset(U, DW_AT_rnglists_base, -1ULL);
if (Result != -1ULL)
return Result;
return getAttributeValueAsSectionOffset(U, DW_AT_GNU_ranges_base, FailValue);

View File

@ -82,9 +82,9 @@ void DWARFDebugLocDWO::parse(DataExtractor data) {
Loc.Offset = Offset;
dwarf::LocationListEntry Kind;
while ((Kind = static_cast<dwarf::LocationListEntry>(
data.getU8(&Offset))) != dwarf::DW_LLE_end_of_list_entry) {
data.getU8(&Offset))) != dwarf::DW_LLE_end_of_list) {
if (Kind != dwarf::DW_LLE_start_length_entry) {
if (Kind != dwarf::DW_LLE_startx_length) {
llvm::errs() << "error: dumping support for LLE of kind " << (int)Kind
<< " not implemented\n";
return;

View File

@ -257,7 +257,7 @@ size_t DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
AddrOffsetSectionBase = DieArray[0].getAttributeValueAsSectionOffset(
this, DW_AT_GNU_addr_base, 0);
RangeSectionBase = DieArray[0].getAttributeValueAsSectionOffset(
this, DW_AT_ranges_base, 0);
this, DW_AT_rnglists_base, 0);
// Don't fall back to DW_AT_GNU_ranges_base: it should be ignored for
// skeleton CU DIE, so that DWARF users not aware of it are not broken.
}

View File

@ -143,14 +143,31 @@ StringRef llvm::dwarf::AttributeString(unsigned Attribute) {
case DW_AT_rank: return "DW_AT_rank";
case DW_AT_str_offsets_base: return "DW_AT_str_offsets_base";
case DW_AT_addr_base: return "DW_AT_addr_base";
case DW_AT_ranges_base: return "DW_AT_ranges_base";
case DW_AT_rnglists_base: return "DW_AT_rnglists_base";
case DW_AT_dwo_id: return "DW_AT_dwo_id";
case DW_AT_dwo_name: return "DW_AT_dwo_name";
case DW_AT_reference: return "DW_AT_reference";
case DW_AT_rvalue_reference: return "DW_AT_rvalue_reference";
case DW_AT_macros: return "DW_AT_macros";
case DW_AT_call_all_calls: return "DW_AT_call_all_calls";
case DW_AT_call_all_source_calls: return "DW_AT_call_all_source_calls";
case DW_AT_call_all_tail_calls: return "DW_AT_call_all_tail_calls";
case DW_AT_call_return_pc: return "DW_AT_call_return_pc";
case DW_AT_call_value: return "DW_AT_call_value";
case DW_AT_call_origin: return "DW_AT_call_origin";
case DW_AT_call_parameter: return "DW_AT_call_parameter";
case DW_AT_call_pc: return "DW_AT_call_pc";
case DW_AT_call_tail_call: return "DW_AT_call_tail_call";
case DW_AT_call_target: return "DW_AT_call_target";
case DW_AT_call_target_clobbered: return "DW_AT_call_target_clobbered";
case DW_AT_call_data_location: return "DW_AT_call_data_location";
case DW_AT_call_data_value: return "DW_AT_call_data_value";
case DW_AT_noreturn: return "DW_AT_noreturn";
case DW_AT_alignment:
return "DW_AT_alignment";
case DW_AT_alignment: return "DW_AT_alignment";
case DW_AT_export_symbols: return "DW_AT_export_symbols";
case DW_AT_deleted: return "DW_AT_deleted";
case DW_AT_defaulted: return "DW_AT_defaulted";
case DW_AT_loclists_base: return "DW_AT_loclists_base";
case DW_AT_MIPS_loop_begin: return "DW_AT_MIPS_loop_begin";
case DW_AT_MIPS_tail_loop_begin: return "DW_AT_MIPS_tail_loop_begin";
case DW_AT_MIPS_epilog_begin: return "DW_AT_MIPS_epilog_begin";