diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp | 139 |
1 files changed, 103 insertions, 36 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 4fde5748d3f..c3d001cef9c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -196,6 +196,10 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, case DW_FORM_data8: m_value.value.uval = data.GetU64(offset_ptr); break; + case DW_FORM_data16: + m_value.value.uval = 16; + is_block = true; + break; case DW_FORM_string: m_value.value.cstr = data.GetCStr(offset_ptr); break; @@ -218,10 +222,26 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, m_value.value.sval = data.GetSLEB128(offset_ptr); break; case DW_FORM_strp: + case DW_FORM_line_strp: assert(m_cu); m_value.value.uval = data.GetMaxU64(offset_ptr, DWARFUnit::IsDWARF64(m_cu) ? 8 : 4); break; + case DW_FORM_strx: + m_value.value.uval = data.GetULEB128(offset_ptr); + break; + case DW_FORM_strx1: + m_value.value.uval = data.GetU8(offset_ptr); + break; + case DW_FORM_strx2: + m_value.value.uval = data.GetU16(offset_ptr); + break; + case DW_FORM_strx3: + m_value.value.uval = data.GetMaxU64(offset_ptr, 3); + break; + case DW_FORM_strx4: + m_value.value.uval = data.GetU32(offset_ptr); + break; // case DW_FORM_APPLE_db_str: case DW_FORM_udata: m_value.value.uval = data.GetULEB128(offset_ptr); @@ -348,47 +368,56 @@ bool DWARFFormValue::SkipValue(dw_form_t form, case DW_FORM_flag_present: return true; - // 1 byte values - case DW_FORM_data1: - case DW_FORM_flag: - case DW_FORM_ref1: - *offset_ptr += 1; - return true; + // 1 byte values + case DW_FORM_data1: + case DW_FORM_flag: + case DW_FORM_ref1: + case DW_FORM_strx1: + *offset_ptr += 1; + return true; - // 2 byte values - case DW_FORM_data2: - case DW_FORM_ref2: - *offset_ptr += 2; - return true; + // 2 byte values + case DW_FORM_data2: + case DW_FORM_ref2: + case DW_FORM_strx2: + *offset_ptr += 2; + return true; - // 32 bit for DWARF 32, 64 for DWARF 64 - case DW_FORM_sec_offset: - case DW_FORM_strp: - assert(cu); - *offset_ptr += (cu->IsDWARF64() ? 8 : 4); - return true; + // 3 byte values + case DW_FORM_strx3: + *offset_ptr += 3; + return true; - // 4 byte values - case DW_FORM_data4: - case DW_FORM_ref4: - *offset_ptr += 4; - return true; + // 32 bit for DWARF 32, 64 for DWARF 64 + case DW_FORM_sec_offset: + case DW_FORM_strp: + assert(cu); + *offset_ptr += (cu->IsDWARF64() ? 8 : 4); + return true; - // 8 byte values - case DW_FORM_data8: - case DW_FORM_ref8: - case DW_FORM_ref_sig8: - *offset_ptr += 8; - return true; + // 4 byte values + case DW_FORM_data4: + case DW_FORM_ref4: + case DW_FORM_strx4: + *offset_ptr += 4; + return true; - // signed or unsigned LEB 128 values - case DW_FORM_sdata: - case DW_FORM_udata: - case DW_FORM_ref_udata: - case DW_FORM_GNU_addr_index: - case DW_FORM_GNU_str_index: - debug_info_data.Skip_LEB128(offset_ptr); - return true; + // 8 byte values + case DW_FORM_data8: + case DW_FORM_ref8: + case DW_FORM_ref_sig8: + *offset_ptr += 8; + return true; + + // signed or unsigned LEB 128 values + case DW_FORM_sdata: + case DW_FORM_udata: + case DW_FORM_ref_udata: + case DW_FORM_GNU_addr_index: + case DW_FORM_GNU_str_index: + case DW_FORM_strx: + debug_info_data.Skip_LEB128(offset_ptr); + return true; case DW_FORM_indirect: { dw_form_t indirect_form = debug_info_data.GetULEB128(offset_ptr); @@ -546,6 +575,39 @@ const char *DWARFFormValue::AsCString() const { index_size); return symbol_file->get_debug_str_data().PeekCStr(str_offset); } + + if (m_form == DW_FORM_strx || m_form == DW_FORM_strx1 || + m_form == DW_FORM_strx2 || m_form == DW_FORM_strx3 || + m_form == DW_FORM_strx4) { + + // The same code as above. + if (!symbol_file) + return nullptr; + + lldb::offset_t baseOffset = 0; + const DWARFDataExtractor &strOffsets = + symbol_file->get_debug_str_offsets_data(); + uint64_t length = strOffsets.GetU32(&baseOffset); + if (length == 0xffffffff) + length = strOffsets.GetU64(&baseOffset); + + // Check version. + if (strOffsets.GetU16(&baseOffset) < 5) + return nullptr; + + // Skip padding. + baseOffset += 2; + + uint32_t indexSize = m_cu->IsDWARF64() ? 8 : 4; + lldb::offset_t offset = baseOffset + m_value.value.uval * indexSize; + dw_offset_t strOffset = + symbol_file->get_debug_str_offsets_data().GetMaxU64(&offset, indexSize); + return symbol_file->get_debug_str_data().PeekCStr(strOffset); + } + + if (m_form == DW_FORM_line_strp) + return symbol_file->get_debug_line_str_data().PeekCStr(m_value.value.uval); + return nullptr; } @@ -741,6 +803,11 @@ bool DWARFFormValue::FormIsSupported(dw_form_t form) { case DW_FORM_flag: case DW_FORM_sdata: case DW_FORM_strp: + case DW_FORM_strx: + case DW_FORM_strx1: + case DW_FORM_strx2: + case DW_FORM_strx3: + case DW_FORM_strx4: case DW_FORM_udata: case DW_FORM_ref_addr: case DW_FORM_ref1: |