Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h +++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h @@ -164,8 +164,8 @@ protected: SymbolFileDWARF *m_dwarf2Data; std::unique_ptr m_dwo_symbol_file; - const DWARFAbbreviationDeclarationSet *m_abbrevs; - void *m_user_data; + const DWARFAbbreviationDeclarationSet *m_abbrevs = nullptr; + void *m_user_data = nullptr; DWARFDebugInfoEntry::collection m_die_array; // The compile unit debug information entry item std::unique_ptr m_func_aranges_ap; // A table similar to @@ -174,23 +174,23 @@ // points to the exact // DW_TAG_subprogram // DIEs - dw_addr_t m_base_addr; - dw_offset_t m_offset; - dw_offset_t m_length; - uint16_t m_version; - uint8_t m_addr_size; - Producer m_producer; - uint32_t m_producer_version_major; - uint32_t m_producer_version_minor; - uint32_t m_producer_version_update; - lldb::LanguageType m_language_type; - bool m_is_dwarf64; - lldb_private::LazyBool m_is_optimized; - dw_addr_t m_addr_base; // Value of DW_AT_addr_base - dw_addr_t m_ranges_base; // Value of DW_AT_ranges_base - dw_offset_t m_base_obj_offset; // If this is a dwo compile unit this is the - // offset of the base compile unit in the main - // object file + dw_addr_t m_base_addr = 0; + dw_offset_t m_offset = DW_INVALID_OFFSET; + dw_offset_t m_length = 0; + uint16_t m_version = 0; + uint8_t m_addr_size = GetDefaultAddressSize(); + Producer m_producer = eProducerInvalid; + uint32_t m_producer_version_major = 0; + uint32_t m_producer_version_minor = 0; + uint32_t m_producer_version_update = 0; + lldb::LanguageType m_language_type = lldb::eLanguageTypeUnknown; + bool m_is_dwarf64 = false; + lldb_private::LazyBool m_is_optimized = lldb_private::eLazyBoolCalculate; + dw_addr_t m_addr_base = 0; // Value of DW_AT_addr_base + dw_addr_t m_ranges_base = 0; // Value of DW_AT_ranges_base + // If this is a dwo compile unit this is the offset of the base compile unit + // in the main object file + dw_offset_t m_base_obj_offset = DW_INVALID_OFFSET; void ParseProducerInfo(); Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -39,34 +39,14 @@ extern int g_verbose; DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data) - : m_dwarf2Data(dwarf2Data), m_abbrevs(NULL), m_user_data(NULL), - m_die_array(), m_func_aranges_ap(), m_base_addr(0), - m_offset(DW_INVALID_OFFSET), m_length(0), m_version(0), - m_addr_size(DWARFCompileUnit::GetDefaultAddressSize()), - m_producer(eProducerInvalid), m_producer_version_major(0), - m_producer_version_minor(0), m_producer_version_update(0), - m_language_type(eLanguageTypeUnknown), m_is_dwarf64(false), - m_is_optimized(eLazyBoolCalculate), m_addr_base(0), - m_ranges_base(0), m_base_obj_offset(DW_INVALID_OFFSET) {} + : m_dwarf2Data(dwarf2Data) {} DWARFCompileUnit::~DWARFCompileUnit() {} void DWARFCompileUnit::Clear() { - m_offset = DW_INVALID_OFFSET; - m_length = 0; - m_version = 0; - m_abbrevs = NULL; - m_addr_size = DWARFCompileUnit::GetDefaultAddressSize(); - m_base_addr = 0; - m_die_array.clear(); - m_func_aranges_ap.reset(); - m_user_data = NULL; - m_producer = eProducerInvalid; - m_language_type = eLanguageTypeUnknown; - m_is_dwarf64 = false; - m_is_optimized = eLazyBoolCalculate; - m_addr_base = 0; - m_base_obj_offset = DW_INVALID_OFFSET; + SymbolFileDWARF *dwarf2Data = m_dwarf2Data; + this->~DWARFCompileUnit(); + new (this) DWARFCompileUnit(dwarf2Data); } bool DWARFCompileUnit::Extract(const DWARFDataExtractor &debug_info,