diff options
Diffstat (limited to 'contrib/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp')
-rw-r--r-- | contrib/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/contrib/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/contrib/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp index ab67464..02b15d6 100644 --- a/contrib/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/contrib/llvm/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -12,6 +12,7 @@ #include "DWARFContext.h" #include "DWARFDebugAbbrev.h" #include "DWARFFormValue.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" @@ -39,7 +40,7 @@ void DWARFDebugInfoEntryMinimal::dump(raw_ostream &OS, OS << format(" [%u] %c\n", abbrCode, AbbrevDecl->hasChildren() ? '*' : ' '); - // Dump all data in the .debug_info for the attributes + // Dump all data in the DIE for the attributes. const uint32_t numAttributes = AbbrevDecl->getNumAttributes(); for (uint32_t i = 0; i != numAttributes; ++i) { uint16_t attr = AbbrevDecl->getAttrByIndex(i); @@ -113,9 +114,14 @@ bool DWARFDebugInfoEntryMinimal::extractFast(const DWARFCompileUnit *cu, uint32_t i; uint16_t form; for (i=0; i<numAttributes; ++i) { + form = AbbrevDecl->getFormByIndex(i); - const uint8_t fixed_skip_size = fixed_form_sizes[form]; + // FIXME: Currently we're checking if this is less than the last + // entry in the fixed_form_sizes table, but this should be changed + // to use dynamic dispatch. + const uint8_t fixed_skip_size = (form < DW_FORM_ref_sig8) ? + fixed_form_sizes[form] : 0; if (fixed_skip_size) offset += fixed_skip_size; else { @@ -187,6 +193,8 @@ bool DWARFDebugInfoEntryMinimal::extractFast(const DWARFCompileUnit *cu, case DW_FORM_sdata: case DW_FORM_udata: case DW_FORM_ref_udata: + case DW_FORM_GNU_str_index: + case DW_FORM_GNU_addr_index: debug_info_data.getULEB128(&offset); break; @@ -195,11 +203,9 @@ bool DWARFDebugInfoEntryMinimal::extractFast(const DWARFCompileUnit *cu, form = debug_info_data.getULEB128(&offset); break; + // FIXME: 64-bit for DWARF64 case DW_FORM_sec_offset: - if (cu->getAddressByteSize() == 4) - debug_info_data.getU32(offset_ptr); - else - debug_info_data.getU64(offset_ptr); + debug_info_data.getU32(offset_ptr); break; default: @@ -207,7 +213,6 @@ bool DWARFDebugInfoEntryMinimal::extractFast(const DWARFCompileUnit *cu, return false; } offset += form_size; - } while (form_is_indirect); } } @@ -327,6 +332,8 @@ DWARFDebugInfoEntryMinimal::extract(const DWARFCompileUnit *cu, case DW_FORM_sdata: case DW_FORM_udata: case DW_FORM_ref_udata: + case DW_FORM_GNU_str_index: + case DW_FORM_GNU_addr_index: debug_info_data.getULEB128(&offset); break; @@ -335,11 +342,9 @@ DWARFDebugInfoEntryMinimal::extract(const DWARFCompileUnit *cu, form_is_indirect = true; break; + // FIXME: 64-bit for DWARF64. case DW_FORM_sec_offset: - if (cu->getAddressByteSize() == 4) - debug_info_data.getU32(offset_ptr); - else - debug_info_data.getU64(offset_ptr); + debug_info_data.getU32(offset_ptr); break; default: @@ -417,8 +422,7 @@ DWARFDebugInfoEntryMinimal::getAttributeValueAsString( const { DWARFFormValue form_value; if (getAttributeValue(cu, attr, form_value)) { - DataExtractor stringExtractor(cu->getContext().getStringSection(), - false, 0); + DataExtractor stringExtractor(cu->getStringSection(), false, 0); return form_value.getAsCString(&stringExtractor); } return fail_value; |