diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp | 107 |
1 files changed, 8 insertions, 99 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 046ae67446af..f660cc32b3f8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -107,6 +107,7 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, m_value.value.uval = data.GetU64(offset_ptr); break; case DW_FORM_addrx: + case DW_FORM_loclistx: case DW_FORM_rnglistx: case DW_FORM_strx: case DW_FORM_udata: @@ -305,6 +306,7 @@ bool DWARFFormValue::SkipValue(dw_form_t form, // signed or unsigned LEB 128 values case DW_FORM_addrx: + case DW_FORM_loclistx: case DW_FORM_rnglistx: case DW_FORM_sdata: case DW_FORM_udata: @@ -333,7 +335,7 @@ void DWARFFormValue::Dump(Stream &s) const { switch (m_form) { case DW_FORM_addr: - s.Address(uvalue, sizeof(uint64_t)); + DumpAddress(s.AsRawOstream(), uvalue, sizeof(uint64_t)); break; case DW_FORM_flag: case DW_FORM_data1: @@ -409,10 +411,11 @@ void DWARFFormValue::Dump(Stream &s) const { assert(m_unit); // Unit must be valid for DW_FORM_ref_addr objects or we // will get this wrong if (m_unit->GetVersion() <= 2) - s.Address(uvalue, sizeof(uint64_t) * 2); + DumpAddress(s.AsRawOstream(), uvalue, sizeof(uint64_t) * 2); else - s.Address(uvalue, 4 * 2); // 4 for DWARF32, 8 for DWARF64, but we don't - // support DWARF64 yet + DumpAddress(s.AsRawOstream(), uvalue, + 4 * 2); // 4 for DWARF32, 8 for DWARF64, but we don't + // support DWARF64 yet break; } case DW_FORM_ref1: @@ -599,105 +602,11 @@ bool DWARFFormValue::IsDataForm(const dw_form_t form) { return false; } -int DWARFFormValue::Compare(const DWARFFormValue &a_value, - const DWARFFormValue &b_value) { - dw_form_t a_form = a_value.Form(); - dw_form_t b_form = b_value.Form(); - if (a_form < b_form) - return -1; - if (a_form > b_form) - return 1; - switch (a_form) { - case DW_FORM_addr: - case DW_FORM_addrx: - case DW_FORM_flag: - case DW_FORM_data1: - case DW_FORM_data2: - case DW_FORM_data4: - case DW_FORM_data8: - case DW_FORM_udata: - case DW_FORM_ref_addr: - case DW_FORM_sec_offset: - case DW_FORM_flag_present: - case DW_FORM_ref_sig8: - case DW_FORM_GNU_addr_index: { - uint64_t a = a_value.Unsigned(); - uint64_t b = b_value.Unsigned(); - if (a < b) - return -1; - if (a > b) - return 1; - return 0; - } - - case DW_FORM_sdata: { - int64_t a = a_value.Signed(); - int64_t b = b_value.Signed(); - if (a < b) - return -1; - if (a > b) - return 1; - return 0; - } - - case DW_FORM_string: - case DW_FORM_strp: - case DW_FORM_GNU_str_index: { - const char *a_string = a_value.AsCString(); - const char *b_string = b_value.AsCString(); - if (a_string == b_string) - return 0; - else if (a_string && b_string) - return strcmp(a_string, b_string); - else if (a_string == nullptr) - return -1; // A string is NULL, and B is valid - else - return 1; // A string valid, and B is NULL - } - - case DW_FORM_block: - case DW_FORM_block1: - case DW_FORM_block2: - case DW_FORM_block4: - case DW_FORM_exprloc: { - uint64_t a_len = a_value.Unsigned(); - uint64_t b_len = b_value.Unsigned(); - if (a_len < b_len) - return -1; - if (a_len > b_len) - return 1; - // The block lengths are the same - return memcmp(a_value.BlockData(), b_value.BlockData(), a_value.Unsigned()); - } break; - - case DW_FORM_ref1: - case DW_FORM_ref2: - case DW_FORM_ref4: - case DW_FORM_ref8: - case DW_FORM_ref_udata: { - uint64_t a = a_value.m_value.value.uval; - uint64_t b = b_value.m_value.value.uval; - if (a < b) - return -1; - if (a > b) - return 1; - return 0; - } - - case DW_FORM_indirect: - llvm_unreachable( - "This shouldn't happen after the form has been extracted..."); - - default: - llvm_unreachable("Unhandled DW_FORM"); - } - return -1; -} - bool DWARFFormValue::FormIsSupported(dw_form_t form) { switch (form) { case DW_FORM_addr: case DW_FORM_addrx: + case DW_FORM_loclistx: case DW_FORM_rnglistx: case DW_FORM_block2: case DW_FORM_block4: |
