Author: jankratochvil
Date: Sat Apr 14 04:12:52 2018
New Revision: 330084
URL: http://llvm.org/viewvc/llvm-project?rev=330084&view=rev
Log:
Reapply "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding
DWARFTypeUnit".
This patch by Greg Clayton drops the virtualization for DWARFPartialUnit.
The virtualization of DWARFUnit now matches more its LLVM counterpart.
DWZ patchset is going to be implementable without DWARFPartialUnit remapping.
https://reviews.llvm.org/D40474
This reverts commit 329423.
This reapplies commit r329305.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=330084&r1=330083&r2=330084&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Sat Apr 14
04:12:52 2018
@@ -9,36 +9,15 @@
#include "DWARFCompileUnit.h"
-#include "lldb/Core/DumpDataExtractor.h"
-#include "lldb/Core/Mangled.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Host/StringConvert.h"
-#include "lldb/Symbol/CompileUnit.h"
-#include "lldb/Symbol/LineTable.h"
-#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Utility/Stream.h"
-#include "lldb/Utility/StreamString.h"
-#include "lldb/Utility/Timer.h"
-
-#include "DWARFDIECollection.h"
-#include "DWARFDebugAbbrev.h"
-#include "DWARFDebugAranges.h"
-#include "DWARFDebugInfo.h"
-#include "DWARFFormValue.h"
-#include "LogChannelDWARF.h"
-#include "NameToDIE.h"
#include "SymbolFileDWARF.h"
-#include "SymbolFileDWARFDebugMap.h"
-#include "SymbolFileDWARFDwo.h"
using namespace lldb;
using namespace lldb_private;
-using namespace std;
extern int g_verbose;
DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
-: m_dwarf2Data(dwarf2Data) {}
+: DWARFUnit(dwarf2Data) {}
DWARFUnitSP DWARFCompileUnit::Extract(SymbolFileDWARF *dwarf2Data,
lldb::offset_t *offset_ptr) {
@@ -81,259 +60,6 @@ DWARFUnitSP DWARFCompileUnit::Extract(Sy
return nullptr;
}
-void DWARFCompileUnit::ClearDIEs(bool keep_compile_unit_die) {
- if (m_die_array.size() > 1) {
-// std::vectors never get any smaller when resized to a smaller size,
-// or when clear() or erase() are called, the size will report that it
-// is smaller, but the memory allocated remains intact (call capacity()
-// to see this). So we need to create a temporary vector and swap the
-// contents which will cause just the internal pointers to be swapped
-// so that when "tmp_array" goes out of scope, it will destroy the
-// contents.
-
-// Save at least the compile unit DIE
-DWARFDebugInfoEntry::collection tmp_array;
-m_die_array.swap(tmp_array);
-if (keep_compile_unit_die)
- m_die_array.push_back(tmp_array.front());
- }
-
- if (m_dwo_symbol_file)
-m_dwo_symbol_file->GetCompileUnit()->ClearDIEs(keep_compile_unit_die);
-}
-
-//--
-// ParseCompileUnitDIEsIfNeeded
-//
-// Parses a compile unit and indexes its DIEs if it hasn't already been
-// done.
-//--
-size_t DWARFCompileUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
- const size_t initial_die_array_size = m_die_array.size();
- if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size >
1)
-return 0; // Already parsed
-
- static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
- Timer scoped_timer(
- func_cat,
- "%8.8x: DWARFCompileUnit::ExtractDIEsIfNeeded( cu_die_only = %i )",
- m_offset, cu_die_only);
-
- // Set the offset to that of the first DIE and calculate the start of the
- // next compilation unit header.
- lldb::offset_t offset = GetFirstDIEOffset();
- lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
-
- DWARFDebugInfoEntry die;
- // Keep a flat array of the DIE for binary lookup by DIE offset
- if (!cu_die_only) {
-Log *log(
-LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO |
DWARF_LOG_LOOKUPS));
-if (log) {
- m_dwarf2Data->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
- log, "DWARFCompileUnit::ExtractDIEsIfNeeded () for compile unit at "
- ".debug_info[0x%8.8x]",
- Ge