jankratochvil updated this revision to Diff 178353.
jankratochvil added a comment.
Updated against trunk due to new `getSectionType` from rL348936
<https://reviews.llvm.org/rL348936>.
Repository:
rLLDB LLDB
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D51578/new/
https://reviews.llvm.org/D51578
Files:
include/lldb/lldb-enumerations.h
source/Core/Section.cpp
source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
source/Plugins/SymbolFile/DWARF/DWARFUnit.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
source/Symbol/ObjectFile.cpp
Index: source/Symbol/ObjectFile.cpp
===================================================================
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -368,6 +368,7 @@
case eSectionTypeDWARFDebugStrOffsets:
case eSectionTypeDWARFDebugStrOffsetsDwo:
case eSectionTypeDWARFDebugTypes:
+ case eSectionTypeDWARFDebugTypesDwo:
case eSectionTypeDWARFAppleNames:
case eSectionTypeDWARFAppleTypes:
case eSectionTypeDWARFAppleNamespaces:
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -48,9 +48,10 @@
const lldb_private::DWARFDataExtractor &get_debug_abbrev_data() override;
const lldb_private::DWARFDataExtractor &get_debug_addr_data() override;
- const lldb_private::DWARFDataExtractor &get_debug_info_data() override;
+ const lldb_private::DWARFDataExtractor &get_raw_debug_info_data() override;
const lldb_private::DWARFDataExtractor &get_debug_str_data() override;
const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data() override;
+ const lldb_private::DWARFDataExtractor &get_raw_debug_types_data() override;
protected:
void LoadSectionData(lldb::SectionType sect_type,
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -136,8 +136,9 @@
return m_data_debug_addr.m_data;
}
-const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_info_data() {
- return GetCachedSectionData(eSectionTypeDWARFDebugInfoDwo, m_data_debug_info);
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_raw_debug_info_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugInfoDwo,
+ m_data_raw_debug_info);
}
const DWARFDataExtractor &SymbolFileDWARFDwo::get_debug_str_data() {
@@ -149,6 +150,11 @@
m_data_debug_str_offsets);
}
+const DWARFDataExtractor &SymbolFileDWARFDwo::get_raw_debug_types_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugTypesDwo,
+ m_data_raw_debug_types);
+}
+
SymbolFileDWARF *SymbolFileDWARFDwo::GetBaseSymbolFile() {
return m_base_dwarf_cu->GetSymbolFileDWARF();
}
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -237,7 +237,8 @@
virtual const lldb_private::DWARFDataExtractor &get_debug_addr_data();
const lldb_private::DWARFDataExtractor &get_debug_aranges_data();
const lldb_private::DWARFDataExtractor &get_debug_frame_data();
- virtual const lldb_private::DWARFDataExtractor &get_debug_info_data();
+ const lldb_private::DWARFDataExtractor &get_debug_info_data();
+ virtual const lldb_private::DWARFDataExtractor &get_raw_debug_info_data();
const lldb_private::DWARFDataExtractor &get_debug_line_data();
const lldb_private::DWARFDataExtractor &get_debug_line_str_data();
const lldb_private::DWARFDataExtractor &get_debug_macro_data();
@@ -247,7 +248,7 @@
const lldb_private::DWARFDataExtractor &get_debug_rnglists_data();
virtual const lldb_private::DWARFDataExtractor &get_debug_str_data();
virtual const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data();
- const lldb_private::DWARFDataExtractor &get_debug_types_data();
+ virtual const lldb_private::DWARFDataExtractor &get_raw_debug_types_data();
const lldb_private::DWARFDataExtractor &get_apple_names_data();
const lldb_private::DWARFDataExtractor &get_apple_types_data();
const lldb_private::DWARFDataExtractor &get_apple_namespaces_data();
@@ -327,6 +328,10 @@
void DumpClangAST(lldb_private::Stream &s) override;
+ uint64_t get_debug_types_offset() const {
+ return m_debug_info_concatenated_types_offset;
+ }
+
protected:
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *>
DIEToTypePtr;
@@ -473,7 +478,7 @@
DWARFDataSegment m_data_debug_addr;
DWARFDataSegment m_data_debug_aranges;
DWARFDataSegment m_data_debug_frame;
- DWARFDataSegment m_data_debug_info;
+ DWARFDataSegment m_data_raw_debug_info;
DWARFDataSegment m_data_debug_line;
DWARFDataSegment m_data_debug_line_str;
DWARFDataSegment m_data_debug_macro;
@@ -483,13 +488,17 @@
DWARFDataSegment m_data_debug_rnglists;
DWARFDataSegment m_data_debug_str;
DWARFDataSegment m_data_debug_str_offsets;
- DWARFDataSegment m_data_debug_types;
+ DWARFDataSegment m_data_raw_debug_types;
DWARFDataSegment m_data_apple_names;
DWARFDataSegment m_data_apple_types;
DWARFDataSegment m_data_apple_namespaces;
DWARFDataSegment m_data_apple_objc;
DWARFDataSegment m_data_gnu_debugaltlink;
+ llvm::once_flag m_concatenated_data_once;
+ lldb_private::DWARFDataExtractor m_data_debug_info_concatenated;
+ uint64_t m_debug_info_concatenated_types_offset;
+
// The unique pointer items below are generated on demand if and when someone
// accesses
// them through a non const version of this class.
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -411,7 +411,7 @@
// when this class parses .o files to
// contain the .o file index/ID
m_debug_map_module_wp(), m_debug_map_symfile(NULL), m_data_debug_abbrev(),
- m_data_debug_aranges(), m_data_debug_frame(), m_data_debug_info(),
+ m_data_debug_aranges(), m_data_debug_frame(), m_data_raw_debug_info(),
m_data_debug_line(), m_data_debug_macro(), m_data_debug_loc(),
m_data_debug_ranges(), m_data_debug_rnglists(), m_data_debug_str(),
m_data_apple_names(), m_data_apple_types(), m_data_apple_namespaces(),
@@ -637,8 +637,9 @@
return GetCachedSectionData(eSectionTypeDWARFDebugFrame, m_data_debug_frame);
}
-const DWARFDataExtractor &SymbolFileDWARF::get_debug_info_data() {
- return GetCachedSectionData(eSectionTypeDWARFDebugInfo, m_data_debug_info);
+const DWARFDataExtractor &SymbolFileDWARF::get_raw_debug_info_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugInfo,
+ m_data_raw_debug_info);
}
const DWARFDataExtractor &SymbolFileDWARF::get_debug_line_data() {
@@ -688,8 +689,9 @@
m_data_debug_str_offsets);
}
-const DWARFDataExtractor &SymbolFileDWARF::get_debug_types_data() {
- return GetCachedSectionData(eSectionTypeDWARFDebugTypes, m_data_debug_types);
+const DWARFDataExtractor &SymbolFileDWARF::get_raw_debug_types_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugTypes,
+ m_data_raw_debug_types);
}
const DWARFDataExtractor &SymbolFileDWARF::get_apple_names_data() {
@@ -714,6 +716,69 @@
m_data_gnu_debugaltlink);
}
+const DWARFDataExtractor &
+ SymbolFileDWARF::get_debug_info_data() {
+ llvm::call_once(m_concatenated_data_once, [&] {
+ const auto &debug_info_data = get_raw_debug_info_data();
+ const auto &debug_types_data = get_raw_debug_types_data();
+ if (!debug_info_data.GetByteSize() && !debug_types_data.GetByteSize())
+ return;
+ // For this optimization of mmapped sections we do not handle .debug_types
+ // present without .debug_info as that should not happen.
+ if (debug_info_data.GetByteSize()
+ && (!debug_types_data.GetByteSize()
+ || debug_info_data.GetDataStart() + debug_info_data.GetByteSize()
+ <= debug_types_data.GetDataStart())) {
+ uint64_t length;
+ if (debug_types_data.GetByteSize()) {
+ m_debug_info_concatenated_types_offset =
+ debug_types_data.GetDataStart() - debug_info_data.GetDataStart();
+ length = debug_types_data.GetDataStart()
+ + debug_types_data.GetByteSize() - debug_info_data.GetDataStart();
+ } else {
+ m_debug_info_concatenated_types_offset = debug_info_data.GetByteSize();
+ length = debug_info_data.GetByteSize();
+ }
+ if (m_dwarf_data.GetByteSize()) {
+ m_data_debug_info_concatenated.SetData(m_dwarf_data,
+ debug_info_data.GetDataStart() - m_dwarf_data.GetDataStart(),
+ length);
+ return;
+ }
+ if (!m_obj_file->IsInMemory()) {
+ const SectionList *section_list =
+ m_obj_file->GetSectionList(false /* update_module_section_list */);
+ if (section_list) {
+ SectionSP section_sp(section_list->FindSectionByType(
+ eSectionTypeDWARFDebugInfo, true));
+ if (section_sp) {
+ lldbassert(section_sp->GetObjectFile() == m_obj_file);
+ m_obj_file->GetData(section_sp->GetFileOffset(), length,
+ m_data_debug_info_concatenated);
+ return;
+ }
+ }
+ }
+ }
+ DataBufferHeap *databufferheap = new DataBufferHeap();
+ DataBufferSP databuffer = DataBufferSP(databufferheap);
+ databufferheap->AppendData(
+ debug_info_data.GetDataStart(),
+ debug_info_data.GetByteSize());
+ m_debug_info_concatenated_types_offset =
+ databufferheap->GetByteSize();
+ databufferheap->AppendData(
+ debug_types_data.GetDataStart(),
+ debug_types_data.GetByteSize());
+ m_data_debug_info_concatenated.SetData(databuffer);
+ m_data_debug_info_concatenated.SetByteOrder(
+ debug_info_data.GetByteOrder());
+ m_data_debug_info_concatenated.SetAddressByteSize(
+ debug_info_data.GetAddressByteSize());
+ });
+ return m_data_debug_info_concatenated;
+}
+
DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
if (m_abbr.get() == NULL) {
const DWARFDataExtractor &debug_abbrev_data = get_debug_abbrev_data();
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -70,7 +70,7 @@
/// @return
/// The correct data for the DIE information in this unit.
//------------------------------------------------------------------
- virtual const lldb_private::DWARFDataExtractor &GetData() const = 0;
+ const lldb_private::DWARFDataExtractor &GetData() const;
//------------------------------------------------------------------
/// Get the size in bytes of the compile unit header.
///
Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -810,3 +810,6 @@
return *m_func_aranges_ap.get();
}
+const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const {
+ return m_dwarf->get_debug_info_data();
+}
Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -98,7 +98,7 @@
if (m_dwarf2Data != NULL) {
lldb::offset_t offset = 0;
DWARFUnitSP cu_sp;
- const auto &debug_info_data = m_dwarf2Data->get_debug_info_data();
+ const auto &debug_info_data = m_dwarf2Data->get_raw_debug_info_data();
while ((cu_sp = DWARFCompileUnit::Extract(m_dwarf2Data, debug_info_data,
&offset))) {
m_compile_units.push_back(cu_sp);
Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -19,16 +19,6 @@
lldb::offset_t *offset_ptr);
void Dump(lldb_private::Stream *s) const override;
- //------------------------------------------------------------------
- /// Get the data that contains the DIE information for this unit.
- ///
- /// @return
- /// The correct data (.debug_types for DWARF 4 and earlier, and
- /// .debug_info for DWARF 5 and later) for the DIE information in
- /// this unit.
- //------------------------------------------------------------------
- const lldb_private::DWARFDataExtractor &GetData() const override;
-
//------------------------------------------------------------------
/// Get the size in bytes of the header.
///
Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -92,7 +92,3 @@
}
llvm_unreachable("invalid UnitType.");
}
-
-const lldb_private::DWARFDataExtractor &DWARFCompileUnit::GetData() const {
- return m_dwarf->get_debug_info_data();
-}
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===================================================================
--- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1210,6 +1210,7 @@
case eSectionTypeDWARFDebugStrOffsets:
case eSectionTypeDWARFDebugStrOffsetsDwo:
case eSectionTypeDWARFDebugTypes:
+ case eSectionTypeDWARFDebugTypesDwo:
case eSectionTypeDWARFAppleNames:
case eSectionTypeDWARFAppleTypes:
case eSectionTypeDWARFAppleNamespaces:
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1767,6 +1767,7 @@
.Case(".debug_str_offsets", eSectionTypeDWARFDebugStrOffsets)
.Case(".debug_str_offsets.dwo", eSectionTypeDWARFDebugStrOffsetsDwo)
.Case(".debug_types", eSectionTypeDWARFDebugTypes)
+ .Case(".debug_types.dwo", eSectionTypeDWARFDebugTypesDwo)
.Case(".eh_frame", eSectionTypeEHFrame)
.Case(".gnu_debugaltlink", eSectionTypeDWARFGNUDebugAltLink)
.Case(".gosymtab", eSectionTypeGoSymtab)
Index: source/Core/Section.cpp
===================================================================
--- source/Core/Section.cpp
+++ source/Core/Section.cpp
@@ -105,6 +105,8 @@
return "dwarf-str-offsets-dwo";
case eSectionTypeDWARFDebugTypes:
return "dwarf-types";
+ case eSectionTypeDWARFDebugTypesDwo:
+ return "dwarf-types-dwo";
case eSectionTypeDWARFDebugNames:
return "dwarf-names";
case eSectionTypeELFSymbolTable:
Index: include/lldb/lldb-enumerations.h
===================================================================
--- include/lldb/lldb-enumerations.h
+++ include/lldb/lldb-enumerations.h
@@ -719,6 +719,7 @@
eSectionTypeDWARFDebugInfoDwo,
eSectionTypeDWARFDebugStrDwo,
eSectionTypeDWARFDebugStrOffsetsDwo,
+ eSectionTypeDWARFDebugTypesDwo,
};
FLAGS_ENUM(EmulateInstructionOptions){
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits