[Lldb-commits] [lldb] r331777 - Add support to object files for accessing the .debug_types section
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue May 8 10:19:24 PDT 2018
Author: gclayton
Date: Tue May 8 10:19:24 2018
New Revision: 331777
URL: http://llvm.org/viewvc/llvm-project?rev=331777&view=rev
Log:
Add support to object files for accessing the .debug_types section
In an effort to make the .debug_types patch smaller, breaking out the part that reads the .debug_types from object files into a separate patch
Differential Revision: https://reviews.llvm.org/D46529
Modified:
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/lit/Modules/elf-section-types.yaml
lldb/trunk/source/Core/Section.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Symbol/ObjectFile.cpp
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Tue May 8 10:19:24 2018
@@ -656,6 +656,7 @@ enum SectionType {
eSectionTypeAbsoluteAddress, // Dummy section for symbols with absolute
// address
eSectionTypeDWARFGNUDebugAltLink,
+ eSectionTypeDWARFDebugTypes, // DWARF .debug_types section
eSectionTypeOther
};
Modified: lldb/trunk/lit/Modules/elf-section-types.yaml
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/elf-section-types.yaml?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/lit/Modules/elf-section-types.yaml (original)
+++ lldb/trunk/lit/Modules/elf-section-types.yaml Tue May 8 10:19:24 2018
@@ -4,6 +4,16 @@
# CHECK: Name: .text
# CHECK-NEXT: Type: code
+# CHECK: Name: .debug_info
+# CHECK-NEXT: Type: dwarf-info
+# CHECK-NEXT: VM size: 0
+# CHECK-NEXT: File size: 8
+
+# CHECK: Name: .debug_types
+# CHECK-NEXT: Type: dwarf-types
+# CHECK-NEXT: VM size: 0
+# CHECK-NEXT: File size: 8
+
# CHECK: Name: .gnu_debugaltlink
# CHECK-NEXT: Type: dwarf-gnu-debugaltlink
# CHECK-NEXT: VM size: 0
@@ -13,13 +23,13 @@
# CHECK-NEXT: Type: code
--- !ELF
-FileHeader:
+FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_X86_64
Entry: 0x00000000000007A0
-Sections:
+Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
@@ -28,6 +38,10 @@ Sections:
Type: SHT_PROGBITS
AddressAlign: 0x0000000000000001
Content: DEADBEEFBAADF00D
+ - Name: .debug_types
+ Type: SHT_PROGBITS
+ AddressAlign: 0x0000000000000001
+ Content: DEADBEEFBAADF00D
- Name: .gnu_debugaltlink
Type: SHT_PROGBITS
AddressAlign: 0x0000000000000001
Modified: lldb/trunk/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/source/Core/Section.cpp (original)
+++ lldb/trunk/source/Core/Section.cpp Tue May 8 10:19:24 2018
@@ -89,6 +89,8 @@ const char *Section::GetTypeAsCString()
return "dwarf-str";
case eSectionTypeDWARFDebugStrOffsets:
return "dwarf-str-offsets";
+ case eSectionTypeDWARFDebugTypes:
+ return "dwarf-types";
case eSectionTypeELFSymbolTable:
return "elf-symbol-table";
case eSectionTypeELFDynamicSymbols:
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Tue May 8 10:19:24 2018
@@ -1806,6 +1806,7 @@ void ObjectFileELF::CreateSections(Secti
static ConstString g_sect_name_dwarf_debug_str_dwo(".debug_str.dwo");
static ConstString g_sect_name_dwarf_debug_str_offsets_dwo(
".debug_str_offsets.dwo");
+ static ConstString g_sect_name_dwarf_debug_types(".debug_types");
static ConstString g_sect_name_eh_frame(".eh_frame");
static ConstString g_sect_name_arm_exidx(".ARM.exidx");
static ConstString g_sect_name_arm_extab(".ARM.extab");
@@ -1873,6 +1874,8 @@ void ObjectFileELF::CreateSections(Secti
sect_type = eSectionTypeDWARFDebugRanges;
else if (name == g_sect_name_dwarf_debug_str)
sect_type = eSectionTypeDWARFDebugStr;
+ else if (name == g_sect_name_dwarf_debug_types)
+ sect_type = eSectionTypeDWARFDebugTypes;
else if (name == g_sect_name_dwarf_debug_str_offsets)
sect_type = eSectionTypeDWARFDebugStrOffsets;
else if (name == g_sect_name_dwarf_debug_abbrev_dwo)
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue May 8 10:19:24 2018
@@ -1205,6 +1205,7 @@ AddressClass ObjectFileMachO::GetAddress
case eSectionTypeDWARFDebugRanges:
case eSectionTypeDWARFDebugStr:
case eSectionTypeDWARFDebugStrOffsets:
+ case eSectionTypeDWARFDebugTypes:
case eSectionTypeDWARFAppleNames:
case eSectionTypeDWARFAppleTypes:
case eSectionTypeDWARFAppleNamespaces:
@@ -1458,6 +1459,7 @@ static lldb::SectionType GetSectionType(
static ConstString g_sect_name_dwarf_debug_pubtypes("__debug_pubtypes");
static ConstString g_sect_name_dwarf_debug_ranges("__debug_ranges");
static ConstString g_sect_name_dwarf_debug_str("__debug_str");
+ static ConstString g_sect_name_dwarf_debug_types("__debug_types");
static ConstString g_sect_name_dwarf_apple_names("__apple_names");
static ConstString g_sect_name_dwarf_apple_types("__apple_types");
static ConstString g_sect_name_dwarf_apple_namespaces("__apple_namespac");
@@ -1490,6 +1492,8 @@ static lldb::SectionType GetSectionType(
return eSectionTypeDWARFDebugRanges;
if (section_name == g_sect_name_dwarf_debug_str)
return eSectionTypeDWARFDebugStr;
+ if (section_name == g_sect_name_dwarf_debug_types)
+ return eSectionTypeDWARFDebugTypes;
if (section_name == g_sect_name_dwarf_apple_names)
return eSectionTypeDWARFAppleNames;
if (section_name == g_sect_name_dwarf_apple_types)
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Tue May 8 10:19:24 2018
@@ -696,6 +696,7 @@ void ObjectFilePECOFF::CreateSections(Se
static ConstString g_sect_name_dwarf_debug_pubtypes(".debug_pubtypes");
static ConstString g_sect_name_dwarf_debug_ranges(".debug_ranges");
static ConstString g_sect_name_dwarf_debug_str(".debug_str");
+ static ConstString g_sect_name_dwarf_debug_types(".debug_types");
static ConstString g_sect_name_eh_frame(".eh_frame");
static ConstString g_sect_name_go_symtab(".gosymtab");
SectionType section_type = eSectionTypeOther;
@@ -744,6 +745,8 @@ void ObjectFilePECOFF::CreateSections(Se
section_type = eSectionTypeDWARFDebugRanges;
else if (const_sect_name == g_sect_name_dwarf_debug_str)
section_type = eSectionTypeDWARFDebugStr;
+ else if (const_sect_name == g_sect_name_dwarf_debug_types)
+ section_type = eSectionTypeDWARFDebugTypes;
else if (const_sect_name == g_sect_name_eh_frame)
section_type = eSectionTypeEHFrame;
else if (const_sect_name == g_sect_name_go_symtab)
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue May 8 10:19:24 2018
@@ -665,6 +665,10 @@ const DWARFDataExtractor &SymbolFileDWAR
m_data_debug_str_offsets);
}
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_types_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugTypes, m_data_debug_types);
+}
+
const DWARFDataExtractor &SymbolFileDWARF::get_apple_names_data() {
return GetCachedSectionData(eSectionTypeDWARFAppleNames, m_data_apple_names);
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue May 8 10:19:24 2018
@@ -246,6 +246,7 @@ public:
const lldb_private::DWARFDataExtractor &get_debug_ranges_data();
const lldb_private::DWARFDataExtractor &get_debug_str_data();
const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data();
+ const lldb_private::DWARFDataExtractor &get_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();
@@ -492,6 +493,7 @@ protected:
DWARFDataSegment m_data_debug_ranges;
DWARFDataSegment m_data_debug_str;
DWARFDataSegment m_data_debug_str_offsets;
+ DWARFDataSegment m_data_debug_types;
DWARFDataSegment m_data_apple_names;
DWARFDataSegment m_data_apple_types;
DWARFDataSegment m_data_apple_namespaces;
Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=331777&r1=331776&r2=331777&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Tue May 8 10:19:24 2018
@@ -359,6 +359,7 @@ AddressClass ObjectFile::GetAddressClass
case eSectionTypeDWARFDebugRanges:
case eSectionTypeDWARFDebugStr:
case eSectionTypeDWARFDebugStrOffsets:
+ case eSectionTypeDWARFDebugTypes:
case eSectionTypeDWARFAppleNames:
case eSectionTypeDWARFAppleTypes:
case eSectionTypeDWARFAppleNamespaces:
More information about the lldb-commits
mailing list