clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed.
This is not the right fix. Compilers that emit addresses with DW_FORM_data* forms are saying that this address is an offset from the DW_AT_low_pc so this function will not return a valid address, but it will now return an offset. If you have a compiler that is actually emitting addresses incorrectly using DW_FORM_data* when the values are not offsets, the compiler should be fixed. There are two solutions to this: 1 - modify DWARFFormValue::Address() to return LLDB_INVALID_ADDRESS if the form is not DW_FORM_addr or DW_FORM_GNU_addr_index. 2 - modify DWARFFormValue::Address() to take an lldb::addr_t that is the base address that the DW_FORM_data* would be relative to. This argument could be defaulted: dw_addr_t DWARFFormValue::Address(lldb::addr_t base_addr = LLDB_INVALID_ADDRESS) const Then in the code we would do: dw_addr_t DWARFFormValue::Address(lldb::addr_t base_addr) const { switch (m_form) { case DW_FORM_addr: return Unsigned(); case DW_FORM_GNU_addr_index: if (m_cu) { SymbolFileDWARF* symbol_file = m_cu->GetSymbolFileDWARF(); if (symbol_file) { uint32_t index_size = m_cu->GetAddressByteSize(); dw_offset_t addr_base = m_cu->GetAddrBase(); lldb::offset_t offset = addr_base + m_value.value.uval * index_size; return symbol_file->get_debug_addr_data().GetMaxU64(&offset, index_size); } } break; case DW_FORM_data1: case DW_FORM_data2: case DW_FORM_data4: case DW_FORM_data8: case DW_FORM_sdata: case DW_FORM_udata: if (base_addr != LLDB_INVALID_ADDRESS) return base_addr + Unsigned(); default: break; } return LLDB_INVALID_ADDRESS; } Repository: rL LLVM http://reviews.llvm.org/D14631 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits